diff --git a/client/asset/eth/deploy.go b/client/asset/eth/deploy.go index 975f155ec2..310b76ac94 100644 --- a/client/asset/eth/deploy.go +++ b/client/asset/eth/deploy.go @@ -13,9 +13,11 @@ import ( "decred.org/dcrdex/client/asset" "decred.org/dcrdex/dex" erc20v0 "decred.org/dcrdex/dex/networks/erc20/contracts/v0" + erc20v1 "decred.org/dcrdex/dex/networks/erc20/contracts/v1" dexeth "decred.org/dcrdex/dex/networks/eth" multibal "decred.org/dcrdex/dex/networks/eth/contracts/multibalance" ethv0 "decred.org/dcrdex/dex/networks/eth/contracts/v0" + ethv1 "decred.org/dcrdex/dex/networks/eth/contracts/v1" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -140,37 +142,35 @@ func (contractDeployer) EstimateMultiBalanceDeployFunding( } func (contractDeployer) txData(contractVer uint32, tokenAddr common.Address) (txData []byte, err error) { - var abi *abi.ABI - var bytecode []byte - isToken := tokenAddr != (common.Address{}) - if isToken { - switch contractVer { - case 0: - bytecode = common.FromHex(erc20v0.ERC20SwapBin) - abi, err = erc20v0.ERC20SwapMetaData.GetAbi() - } - } else { + if tokenAddr == (common.Address{}) { switch contractVer { case 0: - bytecode = common.FromHex(ethv0.ETHSwapBin) - abi, err = ethv0.ETHSwapMetaData.GetAbi() + return common.FromHex(ethv0.ETHSwapBin), nil + case 1: + return common.FromHex(ethv1.ETHSwapBin), nil } } + var abi *abi.ABI + var bytecode []byte + switch contractVer { + case 0: + bytecode = common.FromHex(erc20v0.ERC20SwapBin) + abi, err = erc20v0.ERC20SwapMetaData.GetAbi() + case 1: + bytecode = common.FromHex(erc20v1.ERC20SwapBin) + abi, err = erc20v1.ERC20SwapMetaData.GetAbi() + } if err != nil { return nil, fmt.Errorf("error parsing ABI: %w", err) } if abi == nil { return nil, fmt.Errorf("no abi data for version %d", contractVer) } - txData = bytecode - if isToken { - argData, err := abi.Pack("", tokenAddr) - if err != nil { - return nil, fmt.Errorf("error packing token address: %w", err) - } - txData = append(txData, argData...) + argData, err := abi.Pack("", tokenAddr) + if err != nil { + return nil, fmt.Errorf("error packing token address: %w", err) } - return + return append(bytecode, argData...), nil } // DeployContract deployes a dcrdex swap contract. @@ -199,6 +199,11 @@ func (contractDeployer) DeployContract( contractAddr, tx, _, err := erc20v0.DeployERC20Swap(txOpts, cb, tokenAddress) return contractAddr, tx, err } + case 1: + deployer = func(txOpts *bind.TransactOpts, cb bind.ContractBackend) (common.Address, *types.Transaction, error) { + contractAddr, tx, _, err := erc20v1.DeployERC20Swap(txOpts, cb, tokenAddress) + return contractAddr, tx, err + } } } else { @@ -208,6 +213,11 @@ func (contractDeployer) DeployContract( contractAddr, tx, _, err := ethv0.DeployETHSwap(txOpts, cb) return contractAddr, tx, err } + case 1: + deployer = func(txOpts *bind.TransactOpts, cb bind.ContractBackend) (common.Address, *types.Transaction, error) { + contractAddr, tx, _, err := ethv1.DeployETHSwap(txOpts, cb) + return contractAddr, tx, err + } } } if deployer == nil { @@ -264,7 +274,7 @@ func (contractDeployer) deployContract( } feeRate := dexeth.WeiToGweiCeil(maxFeeRate) - log.Infof("Estimated fees: %s gwei / gas", ui.ConventionalString(feeRate*gas)) + log.Infof("Estimated fees: %s gwei", ui.ConventionalString(feeRate*gas)) gas *= 5 / 4 // Add 20% buffer feesWithBuffer := feeRate * gas @@ -287,7 +297,13 @@ func (contractDeployer) deployContract( return err } - log.Infof("👍 Contract %s launched with tx %s", contractAddr, tx.Hash()) + log.Infof("Contract %s launched with tx %s", contractAddr, tx.Hash()) + + if err = waitForConfirmation(ctx, cl, tx.Hash()); err != nil { + return fmt.Errorf("error waiting for deployment transaction status: %w", err) + } + + log.Info("👍 Transaction confirmed") return nil } diff --git a/client/asset/eth/eth.go b/client/asset/eth/eth.go index d7d4773cdf..346124fb14 100644 --- a/client/asset/eth/eth.go +++ b/client/asset/eth/eth.go @@ -879,7 +879,8 @@ func (w *ETHWallet) Connect(ctx context.Context) (_ *sync.WaitGroup, err error) for ver, constructor := range contractorConstructors { contractAddr, exists := w.versionedContracts[ver] if !exists || contractAddr == (common.Address{}) { - return nil, fmt.Errorf("no contract address for version %d, net %s", ver, w.net) + w.log.Debugf("no eth swap contract address for version %d, net %s", ver, w.net) + continue } c, err := constructor(w.net, contractAddr, w.addr, w.node.contractBackend()) if err != nil { @@ -5580,9 +5581,26 @@ func (getGas) ReadCredentials(chain, credentialsPath string, net dex.Network) (a return } -func getGetGasClientWithEstimatesAndBalances(ctx context.Context, net dex.Network, assetID, contractVer uint32, maxSwaps int, - walletDir string, providers []string, seed []byte, wParams *GetGasWalletParams, log dex.Logger) (cl *multiRPCClient, c contractor, - ethReq, swapReq, feeRate uint64, ethBal, tokenBal *big.Int, err error) { +func getGetGasClientWithEstimatesAndBalances( + ctx context.Context, + net dex.Network, + contractVer uint32, + maxSwaps int, + walletDir string, + providers []string, + seed []byte, + wParams *GetGasWalletParams, + log dex.Logger, +) ( + cl *multiRPCClient, + c contractor, + ethReq, + swapReq, + feeRate uint64, + ethBal, + tokenBal *big.Int, + err error, +) { cl, c, err = quickNode(ctx, walletDir, contractVer, seed, providers, wParams, net, log) if err != nil { @@ -5666,7 +5684,7 @@ func (getGas) EstimateFunding(ctx context.Context, net dex.Network, assetID, con } defer os.RemoveAll(walletDir) - cl, _, ethReq, swapReq, _, ethBalBig, tokenBalBig, err := getGetGasClientWithEstimatesAndBalances(ctx, net, assetID, contractVer, maxSwaps, walletDir, providers, seed, wParams, log) + cl, _, ethReq, swapReq, _, ethBalBig, tokenBalBig, err := getGetGasClientWithEstimatesAndBalances(ctx, net, contractVer, maxSwaps, walletDir, providers, seed, wParams, log) if err != nil { return err } @@ -5833,6 +5851,7 @@ func (getGas) returnFunds( } remainder := ethBal - fees + txOpts, err := cl.txOpts(ctx, remainder, defaultSendGasLimit, maxFeeRate, tipRate, nil) if err != nil { return fmt.Errorf("error generating tx opts: %w", err) @@ -5857,6 +5876,10 @@ func (getGas) returnFunds( func (getGas) Estimate(ctx context.Context, net dex.Network, assetID, contractVer uint32, maxSwaps int, credentialsPath string, wParams *GetGasWalletParams, log dex.Logger) error { + if *wParams.Gas == (dexeth.Gases{}) { + return fmt.Errorf("empty gas table. put some estimates in VersionedGases or Tokens for this contract") + } + symbol := dex.BipIDSymbol(assetID) log.Infof("Getting gas estimates for up to %d swaps of asset %s, contract version %d on %s", maxSwaps, symbol, contractVer, symbol) @@ -5873,7 +5896,7 @@ func (getGas) Estimate(ctx context.Context, net dex.Network, assetID, contractVe } defer os.RemoveAll(walletDir) - cl, c, ethReq, swapReq, feeRate, ethBal, tokenBal, err := getGetGasClientWithEstimatesAndBalances(ctx, net, assetID, contractVer, maxSwaps, walletDir, providers, seed, wParams, log) + cl, c, ethReq, swapReq, feeRate, ethBal, tokenBal, err := getGetGasClientWithEstimatesAndBalances(ctx, net, contractVer, maxSwaps, walletDir, providers, seed, wParams, log) if err != nil { return err } @@ -5998,6 +6021,8 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t return fmt.Errorf("error getting network fees: %v", err) } + maxFeeRate := new(big.Int).Add(tipRate, new(big.Int).Mul(baseRate, big.NewInt(2))) + defer func() { if len(stats.swaps) == 0 { return @@ -6038,10 +6063,15 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t fmt.Printf(" %+v \n", stats.transfers) }() + logTx := func(tag string, n int, tx *types.Transaction) { + log.Infof("%s %d tx, hash = %s, nonce = %d, maxFeeRate = %s, tip cap = %s", + tag, n, tx.Hash(), tx.Nonce(), tx.GasFeeCap(), tx.GasTipCap()) + } + // Estimate approve for tokens. if isToken { sendApprove := func(cl ethFetcher, c tokenContractor) error { - txOpts, err := cl.txOpts(ctx, 0, g.Approve*2, baseRate, tipRate, nil) + txOpts, err := cl.txOpts(ctx, 0, g.Approve*2, maxFeeRate, tipRate, nil) if err != nil { return fmt.Errorf("error constructing signed tx opts for approve: %w", err) } @@ -6049,6 +6079,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t if err != nil { return fmt.Errorf("error estimating approve gas: %w", err) } + logTx("Approve", 1, tx) if err = waitForConfirmation(ctx, cl, tx.Hash()); err != nil { return fmt.Errorf("error waiting for approve transaction: %w", err) } @@ -6075,7 +6106,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t return fmt.Errorf("error sending approve transaction for the initiator: %w", err) } - txOpts, err := cl.txOpts(ctx, 0, g.Transfer*2, baseRate, tipRate, nil) + txOpts, err := cl.txOpts(ctx, 0, g.Transfer*2, maxFeeRate, tipRate, nil) if err != nil { return fmt.Errorf("error constructing signed tx opts for transfer: %w", err) } @@ -6088,6 +6119,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t if err != nil { return fmt.Errorf("transfer error: %w", err) } + logTx("Transfer", 1, transferTx) if err = waitForConfirmation(ctx, cl, transferTx.Hash()); err != nil { return fmt.Errorf("error waiting for transfer tx: %w", err) } @@ -6127,7 +6159,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t } // Send the inits - txOpts, err := cl.txOpts(ctx, optsVal, g.SwapN(n)*2, baseRate, tipRate, nil) + txOpts, err := cl.txOpts(ctx, optsVal, g.SwapN(n)*2, maxFeeRate, tipRate, nil) if err != nil { return fmt.Errorf("error constructing signed tx opts for %d swaps: %v", n, err) } @@ -6136,6 +6168,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t if err != nil { return fmt.Errorf("initiate error for %d swaps: %v", n, err) } + logTx("Initiate", n, tx) if err = waitForConfirmation(ctx, cl, tx.Hash()); err != nil { return fmt.Errorf("error waiting for init tx to be mined: %w", err) } @@ -6170,7 +6203,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t }) } - txOpts, err = cl.txOpts(ctx, 0, g.RedeemN(n)*2, baseRate, tipRate, nil) + txOpts, err = cl.txOpts(ctx, 0, g.RedeemN(n)*2, maxFeeRate, tipRate, nil) if err != nil { return fmt.Errorf("error constructing signed tx opts for %d redeems: %v", n, err) } @@ -6179,6 +6212,7 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t if err != nil { return fmt.Errorf("redeem error for %d swaps: %v", n, err) } + logTx("Redeem", n, tx) if err = waitForConfirmation(ctx, cl, tx.Hash()); err != nil { return fmt.Errorf("error waiting for redeem tx to be mined: %w", err) } diff --git a/client/asset/polygon/polygon.go b/client/asset/polygon/polygon.go index fd8faeaf3a..f97a82b51c 100644 --- a/client/asset/polygon/polygon.go +++ b/client/asset/polygon/polygon.go @@ -74,7 +74,7 @@ var ( WalletInfo = asset.WalletInfo{ Name: "Polygon", Version: 0, - SupportedVersions: []uint32{0}, + SupportedVersions: []uint32{0, 1}, UnitInfo: dexpolygon.UnitInfo, AvailableWallets: []*asset.WalletDefinition{ { diff --git a/dex/networks/erc20/contracts/updatecontract.sh b/dex/networks/erc20/contracts/updatecontract.sh index 4ab633e891..328badfc95 100755 --- a/dex/networks/erc20/contracts/updatecontract.sh +++ b/dex/networks/erc20/contracts/updatecontract.sh @@ -36,16 +36,6 @@ fi mkdir temp solc --abi --bin --bin-runtime --overwrite --optimize ${SOLIDITY_FILE} -o ./temp/ -BYTECODE=$(<./temp/${CONTRACT_NAME}.bin-runtime) - -cat > "./${PKG_NAME}/BinRuntimeV${VERSION}.go" < "v${VERSION}/swap_contract.bin" +echo "${TEST_TOKEN_BYTECODE}" | xxd -r -p > "v${VERSION}/token_contract.bin" rm -fr temp diff --git a/dex/networks/erc20/contracts/v0/BinRuntimeV0.go b/dex/networks/erc20/contracts/v0/BinRuntimeV0.go deleted file mode 100644 index 9d5a079e5d..0000000000 --- a/dex/networks/erc20/contracts/v0/BinRuntimeV0.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package v0 - -const ERC20SwapRuntimeBin = "608060405234801561001057600080fd5b506004361061007d5760003560e01c8063a8793f941161005b578063a8793f94146100ff578063d0f761c014610112578063eb84e7f214610135578063f4fd17f9146101a457600080fd5b80637249fbb61461008257806376467cbd146100975780638c8e8fee146100c0575b600080fd5b610095610090366004610ac8565b6101b7565b005b6100aa6100a5366004610ac8565b610376565b6040516100b79190610b19565b60405180910390f35b6100e77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100b7565b61009561010d366004610b7e565b610451565b610125610120366004610ac8565b61074c565b60405190151581526020016100b7565b610191610143366004610ac8565b60006020819052908152604090208054600182015460028301546003840154600485015460059095015493949293919290916001600160a01b0391821691811690600160a01b900460ff1687565b6040516100b79796959493929190610bf3565b6100956101b2366004610c3f565b6107ac565b3233146101df5760405162461bcd60e51b81526004016101d690610ca2565b60405180910390fd5b6101e88161074c565b6102255760405162461bcd60e51b815260206004820152600e60248201526d6e6f7420726566756e6461626c6560901b60448201526064016101d6565b60008181526020818152604080832060058101805460ff60a01b1916600360a01b17905560018101548251336024820152604480820192909252835180820390920182526064018352928301805163a9059cbb60e01b6001600160e01b0390911617905290519092916060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916102c591610ccc565b6000604051808303816000865af19150503d8060008114610302576040519150601f19603f3d011682016040523d82523d6000602084013e610307565b606091505b5090925090508180156103325750805115806103325750808060200190518101906103329190610cfb565b6103705760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d6565b50505050565b6103b36040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60008281526020818152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154606083015260048301546001600160a01b039081166080840152600584015490811660a084015291929160c0840191600160a01b90910460ff169081111561043757610437610ae1565b600381111561044857610448610ae1565b90525092915050565b3233146104705760405162461bcd60e51b81526004016101d690610ca2565b6000805b82811015610615573684848381811061048f5761048f610d1d565b9050608002019050600080600083602001358152602001908152602001600020905060008260600135116104ed5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d6565b813561052f5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d6565b60006005820154600160a01b900460ff16600381111561055157610551610ae1565b146105905760405162461bcd60e51b815260206004820152600f60248201526e0c8eae040e6cac6e4cae840d0c2e6d608b1b60448201526064016101d6565b436002820155813560038201556004810180546001600160a01b031916331790556105c16060830160408401610d33565b6005820180546060850135600185018190556001600160a01b03939093166001600160a81b031990911617600160a01b1790556105fe9085610d72565b93505050808061060d90610d8b565b915050610474565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161069591610ccc565b6000604051808303816000865af19150503d80600081146106d2576040519150601f19603f3d011682016040523d82523d6000602084013e6106d7565b606091505b5090925090508180156107025750805115806107025750808060200190518101906107029190610cfb565b6107455760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b60448201526064016101d6565b5050505050565b600081815260208190526040812060016005820154600160a01b900460ff16600381111561077c5761077c610ae1565b148015610795575060048101546001600160a01b031633145b80156107a5575080600301544210155b9392505050565b3233146107cb5760405162461bcd60e51b81526004016101d690610ca2565b6000805b828110156109a357368484838181106107ea576107ea610d1d565b6020604091820293909301838101356000908152938490529220919250600190506005820154600160a01b900460ff16600381111561082b5761082b610ae1565b146108645760405162461bcd60e51b815260206004820152600960248201526862616420737461746560b81b60448201526064016101d6565b60058101546001600160a01b031633146108b25760405162461bcd60e51b815260206004820152600f60248201526e189859081c185c9d1a58da5c185b9d608a1b60448201526064016101d6565b8160200135600283600001356040516020016108d091815260200190565b60408051601f19818403018152908290526108ea91610ccc565b602060405180830381855afa158015610907573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061092a9190610da4565b146109645760405162461bcd60e51b815260206004820152600a602482015269189859081cd958dc995d60b21b60448201526064016101d6565b60058101805460ff60a01b1916600160a11b17905581358155600181015461098c9085610d72565b93505050808061099b90610d8b565b9150506107cf565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691610a1d91610ccc565b6000604051808303816000865af19150503d8060008114610a5a576040519150601f19603f3d011682016040523d82523d6000602084013e610a5f565b606091505b509092509050818015610a8a575080511580610a8a575080806020019051810190610a8a9190610cfb565b6107455760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d6565b600060208284031215610ada57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60048110610b1557634e487b7160e01b600052602160045260246000fd5b9052565b600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160018060a01b0380821660808501528060a08601511660a0850152505060c0830151610b7760c0840182610af7565b5092915050565b60008060208385031215610b9157600080fd5b823567ffffffffffffffff80821115610ba957600080fd5b818501915085601f830112610bbd57600080fd5b813581811115610bcc57600080fd5b8660208260071b8501011115610be157600080fd5b60209290920196919550909350505050565b8781526020810187905260408101869052606081018590526001600160a01b038481166080830152831660a082015260e08101610c3360c0830184610af7565b98975050505050505050565b60008060208385031215610c5257600080fd5b823567ffffffffffffffff80821115610c6a57600080fd5b818501915085601f830112610c7e57600080fd5b813581811115610c8d57600080fd5b8660208260061b8501011115610be157600080fd5b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b6000825160005b81811015610ced5760208186018101518583015201610cd3565b506000920191825250919050565b600060208284031215610d0d57600080fd5b815180151581146107a557600080fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215610d4557600080fd5b81356001600160a01b03811681146107a557600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610d8557610d85610d5c565b92915050565b600060018201610d9d57610d9d610d5c565b5060010190565b600060208284031215610db657600080fd5b505191905056fea2646970667358221220a055a4890a5ecf3876dbee91dfbeb46ba11b5f7c09b6d935173932d93f8fb92264736f6c63430008120033" diff --git a/dex/networks/erc20/contracts/v0/contract.go b/dex/networks/erc20/contracts/v0/contract.go index 3f9d522c31..4b366daf0e 100644 --- a/dex/networks/erc20/contracts/v0/contract.go +++ b/dex/networks/erc20/contracts/v0/contract.go @@ -27,13 +27,12 @@ var ( _ = common.Big1 _ = types.BloomLookup _ = event.NewSubscription - _ = abi.ConvertType ) // 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\":\"uint256\",\"name\":\"refundTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"structERC20Swap.Initiation[]\",\"name\":\"initiations\",\"type\":\"tuple[]\"}],\"name\":\"initiate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"isRefundable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"internalType\":\"structERC20Swap.Redemption[]\",\"name\":\"redemptions\",\"type\":\"tuple[]\"}],\"name\":\"redeem\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"swap\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"refundBlockTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"},{\"internalType\":\"enumERC20Swap.State\",\"name\":\"state\",\"type\":\"uint8\"}],\"internalType\":\"structERC20Swap.Swap\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"swaps\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"refundBlockTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"},{\"internalType\":\"enumERC20Swap.State\",\"name\":\"state\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token_address\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x60a060405234801561001057600080fd5b50604051610e92380380610e9283398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610df361009f6000396000818160c50152818161029b0152818161066b01526109f30152610df36000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063a8793f941161005b578063a8793f94146100ff578063d0f761c014610112578063eb84e7f214610135578063f4fd17f9146101a457600080fd5b80637249fbb61461008257806376467cbd146100975780638c8e8fee146100c0575b600080fd5b610095610090366004610ac8565b6101b7565b005b6100aa6100a5366004610ac8565b610376565b6040516100b79190610b19565b60405180910390f35b6100e77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100b7565b61009561010d366004610b7e565b610451565b610125610120366004610ac8565b61074c565b60405190151581526020016100b7565b610191610143366004610ac8565b60006020819052908152604090208054600182015460028301546003840154600485015460059095015493949293919290916001600160a01b0391821691811690600160a01b900460ff1687565b6040516100b79796959493929190610bf3565b6100956101b2366004610c3f565b6107ac565b3233146101df5760405162461bcd60e51b81526004016101d690610ca2565b60405180910390fd5b6101e88161074c565b6102255760405162461bcd60e51b815260206004820152600e60248201526d6e6f7420726566756e6461626c6560901b60448201526064016101d6565b60008181526020818152604080832060058101805460ff60a01b1916600360a01b17905560018101548251336024820152604480820192909252835180820390920182526064018352928301805163a9059cbb60e01b6001600160e01b0390911617905290519092916060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916102c591610ccc565b6000604051808303816000865af19150503d8060008114610302576040519150601f19603f3d011682016040523d82523d6000602084013e610307565b606091505b5090925090508180156103325750805115806103325750808060200190518101906103329190610cfb565b6103705760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d6565b50505050565b6103b36040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60008281526020818152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154606083015260048301546001600160a01b039081166080840152600584015490811660a084015291929160c0840191600160a01b90910460ff169081111561043757610437610ae1565b600381111561044857610448610ae1565b90525092915050565b3233146104705760405162461bcd60e51b81526004016101d690610ca2565b6000805b82811015610615573684848381811061048f5761048f610d1d565b9050608002019050600080600083602001358152602001908152602001600020905060008260600135116104ed5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d6565b813561052f5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d6565b60006005820154600160a01b900460ff16600381111561055157610551610ae1565b146105905760405162461bcd60e51b815260206004820152600f60248201526e0c8eae040e6cac6e4cae840d0c2e6d608b1b60448201526064016101d6565b436002820155813560038201556004810180546001600160a01b031916331790556105c16060830160408401610d33565b6005820180546060850135600185018190556001600160a01b03939093166001600160a81b031990911617600160a01b1790556105fe9085610d72565b93505050808061060d90610d8b565b915050610474565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161069591610ccc565b6000604051808303816000865af19150503d80600081146106d2576040519150601f19603f3d011682016040523d82523d6000602084013e6106d7565b606091505b5090925090508180156107025750805115806107025750808060200190518101906107029190610cfb565b6107455760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b60448201526064016101d6565b5050505050565b600081815260208190526040812060016005820154600160a01b900460ff16600381111561077c5761077c610ae1565b148015610795575060048101546001600160a01b031633145b80156107a5575080600301544210155b9392505050565b3233146107cb5760405162461bcd60e51b81526004016101d690610ca2565b6000805b828110156109a357368484838181106107ea576107ea610d1d565b6020604091820293909301838101356000908152938490529220919250600190506005820154600160a01b900460ff16600381111561082b5761082b610ae1565b146108645760405162461bcd60e51b815260206004820152600960248201526862616420737461746560b81b60448201526064016101d6565b60058101546001600160a01b031633146108b25760405162461bcd60e51b815260206004820152600f60248201526e189859081c185c9d1a58da5c185b9d608a1b60448201526064016101d6565b8160200135600283600001356040516020016108d091815260200190565b60408051601f19818403018152908290526108ea91610ccc565b602060405180830381855afa158015610907573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061092a9190610da4565b146109645760405162461bcd60e51b815260206004820152600a602482015269189859081cd958dc995d60b21b60448201526064016101d6565b60058101805460ff60a01b1916600160a11b17905581358155600181015461098c9085610d72565b93505050808061099b90610d8b565b9150506107cf565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691610a1d91610ccc565b6000604051808303816000865af19150503d8060008114610a5a576040519150601f19603f3d011682016040523d82523d6000602084013e610a5f565b606091505b509092509050818015610a8a575080511580610a8a575080806020019051810190610a8a9190610cfb565b6107455760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d6565b600060208284031215610ada57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60048110610b1557634e487b7160e01b600052602160045260246000fd5b9052565b600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160018060a01b0380821660808501528060a08601511660a0850152505060c0830151610b7760c0840182610af7565b5092915050565b60008060208385031215610b9157600080fd5b823567ffffffffffffffff80821115610ba957600080fd5b818501915085601f830112610bbd57600080fd5b813581811115610bcc57600080fd5b8660208260071b8501011115610be157600080fd5b60209290920196919550909350505050565b8781526020810187905260408101869052606081018590526001600160a01b038481166080830152831660a082015260e08101610c3360c0830184610af7565b98975050505050505050565b60008060208385031215610c5257600080fd5b823567ffffffffffffffff80821115610c6a57600080fd5b818501915085601f830112610c7e57600080fd5b813581811115610c8d57600080fd5b8660208260061b8501011115610be157600080fd5b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b6000825160005b81811015610ced5760208186018101518583015201610cd3565b506000920191825250919050565b600060208284031215610d0d57600080fd5b815180151581146107a557600080fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215610d4557600080fd5b81356001600160a01b03811681146107a557600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610d8557610d85610d5c565b92915050565b600060018201610d9d57610d9d610d5c565b5060010190565b600060208284031215610db657600080fd5b505191905056fea2646970667358221220a055a4890a5ecf3876dbee91dfbeb46ba11b5f7c09b6d935173932d93f8fb92264736f6c63430008120033", + Bin: "0x60a060405234801561001057600080fd5b50604051610e92380380610e9283398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610df361009f6000396000818160c50152818161029b0152818161066b01526109f30152610df36000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c8063a8793f941161005b578063a8793f94146100ff578063d0f761c014610112578063eb84e7f214610135578063f4fd17f9146101a457600080fd5b80637249fbb61461008257806376467cbd146100975780638c8e8fee146100c0575b600080fd5b610095610090366004610ac8565b6101b7565b005b6100aa6100a5366004610ac8565b610376565b6040516100b79190610b19565b60405180910390f35b6100e77f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100b7565b61009561010d366004610b7e565b610451565b610125610120366004610ac8565b61074c565b60405190151581526020016100b7565b610191610143366004610ac8565b60006020819052908152604090208054600182015460028301546003840154600485015460059095015493949293919290916001600160a01b0391821691811690600160a01b900460ff1687565b6040516100b79796959493929190610bf3565b6100956101b2366004610c3f565b6107ac565b3233146101df5760405162461bcd60e51b81526004016101d690610ca2565b60405180910390fd5b6101e88161074c565b6102255760405162461bcd60e51b815260206004820152600e60248201526d6e6f7420726566756e6461626c6560901b60448201526064016101d6565b60008181526020818152604080832060058101805460ff60a01b1916600360a01b17905560018101548251336024820152604480820192909252835180820390920182526064018352928301805163a9059cbb60e01b6001600160e01b0390911617905290519092916060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916102c591610ccc565b6000604051808303816000865af19150503d8060008114610302576040519150601f19603f3d011682016040523d82523d6000602084013e610307565b606091505b5090925090508180156103325750805115806103325750808060200190518101906103329190610cfb565b6103705760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d6565b50505050565b6103b36040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60008281526020818152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154606083015260048301546001600160a01b039081166080840152600584015490811660a084015291929160c0840191600160a01b90910460ff169081111561043757610437610ae1565b600381111561044857610448610ae1565b90525092915050565b3233146104705760405162461bcd60e51b81526004016101d690610ca2565b6000805b82811015610615573684848381811061048f5761048f610d1d565b9050608002019050600080600083602001358152602001908152602001600020905060008260600135116104ed5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d6565b813561052f5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d6565b60006005820154600160a01b900460ff16600381111561055157610551610ae1565b146105905760405162461bcd60e51b815260206004820152600f60248201526e0c8eae040e6cac6e4cae840d0c2e6d608b1b60448201526064016101d6565b436002820155813560038201556004810180546001600160a01b031916331790556105c16060830160408401610d33565b6005820180546060850135600185018190556001600160a01b03939093166001600160a81b031990911617600160a01b1790556105fe9085610d72565b93505050808061060d90610d8b565b915050610474565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161069591610ccc565b6000604051808303816000865af19150503d80600081146106d2576040519150601f19603f3d011682016040523d82523d6000602084013e6106d7565b606091505b5090925090508180156107025750805115806107025750808060200190518101906107029190610cfb565b6107455760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b60448201526064016101d6565b5050505050565b600081815260208190526040812060016005820154600160a01b900460ff16600381111561077c5761077c610ae1565b148015610795575060048101546001600160a01b031633145b80156107a5575080600301544210155b9392505050565b3233146107cb5760405162461bcd60e51b81526004016101d690610ca2565b6000805b828110156109a357368484838181106107ea576107ea610d1d565b6020604091820293909301838101356000908152938490529220919250600190506005820154600160a01b900460ff16600381111561082b5761082b610ae1565b146108645760405162461bcd60e51b815260206004820152600960248201526862616420737461746560b81b60448201526064016101d6565b60058101546001600160a01b031633146108b25760405162461bcd60e51b815260206004820152600f60248201526e189859081c185c9d1a58da5c185b9d608a1b60448201526064016101d6565b8160200135600283600001356040516020016108d091815260200190565b60408051601f19818403018152908290526108ea91610ccc565b602060405180830381855afa158015610907573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061092a9190610da4565b146109645760405162461bcd60e51b815260206004820152600a602482015269189859081cd958dc995d60b21b60448201526064016101d6565b60058101805460ff60a01b1916600160a11b17905581358155600181015461098c9085610d72565b93505050808061099b90610d8b565b9150506107cf565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691610a1d91610ccc565b6000604051808303816000865af19150503d8060008114610a5a576040519150601f19603f3d011682016040523d82523d6000602084013e610a5f565b606091505b509092509050818015610a8a575080511580610a8a575080806020019051810190610a8a9190610cfb565b6107455760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d6565b600060208284031215610ada57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60048110610b1557634e487b7160e01b600052602160045260246000fd5b9052565b600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160018060a01b0380821660808501528060a08601511660a0850152505060c0830151610b7760c0840182610af7565b5092915050565b60008060208385031215610b9157600080fd5b823567ffffffffffffffff80821115610ba957600080fd5b818501915085601f830112610bbd57600080fd5b813581811115610bcc57600080fd5b8660208260071b8501011115610be157600080fd5b60209290920196919550909350505050565b8781526020810187905260408101869052606081018590526001600160a01b038481166080830152831660a082015260e08101610c3360c0830184610af7565b98975050505050505050565b60008060208385031215610c5257600080fd5b823567ffffffffffffffff80821115610c6a57600080fd5b818501915085601f830112610c7e57600080fd5b813581811115610c8d57600080fd5b8660208260061b8501011115610be157600080fd5b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b6000825160005b81811015610ced5760208186018101518583015201610cd3565b506000920191825250919050565b600060208284031215610d0d57600080fd5b815180151581146107a557600080fd5b634e487b7160e01b600052603260045260246000fd5b600060208284031215610d4557600080fd5b81356001600160a01b03811681146107a557600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610d8557610d85610d5c565b92915050565b600060018201610d9d57610d9d610d5c565b5060010190565b600060208284031215610db657600080fd5b505191905056fea26469706673582212206e467d69294766316da063165c1299fd448b484e03da316a32f5fc033f36ef0d64736f6c63430008120033", } // ERC20SwapABI is the input ABI used to generate the binding from. @@ -158,11 +157,11 @@ func NewERC20SwapFilterer(address common.Address, filterer bind.ContractFilterer // bindERC20Swap binds a generic wrapper to an already deployed contract. func bindERC20Swap(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := ERC20SwapMetaData.GetAbi() + parsed, err := abi.JSON(strings.NewReader(ERC20SwapABI)) if err != nil { return nil, err } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil } // Call invokes the (constant) contract method with params as input values and diff --git a/dex/networks/erc20/contracts/v0/swap_contract.bin b/dex/networks/erc20/contracts/v0/swap_contract.bin new file mode 100644 index 0000000000..bf71557108 Binary files /dev/null and b/dex/networks/erc20/contracts/v0/swap_contract.bin differ diff --git a/dex/networks/erc20/contracts/v0/token_contract.bin b/dex/networks/erc20/contracts/v0/token_contract.bin new file mode 100644 index 0000000000..b7b53ee1b8 Binary files /dev/null and b/dex/networks/erc20/contracts/v0/token_contract.bin differ diff --git a/dex/networks/erc20/contracts/v1/BinRuntimeV1.go b/dex/networks/erc20/contracts/v1/BinRuntimeV1.go deleted file mode 100644 index 64f014706b..0000000000 --- a/dex/networks/erc20/contracts/v1/BinRuntimeV1.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package v1 - -const ERC20SwapRuntimeBin = "6080604052600436106100865760003560e01c80638cd8dd97116100595780638cd8dd9714610141578063a76f9f2d14610161578063d5cfd0491461018f578063db3b419c146101af578063eb84e7f2146101dc57600080fd5b806323f0388b1461008b5780633da59631146100ad57806377d7e031146100c05780638c8e8fee146100f5575b600080fd5b34801561009757600080fd5b506100ab6100a6366004610d69565b610209565b005b6100ab6100bb366004610dde565b61050c565b3480156100cc57600080fd5b506100e06100db366004610e41565b61087a565b60405190151581526020015b60405180910390f35b34801561010157600080fd5b506101297f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100ec565b34801561014d57600080fd5b506100ab61015c366004610e63565b6108f6565b34801561016d57600080fd5b5061018161017c366004610e63565b610b66565b6040519081526020016100ec565b34801561019b57600080fd5b506100e06101aa366004610e63565b610c4e565b3480156101bb57600080fd5b506101cf6101ca366004610e63565b610c82565b6040516100ec9190610e91565b3480156101e857600080fd5b506101816101f7366004610ed4565b60006020819052908152604090205481565b3233146102315760405162461bcd60e51b815260040161022890610eed565b60405180910390fd5b6000805b828110156103e0573684848381811061025057610250610f17565b60c00291909101915033905061026c60a0830160808401610f2d565b6001600160a01b0316146102af5760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b6044820152606401610228565b600080806102bc84610d3d565b9250925092506000811180156102d157504381105b61030d5760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b6044820152606401610228565b61031882853561087a565b156103585760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b6044820152606401610228565b61036760a0850135853561087a565b6103a45760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b6044820152606401610228565b60008381526020818152604090912060a086013590556103c79085013587610f73565b95505050505080806103d890610f86565b915050610235565b5060408051336024820152604480820184905282518083039091018152606490910182526020810180516001600160e01b031663a9059cbb60e01b17905290516000916060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169161045a91610f9f565b6000604051808303816000865af19150503d8060008114610497576040519150601f19603f3d011682016040523d82523d6000602084013e61049c565b606091505b5090925090508180156104c75750805115806104c75750808060200190518101906104c79190610fce565b6105055760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b5050505050565b32331461052b5760405162461bcd60e51b815260040161022890610eed565b6000805b8281101561074a573684848381811061054a5761054a610f17565b905060a002019050600081602001351161058e5760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b6044820152606401610228565b60006105a06080830160608401610ff0565b67ffffffffffffffff16116105eb5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b6044820152606401610228565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf81350161066c5760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b6064820152608401610228565b600061067782610b66565b60008181526020819052604090205490915080156106c85760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b6044820152606401610228565b50436106d581843561087a565b156107135760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b6044820152606401610228565b6000828152602081815260409091208290556107329084013586610f73565b9450505050808061074290610f86565b91505061052f565b5060408051336024820152306044820152606480820184905282518083039091018152608490910182526020810180516001600160e01b03166323b872dd60e01b17905290516000916060916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016916107ca91610f9f565b6000604051808303816000865af19150503d8060008114610807576040519150601f19603f3d011682016040523d82523d6000602084013e61080c565b606091505b5090925090508180156108375750805115806108375750808060200190518101906108379190610fce565b6105055760405162461bcd60e51b81526020600482015260146024820152731d1c985b9cd9995c88199c9bdb4819985a5b195960621b6044820152606401610228565b60008160028460405160200161089291815260200190565b60408051601f19818403018152908290526108ac91610f9f565b602060405180830381855afa1580156108c9573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108ec919061101a565b1490505b92915050565b3233146109155760405162461bcd60e51b815260040161022890610eed565b6109256080820160608301610ff0565b67ffffffffffffffff164210156109755760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b6044820152606401610228565b600080600061098384610d3d565b9250925092506000811180156109995750438111155b6109d75760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b6044820152606401610228565b6109e282853561087a565b15610a275760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b6044820152606401610228565b6000838152602081815260408083206000199055805133602482015287830135604480830191909152825180830390910181526064909101825291820180516001600160e01b031663a9059cbb60e01b179052516060917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031691610ab39190610f9f565b6000604051808303816000865af19150503d8060008114610af0576040519150601f19603f3d011682016040523d82523d6000602084013e610af5565b606091505b509092509050818015610b20575080511580610b20575080806020019051810190610b209190610fce565b610b5e5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b6044820152606401610228565b505050505050565b600060028235610b7c6060850160408601610f2d565b60601b610b8f60a0860160808701610f2d565b60601b856020013560001b866060016020810190610bad9190610ff0565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f1981840301815290829052610c0e91610f9f565b602060405180830381855afa158015610c2b573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906108f0919061101a565b6000806000610c5c84610d3d565b925092505080600014158015610c7a5750610c7882853561087a565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610ca984610d3d565b9250925050610cd36040805160608101909152806000815260006020820181905260409091015290565b81600003610cfa578060005b90816003811115610cf257610cf2610e7b565b905250610c7a565b60018301610d0a57806003610cdf565b610d1583863561087a565b15610d2a576002815260208101839052610c7a565b6001815260408101919091529392505050565b600080600080610d4c85610b66565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610d7c57600080fd5b823567ffffffffffffffff80821115610d9457600080fd5b818501915085601f830112610da857600080fd5b813581811115610db757600080fd5b86602060c083028501011115610dcc57600080fd5b60209290920196919550909350505050565b60008060208385031215610df157600080fd5b823567ffffffffffffffff80821115610e0957600080fd5b818501915085601f830112610e1d57600080fd5b813581811115610e2c57600080fd5b86602060a083028501011115610dcc57600080fd5b60008060408385031215610e5457600080fd5b50508035926020909101359150565b600060a08284031215610e7557600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610eb657634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610ee657600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610f3f57600080fd5b81356001600160a01b0381168114610f5657600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156108f0576108f0610f5d565b600060018201610f9857610f98610f5d565b5060010190565b6000825160005b81811015610fc05760208186018101518583015201610fa6565b506000920191825250919050565b600060208284031215610fe057600080fd5b81518015158114610f5657600080fd5b60006020828403121561100257600080fd5b813567ffffffffffffffff81168114610f5657600080fd5b60006020828403121561102c57600080fd5b505191905056fea2646970667358221220acfd007366a18ada193efab33a7139cee67cfd39d1c89075b5534cc57862baa464736f6c63430008120033" diff --git a/dex/networks/erc20/contracts/v1/swap_contract.bin b/dex/networks/erc20/contracts/v1/swap_contract.bin new file mode 100644 index 0000000000..a3ddb1ccc7 Binary files /dev/null and b/dex/networks/erc20/contracts/v1/swap_contract.bin differ diff --git a/dex/networks/erc20/contracts/v1/token_contract.bin b/dex/networks/erc20/contracts/v1/token_contract.bin new file mode 100644 index 0000000000..b7b53ee1b8 Binary files /dev/null and b/dex/networks/erc20/contracts/v1/token_contract.bin differ diff --git a/dex/networks/eth/contracts/build-multibalance.sh b/dex/networks/eth/contracts/build-multibalance.sh old mode 100644 new mode 100755 index 0ddd19b447..c9e6989e91 --- a/dex/networks/eth/contracts/build-multibalance.sh +++ b/dex/networks/eth/contracts/build-multibalance.sh @@ -18,26 +18,11 @@ fi mkdir temp solc --abi --bin --bin-runtime --overwrite --optimize ${SOLIDITY_FILE} -o ./temp/ -BYTECODE=$(<./temp/${CONTRACT_NAME}.bin-runtime) - -cat > "./${PKG_NAME}/BinRuntime${CONTRACT_NAME}.go" < "${PKG_NAME}/contract.bin" rm -fr temp diff --git a/dex/networks/eth/contracts/multibalance/BinRuntimeMultiBalanceV0.go b/dex/networks/eth/contracts/multibalance/BinRuntimeMultiBalanceV0.go deleted file mode 100644 index 7f70e53a0e..0000000000 --- a/dex/networks/eth/contracts/multibalance/BinRuntimeMultiBalanceV0.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package multibalance - -const MultiBalanceV0RuntimeBin = "608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d3e5ca8714610030575b600080fd5b61004361003e3660046102a5565b610059565b604051610050919061032b565b60405180910390f35b60606000610068836001610385565b67ffffffffffffffff8111156100805761008061039e565b6040519080825280602002602001820160405280156100a9578160200160208202803683370190505b509050846001600160a01b031631816000815181106100ca576100ca6103b4565b60200260200101818152505060005b838110156102805760008585838181106100f5576100f56103b4565b905060200201602081019061010a91906103ca565b905060006060826001600160a01b03167f70a08231b98ef4ca268c9cc3f6b4590e4bfec28280db06bb5d45e689f2a360be8a60405160240161015b91906001600160a01b0391909116815260200190565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161019991906103ec565b600060405180830381855afa9150503d80600081146101d4576040519150601f19603f3d011682016040523d82523d6000602084013e6101d9565b606091505b509092509050816102285760405162461bcd60e51b815260206004820152601560248201527418985b185b98d953d98818d85b1b0819985a5b1959605a1b604482015260640160405180910390fd5b60008180602001905181019061023e919061041b565b9050808661024d876001610385565b8151811061025d5761025d6103b4565b60200260200101818152505050505050808061027890610434565b9150506100d9565b50949350505050565b80356001600160a01b03811681146102a057600080fd5b919050565b6000806000604084860312156102ba57600080fd5b6102c384610289565b9250602084013567ffffffffffffffff808211156102e057600080fd5b818601915086601f8301126102f457600080fd5b81358181111561030357600080fd5b8760208260051b850101111561031857600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561036357835183529284019291840191600101610347565b50909695505050505050565b634e487b7160e01b600052601160045260246000fd5b808201808211156103985761039861036f565b92915050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000602082840312156103dc57600080fd5b6103e582610289565b9392505050565b6000825160005b8181101561040d57602081860181015185830152016103f3565b506000920191825250919050565b60006020828403121561042d57600080fd5b5051919050565b6000600182016104465761044661036f565b506001019056fea26469706673582212207074e3e189a2692e2841f7943a9de24bcdbca943ee6bfcbd83a2fa6e43ec497b64736f6c63430008120033" diff --git a/dex/networks/eth/contracts/multibalance/contract.bin b/dex/networks/eth/contracts/multibalance/contract.bin new file mode 100644 index 0000000000..195ca6c037 Binary files /dev/null and b/dex/networks/eth/contracts/multibalance/contract.bin differ diff --git a/dex/networks/eth/contracts/updatecontract.sh b/dex/networks/eth/contracts/updatecontract.sh index 623d7885db..75bf20b613 100755 --- a/dex/networks/eth/contracts/updatecontract.sh +++ b/dex/networks/eth/contracts/updatecontract.sh @@ -26,26 +26,11 @@ mkdir temp mkdir -p ${PKG_NAME} solc --abi --bin --bin-runtime --overwrite --optimize ${SOLIDITY_FILE} -o ./temp/ -BYTECODE=$(<./temp/${CONTRACT_NAME}.bin-runtime) - -cat > "./${PKG_NAME}/BinRuntimeV${VERSION}.go" < "v${VERSION}/contract.bin" rm -fr temp diff --git a/dex/networks/eth/contracts/v0/BinRuntimeV0.go b/dex/networks/eth/contracts/v0/BinRuntimeV0.go deleted file mode 100644 index 35f5a11c05..0000000000 --- a/dex/networks/eth/contracts/v0/BinRuntimeV0.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package v0 - -const ETHSwapRuntimeBin = "6080604052600436106100555760003560e01c80637249fbb61461005a57806376467cbd1461007c578063a8793f94146100b2578063d0f761c0146100c5578063eb84e7f2146100f5578063f4fd17f914610171575b600080fd5b34801561006657600080fd5b5061007a610075366004610871565b610191565b005b34801561008857600080fd5b5061009c610097366004610871565b6102c9565b6040516100a991906108c2565b60405180910390f35b61007a6100c0366004610927565b6103a4565b3480156100d157600080fd5b506100e56100e0366004610871565b61059b565b60405190151581526020016100a9565b34801561010157600080fd5b5061015e610110366004610871565b60006020819052908152604090208054600182015460028301546003840154600485015460059095015493949293919290916001600160a01b0391821691811690600160a01b900460ff1687565b6040516100a9979695949392919061099c565b34801561017d57600080fd5b5061007a61018c3660046109e8565b6105e3565b3233146101b95760405162461bcd60e51b81526004016101b090610a4b565b60405180910390fd5b6101c28161059b565b6101ff5760405162461bcd60e51b815260206004820152600e60248201526d6e6f7420726566756e6461626c6560901b60448201526064016101b0565b60008181526020819052604080822060058101805460ff60a01b1916600360a01b1790556004810154600182015492519193926001600160a01b03909116918381818185875af1925050503d8060008114610276576040519150601f19603f3d011682016040523d82523d6000602084013e61027b565b606091505b50909150506001811515146102c45760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101b0565b505050565b6103066040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60008281526020818152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154606083015260048301546001600160a01b039081166080840152600584015490811660a084015291929160c0840191600160a01b90910460ff169081111561038a5761038a61088a565b600381111561039b5761039b61088a565b90525092915050565b3233146103c35760405162461bcd60e51b81526004016101b090610a4b565b6000805b8281101561056157368484838181106103e2576103e2610a75565b9050608002019050600080600083602001358152602001908152602001600020905060008260600135116104405760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101b0565b81356104825760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101b0565b60006005820154600160a01b900460ff1660038111156104a4576104a461088a565b146104dc5760405162461bcd60e51b8152602060048201526008602482015267064757020737761760c41b60448201526064016101b0565b436002820155813560038201556004810180546001600160a01b0319163317905561050d6060830160408401610a8b565b6005820180546060850135600185018190556001600160a01b03939093166001600160a81b031990911617600160a01b17905561054a9085610aca565b93505050808061055990610ae3565b9150506103c7565b503481146102c45760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101b0565b600081815260208190526040812060016005820154600160a01b900460ff1660038111156105cb576105cb61088a565b1480156105dc575080600301544210155b9392505050565b3233146106025760405162461bcd60e51b81526004016101b090610a4b565b6000805b828110156107da573684848381811061062157610621610a75565b6020604091820293909301838101356000908152938490529220919250600190506005820154600160a01b900460ff1660038111156106625761066261088a565b1461069b5760405162461bcd60e51b815260206004820152600960248201526862616420737461746560b81b60448201526064016101b0565b60058101546001600160a01b031633146106e95760405162461bcd60e51b815260206004820152600f60248201526e189859081c185c9d1a58da5c185b9d608a1b60448201526064016101b0565b81602001356002836000013560405160200161070791815260200190565b60408051601f198184030181529082905261072191610afc565b602060405180830381855afa15801561073e573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107619190610b2b565b1461079b5760405162461bcd60e51b815260206004820152600a602482015269189859081cd958dc995d60b21b60448201526064016101b0565b60058101805460ff60a01b1916600160a11b1790558135815560018101546107c39085610aca565b9350505080806107d290610ae3565b915050610606565b50604051600090339083908381818185875af1925050503d806000811461081d576040519150601f19603f3d011682016040523d82523d6000602084013e610822565b606091505b509091505060018115151461086b5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101b0565b50505050565b60006020828403121561088357600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b600481106108be57634e487b7160e01b600052602160045260246000fd5b9052565b600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160018060a01b0380821660808501528060a08601511660a0850152505060c083015161092060c08401826108a0565b5092915050565b6000806020838503121561093a57600080fd5b823567ffffffffffffffff8082111561095257600080fd5b818501915085601f83011261096657600080fd5b81358181111561097557600080fd5b8660208260071b850101111561098a57600080fd5b60209290920196919550909350505050565b8781526020810187905260408101869052606081018590526001600160a01b038481166080830152831660a082015260e081016109dc60c08301846108a0565b98975050505050505050565b600080602083850312156109fb57600080fd5b823567ffffffffffffffff80821115610a1357600080fd5b818501915085601f830112610a2757600080fd5b813581811115610a3657600080fd5b8660208260061b850101111561098a57600080fd5b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a9d57600080fd5b81356001600160a01b03811681146105dc57600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610add57610add610ab4565b92915050565b600060018201610af557610af5610ab4565b5060010190565b6000825160005b81811015610b1d5760208186018101518583015201610b03565b506000920191825250919050565b600060208284031215610b3d57600080fd5b505191905056fea2646970667358221220d288c9a18362adf67607179f5c8585d0abe014bdb904b6e878451ac0c393a04364736f6c63430008120033" diff --git a/dex/networks/eth/contracts/v0/contract.bin b/dex/networks/eth/contracts/v0/contract.bin new file mode 100644 index 0000000000..32395c9d6b Binary files /dev/null and b/dex/networks/eth/contracts/v0/contract.bin differ diff --git a/dex/networks/eth/contracts/v0/contract.go b/dex/networks/eth/contracts/v0/contract.go index d11ea6cff3..5e44d70cf3 100644 --- a/dex/networks/eth/contracts/v0/contract.go +++ b/dex/networks/eth/contracts/v0/contract.go @@ -56,7 +56,7 @@ type ETHSwapSwap struct { // ETHSwapMetaData contains all meta data concerning the ETHSwap contract. var ETHSwapMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"refundTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"internalType\":\"structETHSwap.Initiation[]\",\"name\":\"initiations\",\"type\":\"tuple[]\"}],\"name\":\"initiate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"isRefundable\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"internalType\":\"structETHSwap.Redemption[]\",\"name\":\"redemptions\",\"type\":\"tuple[]\"}],\"name\":\"redeem\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"refund\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"secretHash\",\"type\":\"bytes32\"}],\"name\":\"swap\",\"outputs\":[{\"components\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"refundBlockTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"},{\"internalType\":\"enumETHSwap.State\",\"name\":\"state\",\"type\":\"uint8\"}],\"internalType\":\"structETHSwap.Swap\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"swaps\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"secret\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"initBlockNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"refundBlockTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"initiator\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"participant\",\"type\":\"address\"},{\"internalType\":\"enumETHSwap.State\",\"name\":\"state\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", - Bin: "0x608060405234801561001057600080fd5b50610b7a806100206000396000f3fe6080604052600436106100555760003560e01c80637249fbb61461005a57806376467cbd1461007c578063a8793f94146100b2578063d0f761c0146100c5578063eb84e7f2146100f5578063f4fd17f914610171575b600080fd5b34801561006657600080fd5b5061007a610075366004610871565b610191565b005b34801561008857600080fd5b5061009c610097366004610871565b6102c9565b6040516100a991906108c2565b60405180910390f35b61007a6100c0366004610927565b6103a4565b3480156100d157600080fd5b506100e56100e0366004610871565b61059b565b60405190151581526020016100a9565b34801561010157600080fd5b5061015e610110366004610871565b60006020819052908152604090208054600182015460028301546003840154600485015460059095015493949293919290916001600160a01b0391821691811690600160a01b900460ff1687565b6040516100a9979695949392919061099c565b34801561017d57600080fd5b5061007a61018c3660046109e8565b6105e3565b3233146101b95760405162461bcd60e51b81526004016101b090610a4b565b60405180910390fd5b6101c28161059b565b6101ff5760405162461bcd60e51b815260206004820152600e60248201526d6e6f7420726566756e6461626c6560901b60448201526064016101b0565b60008181526020819052604080822060058101805460ff60a01b1916600360a01b1790556004810154600182015492519193926001600160a01b03909116918381818185875af1925050503d8060008114610276576040519150601f19603f3d011682016040523d82523d6000602084013e61027b565b606091505b50909150506001811515146102c45760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101b0565b505050565b6103066040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60008281526020818152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154606083015260048301546001600160a01b039081166080840152600584015490811660a084015291929160c0840191600160a01b90910460ff169081111561038a5761038a61088a565b600381111561039b5761039b61088a565b90525092915050565b3233146103c35760405162461bcd60e51b81526004016101b090610a4b565b6000805b8281101561056157368484838181106103e2576103e2610a75565b9050608002019050600080600083602001358152602001908152602001600020905060008260600135116104405760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101b0565b81356104825760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101b0565b60006005820154600160a01b900460ff1660038111156104a4576104a461088a565b146104dc5760405162461bcd60e51b8152602060048201526008602482015267064757020737761760c41b60448201526064016101b0565b436002820155813560038201556004810180546001600160a01b0319163317905561050d6060830160408401610a8b565b6005820180546060850135600185018190556001600160a01b03939093166001600160a81b031990911617600160a01b17905561054a9085610aca565b93505050808061055990610ae3565b9150506103c7565b503481146102c45760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101b0565b600081815260208190526040812060016005820154600160a01b900460ff1660038111156105cb576105cb61088a565b1480156105dc575080600301544210155b9392505050565b3233146106025760405162461bcd60e51b81526004016101b090610a4b565b6000805b828110156107da573684848381811061062157610621610a75565b6020604091820293909301838101356000908152938490529220919250600190506005820154600160a01b900460ff1660038111156106625761066261088a565b1461069b5760405162461bcd60e51b815260206004820152600960248201526862616420737461746560b81b60448201526064016101b0565b60058101546001600160a01b031633146106e95760405162461bcd60e51b815260206004820152600f60248201526e189859081c185c9d1a58da5c185b9d608a1b60448201526064016101b0565b81602001356002836000013560405160200161070791815260200190565b60408051601f198184030181529082905261072191610afc565b602060405180830381855afa15801561073e573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107619190610b2b565b1461079b5760405162461bcd60e51b815260206004820152600a602482015269189859081cd958dc995d60b21b60448201526064016101b0565b60058101805460ff60a01b1916600160a11b1790558135815560018101546107c39085610aca565b9350505080806107d290610ae3565b915050610606565b50604051600090339083908381818185875af1925050503d806000811461081d576040519150601f19603f3d011682016040523d82523d6000602084013e610822565b606091505b509091505060018115151461086b5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101b0565b50505050565b60006020828403121561088357600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b600481106108be57634e487b7160e01b600052602160045260246000fd5b9052565b600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160018060a01b0380821660808501528060a08601511660a0850152505060c083015161092060c08401826108a0565b5092915050565b6000806020838503121561093a57600080fd5b823567ffffffffffffffff8082111561095257600080fd5b818501915085601f83011261096657600080fd5b81358181111561097557600080fd5b8660208260071b850101111561098a57600080fd5b60209290920196919550909350505050565b8781526020810187905260408101869052606081018590526001600160a01b038481166080830152831660a082015260e081016109dc60c08301846108a0565b98975050505050505050565b600080602083850312156109fb57600080fd5b823567ffffffffffffffff80821115610a1357600080fd5b818501915085601f830112610a2757600080fd5b813581811115610a3657600080fd5b8660208260061b850101111561098a57600080fd5b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a9d57600080fd5b81356001600160a01b03811681146105dc57600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610add57610add610ab4565b92915050565b600060018201610af557610af5610ab4565b5060010190565b6000825160005b81811015610b1d5760208186018101518583015201610b03565b506000920191825250919050565b600060208284031215610b3d57600080fd5b505191905056fea2646970667358221220d288c9a18362adf67607179f5c8585d0abe014bdb904b6e878451ac0c393a04364736f6c63430008120033", + Bin: "0x608060405234801561001057600080fd5b50610b7a806100206000396000f3fe6080604052600436106100555760003560e01c80637249fbb61461005a57806376467cbd1461007c578063a8793f94146100b2578063d0f761c0146100c5578063eb84e7f2146100f5578063f4fd17f914610171575b600080fd5b34801561006657600080fd5b5061007a610075366004610871565b610191565b005b34801561008857600080fd5b5061009c610097366004610871565b6102c9565b6040516100a991906108c2565b60405180910390f35b61007a6100c0366004610927565b6103a4565b3480156100d157600080fd5b506100e56100e0366004610871565b61059b565b60405190151581526020016100a9565b34801561010157600080fd5b5061015e610110366004610871565b60006020819052908152604090208054600182015460028301546003840154600485015460059095015493949293919290916001600160a01b0391821691811690600160a01b900460ff1687565b6040516100a9979695949392919061099c565b34801561017d57600080fd5b5061007a61018c3660046109e8565b6105e3565b3233146101b95760405162461bcd60e51b81526004016101b090610a4b565b60405180910390fd5b6101c28161059b565b6101ff5760405162461bcd60e51b815260206004820152600e60248201526d6e6f7420726566756e6461626c6560901b60448201526064016101b0565b60008181526020819052604080822060058101805460ff60a01b1916600360a01b1790556004810154600182015492519193926001600160a01b03909116918381818185875af1925050503d8060008114610276576040519150601f19603f3d011682016040523d82523d6000602084013e61027b565b606091505b50909150506001811515146102c45760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101b0565b505050565b6103066040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a081018290529060c082015290565b60008281526020818152604091829020825160e08101845281548152600182015492810192909252600281015492820192909252600380830154606083015260048301546001600160a01b039081166080840152600584015490811660a084015291929160c0840191600160a01b90910460ff169081111561038a5761038a61088a565b600381111561039b5761039b61088a565b90525092915050565b3233146103c35760405162461bcd60e51b81526004016101b090610a4b565b6000805b8281101561056157368484838181106103e2576103e2610a75565b9050608002019050600080600083602001358152602001908152602001600020905060008260600135116104405760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101b0565b81356104825760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101b0565b60006005820154600160a01b900460ff1660038111156104a4576104a461088a565b146104dc5760405162461bcd60e51b8152602060048201526008602482015267064757020737761760c41b60448201526064016101b0565b436002820155813560038201556004810180546001600160a01b0319163317905561050d6060830160408401610a8b565b6005820180546060850135600185018190556001600160a01b03939093166001600160a81b031990911617600160a01b17905561054a9085610aca565b93505050808061055990610ae3565b9150506103c7565b503481146102c45760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101b0565b600081815260208190526040812060016005820154600160a01b900460ff1660038111156105cb576105cb61088a565b1480156105dc575080600301544210155b9392505050565b3233146106025760405162461bcd60e51b81526004016101b090610a4b565b6000805b828110156107da573684848381811061062157610621610a75565b6020604091820293909301838101356000908152938490529220919250600190506005820154600160a01b900460ff1660038111156106625761066261088a565b1461069b5760405162461bcd60e51b815260206004820152600960248201526862616420737461746560b81b60448201526064016101b0565b60058101546001600160a01b031633146106e95760405162461bcd60e51b815260206004820152600f60248201526e189859081c185c9d1a58da5c185b9d608a1b60448201526064016101b0565b81602001356002836000013560405160200161070791815260200190565b60408051601f198184030181529082905261072191610afc565b602060405180830381855afa15801561073e573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107619190610b2b565b1461079b5760405162461bcd60e51b815260206004820152600a602482015269189859081cd958dc995d60b21b60448201526064016101b0565b60058101805460ff60a01b1916600160a11b1790558135815560018101546107c39085610aca565b9350505080806107d290610ae3565b915050610606565b50604051600090339083908381818185875af1925050503d806000811461081d576040519150601f19603f3d011682016040523d82523d6000602084013e610822565b606091505b509091505060018115151461086b5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101b0565b50505050565b60006020828403121561088357600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b600481106108be57634e487b7160e01b600052602160045260246000fd5b9052565b600060e08201905082518252602083015160208301526040830151604083015260608301516060830152608083015160018060a01b0380821660808501528060a08601511660a0850152505060c083015161092060c08401826108a0565b5092915050565b6000806020838503121561093a57600080fd5b823567ffffffffffffffff8082111561095257600080fd5b818501915085601f83011261096657600080fd5b81358181111561097557600080fd5b8660208260071b850101111561098a57600080fd5b60209290920196919550909350505050565b8781526020810187905260408101869052606081018590526001600160a01b038481166080830152831660a082015260e081016109dc60c08301846108a0565b98975050505050505050565b600080602083850312156109fb57600080fd5b823567ffffffffffffffff80821115610a1357600080fd5b818501915085601f830112610a2757600080fd5b813581811115610a3657600080fd5b8660208260061b850101111561098a57600080fd5b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a9d57600080fd5b81356001600160a01b03811681146105dc57600080fd5b634e487b7160e01b600052601160045260246000fd5b80820180821115610add57610add610ab4565b92915050565b600060018201610af557610af5610ab4565b5060010190565b6000825160005b81811015610b1d5760208186018101518583015201610b03565b506000920191825250919050565b600060208284031215610b3d57600080fd5b505191905056fea2646970667358221220648f19b7cbecc5d8f334599230fe401b87cd978a6b609a47cb0554cb5da562b364736f6c63430008120033", } // ETHSwapABI is the input ABI used to generate the binding from. diff --git a/dex/networks/eth/contracts/v1/BinRuntimeV1.go b/dex/networks/eth/contracts/v1/BinRuntimeV1.go deleted file mode 100644 index 9bd4f954ae..0000000000 --- a/dex/networks/eth/contracts/v1/BinRuntimeV1.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package v1 - -const ETHSwapRuntimeBin = "60806040526004361061007b5760003560e01c8063a76f9f2d1161004e578063a76f9f2d1461010a578063d5cfd04914610138578063db3b419c14610158578063eb84e7f21461018557600080fd5b806323f0388b146100805780633da59631146100a257806377d7e031146100b55780638cd8dd97146100ea575b600080fd5b34801561008c57600080fd5b506100a061009b366004610b14565b6101b2565b005b6100a06100b0366004610b89565b610420565b3480156100c157600080fd5b506100d56100d0366004610bec565b61069d565b60405190151581526020015b60405180910390f35b3480156100f657600080fd5b506100a0610105366004610c0e565b610719565b34801561011657600080fd5b5061012a610125366004610c0e565b610911565b6040519081526020016100e1565b34801561014457600080fd5b506100d5610153366004610c0e565b6109f9565b34801561016457600080fd5b50610178610173366004610c0e565b610a2d565b6040516100e19190610c3c565b34801561019157600080fd5b5061012a6101a0366004610c7f565b60006020819052908152604090205481565b3233146101da5760405162461bcd60e51b81526004016101d190610c98565b60405180910390fd5b6000805b8281101561038957368484838181106101f9576101f9610cc2565b60c00291909101915033905061021560a0830160808401610cd8565b6001600160a01b0316146102585760405162461bcd60e51b815260206004820152600a6024820152691b9bdd08185d5d1a195960b21b60448201526064016101d1565b6000808061026584610ae8565b92509250925060008111801561027a57504381105b6102b65760405162461bcd60e51b815260206004820152600d60248201526c0756e66696c6c6564207377617609c1b60448201526064016101d1565b6102c182853561069d565b156103015760405162461bcd60e51b815260206004820152601060248201526f185b1c9958591e481c995919595b595960821b60448201526064016101d1565b61031060a0850135853561069d565b61034d5760405162461bcd60e51b815260206004820152600e60248201526d1a5b9d985b1a59081cd958dc995d60921b60448201526064016101d1565b60008381526020818152604090912060a086013590556103709085013587610d1e565b955050505050808061038190610d31565b9150506101de565b50604051600090339083908381818185875af1925050503d80600081146103cc576040519150601f19603f3d011682016040523d82523d6000602084013e6103d1565b606091505b509091505060018115151461041a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b50505050565b32331461043f5760405162461bcd60e51b81526004016101d190610c98565b6000805b8281101561065e573684848381811061045e5761045e610cc2565b905060a00201905060008160200135116104a25760405162461bcd60e51b81526020600482015260056024820152640c081d985b60da1b60448201526064016101d1565b60006104b46080830160608401610d4a565b67ffffffffffffffff16116104ff5760405162461bcd60e51b815260206004820152601160248201527003020726566756e6454696d657374616d7607c1b60448201526064016101d1565b7f5069ec89f08d9ca0424bb5a5f59c3c60ed50cf06af5911a368e41e771763bfaf8135016105805760405162461bcd60e51b815260206004820152602860248201527f696c6c6567616c2073656372657420686173682028726566756e64207265636f604482015267726420686173682960c01b60648201526084016101d1565b600061058b82610911565b60008181526020819052604090205490915080156105dc5760405162461bcd60e51b815260206004820152600e60248201526d73776170206e6f7420656d70747960901b60448201526064016101d1565b50436105e981843561069d565b156106275760405162461bcd60e51b815260206004820152600e60248201526d3430b9b41031b7b63634b9b4b7b760911b60448201526064016101d1565b6000828152602081815260409091208290556106469084013586610d1e565b9450505050808061065690610d31565b915050610443565b503481146106985760405162461bcd60e51b8152602060048201526007602482015266189859081d985b60ca1b60448201526064016101d1565b505050565b6000816002846040516020016106b591815260200190565b60408051601f19818403018152908290526106cf91610d74565b602060405180830381855afa1580156106ec573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061070f9190610da3565b1490505b92915050565b3233146107385760405162461bcd60e51b81526004016101d190610c98565b6107486080820160608301610d4a565b67ffffffffffffffff164210156107985760405162461bcd60e51b81526020600482015260146024820152731b1bd8dadd1a5b59481b9bdd08195e1c1a5c995960621b60448201526064016101d1565b60008060006107a684610ae8565b9250925092506000811180156107bc5750438111155b6107fa5760405162461bcd60e51b815260206004820152600f60248201526e73776170206e6f742061637469766560881b60448201526064016101d1565b61080582853561069d565b1561084a5760405162461bcd60e51b81526020600482015260156024820152741cddd85c08185b1c9958591e481c995919595b5959605a1b60448201526064016101d1565b600083815260208190526040808220600019905561086e9060608701908701610cd8565b6001600160a01b0316856020013560405160006040518083038185875af1925050503d80600081146108bc576040519150601f19603f3d011682016040523d82523d6000602084013e6108c1565b606091505b509091505060018115151461090a5760405162461bcd60e51b815260206004820152600f60248201526e1d1c985b9cd9995c8819985a5b1959608a1b60448201526064016101d1565b5050505050565b6000600282356109276060850160408601610cd8565b60601b61093a60a0860160808701610cd8565b60601b856020013560001b8660600160208101906109589190610d4a565b6040805160208101969096526bffffffffffffffffffffffff199485169086015292909116605484015260688301526001600160c01b031960c09190911b16608882015260900160408051601f19818403018152908290526109b991610d74565b602060405180830381855afa1580156109d6573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906107139190610da3565b6000806000610a0784610ae8565b925092505080600014158015610a255750610a2382853561069d565b155b949350505050565b604080516060810182526000808252602082018190529181018290529080610a5484610ae8565b9250925050610a7e6040805160608101909152806000815260006020820181905260409091015290565b81600003610aa5578060005b90816003811115610a9d57610a9d610c26565b905250610a25565b60018301610ab557806003610a8a565b610ac083863561069d565b15610ad5576002815260208101839052610a25565b6001815260408101919091529392505050565b600080600080610af785610911565b600081815260208190526040902054909690955085945092505050565b60008060208385031215610b2757600080fd5b823567ffffffffffffffff80821115610b3f57600080fd5b818501915085601f830112610b5357600080fd5b813581811115610b6257600080fd5b86602060c083028501011115610b7757600080fd5b60209290920196919550909350505050565b60008060208385031215610b9c57600080fd5b823567ffffffffffffffff80821115610bb457600080fd5b818501915085601f830112610bc857600080fd5b813581811115610bd757600080fd5b86602060a083028501011115610b7757600080fd5b60008060408385031215610bff57600080fd5b50508035926020909101359150565b600060a08284031215610c2057600080fd5b50919050565b634e487b7160e01b600052602160045260246000fd5b8151606082019060048110610c6157634e487b7160e01b600052602160045260246000fd5b80835250602083015160208301526040830151604083015292915050565b600060208284031215610c9157600080fd5b5035919050565b60208082526010908201526f39b2b73232b910109e9037b934b3b4b760811b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610cea57600080fd5b81356001600160a01b0381168114610d0157600080fd5b9392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561071357610713610d08565b600060018201610d4357610d43610d08565b5060010190565b600060208284031215610d5c57600080fd5b813567ffffffffffffffff81168114610d0157600080fd5b6000825160005b81811015610d955760208186018101518583015201610d7b565b506000920191825250919050565b600060208284031215610db557600080fd5b505191905056fea2646970667358221220420ce9cfd5a39be8e719369517f704148d580fb33472b5b8947c77d61eee66d664736f6c63430008120033" diff --git a/dex/networks/eth/contracts/v1/contract.bin b/dex/networks/eth/contracts/v1/contract.bin new file mode 100644 index 0000000000..c68e299ad6 Binary files /dev/null and b/dex/networks/eth/contracts/v1/contract.bin differ diff --git a/dex/networks/eth/params.go b/dex/networks/eth/params.go index bb50dc5de9..103f12d10e 100644 --- a/dex/networks/eth/params.go +++ b/dex/networks/eth/params.go @@ -66,8 +66,8 @@ var ( dex.Simnet: common.HexToAddress("0x2f68e723b8989ba1c6a9f03e42f33cb7dc9d606f"), }, 1: { - dex.Mainnet: common.Address{}, - dex.Testnet: common.Address{}, + dex.Mainnet: common.HexToAddress("0xa958d5B8a3a29E3f5f41742Fbb939A0dd93EB418"), // tx 0x4adf0314237c454acee1f8d33e97f84126af612245cad0794471693f0906610e + dex.Testnet: common.HexToAddress("0x9CDe3c347021F0AA63E2780dAD867B5949c5E083"), // tx 0x90f18e70121598a48fc49a5d5b0328358eb34441e2c5dee439dda2dfc7bf3dd8 dex.Simnet: common.HexToAddress("0x2f68e723b8989ba1c6a9f03e42f33cb7dc9d606f"), }, } diff --git a/dex/networks/eth/tokens.go b/dex/networks/eth/tokens.go index d6e6c9f4d4..c77da808e0 100644 --- a/dex/networks/eth/tokens.go +++ b/dex/networks/eth/tokens.go @@ -101,6 +101,32 @@ var Tokens = map[uint32]*Token{ Transfer: 85_100, }, }, + 1: { + // deploy tx: https://etherscan.io/tx/0x49a382f1ae27fd5191c8b92f14738ea934cdb1e167b1a59e2c4a3022097a35b1 + // swap contract: https://etherscan.io/address/0xd45e648D97Beb2ee0045E5e91d1C2C751Cd0Bc00 + Address: common.HexToAddress("0xd45e648D97Beb2ee0045E5e91d1C2C751Cd0Bc00"), + Gas: Gases{ + // First swap used 98443 gas Recommended Gases.Swap = 127975 + // 1 additional swaps averaged 26491 gas each. Recommended Gases.SwapAdd = 34438 + // [98443 124934] + // First redeem used 54761 gas. Recommended Gases.Redeem = 71189 + // 1 additional redeems averaged 10722 gas each. recommended Gases.RedeemAdd = 13938 + // [54761 65483] + // Average of 2 refunds: 58328. Recommended Gases.Refund = 75826 + // [58289 58367] + // Average of 2 approvals: 55882. Recommended Gases.Approve = 72646 + // [55882 55882] + // Average of 1 transfers: 62224. Recommended Gases.Transfer = 80891 + // [62224] + Swap: 127_975, + SwapAdd: 34_438, + Redeem: 71_189, + RedeemAdd: 13_938, + Refund: 75_826, + Approve: 72_646, + Transfer: 80_891, + }, + }, }, }, dex.Testnet: { @@ -154,24 +180,29 @@ var Tokens = map[uint32]*Token{ }, }, 1: { - // Swap contract address. The simnet harness writes this - // address to file. Live tests must populate this field. - Address: common.Address{}, + // deploy tx: https://sepolia.etherscan.io/tx/0x2955323c4ff389d37b95c2c4c9c47044346c4aa52419711db880836710136c52 + // swap contract: https://sepolia.etherscan.io/address/0x0F373a20Fa2c4ecB42984C2e6bE2B3C594E97B85 + Address: common.HexToAddress("0x0F373a20Fa2c4ecB42984C2e6bE2B3C594E97B85"), Gas: Gases{ - Swap: 95_000, // [86009 112920 139831 166742 193651] - SwapAdd: 30_000, // avg SwapAdd 26910 - Redeem: 50_000, // [42569 53614 64646 75703 86734] - RedeemAdd: 14_000, // avg RedeemAdd 11038 - Refund: 50_000, // [45306 45306 45306 45306 45294] avg: 45303 - // Approve is the gas used to call the approve - // method of the contract. For Approve transactions, - // the very first approval for an account-spender - // pair takes more than subsequent approvals. The - // results are repeated for a different account's - // first approvals on the same contract, so it's not - // just the global first. - Approve: 46_000, - Transfer: 33_000, + // First swap used 98310 gas Recommended Gases.Swap = 127803 + // 2 additional swaps averaged 26507 gas each. Recommended Gases.SwapAdd = 34459 + // [98310 124825 151325] + // First redeem used 54672 gas. Recommended Gases.Redeem = 71073 + // 2 additional redeems averaged 10726 gas each. recommended Gases.RedeemAdd = 13943 + // [54672 65406 76124] + // Average of 3 refunds: 58056. Recommended Gases.Refund = 75472 + // [58187 58278 57705] + // Average of 2 approvals: 55785. Recommended Gases.Approve = 72520 + // [55785 55785] + // Average of 1 transfers: 62135. Recommended Gases.Transfer = 80775 + // [62135] + Swap: 127_803, + SwapAdd: 34_459, + Redeem: 71_073, + RedeemAdd: 13_943, + Refund: 75_472, + Approve: 72_520, + Transfer: 80_775, }, }, }, @@ -192,7 +223,7 @@ var Tokens = map[uint32]*Token{ }, }, 1: { - Address: common.Address{}, + Address: common.Address{}, // Filled in by MaybeReadSimnetAddrs Gas: Gases{ Swap: 174_000, // [171756 284366 396976 509586 622184] SwapAdd: 115_000, @@ -254,6 +285,32 @@ var Tokens = map[uint32]*Token{ Transfer: 82_124, }, }, + 1: { + // deploy tx: https://etherscan.io/tx/0xf0549c2ec72d1beba23b239a1ad5901c7efce1daeeb38e976f8da224112380a9 + // swap contract: https://etherscan.io/address/0x11158fDeF839FC4e50b78cc3931683b441E8B9f5 + Address: common.HexToAddress("0x11158fDeF839FC4e50b78cc3931683b441E8B9f5"), + // First swap used 95314 gas Recommended Gases.Swap = 123908 + // 1 additional swaps averaged 26503 gas each. Recommended Gases.SwapAdd = 34453 + // [95314 121817] + // First redeem used 55512 gas. Recommended Gases.Redeem = 72165 + // 1 additional redeems averaged 10710 gas each. recommended Gases.RedeemAdd = 13923 + // [55512 66222] + // Average of 2 refunds: 59072. Recommended Gases.Refund = 76793 + // [59036 59109] + // Average of 2 approvals: 48897. Recommended Gases.Approve = 63566 + // [48897 48897] + // Average of 1 transfers: 63173. Recommended Gases.Transfer = 82124 + // [63173] + Gas: Gases{ + Swap: 123_908, + SwapAdd: 34_453, + Redeem: 72_165, + RedeemAdd: 13_923, + Refund: 76_793, + Approve: 63_566, + Transfer: 82_124, + }, + }, }, }, dex.Testnet: { @@ -285,13 +342,39 @@ var Tokens = map[uint32]*Token{ Transfer: 82_196, }, }, + 1: { + // deploy tx: https://sepolia.etherscan.io/tx/0x2298079e0201e9fd82b0294e4e32607174090c3f84313560d8e18179d3051fe3 + // swap contract: https://sepolia.etherscan.io/address/0x10cFdf5ba50ebc3974564913eF983B46FD4A08F4 + Address: common.HexToAddress("0x10cFdf5ba50ebc3974564913eF983B46FD4A08F4"), + Gas: Gases{ + // First swap used 95350 gas Recommended Gases.Swap = 123955 + // 2 additional swaps averaged 26501 gas each. Recommended Gases.SwapAdd = 34451 + // [95350 121853 148353] + // First redeem used 55567 gas. Recommended Gases.Redeem = 72237 + // 2 additional redeems averaged 10714 gas each. recommended Gases.RedeemAdd = 13928 + // [55567 66289 76995] + // Average of 3 refunds: 58950. Recommended Gases.Refund = 76635 + // [59092 58595 59164] + // Average of 2 approvals: 48930. Recommended Gases.Approve = 63609 + // [48930 48930] + // Average of 1 transfers: 63216. Recommended Gases.Transfer = 82180 + // [63216] + Swap: 123_955, + SwapAdd: 34_451, + Redeem: 72_237, + RedeemAdd: 13_928, + Refund: 76_635, + Approve: 63_609, + Transfer: 82_180, + }, + }, }, }, dex.Simnet: { Address: common.Address{}, SwapContracts: map[uint32]*SwapContract{ 0: { - Address: common.Address{}, + Address: common.Address{}, // Filled in by MaybeReadSimnetAddrs Gas: Gases{ Swap: 242_000, SwapAdd: 146_400, @@ -300,7 +383,8 @@ var Tokens = map[uint32]*Token{ Refund: 77_000, Approve: 78_400, Transfer: 85_100, - }}, + }, + }, }, }, }, diff --git a/dex/networks/polygon/params.go b/dex/networks/polygon/params.go index c77dac7eef..6ea4ce3b6a 100644 --- a/dex/networks/polygon/params.go +++ b/dex/networks/polygon/params.go @@ -38,8 +38,26 @@ var ( Refund: 55_000, } + v1Gases = &dexeth.Gases{ + Swap: 62_842, + // 4 additional swaps averaged 26499 gas each. Recommended Gases.SwapAdd = 34448 + // [48340 74837 101338 127836 154338] + SwapAdd: 34_448, + // First redeem used 39496 gas. Recommended Gases.Redeem = 51344 + Redeem: 51_344, + // 4 additional redeems averaged 10744 gas each. recommended Gases.RedeemAdd = 13967 + // [39496 50238 60984 71727 82473] + RedeemAdd: 13_967, + // *** Compare expected Swap + Redeem = 88k with UniSwap v2: 102k, v3: 127k + // *** A 1-match order is cheaper than UniSwap. + // Average of 5 refunds: 39918. Recommended Gases.Refund = 51893 + // [39918 39918 39918 39918 39918] + Refund: 51_893, + } + VersionedGases = map[uint32]*dexeth.Gases{ 0: v0Gases, + 1: v1Gases, } ContractAddresses = map[uint32]map[dex.Network]common.Address{ @@ -48,7 +66,11 @@ var ( dex.Testnet: common.HexToAddress("0x73bc803A2604b2c58B8680c3CE1b14489842EF16"), // txid: 0x88f656a8e432fdd50f33e67bdc39a66d24f663e33792bfab16b033dd2c609a99 dex.Simnet: common.HexToAddress(""), // Filled in by MaybeReadSimnetAddrs }, - 1: {}, + 1: { + dex.Mainnet: common.HexToAddress("0xcb9B5AD64FD3fc20215f744293d95887c888B8a5"), // txid: 0x35e5318f3b91b9890a59b0907c6fe9603cc46651111ee18e4df142c7a39cdc10 + dex.Testnet: common.HexToAddress("0xFbF60393F5AB800139F283cc6e090a17db6cC7a1"), // txid: 0xab730f7c64f4af013a590e0c9521a9caa29f549462de842c67c7c9c6c08f8c3e + dex.Simnet: common.HexToAddress(""), // Filled in by MaybeReadSimnetAddrs + }, } MultiBalanceAddresses = map[dex.Network]common.Address{ @@ -111,6 +133,32 @@ var ( Transfer: 85_150, }, }, + 1: { + // deploy tx: https://polygonscan.com/tx/0xd0b8a2ed95e522ebdb15490f2af8504dcb84d0081ad42e89278201696eff783a + // swap contract: https://polygonscan.com/address/0x4ce6d6514e27c703591eac3862b1f4aedb22a204 + Address: common.HexToAddress("0x4cE6D6514e27c703591eaC3862B1F4aedb22A204"), + Gas: dexeth.Gases{ + // First swap used 98322 gas Recommended Gases.Swap = 127818 + // 1 additional swaps averaged 26503 gas each. Recommended Gases.SwapAdd = 34453 + // [98322 124825] + // First redeem used 54684 gas. Recommended Gases.Redeem = 71089 + // 1 additional redeems averaged 10722 gas each. recommended Gases.RedeemAdd = 13938 + // [54684 65406] + // Average of 2 refunds: 60205. Recommended Gases.Refund = 78266 + // [60205 60205] + // Average of 2 approvals: 55785. Recommended Gases.Approve = 72520 + // [55785 55785] + // Average of 1 transfers: 62135. Recommended Gases.Transfer = 80775 + // [62135] + Swap: 127_818, + SwapAdd: 34_453, + Redeem: 71_089, + RedeemAdd: 13_938, + Refund: 78_266, + Approve: 72_520, + Transfer: 80_775, + }, + }, }, }, dex.Testnet: { @@ -142,6 +190,32 @@ var ( Transfer: 82_816, }, }, + 1: { + // deploy tx: https://amoy.polygonscan.com/tx/0x7e0ad6974b41bf0012877cbd6b966aca731cbed2838aa4616fcc2a8c369d661e + // swap contract: https://amoy.polygonscan.com/address/0xA41505bc164d1Fb70D25218EaFaD17C2D4e50e77 + Address: common.HexToAddress("0xA41505bc164d1Fb70D25218EaFaD17C2D4e50e77"), + Gas: dexeth.Gases{ + // First swap used 98322 gas Recommended Gases.Swap = 127818 + // 2 additional swaps averaged 26495 gas each. Recommended Gases.SwapAdd = 34443 + // [98322 124825 151313] + // First redeem used 54684 gas. Recommended Gases.Redeem = 71089 + // 2 additional redeems averaged 10708 gas each. recommended Gases.RedeemAdd = 13920 + // [54684 65406 76100] + // Average of 3 refunds: 57705. Recommended Gases.Refund = 75016 + // [57705 57705 57705] + // Average of 2 approvals: 55785. Recommended Gases.Approve = 72520 + // [55785 55785] + // Average of 1 transfers: 62135. Recommended Gases.Transfer = 80775 + // [62135] + Swap: 127_818, + SwapAdd: 34_443, + Redeem: 71_089, + RedeemAdd: 13_920, + Refund: 75_016, + Approve: 72_520, + Transfer: 80_775, + }, + }, }, }, dex.Simnet: { @@ -160,7 +234,7 @@ var ( }, }, 1: { - Address: common.Address{}, + Address: common.Address{}, // Filled in by MaybeReadSimnetAddrs Gas: dexeth.Gases{ Swap: 174_000, // [171756 284366 396976 509586 622184] SwapAdd: 115_000, @@ -220,6 +294,32 @@ var ( Transfer: 74_451, }, }, + 1: { + // deploy tx: https://polygonscan.com/tx/0x55d6228406d116bf3a0a6678dc019f58c3e0d6a55c5f6a653c6825f741d717b0 + // swap contract: https://polygonscan.com/address/0x14D19F97785A299c47a4e10601C5780bdb9A0206 + Address: common.HexToAddress("0x14D19F97785A299c47a4e10601C5780bdb9A0206"), + Gas: dexeth.Gases{ + // First swap used 95187 gas Recommended Gases.Swap = 123743 + // 1 additional swaps averaged 26503 gas each. Recommended Gases.SwapAdd = 34453 + // [95187 121690] + // First redeem used 49819 gas. Recommended Gases.Redeem = 64764 + // 1 additional redeems averaged 10722 gas each. recommended Gases.RedeemAdd = 13938 + // [49819 60541] + // Average of 2 refunds: 62502. Recommended Gases.Refund = 81252 + // [62502 62502] + // Average of 2 approvals: 52072. Recommended Gases.Approve = 67693 + // [52072 52072] + // Average of 1 transfers: 57270. Recommended Gases.Transfer = 74451 + // [57270] + Swap: 123_743, + SwapAdd: 34_453, + Redeem: 72_237, // using eth testnet value which is higher + RedeemAdd: 13_928, + Refund: 81_252, + Approve: 67_693, + Transfer: 82_180, // using eth testnet value which is higher + }, + }, }, }, dex.Simnet: { @@ -286,6 +386,32 @@ var ( Transfer: 67_483, }, }, + 1: { + // deploy tx: https://polygonscan.com/tx/0xaf897a42db8bd52fa1a233489746561def4562d933d23795f7e5774a32b0afd9 + // swap contract: https://polygonscan.com/address/0xD123F0ed3c97b2990A11BF5C06eed3e184b4aEAC + Address: common.HexToAddress("0xD123F0ed3c97b2990A11BF5C06eed3e184b4aEAC"), + Gas: dexeth.Gases{ + // First swap used 89867 gas Recommended Gases.Swap = 116827 + // 1 additional swaps averaged 26527 gas each. Recommended Gases.SwapAdd = 34485 + // [89867 116394] + // First redeem used 44483 gas. Recommended Gases.Redeem = 57827 + // 1 additional redeems averaged 10746 gas each. recommended Gases.RedeemAdd = 13969 + // [44483 55229] + // Average of 2 refunds: 49766. Recommended Gases.Refund = 64695 + // [49766 49766] + // Average of 2 approvals: 46712. Recommended Gases.Approve = 60725 + // [46712 46712] + // Average of 1 transfers: 51910. Recommended Gases.Transfer = 67483 + // [51910] + Swap: 116_827, + SwapAdd: 34_485, + Redeem: 57_827, + RedeemAdd: 13_969, + Refund: 64_695, + Approve: 60_725, + Transfer: 67_483, + }, + }, }, }, }, @@ -338,6 +464,32 @@ var ( Transfer: 74_451, }, }, + 1: { + // deploy tx: https://polygonscan.com/tx/0xbcd772a2439c56ea1ba96437775dde729ac6f1b992ed93c06fad588cc4e4cd26 + // swap contract: https://polygonscan.com/address/0xA2A3B9CFFd040C7DddF1c8153b5501c3492F7B18 + Address: common.HexToAddress("0xA2A3B9CFFd040C7DddF1c8153b5501c3492F7B18"), + Gas: dexeth.Gases{ + // First swap used 95187 gas Recommended Gases.Swap = 123743 + // 1 additional swaps averaged 26503 gas each. Recommended Gases.SwapAdd = 34453 + // [95187 121690] + // First redeem used 49819 gas. Recommended Gases.Redeem = 64764 + // 1 additional redeems averaged 10722 gas each. recommended Gases.RedeemAdd = 13938 + // [49819 60541] + // Average of 2 refunds: 62502. Recommended Gases.Refund = 81252 + // [62502 62502] + // Average of 2 approvals: 52072. Recommended Gases.Approve = 67693 + // [52072 52072] + // Average of 1 transfers: 57270. Recommended Gases.Transfer = 74451 + // [57270] + Swap: 123_743, + SwapAdd: 34_453, + Redeem: 64_764, + RedeemAdd: 13_938, + Refund: 81_252, + Approve: 67_693, + Transfer: 74_451, + }, + }, }, }, }, diff --git a/dex/testing/dcrdex/harness.sh b/dex/testing/dcrdex/harness.sh index edb7f267ed..a94c0624ad 100755 --- a/dex/testing/dcrdex/harness.sh +++ b/dex/testing/dcrdex/harness.sh @@ -127,8 +127,6 @@ chmod +x "${DCRDEX_DATA_DIR}/quit" cat > "${DCRDEX_DATA_DIR}/evm-protocol-overrides.json" < "${NODES_ROOT}/eth_swap_contract_address_v0.txt" < "${NODES_ROOT}/eth_swap_contract_address_v1.txt" < "${HARNESS_DIR}/sendUSDT" < "${NODES_ROOT}/usdc_swap_contract_address_v0.txt" < "${NODES_ROOT}/usdc_swap_contract_address_v1.txt" < "${HARNESS_DIR}/bw1ctl" chmod +x "${HARNESS_DIR}/bw1ctl" echo "xdg-open http://${CLIENT_2_ADDR} > /dev/null 2>&1" > "${HARNESS_DIR}/dexc2" -chmod +x "${HARNESS_DIR}/dexc2" +chmod +x "${HARNESS_DIR}/bisonw2" echo "bwctl -C ${CLIENT_2_CTL_CONF} \$1" > "${HARNESS_DIR}/bw2ctl" chmod +x "${HARNESS_DIR}/bw2ctl" diff --git a/server/asset/eth/coiner_test.go b/server/asset/eth/coiner_test.go index 1b658b989a..2ea5f83f1c 100644 --- a/server/asset/eth/coiner_test.go +++ b/server/asset/eth/coiner_test.go @@ -123,8 +123,6 @@ func TestNewRedeemCoin(t *testing.T) { t.Fatalf("unexpected error for test %q: %v", test.name, err) } - fmt.Println("--", rc.gasFeeCap == nil, rc.gasTipCap == nil) - if test.txErr == nil && (!bytes.Equal(rc.locator, test.locator) || rc.secret != secretB || rc.value != 0 || diff --git a/server/cmd/dcrdex/evm-protocol-overrides.json b/server/cmd/dcrdex/evm-protocol-overrides.json index ad3cb65d05..9e26dfeeb6 100644 --- a/server/cmd/dcrdex/evm-protocol-overrides.json +++ b/server/cmd/dcrdex/evm-protocol-overrides.json @@ -1,10 +1 @@ -{ - "eth": 0, - "usdc.eth": 0, - "usdt.eth": 0, - "polygon": 0, - "usdc.polygon": 0, - "usdt.polygon": 0, - "wbtc.polygon": 0, - "weth.polygon": 0 -} \ No newline at end of file +{} \ No newline at end of file