From 76d5a28a90d7d6ce197e5a1ba12bc0ce45e7ee62 Mon Sep 17 00:00:00 2001 From: Brian Stafford Date: Fri, 22 Mar 2024 14:29:00 -0500 Subject: [PATCH] review followup --- client/asset/eth/contractor.go | 17 +++---------- client/asset/eth/eth.go | 6 ++--- client/asset/eth/eth_test.go | 8 +++--- client/core/simnet_trade.go | 2 +- dex/networks/erc20/contracts/ERC20SwapV0.sol | 2 +- dex/networks/erc20/contracts/ERC20SwapV1.sol | 24 ++++++++++-------- .../erc20/contracts/v1/BinRuntimeV1.go | 2 +- dex/networks/erc20/contracts/v1/contract.go | 2 +- dex/networks/eth/contracts/ETHSwapV0.sol | 2 +- dex/networks/eth/contracts/ETHSwapV1.sol | 16 ++++++------ dex/networks/eth/contracts/v1/BinRuntimeV1.go | 2 +- dex/networks/eth/contracts/v1/contract.go | 2 +- dex/networks/eth/params.go | 2 ++ dex/networks/eth/txdata.go | 9 +++---- dex/testing/eth/harness.sh | 4 +-- server/asset/eth/coiner.go | 21 ++++++---------- server/asset/eth/eth.go | 9 +++++-- server/asset/eth/tokener.go | 25 +++++++++---------- 18 files changed, 73 insertions(+), 82 deletions(-) diff --git a/client/asset/eth/contractor.go b/client/asset/eth/contractor.go index e4ee5e796c..a8d41c28ad 100644 --- a/client/asset/eth/contractor.go +++ b/client/asset/eth/contractor.go @@ -221,8 +221,8 @@ func (c *contractorV0) vector(ctx context.Context, locator []byte) (*dexeth.Swap return nil, err } vector := &dexeth.SwapVector{ - From: swap.Participant, - To: swap.Initiator, + From: swap.Initiator, + To: swap.Participant, Value: swap.Value, SecretHash: secretHash, LockTime: uint64(swap.LockTime.Unix()), @@ -243,8 +243,8 @@ func (c *contractorV0) statusAndVector(ctx context.Context, locator []byte) (*de return nil, nil, err } vector := &dexeth.SwapVector{ - From: swap.Participant, - To: swap.Initiator, + From: swap.Initiator, + To: swap.Participant, Value: swap.Value, SecretHash: secretHash, LockTime: uint64(swap.LockTime.Unix()), @@ -452,7 +452,6 @@ func (c *erc20Contractor) balance(ctx context.Context) (*big.Int, error) { // allowance exposes the read-only allowance method of the erc20 token contract. func (c *erc20Contractor) allowance(ctx context.Context) (*big.Int, error) { callOpts := &bind.CallOpts{ - // Pending: true, // Seeing errors on even simnet that say "backend does not support pending state" From: c.acct, Context: ctx, } @@ -947,14 +946,6 @@ func (c *tokenContractorV1) tokenAddress() common.Address { var _ contractor = (*tokenContractorV1)(nil) var _ tokenContractor = (*tokenContractorV1)(nil) -// readOnlyCallOpts is the CallOpts used for read-only contract method calls. -func readOnlyCallOpts(ctx context.Context) *bind.CallOpts { - return &bind.CallOpts{ - Pending: true, - Context: ctx, - } -} - func estimateGas(ctx context.Context, from, to common.Address, abi *abi.ABI, cb bind.ContractBackend, value *big.Int, method string, args ...interface{}) (uint64, error) { data, err := abi.Pack(method, args...) if err != nil { diff --git a/client/asset/eth/eth.go b/client/asset/eth/eth.go index efb0ad3dc5..a3b63097ac 100644 --- a/client/asset/eth/eth.go +++ b/client/asset/eth/eth.go @@ -1497,7 +1497,7 @@ func (w *TokenWallet) FundOrder(ord *asset.Order) (asset.Coins, []dex.Bytes, uin g, err := w.initGasEstimate(int(ord.MaxSwapCount), contractVer, ord.RedeemVersion, ord.RedeemAssetID) if err != nil { - return nil, nil, 0, fmt.Errorf("error estimating swap gas: %vlaptop apart comic equip remove adult system tuna office discover toddler can keep fury aware amazing injury typical", err) + return nil, nil, 0, fmt.Errorf("error estimating swap gas: %v", err) } ethToLock := ord.MaxFeeRate * g.Swap * ord.MaxSwapCount @@ -3446,7 +3446,7 @@ func parseSecretHashes(tx *types.Transaction, contractVer uint32, isInit bool) ( } locators = make([][]byte, 0, len(inits)) for k := range inits { - copyK := k // TODO: Is this really necessary? + copyK := k locators = append(locators, copyK[:]) } } else { @@ -4628,7 +4628,7 @@ func (w *assetWallet) loadContractors() error { // withContractor runs the provided function with the versioned contractor. func (w *assetWallet) withContractor(contractVer uint32, f func(contractor) error) error { if contractVer == dexeth.ContractVersionERC20 { - // For ERC02 methods, use the most recent contractor version. + // For ERC20 methods, use the most recent contractor version. var bestVer uint32 var bestContractor contractor for ver, c := range w.contractors { diff --git a/client/asset/eth/eth_test.go b/client/asset/eth/eth_test.go index a2b400c7be..836ff5411a 100644 --- a/client/asset/eth/eth_test.go +++ b/client/asset/eth/eth_test.go @@ -377,8 +377,8 @@ func (c *tContractor) vector(ctx context.Context, locator []byte) (*dexeth.SwapV return nil, errors.New("swap not in map") } v := &dexeth.SwapVector{ - From: swap.Participant, - To: swap.Initiator, + From: swap.Initiator, + To: swap.Participant, Value: swap.Value, SecretHash: secretHash, LockTime: uint64(swap.LockTime.Unix()), @@ -399,8 +399,8 @@ func (c *tContractor) statusAndVector(ctx context.Context, locator []byte) (*dex return nil, nil, errors.New("swap not in map") } v := &dexeth.SwapVector{ - From: swap.Participant, - To: swap.Initiator, + From: swap.Initiator, + To: swap.Participant, Value: swap.Value, SecretHash: vector.SecretHash, LockTime: uint64(swap.LockTime.Unix()), diff --git a/client/core/simnet_trade.go b/client/core/simnet_trade.go index 68b55f39cd..cae71b4fca 100644 --- a/client/core/simnet_trade.go +++ b/client/core/simnet_trade.go @@ -2135,7 +2135,7 @@ func (s *simulationTest) assertBalanceChanges(client *simulationClient, isRefund if isRefund { // NOTE: Gas price may be higher if the eth harness has // had a lot of use. The minimum is the gas tip cap. - ethRefundFees := int64(dexeth.RefundGas(0 /*version*/)) * dexeth.MinGasTipCap + ethRefundFees := int64(dexeth.RefundGas(1 /*version*/)) * dexeth.MinGasTipCap msgTx := wire.NewMsgTx(0) prevOut := wire.NewOutPoint(&chainhash.Hash{}, 0) diff --git a/dex/networks/erc20/contracts/ERC20SwapV0.sol b/dex/networks/erc20/contracts/ERC20SwapV0.sol index 4037f3bed5..76ba9d4c0a 100644 --- a/dex/networks/erc20/contracts/ERC20SwapV0.sol +++ b/dex/networks/erc20/contracts/ERC20SwapV0.sol @@ -120,7 +120,7 @@ contract ERC20Swap { } // redeem redeems an array of swaps contract. It checks that the sender is - // not a contract, and that the secret hash hashes to secretHash. The ERC20 + // not a contract, and that the secret hashes to secretHash. The ERC20 // tokens are transferred from the contract to the sender. function redeem(Redemption[] calldata redemptions) public diff --git a/dex/networks/erc20/contracts/ERC20SwapV1.sol b/dex/networks/erc20/contracts/ERC20SwapV1.sol index e24541b2fc..c9542b10eb 100644 --- a/dex/networks/erc20/contracts/ERC20SwapV1.sol +++ b/dex/networks/erc20/contracts/ERC20SwapV1.sol @@ -14,11 +14,11 @@ pragma solidity = 0.8.18; // When calling initiate, the necessary tokens for swaps are transferred to // the swap contract. At this point the funds belong to the contract, and // cannot be accessed by anyone else, not even the contract's deployer. The -// initiator sets a secret hash, a blocktime the funds will be accessible should -// they not be redeemed, and a participant who can redeem before or after the -// locktime. The participant can redeem at any time after the initiation -// transaction is mined if they have the secret that hashes to the secret hash. -// Otherwise, the initiator can refund funds any time after the locktime. +// initiator commits to the swap parameters, including a locktime after which +// the funds will be accessible for refund should they not be redeemed. The +// participant can redeem at any time after the initiation transaction is mined +// if they have the secret that hashes to the secret hash. Otherwise, the +// initiator can refund funds any time after the locktime. // // This contract has no limits on gas used for any transactions. // @@ -30,7 +30,7 @@ contract ERC20Swap { address public immutable token_address; - // Step is a type that hold's a contract's current step. Empty is the + // Step is a type that hold's a contract's current step. Empty is the // uninitiated or null value. enum Step { Empty, Filled, Redeemed, Refunded } @@ -41,6 +41,7 @@ contract ERC20Swap { } bytes32 constant RefundRecord = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + bytes32 constant RefundRecordHash = 0xAF9613760F72635FBDB44A5A0A63C39F12AF30F950A6EE5C971BE188E89C4051; // swaps is a map of contract hashes to the "swap record". The swap record // has the following interpretation. @@ -134,6 +135,7 @@ contract ERC20Swap { require(v.value > 0, "0 val"); require(v.refundTimestamp > 0, "0 refundTimestamp"); + require(v.secretHash != RefundRecordHash, "illegal secret hash (refund record hash)"); bytes32 k = contractKey(v); bytes32 record = swaps[k]; @@ -153,7 +155,7 @@ contract ERC20Swap { require(success && (data.length == 0 || abi.decode(data, (bool))), 'transfer from failed'); } - // isRedeemable returns whether or not a swap identified by secretHash + // isRedeemable returns whether or not a swap identified by vector // can be redeemed using secret. function isRedeemable(Vector calldata v) public @@ -165,7 +167,7 @@ contract ERC20Swap { } // redeem redeems a Vector. It checks that the sender is not a contract, - // and that the secret hash hashes to secretHash. msg.value is tranfered + // and that the secret hashes to secretHash. msg.value is tranfered // from ETHSwap to the sender. // // To prevent reentry attack, it is very important to check the state of the @@ -223,14 +225,14 @@ contract ERC20Swap { (bytes32 k, bytes32 record, uint256 blockNum) = retrieveStatus(v); // Is this swap initialized? + // This check also guarantees that the swap has not already been + // refunded i.e. record != RefundRecord, since RefundRecord is certainly + // greater than block.number. require(blockNum > 0 && blockNum <= block.number, "swap not active"); // Is it already redeemed? require(!secretValidates(record, v.secretHash), "swap already redeemed"); - // Is it already refunded? - require(record != RefundRecord, "swap already refunded"); - swaps[k] = RefundRecord; bool success; diff --git a/dex/networks/erc20/contracts/v1/BinRuntimeV1.go b/dex/networks/erc20/contracts/v1/BinRuntimeV1.go index 7ce59acbdb..64f014706b 100644 --- a/dex/networks/erc20/contracts/v1/BinRuntimeV1.go +++ b/dex/networks/erc20/contracts/v1/BinRuntimeV1.go @@ -3,4 +3,4 @@ package v1 -const ERC20SwapRuntimeBin = "6080604052600436106100865760003560e01c80638cd8dd97116100595780638cd8dd9714610141578063a76f9f2d14610161578063d5cfd0491461018f578063db3b419c146101af578063eb84e7f2146101dc57600080fd5b806323f0388b1461008b5780633da59631146100ad57806377d7e031146100c05780638c8e8fee146100f5575b600080fd5b34801561009757600080fd5b506100ab6100a6366004610d30565b610209565b005b6100ab6100bb366004610da5565b61050c565b3480156100cc57600080fd5b506100e06100db366004610e08565b6107f9565b60405190151581526020015b60405180910390f35b34801561010157600080fd5b506101297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b34801561014d57600080fd5b506100ab61015c366004610e2a565b610875565b34801561016d57600080fd5b5061018161017c366004610e2a565b610b2d565b6040519081526020016100ec565b34801561019b57600080fd5b506100e06101aa366004610e2a565b610c15565b3480156101bb57600080fd5b506101cf6101ca366004610e2a565b610c49565b6040516100ec9190610e58565b3480156101e857600080fd5b506101816101f7366004610e9b565b60006020819052908152604090205481565b3233146102315760405162461bcd60e51b815260040161022890610eb4565b60405180910390fd5b6000805b828110156103e0573684848381811061025057610250610ede565b60c00291909101915033905061026c60a0830160808401610ef4565b6001600160a01b0316146102af5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b6044820152606401610228565b600080806102bc84610d04565b9250925092506000811180156102d157504381105b61030d5760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b6044820152606401610228565b6103188285356107f9565b156103585760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b6044820152606401610228565b61036760a085013585356107f9565b6103a45760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b6044820152606401610228565b60008381526020818152604090912060a086013590556103c79085013587610f3a565b95505050505080806103d890610f4d565b915050610235565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161045a91610f66565b6000604051808303816000865af19150503d8060008114610497576040519150601f19603f3d011682016040523d82523d6000602084013e61049c565b606091505b5090925090508180156104c75750805115806104c75750808060200190518101906104c79190610f95565b6105055760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b5050505050565b32331461052b5760405162461bcd60e51b815260040161022890610eb4565b6000805b828110156106c9573684848381811061054a5761054a610ede565b905060a002019050600081602001351161058e5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b6044820152606401610228565b60006105a06080830160608401610fb7565b67ffffffffffffffff16116105eb5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b6044820152606401610228565b60006105f682610b2d565b60008181526020819052604090205490915080156106475760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b6044820152606401610228565b50436106548184356107f9565b156106925760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b6044820152606401610228565b6000828152602081815260409091208290556106b19084013586610f3a565b945050505080806106c190610f4d565b91505061052f565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161074991610f66565b6000604051808303816000865af19150503d8060008114610786576040519150601f19603f3d011682016040523d82523d6000602084013e61078b565b606091505b5090925090508180156107b65750805115806107b65750808060200190518101906107b69190610f95565b6105055760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b6044820152606401610228565b60008160028460405160200161081191815260200190565b60408051601f198184030181529082905261082b91610f66565b602060405180830381855afa158015610848573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061086b9190610fe1565b1490505b92915050565b3233146108945760405162461bcd60e51b815260040161022890610eb4565b6108a46080820160608301610fb7565b67ffffffffffffffff164210156108f45760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b6044820152606401610228565b600080600061090284610d04565b9250925092506000811180156109185750438111155b6109565760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b6044820152606401610228565b6109618285356107f9565b156109a65760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b6044820152606401610228565b600182016109ee5760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c99599d5b991959605a1b6044820152606401610228565b6000838152602081815260408083206000199055805133602482015287830135604480830191909152825180830390910181526064909101825291820180516001600160e01b031663a9059cbb60e01b179052516060917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691610a7a9190610f66565b6000604051808303816000865af19150503d8060008114610ab7576040519150601f19603f3d011682016040523d82523d6000602084013e610abc565b606091505b509092509050818015610ae7575080511580610ae7575080806020019051810190610ae79190610f95565b610b255760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b505050505050565b600060028235610b436060850160408601610ef4565b60601b610b5660a0860160808701610ef4565b60601b856020013560001b866060016020810190610b749190610fb7565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f1981840301815290829052610bd591610f66565b602060405180830381855afa158015610bf2573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061086f9190610fe1565b6000806000610c2384610d04565b925092505080600014158015610c415750610c3f8285356107f9565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610c7084610d04565b9250925050610c9a6040805160608101909152806000815260006020820181905260409091015290565b81600003610cc1578060005b90816003811115610cb957610cb9610e42565b905250610c41565b60018301610cd157806003610ca6565b610cdc8386356107f9565b15610cf1576002815260208101839052610c41565b6001815260408101919091529392505050565b600080600080610d1385610b2d565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610d4357600080fd5b823567ffffffffffffffff80821115610d5b57600080fd5b818501915085601f830112610d6f57600080fd5b813581811115610d7e57600080fd5b86602060c083028501011115610d9357600080fd5b60209290920196919550909350505050565b60008060208385031215610db857600080fd5b823567ffffffffffffffff80821115610dd057600080fd5b818501915085601f830112610de457600080fd5b813581811115610df357600080fd5b86602060a083028501011115610d9357600080fd5b60008060408385031215610e1b57600080fd5b50508035926020909101359150565b600060a08284031215610e3c57600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610e7d57634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610ead57600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f0657600080fd5b81356001600160a01b0381168114610f1d57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561086f5761086f610f24565b600060018201610f5f57610f5f610f24565b5060010190565b6000825160005b81811015610f875760208186018101518583015201610f6d565b506000920191825250919050565b600060208284031215610fa757600080fd5b81518015158114610f1d57600080fd5b600060208284031215610fc957600080fd5b813567ffffffffffffffff81168114610f1d57600080fd5b600060208284031215610ff357600080fd5b505191905056fea2646970667358221220c0241e9efff6cacb5548883e39463986c365c3946a5a393e3484418cfb88e66a64736f6c63430008120033" +const ERC20SwapRuntimeBin = "6080604052600436106100865760003560e01c80638cd8dd97116100595780638cd8dd9714610141578063a76f9f2d14610161578063d5cfd0491461018f578063db3b419c146101af578063eb84e7f2146101dc57600080fd5b806323f0388b1461008b5780633da59631146100ad57806377d7e031146100c05780638c8e8fee146100f5575b600080fd5b34801561009757600080fd5b506100ab6100a6366004610d69565b610209565b005b6100ab6100bb366004610dde565b61050c565b3480156100cc57600080fd5b506100e06100db366004610e41565b61087a565b60405190151581526020015b60405180910390f35b34801561010157600080fd5b506101297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b34801561014d57600080fd5b506100ab61015c366004610e63565b6108f6565b34801561016d57600080fd5b5061018161017c366004610e63565b610b66565b6040519081526020016100ec565b34801561019b57600080fd5b506100e06101aa366004610e63565b610c4e565b3480156101bb57600080fd5b506101cf6101ca366004610e63565b610c82565b6040516100ec9190610e91565b3480156101e857600080fd5b506101816101f7366004610ed4565b60006020819052908152604090205481565b3233146102315760405162461bcd60e51b815260040161022890610eed565b60405180910390fd5b6000805b828110156103e0573684848381811061025057610250610f17565b60c00291909101915033905061026c60a0830160808401610f2d565b6001600160a01b0316146102af5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b6044820152606401610228565b600080806102bc84610d3d565b9250925092506000811180156102d157504381105b61030d5760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b6044820152606401610228565b61031882853561087a565b156103585760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b6044820152606401610228565b61036760a0850135853561087a565b6103a45760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b6044820152606401610228565b60008381526020818152604090912060a086013590556103c79085013587610f73565b95505050505080806103d890610f86565b915050610235565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161045a91610f9f565b6000604051808303816000865af19150503d8060008114610497576040519150601f19603f3d011682016040523d82523d6000602084013e61049c565b606091505b5090925090508180156104c75750805115806104c75750808060200190518101906104c79190610fce565b6105055760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b5050505050565b32331461052b5760405162461bcd60e51b815260040161022890610eed565b6000805b8281101561074a573684848381811061054a5761054a610f17565b905060a002019050600081602001351161058e5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b6044820152606401610228565b60006105a06080830160608401610ff0565b67ffffffffffffffff16116105eb5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b6044820152606401610228565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf81350161066c5760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b6064820152608401610228565b600061067782610b66565b60008181526020819052604090205490915080156106c85760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b6044820152606401610228565b50436106d581843561087a565b156107135760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b6044820152606401610228565b6000828152602081815260409091208290556107329084013586610f73565b9450505050808061074290610f86565b91505061052f565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916107ca91610f9f565b6000604051808303816000865af19150503d8060008114610807576040519150601f19603f3d011682016040523d82523d6000602084013e61080c565b606091505b5090925090508180156108375750805115806108375750808060200190518101906108379190610fce565b6105055760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b6044820152606401610228565b60008160028460405160200161089291815260200190565b60408051601f19818403018152908290526108ac91610f9f565b602060405180830381855afa1580156108c9573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108ec919061101a565b1490505b92915050565b3233146109155760405162461bcd60e51b815260040161022890610eed565b6109256080820160608301610ff0565b67ffffffffffffffff164210156109755760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b6044820152606401610228565b600080600061098384610d3d565b9250925092506000811180156109995750438111155b6109d75760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b6044820152606401610228565b6109e282853561087a565b15610a275760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b6044820152606401610228565b6000838152602081815260408083206000199055805133602482015287830135604480830191909152825180830390910181526064909101825291820180516001600160e01b031663a9059cbb60e01b179052516060917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691610ab39190610f9f565b6000604051808303816000865af19150503d8060008114610af0576040519150601f19603f3d011682016040523d82523d6000602084013e610af5565b606091505b509092509050818015610b20575080511580610b20575080806020019051810190610b209190610fce565b610b5e5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b505050505050565b600060028235610b7c6060850160408601610f2d565b60601b610b8f60a0860160808701610f2d565b60601b856020013560001b866060016020810190610bad9190610ff0565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f1981840301815290829052610c0e91610f9f565b602060405180830381855afa158015610c2b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108f0919061101a565b6000806000610c5c84610d3d565b925092505080600014158015610c7a5750610c7882853561087a565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610ca984610d3d565b9250925050610cd36040805160608101909152806000815260006020820181905260409091015290565b81600003610cfa578060005b90816003811115610cf257610cf2610e7b565b905250610c7a565b60018301610d0a57806003610cdf565b610d1583863561087a565b15610d2a576002815260208101839052610c7a565b6001815260408101919091529392505050565b600080600080610d4c85610b66565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610d7c57600080fd5b823567ffffffffffffffff80821115610d9457600080fd5b818501915085601f830112610da857600080fd5b813581811115610db757600080fd5b86602060c083028501011115610dcc57600080fd5b60209290920196919550909350505050565b60008060208385031215610df157600080fd5b823567ffffffffffffffff80821115610e0957600080fd5b818501915085601f830112610e1d57600080fd5b813581811115610e2c57600080fd5b86602060a083028501011115610dcc57600080fd5b60008060408385031215610e5457600080fd5b50508035926020909101359150565b600060a08284031215610e7557600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610eb657634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610ee657600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f3f57600080fd5b81356001600160a01b0381168114610f5657600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156108f0576108f0610f5d565b600060018201610f9857610f98610f5d565b5060010190565b6000825160005b81811015610fc05760208186018101518583015201610fa6565b506000920191825250919050565b600060208284031215610fe057600080fd5b81518015158114610f5657600080fd5b60006020828403121561100257600080fd5b813567ffffffffffffffff81168114610f5657600080fd5b60006020828403121561102c57600080fd5b505191905056fea2646970667358221220acfd007366a18ada193efab33a7139cee67cfd39d1c89075b5534cc57862baa464736f6c63430008120033" diff --git a/dex/networks/erc20/contracts/v1/contract.go b/dex/networks/erc20/contracts/v1/contract.go index 75531d53a0..68eeb5d44d 100644 --- a/dex/networks/erc20/contracts/v1/contract.go +++ b/dex/networks/erc20/contracts/v1/contract.go @@ -32,7 +32,7 @@ var ( // ERC20SwapMetaData contains all meta data concerning the ERC20Swap contract. var ERC20SwapMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structERC20Swap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"contractKey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structERC20Swap.Vector[]\",\"name\":\"contracts\",\"type\":\"tuple[]\"}],\"name\":\"initiate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structERC20Swap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"isRedeemable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structERC20Swap.Vector\",\"name\":\"v\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"}],\"internalType\":\"structERC20Swap.Redemption[]\",\"name\":\"redemptions\",\"type\":\"tuple[]\"}],\"name\":\"redeem\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structERC20Swap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"secretValidates\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structERC20Swap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"status\",\"outputs\":[{\"components\":[{\"internalType\":\"enumERC20Swap.Step\",\"name\":\"step\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"internalType\":\"structERC20Swap.Status\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"swaps\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token_address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60a060405234801561001057600080fd5b506040516110d03803806110d083398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516110306100a060003960008181610107015281816104300152818161071f0152610a4701526110306000f3fe6080604052600436106100865760003560e01c80638cd8dd97116100595780638cd8dd9714610141578063a76f9f2d14610161578063d5cfd0491461018f578063db3b419c146101af578063eb84e7f2146101dc57600080fd5b806323f0388b1461008b5780633da59631146100ad57806377d7e031146100c05780638c8e8fee146100f5575b600080fd5b34801561009757600080fd5b506100ab6100a6366004610d30565b610209565b005b6100ab6100bb366004610da5565b61050c565b3480156100cc57600080fd5b506100e06100db366004610e08565b6107f9565b60405190151581526020015b60405180910390f35b34801561010157600080fd5b506101297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b34801561014d57600080fd5b506100ab61015c366004610e2a565b610875565b34801561016d57600080fd5b5061018161017c366004610e2a565b610b2d565b6040519081526020016100ec565b34801561019b57600080fd5b506100e06101aa366004610e2a565b610c15565b3480156101bb57600080fd5b506101cf6101ca366004610e2a565b610c49565b6040516100ec9190610e58565b3480156101e857600080fd5b506101816101f7366004610e9b565b60006020819052908152604090205481565b3233146102315760405162461bcd60e51b815260040161022890610eb4565b60405180910390fd5b6000805b828110156103e0573684848381811061025057610250610ede565b60c00291909101915033905061026c60a0830160808401610ef4565b6001600160a01b0316146102af5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b6044820152606401610228565b600080806102bc84610d04565b9250925092506000811180156102d157504381105b61030d5760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b6044820152606401610228565b6103188285356107f9565b156103585760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b6044820152606401610228565b61036760a085013585356107f9565b6103a45760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b6044820152606401610228565b60008381526020818152604090912060a086013590556103c79085013587610f3a565b95505050505080806103d890610f4d565b915050610235565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161045a91610f66565b6000604051808303816000865af19150503d8060008114610497576040519150601f19603f3d011682016040523d82523d6000602084013e61049c565b606091505b5090925090508180156104c75750805115806104c75750808060200190518101906104c79190610f95565b6105055760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b5050505050565b32331461052b5760405162461bcd60e51b815260040161022890610eb4565b6000805b828110156106c9573684848381811061054a5761054a610ede565b905060a002019050600081602001351161058e5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b6044820152606401610228565b60006105a06080830160608401610fb7565b67ffffffffffffffff16116105eb5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b6044820152606401610228565b60006105f682610b2d565b60008181526020819052604090205490915080156106475760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b6044820152606401610228565b50436106548184356107f9565b156106925760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b6044820152606401610228565b6000828152602081815260409091208290556106b19084013586610f3a565b945050505080806106c190610f4d565b91505061052f565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161074991610f66565b6000604051808303816000865af19150503d8060008114610786576040519150601f19603f3d011682016040523d82523d6000602084013e61078b565b606091505b5090925090508180156107b65750805115806107b65750808060200190518101906107b69190610f95565b6105055760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b6044820152606401610228565b60008160028460405160200161081191815260200190565b60408051601f198184030181529082905261082b91610f66565b602060405180830381855afa158015610848573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061086b9190610fe1565b1490505b92915050565b3233146108945760405162461bcd60e51b815260040161022890610eb4565b6108a46080820160608301610fb7565b67ffffffffffffffff164210156108f45760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b6044820152606401610228565b600080600061090284610d04565b9250925092506000811180156109185750438111155b6109565760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b6044820152606401610228565b6109618285356107f9565b156109a65760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b6044820152606401610228565b600182016109ee5760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c99599d5b991959605a1b6044820152606401610228565b6000838152602081815260408083206000199055805133602482015287830135604480830191909152825180830390910181526064909101825291820180516001600160e01b031663a9059cbb60e01b179052516060917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691610a7a9190610f66565b6000604051808303816000865af19150503d8060008114610ab7576040519150601f19603f3d011682016040523d82523d6000602084013e610abc565b606091505b509092509050818015610ae7575080511580610ae7575080806020019051810190610ae79190610f95565b610b255760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b505050505050565b600060028235610b436060850160408601610ef4565b60601b610b5660a0860160808701610ef4565b60601b856020013560001b866060016020810190610b749190610fb7565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f1981840301815290829052610bd591610f66565b602060405180830381855afa158015610bf2573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061086f9190610fe1565b6000806000610c2384610d04565b925092505080600014158015610c415750610c3f8285356107f9565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610c7084610d04565b9250925050610c9a6040805160608101909152806000815260006020820181905260409091015290565b81600003610cc1578060005b90816003811115610cb957610cb9610e42565b905250610c41565b60018301610cd157806003610ca6565b610cdc8386356107f9565b15610cf1576002815260208101839052610c41565b6001815260408101919091529392505050565b600080600080610d1385610b2d565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610d4357600080fd5b823567ffffffffffffffff80821115610d5b57600080fd5b818501915085601f830112610d6f57600080fd5b813581811115610d7e57600080fd5b86602060c083028501011115610d9357600080fd5b60209290920196919550909350505050565b60008060208385031215610db857600080fd5b823567ffffffffffffffff80821115610dd057600080fd5b818501915085601f830112610de457600080fd5b813581811115610df357600080fd5b86602060a083028501011115610d9357600080fd5b60008060408385031215610e1b57600080fd5b50508035926020909101359150565b600060a08284031215610e3c57600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610e7d57634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610ead57600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f0657600080fd5b81356001600160a01b0381168114610f1d57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561086f5761086f610f24565b600060018201610f5f57610f5f610f24565b5060010190565b6000825160005b81811015610f875760208186018101518583015201610f6d565b506000920191825250919050565b600060208284031215610fa757600080fd5b81518015158114610f1d57600080fd5b600060208284031215610fc957600080fd5b813567ffffffffffffffff81168114610f1d57600080fd5b600060208284031215610ff357600080fd5b505191905056fea2646970667358221220c0241e9efff6cacb5548883e39463986c365c3946a5a393e3484418cfb88e66a64736f6c63430008120033", + Bin: "0x60a060405234801561001057600080fd5b5060405161110938038061110983398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516110696100a06000396000818161010701528181610430015281816107a00152610a8001526110696000f3fe6080604052600436106100865760003560e01c80638cd8dd97116100595780638cd8dd9714610141578063a76f9f2d14610161578063d5cfd0491461018f578063db3b419c146101af578063eb84e7f2146101dc57600080fd5b806323f0388b1461008b5780633da59631146100ad57806377d7e031146100c05780638c8e8fee146100f5575b600080fd5b34801561009757600080fd5b506100ab6100a6366004610d69565b610209565b005b6100ab6100bb366004610dde565b61050c565b3480156100cc57600080fd5b506100e06100db366004610e41565b61087a565b60405190151581526020015b60405180910390f35b34801561010157600080fd5b506101297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b34801561014d57600080fd5b506100ab61015c366004610e63565b6108f6565b34801561016d57600080fd5b5061018161017c366004610e63565b610b66565b6040519081526020016100ec565b34801561019b57600080fd5b506100e06101aa366004610e63565b610c4e565b3480156101bb57600080fd5b506101cf6101ca366004610e63565b610c82565b6040516100ec9190610e91565b3480156101e857600080fd5b506101816101f7366004610ed4565b60006020819052908152604090205481565b3233146102315760405162461bcd60e51b815260040161022890610eed565b60405180910390fd5b6000805b828110156103e0573684848381811061025057610250610f17565b60c00291909101915033905061026c60a0830160808401610f2d565b6001600160a01b0316146102af5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b6044820152606401610228565b600080806102bc84610d3d565b9250925092506000811180156102d157504381105b61030d5760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b6044820152606401610228565b61031882853561087a565b156103585760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b6044820152606401610228565b61036760a0850135853561087a565b6103a45760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b6044820152606401610228565b60008381526020818152604090912060a086013590556103c79085013587610f73565b95505050505080806103d890610f86565b915050610235565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161045a91610f9f565b6000604051808303816000865af19150503d8060008114610497576040519150601f19603f3d011682016040523d82523d6000602084013e61049c565b606091505b5090925090508180156104c75750805115806104c75750808060200190518101906104c79190610fce565b6105055760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b5050505050565b32331461052b5760405162461bcd60e51b815260040161022890610eed565b6000805b8281101561074a573684848381811061054a5761054a610f17565b905060a002019050600081602001351161058e5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b6044820152606401610228565b60006105a06080830160608401610ff0565b67ffffffffffffffff16116105eb5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b6044820152606401610228565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf81350161066c5760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b6064820152608401610228565b600061067782610b66565b60008181526020819052604090205490915080156106c85760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b6044820152606401610228565b50436106d581843561087a565b156107135760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b6044820152606401610228565b6000828152602081815260409091208290556107329084013586610f73565b9450505050808061074290610f86565b91505061052f565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916107ca91610f9f565b6000604051808303816000865af19150503d8060008114610807576040519150601f19603f3d011682016040523d82523d6000602084013e61080c565b606091505b5090925090508180156108375750805115806108375750808060200190518101906108379190610fce565b6105055760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b6044820152606401610228565b60008160028460405160200161089291815260200190565b60408051601f19818403018152908290526108ac91610f9f565b602060405180830381855afa1580156108c9573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108ec919061101a565b1490505b92915050565b3233146109155760405162461bcd60e51b815260040161022890610eed565b6109256080820160608301610ff0565b67ffffffffffffffff164210156109755760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b6044820152606401610228565b600080600061098384610d3d565b9250925092506000811180156109995750438111155b6109d75760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b6044820152606401610228565b6109e282853561087a565b15610a275760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b6044820152606401610228565b6000838152602081815260408083206000199055805133602482015287830135604480830191909152825180830390910181526064909101825291820180516001600160e01b031663a9059cbb60e01b179052516060917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691610ab39190610f9f565b6000604051808303816000865af19150503d8060008114610af0576040519150601f19603f3d011682016040523d82523d6000602084013e610af5565b606091505b509092509050818015610b20575080511580610b20575080806020019051810190610b209190610fce565b610b5e5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b505050505050565b600060028235610b7c6060850160408601610f2d565b60601b610b8f60a0860160808701610f2d565b60601b856020013560001b866060016020810190610bad9190610ff0565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f1981840301815290829052610c0e91610f9f565b602060405180830381855afa158015610c2b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108f0919061101a565b6000806000610c5c84610d3d565b925092505080600014158015610c7a5750610c7882853561087a565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610ca984610d3d565b9250925050610cd36040805160608101909152806000815260006020820181905260409091015290565b81600003610cfa578060005b90816003811115610cf257610cf2610e7b565b905250610c7a565b60018301610d0a57806003610cdf565b610d1583863561087a565b15610d2a576002815260208101839052610c7a565b6001815260408101919091529392505050565b600080600080610d4c85610b66565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610d7c57600080fd5b823567ffffffffffffffff80821115610d9457600080fd5b818501915085601f830112610da857600080fd5b813581811115610db757600080fd5b86602060c083028501011115610dcc57600080fd5b60209290920196919550909350505050565b60008060208385031215610df157600080fd5b823567ffffffffffffffff80821115610e0957600080fd5b818501915085601f830112610e1d57600080fd5b813581811115610e2c57600080fd5b86602060a083028501011115610dcc57600080fd5b60008060408385031215610e5457600080fd5b50508035926020909101359150565b600060a08284031215610e7557600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610eb657634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610ee657600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f3f57600080fd5b81356001600160a01b0381168114610f5657600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156108f0576108f0610f5d565b600060018201610f9857610f98610f5d565b5060010190565b6000825160005b81811015610fc05760208186018101518583015201610fa6565b506000920191825250919050565b600060208284031215610fe057600080fd5b81518015158114610f5657600080fd5b60006020828403121561100257600080fd5b813567ffffffffffffffff81168114610f5657600080fd5b60006020828403121561102c57600080fd5b505191905056fea2646970667358221220acfd007366a18ada193efab33a7139cee67cfd39d1c89075b5534cc57862baa464736f6c63430008120033", } // ERC20SwapABI is the input ABI used to generate the binding from. diff --git a/dex/networks/eth/contracts/ETHSwapV0.sol b/dex/networks/eth/contracts/ETHSwapV0.sol index e65c188285..ca53936269 100644 --- a/dex/networks/eth/contracts/ETHSwapV0.sol +++ b/dex/networks/eth/contracts/ETHSwapV0.sol @@ -122,7 +122,7 @@ contract ETHSwap { } // redeem redeems a contract. It checks that the sender is not a contract, - // and that the secret hash hashes to secretHash. msg.value is tranfered + // and that the secret hashes to secretHash. msg.value is tranfered // from the contract to the sender. // // It is important to note that this uses call.value which comes with no diff --git a/dex/networks/eth/contracts/ETHSwapV1.sol b/dex/networks/eth/contracts/ETHSwapV1.sol index d83d0dff0a..767b39bab8 100644 --- a/dex/networks/eth/contracts/ETHSwapV1.sol +++ b/dex/networks/eth/contracts/ETHSwapV1.sol @@ -33,6 +33,7 @@ contract ETHSwap { } bytes32 constant RefundRecord = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; + bytes32 constant RefundRecordHash = 0xAF9613760F72635FBDB44A5A0A63C39F12AF30F950A6EE5C971BE188E89C4051; // swaps is a map of contract hashes to the "swap record". The swap record // has the following interpretation. @@ -127,6 +128,7 @@ contract ETHSwap { require(v.value > 0, "0 val"); require(v.refundTimestamp > 0, "0 refundTimestamp"); + require(v.secretHash != RefundRecordHash, "illegal secret hash (refund record hash)"); bytes32 k = contractKey(v); bytes32 record = swaps[k]; @@ -143,7 +145,7 @@ contract ETHSwap { require(initVal == msg.value, "bad val"); } - // isRedeemable returns whether or not a swap identified by secretHash + // isRedeemable returns whether or not a swap identified by vector // can be redeemed using secret. isRedeemable DOES NOT check if the caller // is the participant in the vector. function isRedeemable(Vector calldata v) @@ -156,7 +158,7 @@ contract ETHSwap { } // redeem redeems a Vector. It checks that the sender is not a contract, - // and that the secret hash hashes to secretHash. msg.value is tranfered + // and that the secret hashes to secretHash. msg.value is tranfered // from ETHSwap to the sender. // // To prevent reentry attack, it is very important to check the state of the @@ -187,10 +189,6 @@ contract ETHSwap { require(secretValidates(r.secret, r.v.secretHash), "invalid secret"); swaps[k] = r.secret; - - - // DRAFT TODO: NOOOOOO! This doesn't account for decimals. This is - // WRONG for e.g. USDC. amountToRedeem += r.v.value; } @@ -215,14 +213,14 @@ contract ETHSwap { (bytes32 k, bytes32 record, uint256 blockNum) = retrieveStatus(v); // Is this swap initialized? + // This check also guarantees that the swap has not already been + // refunded i.e. record != RefundRecord, since RefundRecord is certainly + // greater than block.number. require(blockNum > 0 && blockNum <= block.number, "swap not active"); // Is it already redeemed? require(!secretValidates(record, v.secretHash), "swap already redeemed"); - // Is it already refunded? - require(record != RefundRecord, "swap already refunded"); - swaps[k] = RefundRecord; (bool ok, ) = payable(v.initiator).call{value: v.value}(""); diff --git a/dex/networks/eth/contracts/v1/BinRuntimeV1.go b/dex/networks/eth/contracts/v1/BinRuntimeV1.go index eda4d68d48..9bd4f954ae 100644 --- a/dex/networks/eth/contracts/v1/BinRuntimeV1.go +++ b/dex/networks/eth/contracts/v1/BinRuntimeV1.go @@ -3,4 +3,4 @@ package v1 -const ETHSwapRuntimeBin = "60806040526004361061007b5760003560e01c8063a76f9f2d1161004e578063a76f9f2d1461010a578063d5cfd04914610138578063db3b419c14610158578063eb84e7f21461018557600080fd5b806323f0388b146100805780633da59631146100a257806377d7e031146100b55780638cd8dd97146100ea575b600080fd5b34801561008c57600080fd5b506100a061009b366004610adb565b6101b2565b005b6100a06100b0366004610b50565b610420565b3480156100c157600080fd5b506100d56100d0366004610bb3565b61061c565b60405190151581526020015b60405180910390f35b3480156100f657600080fd5b506100a0610105366004610bd5565b610698565b34801561011657600080fd5b5061012a610125366004610bd5565b6108d8565b6040519081526020016100e1565b34801561014457600080fd5b506100d5610153366004610bd5565b6109c0565b34801561016457600080fd5b50610178610173366004610bd5565b6109f4565b6040516100e19190610c03565b34801561019157600080fd5b5061012a6101a0366004610c46565b60006020819052908152604090205481565b3233146101da5760405162461bcd60e51b81526004016101d190610c5f565b60405180910390fd5b6000805b8281101561038957368484838181106101f9576101f9610c89565b60c00291909101915033905061021560a0830160808401610c9f565b6001600160a01b0316146102585760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b60448201526064016101d1565b6000808061026584610aaf565b92509250925060008111801561027a57504381105b6102b65760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b60448201526064016101d1565b6102c182853561061c565b156103015760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016101d1565b61031060a0850135853561061c565b61034d5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b60448201526064016101d1565b60008381526020818152604090912060a086013590556103709085013587610ce5565b955050505050808061038190610cf8565b9150506101de565b50604051600090339083908381818185875af1925050503d80600081146103cc576040519150601f19603f3d011682016040523d82523d6000602084013e6103d1565b606091505b509091505060018115151461041a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b50505050565b32331461043f5760405162461bcd60e51b81526004016101d190610c5f565b6000805b828110156105dd573684848381811061045e5761045e610c89565b905060a00201905060008160200135116104a25760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d1565b60006104b46080830160608401610d11565b67ffffffffffffffff16116104ff5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d1565b600061050a826108d8565b600081815260208190526040902054909150801561055b5760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b60448201526064016101d1565b504361056881843561061c565b156105a65760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b60448201526064016101d1565b6000828152602081815260409091208290556105c59084013586610ce5565b945050505080806105d590610cf8565b915050610443565b503481146106175760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101d1565b505050565b60008160028460405160200161063491815260200190565b60408051601f198184030181529082905261064e91610d3b565b602060405180830381855afa15801561066b573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061068e9190610d6a565b1490505b92915050565b3233146106b75760405162461bcd60e51b81526004016101d190610c5f565b6106c76080820160608301610d11565b67ffffffffffffffff164210156107175760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b60448201526064016101d1565b600080600061072584610aaf565b92509250925060008111801561073b5750438111155b6107795760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b60448201526064016101d1565b61078482853561061c565b156107c95760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b60448201526064016101d1565b600182016108115760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c99599d5b991959605a1b60448201526064016101d1565b60008381526020819052604080822060001990556108359060608701908701610c9f565b6001600160a01b0316856020013560405160006040518083038185875af1925050503d8060008114610883576040519150601f19603f3d011682016040523d82523d6000602084013e610888565b606091505b50909150506001811515146108d15760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b5050505050565b6000600282356108ee6060850160408601610c9f565b60601b61090160a0860160808701610c9f565b60601b856020013560001b86606001602081019061091f9190610d11565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f198184030181529082905261098091610d3b565b602060405180830381855afa15801561099d573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106929190610d6a565b60008060006109ce84610aaf565b9250925050806000141580156109ec57506109ea82853561061c565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610a1b84610aaf565b9250925050610a456040805160608101909152806000815260006020820181905260409091015290565b81600003610a6c578060005b90816003811115610a6457610a64610bed565b9052506109ec565b60018301610a7c57806003610a51565b610a8783863561061c565b15610a9c5760028152602081018390526109ec565b6001815260408101919091529392505050565b600080600080610abe856108d8565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610aee57600080fd5b823567ffffffffffffffff80821115610b0657600080fd5b818501915085601f830112610b1a57600080fd5b813581811115610b2957600080fd5b86602060c083028501011115610b3e57600080fd5b60209290920196919550909350505050565b60008060208385031215610b6357600080fd5b823567ffffffffffffffff80821115610b7b57600080fd5b818501915085601f830112610b8f57600080fd5b813581811115610b9e57600080fd5b86602060a083028501011115610b3e57600080fd5b60008060408385031215610bc657600080fd5b50508035926020909101359150565b600060a08284031215610be757600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610c2857634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610c5857600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610cb157600080fd5b81356001600160a01b0381168114610cc857600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561069257610692610ccf565b600060018201610d0a57610d0a610ccf565b5060010190565b600060208284031215610d2357600080fd5b813567ffffffffffffffff81168114610cc857600080fd5b6000825160005b81811015610d5c5760208186018101518583015201610d42565b506000920191825250919050565b600060208284031215610d7c57600080fd5b505191905056fea2646970667358221220d06fb8ed23d4808c2b9f4f691e0abd03030305c1af9428077386f96e11f2643364736f6c63430008120033" +const ETHSwapRuntimeBin = "60806040526004361061007b5760003560e01c8063a76f9f2d1161004e578063a76f9f2d1461010a578063d5cfd04914610138578063db3b419c14610158578063eb84e7f21461018557600080fd5b806323f0388b146100805780633da59631146100a257806377d7e031146100b55780638cd8dd97146100ea575b600080fd5b34801561008c57600080fd5b506100a061009b366004610b14565b6101b2565b005b6100a06100b0366004610b89565b610420565b3480156100c157600080fd5b506100d56100d0366004610bec565b61069d565b60405190151581526020015b60405180910390f35b3480156100f657600080fd5b506100a0610105366004610c0e565b610719565b34801561011657600080fd5b5061012a610125366004610c0e565b610911565b6040519081526020016100e1565b34801561014457600080fd5b506100d5610153366004610c0e565b6109f9565b34801561016457600080fd5b50610178610173366004610c0e565b610a2d565b6040516100e19190610c3c565b34801561019157600080fd5b5061012a6101a0366004610c7f565b60006020819052908152604090205481565b3233146101da5760405162461bcd60e51b81526004016101d190610c98565b60405180910390fd5b6000805b8281101561038957368484838181106101f9576101f9610cc2565b60c00291909101915033905061021560a0830160808401610cd8565b6001600160a01b0316146102585760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b60448201526064016101d1565b6000808061026584610ae8565b92509250925060008111801561027a57504381105b6102b65760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b60448201526064016101d1565b6102c182853561069d565b156103015760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016101d1565b61031060a0850135853561069d565b61034d5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b60448201526064016101d1565b60008381526020818152604090912060a086013590556103709085013587610d1e565b955050505050808061038190610d31565b9150506101de565b50604051600090339083908381818185875af1925050503d80600081146103cc576040519150601f19603f3d011682016040523d82523d6000602084013e6103d1565b606091505b509091505060018115151461041a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b50505050565b32331461043f5760405162461bcd60e51b81526004016101d190610c98565b6000805b8281101561065e573684848381811061045e5761045e610cc2565b905060a00201905060008160200135116104a25760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d1565b60006104b46080830160608401610d4a565b67ffffffffffffffff16116104ff5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d1565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf8135016105805760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b60648201526084016101d1565b600061058b82610911565b60008181526020819052604090205490915080156105dc5760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b60448201526064016101d1565b50436105e981843561069d565b156106275760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b60448201526064016101d1565b6000828152602081815260409091208290556106469084013586610d1e565b9450505050808061065690610d31565b915050610443565b503481146106985760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101d1565b505050565b6000816002846040516020016106b591815260200190565b60408051601f19818403018152908290526106cf91610d74565b602060405180830381855afa1580156106ec573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061070f9190610da3565b1490505b92915050565b3233146107385760405162461bcd60e51b81526004016101d190610c98565b6107486080820160608301610d4a565b67ffffffffffffffff164210156107985760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b60448201526064016101d1565b60008060006107a684610ae8565b9250925092506000811180156107bc5750438111155b6107fa5760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b60448201526064016101d1565b61080582853561069d565b1561084a5760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b60448201526064016101d1565b600083815260208190526040808220600019905561086e9060608701908701610cd8565b6001600160a01b0316856020013560405160006040518083038185875af1925050503d80600081146108bc576040519150601f19603f3d011682016040523d82523d6000602084013e6108c1565b606091505b509091505060018115151461090a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b5050505050565b6000600282356109276060850160408601610cd8565b60601b61093a60a0860160808701610cd8565b60601b856020013560001b8660600160208101906109589190610d4a565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f19818403018152908290526109b991610d74565b602060405180830381855afa1580156109d6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107139190610da3565b6000806000610a0784610ae8565b925092505080600014158015610a255750610a2382853561069d565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610a5484610ae8565b9250925050610a7e6040805160608101909152806000815260006020820181905260409091015290565b81600003610aa5578060005b90816003811115610a9d57610a9d610c26565b905250610a25565b60018301610ab557806003610a8a565b610ac083863561069d565b15610ad5576002815260208101839052610a25565b6001815260408101919091529392505050565b600080600080610af785610911565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610b2757600080fd5b823567ffffffffffffffff80821115610b3f57600080fd5b818501915085601f830112610b5357600080fd5b813581811115610b6257600080fd5b86602060c083028501011115610b7757600080fd5b60209290920196919550909350505050565b60008060208385031215610b9c57600080fd5b823567ffffffffffffffff80821115610bb457600080fd5b818501915085601f830112610bc857600080fd5b813581811115610bd757600080fd5b86602060a083028501011115610b7757600080fd5b60008060408385031215610bff57600080fd5b50508035926020909101359150565b600060a08284031215610c2057600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610c6157634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610c9157600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610cea57600080fd5b81356001600160a01b0381168114610d0157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561071357610713610d08565b600060018201610d4357610d43610d08565b5060010190565b600060208284031215610d5c57600080fd5b813567ffffffffffffffff81168114610d0157600080fd5b6000825160005b81811015610d955760208186018101518583015201610d7b565b506000920191825250919050565b600060208284031215610db557600080fd5b505191905056fea2646970667358221220420ce9cfd5a39be8e719369517f704148d580fb33472b5b8947c77d61eee66d664736f6c63430008120033" diff --git a/dex/networks/eth/contracts/v1/contract.go b/dex/networks/eth/contracts/v1/contract.go index 86e9dc9982..61db70d044 100644 --- a/dex/networks/eth/contracts/v1/contract.go +++ b/dex/networks/eth/contracts/v1/contract.go @@ -53,7 +53,7 @@ type ETHSwapVector struct { // ETHSwapMetaData contains all meta data concerning the ETHSwap contract. var ETHSwapMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structETHSwap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"contractKey\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structETHSwap.Vector[]\",\"name\":\"contracts\",\"type\":\"tuple[]\"}],\"name\":\"initiate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structETHSwap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"isRedeemable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structETHSwap.Vector\",\"name\":\"v\",\"type\":\"tuple\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"}],\"internalType\":\"structETHSwap.Redemption[]\",\"name\":\"redemptions\",\"type\":\"tuple[]\"}],\"name\":\"redeem\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structETHSwap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"secretValidates\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"uint64\",\"name\":\"refundTimestamp\",\"type\":\"uint64\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"}],\"internalType\":\"structETHSwap.Vector\",\"name\":\"v\",\"type\":\"tuple\"}],\"name\":\"status\",\"outputs\":[{\"components\":[{\"internalType\":\"enumETHSwap.Step\",\"name\":\"step\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"}],\"internalType\":\"structETHSwap.Status\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"swaps\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50610db9806100206000396000f3fe60806040526004361061007b5760003560e01c8063a76f9f2d1161004e578063a76f9f2d1461010a578063d5cfd04914610138578063db3b419c14610158578063eb84e7f21461018557600080fd5b806323f0388b146100805780633da59631146100a257806377d7e031146100b55780638cd8dd97146100ea575b600080fd5b34801561008c57600080fd5b506100a061009b366004610adb565b6101b2565b005b6100a06100b0366004610b50565b610420565b3480156100c157600080fd5b506100d56100d0366004610bb3565b61061c565b60405190151581526020015b60405180910390f35b3480156100f657600080fd5b506100a0610105366004610bd5565b610698565b34801561011657600080fd5b5061012a610125366004610bd5565b6108d8565b6040519081526020016100e1565b34801561014457600080fd5b506100d5610153366004610bd5565b6109c0565b34801561016457600080fd5b50610178610173366004610bd5565b6109f4565b6040516100e19190610c03565b34801561019157600080fd5b5061012a6101a0366004610c46565b60006020819052908152604090205481565b3233146101da5760405162461bcd60e51b81526004016101d190610c5f565b60405180910390fd5b6000805b8281101561038957368484838181106101f9576101f9610c89565b60c00291909101915033905061021560a0830160808401610c9f565b6001600160a01b0316146102585760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b60448201526064016101d1565b6000808061026584610aaf565b92509250925060008111801561027a57504381105b6102b65760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b60448201526064016101d1565b6102c182853561061c565b156103015760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016101d1565b61031060a0850135853561061c565b61034d5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b60448201526064016101d1565b60008381526020818152604090912060a086013590556103709085013587610ce5565b955050505050808061038190610cf8565b9150506101de565b50604051600090339083908381818185875af1925050503d80600081146103cc576040519150601f19603f3d011682016040523d82523d6000602084013e6103d1565b606091505b509091505060018115151461041a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b50505050565b32331461043f5760405162461bcd60e51b81526004016101d190610c5f565b6000805b828110156105dd573684848381811061045e5761045e610c89565b905060a00201905060008160200135116104a25760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d1565b60006104b46080830160608401610d11565b67ffffffffffffffff16116104ff5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d1565b600061050a826108d8565b600081815260208190526040902054909150801561055b5760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b60448201526064016101d1565b504361056881843561061c565b156105a65760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b60448201526064016101d1565b6000828152602081815260409091208290556105c59084013586610ce5565b945050505080806105d590610cf8565b915050610443565b503481146106175760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101d1565b505050565b60008160028460405160200161063491815260200190565b60408051601f198184030181529082905261064e91610d3b565b602060405180830381855afa15801561066b573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061068e9190610d6a565b1490505b92915050565b3233146106b75760405162461bcd60e51b81526004016101d190610c5f565b6106c76080820160608301610d11565b67ffffffffffffffff164210156107175760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b60448201526064016101d1565b600080600061072584610aaf565b92509250925060008111801561073b5750438111155b6107795760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b60448201526064016101d1565b61078482853561061c565b156107c95760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b60448201526064016101d1565b600182016108115760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c99599d5b991959605a1b60448201526064016101d1565b60008381526020819052604080822060001990556108359060608701908701610c9f565b6001600160a01b0316856020013560405160006040518083038185875af1925050503d8060008114610883576040519150601f19603f3d011682016040523d82523d6000602084013e610888565b606091505b50909150506001811515146108d15760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b5050505050565b6000600282356108ee6060850160408601610c9f565b60601b61090160a0860160808701610c9f565b60601b856020013560001b86606001602081019061091f9190610d11565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f198184030181529082905261098091610d3b565b602060405180830381855afa15801561099d573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106929190610d6a565b60008060006109ce84610aaf565b9250925050806000141580156109ec57506109ea82853561061c565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610a1b84610aaf565b9250925050610a456040805160608101909152806000815260006020820181905260409091015290565b81600003610a6c578060005b90816003811115610a6457610a64610bed565b9052506109ec565b60018301610a7c57806003610a51565b610a8783863561061c565b15610a9c5760028152602081018390526109ec565b6001815260408101919091529392505050565b600080600080610abe856108d8565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610aee57600080fd5b823567ffffffffffffffff80821115610b0657600080fd5b818501915085601f830112610b1a57600080fd5b813581811115610b2957600080fd5b86602060c083028501011115610b3e57600080fd5b60209290920196919550909350505050565b60008060208385031215610b6357600080fd5b823567ffffffffffffffff80821115610b7b57600080fd5b818501915085601f830112610b8f57600080fd5b813581811115610b9e57600080fd5b86602060a083028501011115610b3e57600080fd5b60008060408385031215610bc657600080fd5b50508035926020909101359150565b600060a08284031215610be757600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610c2857634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610c5857600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610cb157600080fd5b81356001600160a01b0381168114610cc857600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561069257610692610ccf565b600060018201610d0a57610d0a610ccf565b5060010190565b600060208284031215610d2357600080fd5b813567ffffffffffffffff81168114610cc857600080fd5b6000825160005b81811015610d5c5760208186018101518583015201610d42565b506000920191825250919050565b600060208284031215610d7c57600080fd5b505191905056fea2646970667358221220d06fb8ed23d4808c2b9f4f691e0abd03030305c1af9428077386f96e11f2643364736f6c63430008120033", + Bin: "0x608060405234801561001057600080fd5b50610df2806100206000396000f3fe60806040526004361061007b5760003560e01c8063a76f9f2d1161004e578063a76f9f2d1461010a578063d5cfd04914610138578063db3b419c14610158578063eb84e7f21461018557600080fd5b806323f0388b146100805780633da59631146100a257806377d7e031146100b55780638cd8dd97146100ea575b600080fd5b34801561008c57600080fd5b506100a061009b366004610b14565b6101b2565b005b6100a06100b0366004610b89565b610420565b3480156100c157600080fd5b506100d56100d0366004610bec565b61069d565b60405190151581526020015b60405180910390f35b3480156100f657600080fd5b506100a0610105366004610c0e565b610719565b34801561011657600080fd5b5061012a610125366004610c0e565b610911565b6040519081526020016100e1565b34801561014457600080fd5b506100d5610153366004610c0e565b6109f9565b34801561016457600080fd5b50610178610173366004610c0e565b610a2d565b6040516100e19190610c3c565b34801561019157600080fd5b5061012a6101a0366004610c7f565b60006020819052908152604090205481565b3233146101da5760405162461bcd60e51b81526004016101d190610c98565b60405180910390fd5b6000805b8281101561038957368484838181106101f9576101f9610cc2565b60c00291909101915033905061021560a0830160808401610cd8565b6001600160a01b0316146102585760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b60448201526064016101d1565b6000808061026584610ae8565b92509250925060008111801561027a57504381105b6102b65760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b60448201526064016101d1565b6102c182853561069d565b156103015760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016101d1565b61031060a0850135853561069d565b61034d5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b60448201526064016101d1565b60008381526020818152604090912060a086013590556103709085013587610d1e565b955050505050808061038190610d31565b9150506101de565b50604051600090339083908381818185875af1925050503d80600081146103cc576040519150601f19603f3d011682016040523d82523d6000602084013e6103d1565b606091505b509091505060018115151461041a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b50505050565b32331461043f5760405162461bcd60e51b81526004016101d190610c98565b6000805b8281101561065e573684848381811061045e5761045e610cc2565b905060a00201905060008160200135116104a25760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d1565b60006104b46080830160608401610d4a565b67ffffffffffffffff16116104ff5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d1565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf8135016105805760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b60648201526084016101d1565b600061058b82610911565b60008181526020819052604090205490915080156105dc5760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b60448201526064016101d1565b50436105e981843561069d565b156106275760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b60448201526064016101d1565b6000828152602081815260409091208290556106469084013586610d1e565b9450505050808061065690610d31565b915050610443565b503481146106985760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101d1565b505050565b6000816002846040516020016106b591815260200190565b60408051601f19818403018152908290526106cf91610d74565b602060405180830381855afa1580156106ec573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061070f9190610da3565b1490505b92915050565b3233146107385760405162461bcd60e51b81526004016101d190610c98565b6107486080820160608301610d4a565b67ffffffffffffffff164210156107985760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b60448201526064016101d1565b60008060006107a684610ae8565b9250925092506000811180156107bc5750438111155b6107fa5760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b60448201526064016101d1565b61080582853561069d565b1561084a5760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b60448201526064016101d1565b600083815260208190526040808220600019905561086e9060608701908701610cd8565b6001600160a01b0316856020013560405160006040518083038185875af1925050503d80600081146108bc576040519150601f19603f3d011682016040523d82523d6000602084013e6108c1565b606091505b509091505060018115151461090a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b5050505050565b6000600282356109276060850160408601610cd8565b60601b61093a60a0860160808701610cd8565b60601b856020013560001b8660600160208101906109589190610d4a565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f19818403018152908290526109b991610d74565b602060405180830381855afa1580156109d6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107139190610da3565b6000806000610a0784610ae8565b925092505080600014158015610a255750610a2382853561069d565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610a5484610ae8565b9250925050610a7e6040805160608101909152806000815260006020820181905260409091015290565b81600003610aa5578060005b90816003811115610a9d57610a9d610c26565b905250610a25565b60018301610ab557806003610a8a565b610ac083863561069d565b15610ad5576002815260208101839052610a25565b6001815260408101919091529392505050565b600080600080610af785610911565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610b2757600080fd5b823567ffffffffffffffff80821115610b3f57600080fd5b818501915085601f830112610b5357600080fd5b813581811115610b6257600080fd5b86602060c083028501011115610b7757600080fd5b60209290920196919550909350505050565b60008060208385031215610b9c57600080fd5b823567ffffffffffffffff80821115610bb457600080fd5b818501915085601f830112610bc857600080fd5b813581811115610bd757600080fd5b86602060a083028501011115610b7757600080fd5b60008060408385031215610bff57600080fd5b50508035926020909101359150565b600060a08284031215610c2057600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610c6157634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610c9157600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610cea57600080fd5b81356001600160a01b0381168114610d0157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561071357610713610d08565b600060018201610d4357610d43610d08565b5060010190565b600060208284031215610d5c57600080fd5b813567ffffffffffffffff81168114610d0157600080fd5b6000825160005b81811015610d955760208186018101518583015201610d7b565b506000920191825250919050565b600060208284031215610db557600080fd5b505191905056fea2646970667358221220420ce9cfd5a39be8e719369517f704148d580fb33472b5b8947c77d61eee66d664736f6c63430008120033", } // ETHSwapABI is the input ABI used to generate the binding from. diff --git a/dex/networks/eth/params.go b/dex/networks/eth/params.go index 3178b2f945..df8752ce7f 100644 --- a/dex/networks/eth/params.go +++ b/dex/networks/eth/params.go @@ -449,6 +449,8 @@ func (v ProtocolVersion) ContractVersion() uint32 { } var ( + // ContractVersionERC20 is passed as the contract version when calling + // ERC20 contract methods. ContractVersionERC20 = ^uint32(0) ContractVersionUnknown = ContractVersionERC20 - 1 ) diff --git a/dex/networks/eth/txdata.go b/dex/networks/eth/txdata.go index 6aabcc1bd0..f80b8e0067 100644 --- a/dex/networks/eth/txdata.go +++ b/dex/networks/eth/txdata.go @@ -91,7 +91,7 @@ func ParseInitiateDataV0(calldata []byte) (map[[SecretHashSize]byte]*Initiation, return toReturn, nil } -// ParseRedeemData parses the calldata used to call the redeem function of a +// ParseRedeemDataV0 parses the calldata used to call the redeem function of a // specific version of the swap contract. It returns the the list of redemptions // done in the call and errors if the call data does not call redeem with expected // argument types. @@ -137,7 +137,7 @@ func ParseRedeemDataV0(calldata []byte) (map[[SecretHashSize]byte]*Redemption, e return toReturn, nil } -// ParseRefundData parses the calldata used to call the refund function of a +// ParseRefundDataV0 parses the calldata used to call the refund function of a // specific version of the swap contract. It returns the secret hash and errors // if the call data does not call refund with expected argument types. func ParseRefundDataV0(calldata []byte) ([32]byte, error) { @@ -201,7 +201,7 @@ func ParseInitiateDataV1(calldata []byte) (map[[SecretHashSize]byte]*SwapVector, } // This is done for the compiler to ensure that the type defined above and - // swapv0.ETHSwapInitiation are the same, other than the tags. + // swapv1.ETHSwapVector are the same, other than the tags. if len(initiations) > 0 { _ = swapv1.ETHSwapVector(initiations[0]) } @@ -253,9 +253,8 @@ func ParseRedeemDataV1(calldata []byte) (map[[SecretHashSize]byte]*RedemptionV1, } // This is done for the compiler to ensure that the type defined above and - // swapv0.ETHSwapRedemption are the same, other than the tags. + // swapv1.ETHSwapVector are the same, other than the tags. if len(redemptions) > 0 { - // Why can't I do ETHSwapRedemption directly? _ = swapv1.ETHSwapVector(redemptions[0].V) } toReturn := make(map[[SecretHashSize]byte]*RedemptionV1, len(redemptions)) diff --git a/dex/testing/eth/harness.sh b/dex/testing/eth/harness.sh index 5f1cb6b68d..5a7cb08161 100755 --- a/dex/testing/eth/harness.sh +++ b/dex/testing/eth/harness.sh @@ -45,8 +45,8 @@ ERC20_SWAP_V0="60a060405234801561001057600080fd5b50604051610e92380380610e9283398 TEST_TOKEN="608060405234801561001057600080fd5b506040805180820190915260098152682a32b9ba2a37b5b2b760b91b602082015260039061003e90826101ad565b506040805180820190915260038152621514d560ea1b602082015260049061006690826101ad565b506909513ea9de0243800000600255600060208190526902544faa778090e000007f7d4921c2bc32c0110a31d16f4efb43c7a1228f1df7af765f608241dee5c62ebc8190557f59603491850c7d11499afe95b334ccfd92b48b36a15df31ef59ff5813fe3708281905573d12ab7cf72ccf1f3882ec99ddc53cd415635c3be9091527f5bd8dfce2dbb581d0922a094c40bab2f7d2f0ea9aaf275bf0fcc0f027a2ff91d5561026c565b634e487b7160e01b600052604160045260246000fd5b600181811c9082168061013857607f821691505b60208210810361015857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156101a857600081815260208120601f850160051c810160208610156101855750805b601f850160051c820191505b818110156101a457828155600101610191565b5050505b505050565b81516001600160401b038111156101c6576101c661010e565b6101da816101d48454610124565b8461015e565b602080601f83116001811461020f57600084156101f75750858301515b600019600386901b1c1916600185901b1785556101a4565b600085815260208120601f198616915b8281101561023e5788860151825594840194600190910190840161021f565b508582101561025c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6107c08061027b6000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a08231146101235780638ba4cc3c1461014c57806395d89b4114610161578063a9059cbb14610169578063ce714b511461017c578063dd62ed3e1461018f57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101c8565b6040516100c3919061060a565b60405180910390f35b6100df6100da366004610674565b61025a565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461069e565b610271565b604051601281526020016100c3565b6100f36101313660046106da565b6001600160a01b031660009081526020819052604090205490565b61015f61015a366004610674565b610320565b005b6100b6610368565b6100df610177366004610674565b610377565b6100df61018a36600461069e565b610384565b6100f361019d3660046106fc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101d79061072f565b80601f01602080910402602001604051908101604052809291908181526020018280546102039061072f565b80156102505780601f1061022557610100808354040283529160200191610250565b820191906000526020600020905b81548152906001019060200180831161023357829003601f168201915b5050505050905090565b600061026733848461039b565b5060015b92915050565b600061027e84848461048a565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103085760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610315853385840361039b565b506001949350505050565b80600260008282546103329190610769565b90915550506001600160a01b0382166000908152602081905260408120805483929061035f908490610769565b90915550505050565b6060600480546101d79061072f565b600061026733848461048a565b600061039184848461039b565b5060019392505050565b6001600160a01b0383166103fd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102ff565b6001600160a01b03821661045e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102ff565b6001600160a01b0392831660009081526001602090815260408083209490951682529290925291902055565b6001600160a01b0383166104ee5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102ff565b6001600160a01b0382166105505760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102ff565b6001600160a01b038316600090815260208190526040902054818110156105c85760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102ff565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906105ff908490610769565b909155505050505050565b600060208083528351808285015260005b818110156106375785810183015185820160400152820161061b565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b038116811461066f57600080fd5b919050565b6000806040838503121561068757600080fd5b61069083610658565b946020939093013593505050565b6000806000606084860312156106b357600080fd5b6106bc84610658565b92506106ca60208501610658565b9150604084013590509250925092565b6000602082840312156106ec57600080fd5b6106f582610658565b9392505050565b6000806040838503121561070f57600080fd5b61071883610658565b915061072660208401610658565b90509250929050565b600181811c9082168061074357607f821691505b60208210810361076357634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561026b57634e487b7160e01b600052601160045260246000fdfea2646970667358221220e48184f15ae575a1ab3966580821ddaff3654cd0137084d70ceeeb4d906b3c5364736f6c63430008120033" MULTIBALANCE_BIN="608060405234801561001057600080fd5b50610483806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d3e5ca8714610030575b600080fd5b61004361003e3660046102a5565b610059565b604051610050919061032b565b60405180910390f35b60606000610068836001610385565b67ffffffffffffffff8111156100805761008061039e565b6040519080825280602002602001820160405280156100a9578160200160208202803683370190505b509050846001600160a01b031631816000815181106100ca576100ca6103b4565b60200260200101818152505060005b838110156102805760008585838181106100f5576100f56103b4565b905060200201602081019061010a91906103ca565b905060006060826001600160a01b03167f70a08231b98ef4ca268c9cc3f6b4590e4bfec28280db06bb5d45e689f2a360be8a60405160240161015b91906001600160a01b0391909116815260200190565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161019991906103ec565b600060405180830381855afa9150503d80600081146101d4576040519150601f19603f3d011682016040523d82523d6000602084013e6101d9565b606091505b509092509050816102285760405162461bcd60e51b815260206004820152601560248201527418985b185b98d953d98818d85b1b0819985a5b1959605a1b604482015260640160405180910390fd5b60008180602001905181019061023e919061041b565b9050808661024d876001610385565b8151811061025d5761025d6103b4565b60200260200101818152505050505050808061027890610434565b9150506100d9565b50949350505050565b80356001600160a01b03811681146102a057600080fd5b919050565b6000806000604084860312156102ba57600080fd5b6102c384610289565b9250602084013567ffffffffffffffff808211156102e057600080fd5b818601915086601f8301126102f457600080fd5b81358181111561030357600080fd5b8760208260051b850101111561031857600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561036357835183529284019291840191600101610347565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156103985761039861036f565b92915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000602082840312156103dc57600080fd5b6103e582610289565b9392505050565b6000825160005b8181101561040d57602081860181015185830152016103f3565b506000920191825250919050565b60006020828403121561042d57600080fd5b5051919050565b6000600182016104465761044661036f565b506001019056fea26469706673582212207074e3e189a2692e2841f7943a9de24bcdbca943ee6bfcbd83a2fa6e43ec497b64736f6c63430008120033" -ETH_SWAP_V1="608060405234801561001057600080fd5b50610db9806100206000396000f3fe60806040526004361061007b5760003560e01c8063a76f9f2d1161004e578063a76f9f2d1461010a578063d5cfd04914610138578063db3b419c14610158578063eb84e7f21461018557600080fd5b806323f0388b146100805780633da59631146100a257806377d7e031146100b55780638cd8dd97146100ea575b600080fd5b34801561008c57600080fd5b506100a061009b366004610adb565b6101b2565b005b6100a06100b0366004610b50565b610420565b3480156100c157600080fd5b506100d56100d0366004610bb3565b61061c565b60405190151581526020015b60405180910390f35b3480156100f657600080fd5b506100a0610105366004610bd5565b610698565b34801561011657600080fd5b5061012a610125366004610bd5565b6108d8565b6040519081526020016100e1565b34801561014457600080fd5b506100d5610153366004610bd5565b6109c0565b34801561016457600080fd5b50610178610173366004610bd5565b6109f4565b6040516100e19190610c03565b34801561019157600080fd5b5061012a6101a0366004610c46565b60006020819052908152604090205481565b3233146101da5760405162461bcd60e51b81526004016101d190610c5f565b60405180910390fd5b6000805b8281101561038957368484838181106101f9576101f9610c89565b60c00291909101915033905061021560a0830160808401610c9f565b6001600160a01b0316146102585760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b60448201526064016101d1565b6000808061026584610aaf565b92509250925060008111801561027a57504381105b6102b65760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b60448201526064016101d1565b6102c182853561061c565b156103015760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016101d1565b61031060a0850135853561061c565b61034d5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b60448201526064016101d1565b60008381526020818152604090912060a086013590556103709085013587610ce5565b955050505050808061038190610cf8565b9150506101de565b50604051600090339083908381818185875af1925050503d80600081146103cc576040519150601f19603f3d011682016040523d82523d6000602084013e6103d1565b606091505b509091505060018115151461041a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b50505050565b32331461043f5760405162461bcd60e51b81526004016101d190610c5f565b6000805b828110156105dd573684848381811061045e5761045e610c89565b905060a00201905060008160200135116104a25760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d1565b60006104b46080830160608401610d11565b67ffffffffffffffff16116104ff5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d1565b600061050a826108d8565b600081815260208190526040902054909150801561055b5760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b60448201526064016101d1565b504361056881843561061c565b156105a65760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b60448201526064016101d1565b6000828152602081815260409091208290556105c59084013586610ce5565b945050505080806105d590610cf8565b915050610443565b503481146106175760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101d1565b505050565b60008160028460405160200161063491815260200190565b60408051601f198184030181529082905261064e91610d3b565b602060405180830381855afa15801561066b573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061068e9190610d6a565b1490505b92915050565b3233146106b75760405162461bcd60e51b81526004016101d190610c5f565b6106c76080820160608301610d11565b67ffffffffffffffff164210156107175760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b60448201526064016101d1565b600080600061072584610aaf565b92509250925060008111801561073b5750438111155b6107795760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b60448201526064016101d1565b61078482853561061c565b156107c95760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b60448201526064016101d1565b600182016108115760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c99599d5b991959605a1b60448201526064016101d1565b60008381526020819052604080822060001990556108359060608701908701610c9f565b6001600160a01b0316856020013560405160006040518083038185875af1925050503d8060008114610883576040519150601f19603f3d011682016040523d82523d6000602084013e610888565b606091505b50909150506001811515146108d15760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b5050505050565b6000600282356108ee6060850160408601610c9f565b60601b61090160a0860160808701610c9f565b60601b856020013560001b86606001602081019061091f9190610d11565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f198184030181529082905261098091610d3b565b602060405180830381855afa15801561099d573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906106929190610d6a565b60008060006109ce84610aaf565b9250925050806000141580156109ec57506109ea82853561061c565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610a1b84610aaf565b9250925050610a456040805160608101909152806000815260006020820181905260409091015290565b81600003610a6c578060005b90816003811115610a6457610a64610bed565b9052506109ec565b60018301610a7c57806003610a51565b610a8783863561061c565b15610a9c5760028152602081018390526109ec565b6001815260408101919091529392505050565b600080600080610abe856108d8565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610aee57600080fd5b823567ffffffffffffffff80821115610b0657600080fd5b818501915085601f830112610b1a57600080fd5b813581811115610b2957600080fd5b86602060c083028501011115610b3e57600080fd5b60209290920196919550909350505050565b60008060208385031215610b6357600080fd5b823567ffffffffffffffff80821115610b7b57600080fd5b818501915085601f830112610b8f57600080fd5b813581811115610b9e57600080fd5b86602060a083028501011115610b3e57600080fd5b60008060408385031215610bc657600080fd5b50508035926020909101359150565b600060a08284031215610be757600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610c2857634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610c5857600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610cb157600080fd5b81356001600160a01b0381168114610cc857600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561069257610692610ccf565b600060018201610d0a57610d0a610ccf565b5060010190565b600060208284031215610d2357600080fd5b813567ffffffffffffffff81168114610cc857600080fd5b6000825160005b81811015610d5c5760208186018101518583015201610d42565b506000920191825250919050565b600060208284031215610d7c57600080fd5b505191905056fea2646970667358221220d06fb8ed23d4808c2b9f4f691e0abd03030305c1af9428077386f96e11f2643364736f6c63430008120033" -ERC20_SWAP_V1="60a060405234801561001057600080fd5b506040516110d03803806110d083398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516110306100a060003960008181610107015281816104300152818161071f0152610a4701526110306000f3fe6080604052600436106100865760003560e01c80638cd8dd97116100595780638cd8dd9714610141578063a76f9f2d14610161578063d5cfd0491461018f578063db3b419c146101af578063eb84e7f2146101dc57600080fd5b806323f0388b1461008b5780633da59631146100ad57806377d7e031146100c05780638c8e8fee146100f5575b600080fd5b34801561009757600080fd5b506100ab6100a6366004610d30565b610209565b005b6100ab6100bb366004610da5565b61050c565b3480156100cc57600080fd5b506100e06100db366004610e08565b6107f9565b60405190151581526020015b60405180910390f35b34801561010157600080fd5b506101297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b34801561014d57600080fd5b506100ab61015c366004610e2a565b610875565b34801561016d57600080fd5b5061018161017c366004610e2a565b610b2d565b6040519081526020016100ec565b34801561019b57600080fd5b506100e06101aa366004610e2a565b610c15565b3480156101bb57600080fd5b506101cf6101ca366004610e2a565b610c49565b6040516100ec9190610e58565b3480156101e857600080fd5b506101816101f7366004610e9b565b60006020819052908152604090205481565b3233146102315760405162461bcd60e51b815260040161022890610eb4565b60405180910390fd5b6000805b828110156103e0573684848381811061025057610250610ede565b60c00291909101915033905061026c60a0830160808401610ef4565b6001600160a01b0316146102af5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b6044820152606401610228565b600080806102bc84610d04565b9250925092506000811180156102d157504381105b61030d5760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b6044820152606401610228565b6103188285356107f9565b156103585760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b6044820152606401610228565b61036760a085013585356107f9565b6103a45760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b6044820152606401610228565b60008381526020818152604090912060a086013590556103c79085013587610f3a565b95505050505080806103d890610f4d565b915050610235565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161045a91610f66565b6000604051808303816000865af19150503d8060008114610497576040519150601f19603f3d011682016040523d82523d6000602084013e61049c565b606091505b5090925090508180156104c75750805115806104c75750808060200190518101906104c79190610f95565b6105055760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b5050505050565b32331461052b5760405162461bcd60e51b815260040161022890610eb4565b6000805b828110156106c9573684848381811061054a5761054a610ede565b905060a002019050600081602001351161058e5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b6044820152606401610228565b60006105a06080830160608401610fb7565b67ffffffffffffffff16116105eb5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b6044820152606401610228565b60006105f682610b2d565b60008181526020819052604090205490915080156106475760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b6044820152606401610228565b50436106548184356107f9565b156106925760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b6044820152606401610228565b6000828152602081815260409091208290556106b19084013586610f3a565b945050505080806106c190610f4d565b91505061052f565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161074991610f66565b6000604051808303816000865af19150503d8060008114610786576040519150601f19603f3d011682016040523d82523d6000602084013e61078b565b606091505b5090925090508180156107b65750805115806107b65750808060200190518101906107b69190610f95565b6105055760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b6044820152606401610228565b60008160028460405160200161081191815260200190565b60408051601f198184030181529082905261082b91610f66565b602060405180830381855afa158015610848573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061086b9190610fe1565b1490505b92915050565b3233146108945760405162461bcd60e51b815260040161022890610eb4565b6108a46080820160608301610fb7565b67ffffffffffffffff164210156108f45760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b6044820152606401610228565b600080600061090284610d04565b9250925092506000811180156109185750438111155b6109565760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b6044820152606401610228565b6109618285356107f9565b156109a65760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b6044820152606401610228565b600182016109ee5760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c99599d5b991959605a1b6044820152606401610228565b6000838152602081815260408083206000199055805133602482015287830135604480830191909152825180830390910181526064909101825291820180516001600160e01b031663a9059cbb60e01b179052516060917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691610a7a9190610f66565b6000604051808303816000865af19150503d8060008114610ab7576040519150601f19603f3d011682016040523d82523d6000602084013e610abc565b606091505b509092509050818015610ae7575080511580610ae7575080806020019051810190610ae79190610f95565b610b255760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b505050505050565b600060028235610b436060850160408601610ef4565b60601b610b5660a0860160808701610ef4565b60601b856020013560001b866060016020810190610b749190610fb7565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f1981840301815290829052610bd591610f66565b602060405180830381855afa158015610bf2573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061086f9190610fe1565b6000806000610c2384610d04565b925092505080600014158015610c415750610c3f8285356107f9565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610c7084610d04565b9250925050610c9a6040805160608101909152806000815260006020820181905260409091015290565b81600003610cc1578060005b90816003811115610cb957610cb9610e42565b905250610c41565b60018301610cd157806003610ca6565b610cdc8386356107f9565b15610cf1576002815260208101839052610c41565b6001815260408101919091529392505050565b600080600080610d1385610b2d565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610d4357600080fd5b823567ffffffffffffffff80821115610d5b57600080fd5b818501915085601f830112610d6f57600080fd5b813581811115610d7e57600080fd5b86602060c083028501011115610d9357600080fd5b60209290920196919550909350505050565b60008060208385031215610db857600080fd5b823567ffffffffffffffff80821115610dd057600080fd5b818501915085601f830112610de457600080fd5b813581811115610df357600080fd5b86602060a083028501011115610d9357600080fd5b60008060408385031215610e1b57600080fd5b50508035926020909101359150565b600060a08284031215610e3c57600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610e7d57634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610ead57600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f0657600080fd5b81356001600160a01b0381168114610f1d57600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561086f5761086f610f24565b600060018201610f5f57610f5f610f24565b5060010190565b6000825160005b81811015610f875760208186018101518583015201610f6d565b506000920191825250919050565b600060208284031215610fa757600080fd5b81518015158114610f1d57600080fd5b600060208284031215610fc957600080fd5b813567ffffffffffffffff81168114610f1d57600080fd5b600060208284031215610ff357600080fd5b505191905056fea2646970667358221220c0241e9efff6cacb5548883e39463986c365c3946a5a393e3484418cfb88e66a64736f6c63430008120033" +ETH_SWAP_V1="608060405234801561001057600080fd5b50610df2806100206000396000f3fe60806040526004361061007b5760003560e01c8063a76f9f2d1161004e578063a76f9f2d1461010a578063d5cfd04914610138578063db3b419c14610158578063eb84e7f21461018557600080fd5b806323f0388b146100805780633da59631146100a257806377d7e031146100b55780638cd8dd97146100ea575b600080fd5b34801561008c57600080fd5b506100a061009b366004610b14565b6101b2565b005b6100a06100b0366004610b89565b610420565b3480156100c157600080fd5b506100d56100d0366004610bec565b61069d565b60405190151581526020015b60405180910390f35b3480156100f657600080fd5b506100a0610105366004610c0e565b610719565b34801561011657600080fd5b5061012a610125366004610c0e565b610911565b6040519081526020016100e1565b34801561014457600080fd5b506100d5610153366004610c0e565b6109f9565b34801561016457600080fd5b50610178610173366004610c0e565b610a2d565b6040516100e19190610c3c565b34801561019157600080fd5b5061012a6101a0366004610c7f565b60006020819052908152604090205481565b3233146101da5760405162461bcd60e51b81526004016101d190610c98565b60405180910390fd5b6000805b8281101561038957368484838181106101f9576101f9610cc2565b60c00291909101915033905061021560a0830160808401610cd8565b6001600160a01b0316146102585760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b60448201526064016101d1565b6000808061026584610ae8565b92509250925060008111801561027a57504381105b6102b65760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b60448201526064016101d1565b6102c182853561069d565b156103015760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016101d1565b61031060a0850135853561069d565b61034d5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b60448201526064016101d1565b60008381526020818152604090912060a086013590556103709085013587610d1e565b955050505050808061038190610d31565b9150506101de565b50604051600090339083908381818185875af1925050503d80600081146103cc576040519150601f19603f3d011682016040523d82523d6000602084013e6103d1565b606091505b509091505060018115151461041a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b50505050565b32331461043f5760405162461bcd60e51b81526004016101d190610c98565b6000805b8281101561065e573684848381811061045e5761045e610cc2565b905060a00201905060008160200135116104a25760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d1565b60006104b46080830160608401610d4a565b67ffffffffffffffff16116104ff5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d1565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf8135016105805760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b60648201526084016101d1565b600061058b82610911565b60008181526020819052604090205490915080156105dc5760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b60448201526064016101d1565b50436105e981843561069d565b156106275760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b60448201526064016101d1565b6000828152602081815260409091208290556106469084013586610d1e565b9450505050808061065690610d31565b915050610443565b503481146106985760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101d1565b505050565b6000816002846040516020016106b591815260200190565b60408051601f19818403018152908290526106cf91610d74565b602060405180830381855afa1580156106ec573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061070f9190610da3565b1490505b92915050565b3233146107385760405162461bcd60e51b81526004016101d190610c98565b6107486080820160608301610d4a565b67ffffffffffffffff164210156107985760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b60448201526064016101d1565b60008060006107a684610ae8565b9250925092506000811180156107bc5750438111155b6107fa5760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b60448201526064016101d1565b61080582853561069d565b1561084a5760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b60448201526064016101d1565b600083815260208190526040808220600019905561086e9060608701908701610cd8565b6001600160a01b0316856020013560405160006040518083038185875af1925050503d80600081146108bc576040519150601f19603f3d011682016040523d82523d6000602084013e6108c1565b606091505b509091505060018115151461090a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b5050505050565b6000600282356109276060850160408601610cd8565b60601b61093a60a0860160808701610cd8565b60601b856020013560001b8660600160208101906109589190610d4a565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f19818403018152908290526109b991610d74565b602060405180830381855afa1580156109d6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107139190610da3565b6000806000610a0784610ae8565b925092505080600014158015610a255750610a2382853561069d565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610a5484610ae8565b9250925050610a7e6040805160608101909152806000815260006020820181905260409091015290565b81600003610aa5578060005b90816003811115610a9d57610a9d610c26565b905250610a25565b60018301610ab557806003610a8a565b610ac083863561069d565b15610ad5576002815260208101839052610a25565b6001815260408101919091529392505050565b600080600080610af785610911565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610b2757600080fd5b823567ffffffffffffffff80821115610b3f57600080fd5b818501915085601f830112610b5357600080fd5b813581811115610b6257600080fd5b86602060c083028501011115610b7757600080fd5b60209290920196919550909350505050565b60008060208385031215610b9c57600080fd5b823567ffffffffffffffff80821115610bb457600080fd5b818501915085601f830112610bc857600080fd5b813581811115610bd757600080fd5b86602060a083028501011115610b7757600080fd5b60008060408385031215610bff57600080fd5b50508035926020909101359150565b600060a08284031215610c2057600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610c6157634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610c9157600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610cea57600080fd5b81356001600160a01b0381168114610d0157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561071357610713610d08565b600060018201610d4357610d43610d08565b5060010190565b600060208284031215610d5c57600080fd5b813567ffffffffffffffff81168114610d0157600080fd5b6000825160005b81811015610d955760208186018101518583015201610d7b565b506000920191825250919050565b600060208284031215610db557600080fd5b505191905056fea2646970667358221220420ce9cfd5a39be8e719369517f704148d580fb33472b5b8947c77d61eee66d664736f6c63430008120033" +ERC20_SWAP_V1="60a060405234801561001057600080fd5b5060405161110938038061110983398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b6080516110696100a06000396000818161010701528181610430015281816107a00152610a8001526110696000f3fe6080604052600436106100865760003560e01c80638cd8dd97116100595780638cd8dd9714610141578063a76f9f2d14610161578063d5cfd0491461018f578063db3b419c146101af578063eb84e7f2146101dc57600080fd5b806323f0388b1461008b5780633da59631146100ad57806377d7e031146100c05780638c8e8fee146100f5575b600080fd5b34801561009757600080fd5b506100ab6100a6366004610d69565b610209565b005b6100ab6100bb366004610dde565b61050c565b3480156100cc57600080fd5b506100e06100db366004610e41565b61087a565b60405190151581526020015b60405180910390f35b34801561010157600080fd5b506101297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b34801561014d57600080fd5b506100ab61015c366004610e63565b6108f6565b34801561016d57600080fd5b5061018161017c366004610e63565b610b66565b6040519081526020016100ec565b34801561019b57600080fd5b506100e06101aa366004610e63565b610c4e565b3480156101bb57600080fd5b506101cf6101ca366004610e63565b610c82565b6040516100ec9190610e91565b3480156101e857600080fd5b506101816101f7366004610ed4565b60006020819052908152604090205481565b3233146102315760405162461bcd60e51b815260040161022890610eed565b60405180910390fd5b6000805b828110156103e0573684848381811061025057610250610f17565b60c00291909101915033905061026c60a0830160808401610f2d565b6001600160a01b0316146102af5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b6044820152606401610228565b600080806102bc84610d3d565b9250925092506000811180156102d157504381105b61030d5760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b6044820152606401610228565b61031882853561087a565b156103585760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b6044820152606401610228565b61036760a0850135853561087a565b6103a45760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b6044820152606401610228565b60008381526020818152604090912060a086013590556103c79085013587610f73565b95505050505080806103d890610f86565b915050610235565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161045a91610f9f565b6000604051808303816000865af19150503d8060008114610497576040519150601f19603f3d011682016040523d82523d6000602084013e61049c565b606091505b5090925090508180156104c75750805115806104c75750808060200190518101906104c79190610fce565b6105055760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b5050505050565b32331461052b5760405162461bcd60e51b815260040161022890610eed565b6000805b8281101561074a573684848381811061054a5761054a610f17565b905060a002019050600081602001351161058e5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b6044820152606401610228565b60006105a06080830160608401610ff0565b67ffffffffffffffff16116105eb5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b6044820152606401610228565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf81350161066c5760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b6064820152608401610228565b600061067782610b66565b60008181526020819052604090205490915080156106c85760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b6044820152606401610228565b50436106d581843561087a565b156107135760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b6044820152606401610228565b6000828152602081815260409091208290556107329084013586610f73565b9450505050808061074290610f86565b91505061052f565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916107ca91610f9f565b6000604051808303816000865af19150503d8060008114610807576040519150601f19603f3d011682016040523d82523d6000602084013e61080c565b606091505b5090925090508180156108375750805115806108375750808060200190518101906108379190610fce565b6105055760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b6044820152606401610228565b60008160028460405160200161089291815260200190565b60408051601f19818403018152908290526108ac91610f9f565b602060405180830381855afa1580156108c9573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108ec919061101a565b1490505b92915050565b3233146109155760405162461bcd60e51b815260040161022890610eed565b6109256080820160608301610ff0565b67ffffffffffffffff164210156109755760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b6044820152606401610228565b600080600061098384610d3d565b9250925092506000811180156109995750438111155b6109d75760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b6044820152606401610228565b6109e282853561087a565b15610a275760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b6044820152606401610228565b6000838152602081815260408083206000199055805133602482015287830135604480830191909152825180830390910181526064909101825291820180516001600160e01b031663a9059cbb60e01b179052516060917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691610ab39190610f9f565b6000604051808303816000865af19150503d8060008114610af0576040519150601f19603f3d011682016040523d82523d6000602084013e610af5565b606091505b509092509050818015610b20575080511580610b20575080806020019051810190610b209190610fce565b610b5e5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b505050505050565b600060028235610b7c6060850160408601610f2d565b60601b610b8f60a0860160808701610f2d565b60601b856020013560001b866060016020810190610bad9190610ff0565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f1981840301815290829052610c0e91610f9f565b602060405180830381855afa158015610c2b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108f0919061101a565b6000806000610c5c84610d3d565b925092505080600014158015610c7a5750610c7882853561087a565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610ca984610d3d565b9250925050610cd36040805160608101909152806000815260006020820181905260409091015290565b81600003610cfa578060005b90816003811115610cf257610cf2610e7b565b905250610c7a565b60018301610d0a57806003610cdf565b610d1583863561087a565b15610d2a576002815260208101839052610c7a565b6001815260408101919091529392505050565b600080600080610d4c85610b66565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610d7c57600080fd5b823567ffffffffffffffff80821115610d9457600080fd5b818501915085601f830112610da857600080fd5b813581811115610db757600080fd5b86602060c083028501011115610dcc57600080fd5b60209290920196919550909350505050565b60008060208385031215610df157600080fd5b823567ffffffffffffffff80821115610e0957600080fd5b818501915085601f830112610e1d57600080fd5b813581811115610e2c57600080fd5b86602060a083028501011115610dcc57600080fd5b60008060408385031215610e5457600080fd5b50508035926020909101359150565b600060a08284031215610e7557600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610eb657634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610ee657600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f3f57600080fd5b81356001600160a01b0381168114610f5657600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156108f0576108f0610f5d565b600060018201610f9857610f98610f5d565b5060010190565b6000825160005b81811015610fc05760208186018101518583015201610fa6565b506000920191825250919050565b600060208284031215610fe057600080fd5b81518015158114610f5657600080fd5b60006020828403121561100257600080fd5b813567ffffffffffffffff81168114610f5657600080fd5b60006020828403121561102c57600080fd5b505191905056fea2646970667358221220acfd007366a18ada193efab33a7139cee67cfd39d1c89075b5534cc57862baa464736f6c63430008120033" # PASSWORD is the password used to unlock all accounts/wallets/addresses. PASSWORD="abc" diff --git a/server/asset/eth/coiner.go b/server/asset/eth/coiner.go index e19213c29e..2d3c9ec876 100644 --- a/server/asset/eth/coiner.go +++ b/server/asset/eth/coiner.go @@ -82,16 +82,6 @@ func (be *AssetBackend) newSwapCoin(coinID []byte, contractData []byte) (*swapCo SecretHash: secretHash, LockTime: uint64(init.LockTime.Unix()), } - - // if value < bc.vector.Value { - // return nil, fmt.Errorf("tx data value is too low. %d < %d", value, bc.vector.Value) - // } - // if init.Participant != bc.vector.To { - // return nil, fmt.Errorf("wrong participant in tx data. wanted %s, got %s", bc.vector.To, init.Participant) - // } - // if init.LockTime.UnixMilli() != int64(bc.vector.LockTime) { - // return nil, fmt.Errorf("wrong locktime in tx data. wanted %s, got %s", time.UnixMilli(int64(bc.vector.LockTime)), init.LockTime) - // } case 1: contractVector, err := dexeth.ParseV1Locator(bc.locator) if err != nil { @@ -109,6 +99,9 @@ func (be *AssetBackend) newSwapCoin(coinID []byte, contractData []byte) (*swapCo return nil, fmt.Errorf("contract and transaction vectors do not match. %+v != %+v", contractVector, txVector) } vector = txVector + if vector.SecretHash == refundRecordHash { + return nil, errors.New("illegal secret hash (refund record hash)") + } for _, v := range txVectors { sum += be.atomize(v.Value) } @@ -171,8 +164,10 @@ func (be *AssetBackend) newRedeemCoin(coinID []byte, contractData []byte) (*rede var secret [32]byte switch bc.contractVer { case 0: - var secretHash [32]byte - copy(secretHash[:], bc.locator) + secretHash, err := dexeth.ParseV0Locator(bc.locator) + if err != nil { + return nil, fmt.Errorf("error parsing vector from v0 locator '%x': %w", bc.locator, err) + } redemptions, err := dexeth.ParseRedeemDataV0(bc.txData) if err != nil { return nil, fmt.Errorf("unable to parse v0 redemption call data: %v", err) @@ -414,5 +409,5 @@ func (c *baseCoin) FeeRate() uint64 { // Value returns the value of one swap in order to validate during processing. func (c *swapCoin) Value() uint64 { - return c.value + return c.backend.atomize(c.vector.Value) } diff --git a/server/asset/eth/eth.go b/server/asset/eth/eth.go index 14140ab6bc..2b7a045c0a 100644 --- a/server/asset/eth/eth.go +++ b/server/asset/eth/eth.go @@ -45,8 +45,13 @@ var ( SupportsDynamicTxFee: true, } - testTokenID, _ = dex.BipSymbolID("dextt.eth") - usdcID, _ = dex.BipSymbolID("usdc.eth") + testTokenID, _ = dex.BipSymbolID("dextt.eth") + usdcID, _ = dex.BipSymbolID("usdc.eth") + refundRecordHash = [32]byte{ + 0xaf, 0x96, 0x13, 0x76, 0x0f, 0x72, 0x63, 0x5f, 0xbd, 0xb4, 0x4a, 0x5a, + 0x0a, 0x63, 0xc3, 0x9f, 0x12, 0xaf, 0x30, 0xf9, 0x50, 0xa6, 0xee, 0x5c, + 0x97, 0x1b, 0xe1, 0x88, 0xe8, 0x9c, 0x40, 0x51, + } ) func init() { diff --git a/server/asset/eth/tokener.go b/server/asset/eth/tokener.go index 9cee6fdedd..e42c22acf4 100644 --- a/server/asset/eth/tokener.go +++ b/server/asset/eth/tokener.go @@ -82,7 +82,7 @@ func newTokener( return nil, err } - boundAddr, err := tokenAddresser.TokenAddress(readOnlyCallOpts(ctx, false)) + boundAddr, err := tokenAddresser.TokenAddress(readOnlyCallOpts(ctx)) if err != nil { return nil, fmt.Errorf("error retrieving bound address for %s version %d contract: %w", vToken.Name, vToken.ContractVersion, err) @@ -129,7 +129,7 @@ func (t *tokener) swapped(txData []byte) *big.Int { // balanceOf checks the account's token balance. func (t *tokener) balanceOf(ctx context.Context, addr common.Address) (*big.Int, error) { - return t.BalanceOf(readOnlyCallOpts(ctx, false), addr) + return t.BalanceOf(readOnlyCallOpts(ctx), addr) } // swapContractV0 represents a version 0 swap contract for ETH or a token. @@ -143,9 +143,9 @@ type swapSourceV0 struct { contract swapContractV0 // *swapv0.ETHSwap or *erc20v0.ERCSwap } -// swap get the swap state for the secretHash on the version 0 contract. +// swap gets the swap state for the secretHash on the version 0 contract. func (s *swapSourceV0) swap(ctx context.Context, secretHash [32]byte) (*dexeth.SwapState, error) { - state, err := s.contract.Swap(readOnlyCallOpts(ctx, true), secretHash) + state, err := s.contract.Swap(readOnlyCallOpts(ctx), secretHash) if err != nil { return nil, fmt.Errorf("swap error: %w", err) } @@ -183,8 +183,8 @@ func (s *swapSourceV0) vector(ctx context.Context, locator []byte) (*dexeth.Swap return nil, err } vector := &dexeth.SwapVector{ - From: swap.Participant, - To: swap.Initiator, + From: swap.Initiator, + To: swap.Participant, Value: swap.Value, SecretHash: secretHash, LockTime: uint64(swap.LockTime.Unix()), @@ -205,8 +205,8 @@ func (s *swapSourceV0) statusAndVector(ctx context.Context, locator []byte) (*de return nil, nil, err } vector := &dexeth.SwapVector{ - From: swap.Participant, - To: swap.Initiator, + From: swap.Initiator, + To: swap.Participant, Value: swap.Value, SecretHash: secretHash, LockTime: uint64(swap.LockTime.Unix()), @@ -232,7 +232,7 @@ func (s *swapSourceV1) status(ctx context.Context, locator []byte) (*dexeth.Swap if err != nil { return nil, err } - rec, err := s.contract.Status(readOnlyCallOpts(ctx, true), dexeth.SwapVectorToAbigen(v)) + rec, err := s.contract.Status(readOnlyCallOpts(ctx), dexeth.SwapVectorToAbigen(v)) if err != nil { return nil, err } @@ -253,7 +253,7 @@ func (s *swapSourceV1) statusAndVector(ctx context.Context, locator []byte) (*de return nil, nil, err } - rec, err := s.contract.Status(readOnlyCallOpts(ctx, true), dexeth.SwapVectorToAbigen(v)) + rec, err := s.contract.Status(readOnlyCallOpts(ctx), dexeth.SwapVectorToAbigen(v)) if err != nil { return nil, nil, err } @@ -270,7 +270,7 @@ func (s *swapSourceV1) Status(ctx context.Context, locator []byte) (*dexeth.Swap return nil, err } - status, err := s.contract.Status(readOnlyCallOpts(ctx, true), dexeth.SwapVectorToAbigen(vec)) + status, err := s.contract.Status(readOnlyCallOpts(ctx), dexeth.SwapVectorToAbigen(vec)) if err != nil { return nil, err } @@ -283,9 +283,8 @@ func (s *swapSourceV1) Status(ctx context.Context, locator []byte) (*dexeth.Swap } // readOnlyCallOpts is the CallOpts used for read-only contract method calls. -func readOnlyCallOpts(ctx context.Context, includePending bool) *bind.CallOpts { +func readOnlyCallOpts(ctx context.Context) *bind.CallOpts { return &bind.CallOpts{ - Pending: includePending, Context: ctx, } }