-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Funding job to send amount upto the topup #637
Conversation
Signed-off-by: OjusWiZard <[email protected]>
if asset_address == ZERO_ADDRESS: | ||
# also count the balance of the wrapped native asset | ||
safe_balance += get_asset_balance( | ||
ledger_api=ledger_api, | ||
contract_address=WRAPPED_NATIVE_ASSET.get(chain, asset_address), | ||
address=chain_data.multisig, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this approach not taken into account also for the agent?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because in the case of Agent EOA, the agent doesn't swap xDAI for wxDAI and we don't want to it to happen that someone send wxDAI to the Agent EOA and the funding job no long funds xDAI in it, failing the agent to make transactions anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems quite custom logic, but ok.
@@ -1491,19 +1491,25 @@ def fund_service_single_chain( # pylint: disable=too-many-arguments,too-many-lo | |||
address=key.address, | |||
) | |||
self.logger.info( | |||
f"Agent {key.address} Asset: {asset_address} balance: {agent_balance}" | |||
f"[FUNDING_JOB] Agent {key.address} Asset: {asset_address} balance: {agent_balance}" | |||
) | |||
if agent_fund_threshold > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check not performed in safe as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really see why we have this check. agent_fund_threshold will always be passed as positive without any programming error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither. Assuming the template has nonnegative values for the fund requirement, if we set, e.g. 0 fund requirements for USDC, then the condition agent_balance < agent_fund_threshold will not be triggered anyways...
Proposed changes
[FUNDING_JOB]
tagged logs in the funding jobTypes of changes
What types of changes does your code introduce?
Put an
x
in the boxes that apply