Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Allow specifying origin parameter for withdrawals #993

Merged
merged 3 commits into from
Mar 28, 2022
Merged

Conversation

nlordell
Copy link
Contributor

This PR adds an --origin flag (the name was chosen to be analogous to the existing --origin flags in both the dump and withdrawService tasks).

This flag allows the caller of hardhat withdraw to specify the solver address to use for executing the withdrawal transaction from the settlement contract. Additionally, this PR also makes it possible to call the withdraw task for an --origin for which you do not have a private key. This is important to be able to build withdrawal transactions that can be sent by a Multisig solver for example.

Test Plan

Run the withdraw task for a short list of tokens so it completes quickly:

% npx hardhat withdraw \
  --network mainnet \
  --origin 0xA03be496e67Ec29bC62F01a428683D7F9c204930 \
  --receiver 0x84E5c8518c248DE590D5302fD7C32d2Ae6B0123c \
  --min-value 500 \
  0x1a5f9352af8af974bfc03399e3767df6370d82e4 0x6810e776880c02933d47db1b9fc05908e5386b96

Using account 0xA03be496e67Ec29bC62F01a428683D7F9c204930
Ignored 165.688615512331530757 units of OWL (0x1a5f9352af8af974bfc03399e3767df6370d82e4) with value 72.02 USD, does not satisfy conditions on min value and leftover
Amounts to withdraw:
 address                                    | balance (usd) | balance                | withdrawn amount       | symbol 
--------------------------------------------+---------------+------------------------+------------------------+--------
 0x6810e776880c02933d47db1b9fc05908e5386b96 |      85138.94 | 244.830313904447664152 | 244.830313904447664152 | GNO    

The transaction will cost approximately 0.00212176304385864 ETH (6.65 USD) and will withdraw the balance of 1 tokens for an estimated total value of 85138.94 USD. All withdrawn funds will be sent to 0x84E5c8518c248DE590D5302fD7C32d2Ae6B0123c.
Settlement transaction:
to:   0x9008D19f58AAbD9eD0D60971565AA8510560ab41
data: 0x13d79a0b000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000001a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000006810e776880c02933d47db1b9fc05908e5386b96000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000084e5c8518c248de590d5302fd7c32d2ae6b0123c00000000000000000000000000000000000000000000000d45b4015459fbb018000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Copy link
Contributor

@josojo josojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. Thanks for coming up so quickly with it

Copy link
Contributor

@fedgiac fedgiac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@nlordell nlordell merged commit 6820b09 into main Mar 28, 2022
@nlordell nlordell deleted the withdrawal-origin branch March 28, 2022 10:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants