From ed1eafafb51661cf5d6d831637f34ee3e5de8a37 Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Mon, 17 Mar 2025 21:27:41 -0400 Subject: [PATCH 1/9] feat: adding some fixes for eip-1559 --- cmd/loadtest/app.go | 29 ++++++----- cmd/loadtest/loadtest.go | 104 ++++++++++++++++++++++++-------------- cmd/loadtest/uniswapv3.go | 2 +- 3 files changed, 84 insertions(+), 51 deletions(-) diff --git a/cmd/loadtest/app.go b/cmd/loadtest/app.go index 286e34158..7eab9b06d 100644 --- a/cmd/loadtest/app.go +++ b/cmd/loadtest/app.go @@ -81,21 +81,23 @@ type ( InscriptionContent *string BlobFeeCap *uint64 StartNonce *uint64 + GasPriceMultiplier *float64 // Computed - CurrentGasPrice *big.Int - CurrentGasTipCap *big.Int - CurrentNonce *uint64 - ECDSAPrivateKey *ecdsa.PrivateKey - FromETHAddress *ethcommon.Address - ToETHAddress *ethcommon.Address - ContractETHAddress *ethcommon.Address - SendAmount *big.Int - CurrentBaseFee *big.Int - ChainSupportBaseFee bool - Mode loadTestMode - ParsedModes []loadTestMode - MultiMode bool + CurrentGasPrice *big.Int + CurrentGasTipCap *big.Int + CurrentNonce *uint64 + ECDSAPrivateKey *ecdsa.PrivateKey + FromETHAddress *ethcommon.Address + ToETHAddress *ethcommon.Address + ContractETHAddress *ethcommon.Address + SendAmount *big.Int + CurrentBaseFee *big.Int + ChainSupportBaseFee bool + Mode loadTestMode + ParsedModes []loadTestMode + MultiMode bool + BigGasPriceMultiplier *big.Float } ) @@ -226,6 +228,7 @@ func initFlags() { ltp.AdaptiveRateLimitIncrement = LoadtestCmd.PersistentFlags().Uint64("adaptive-rate-limit-increment", 50, "When using adaptive rate limiting, this flag controls the size of the additive increases.") ltp.AdaptiveCycleDuration = LoadtestCmd.PersistentFlags().Uint64("adaptive-cycle-duration-seconds", 10, "When using adaptive rate limiting, this flag controls how often we check the queue size and adjust the rates") ltp.AdaptiveBackoffFactor = LoadtestCmd.PersistentFlags().Float64("adaptive-backoff-factor", 2, "When using adaptive rate limiting, this flag controls our multiplicative decrease value.") + ltp.GasPriceMultiplier = LoadtestCmd.PersistentFlags().Float64("gas-price-multiplier", 1, "A multiplier to increase or decrease the gas price") ltp.Iterations = LoadtestCmd.PersistentFlags().Uint64P("iterations", "i", 1, "If we're making contract calls, this controls how many times the contract will execute the instruction in a loop. If we are making ERC721 Mints, this indicates the minting batch size") ltp.Seed = LoadtestCmd.PersistentFlags().Int64("seed", 123456, "A seed for generating random values and addresses") ltp.ForceGasLimit = LoadtestCmd.PersistentFlags().Uint64("gas-limit", 0, "In environments where the gas limit can't be computed on the fly, we can specify it manually. This can also be used to avoid eth_estimateGas") diff --git a/cmd/loadtest/loadtest.go b/cmd/loadtest/loadtest.go index 3f53f1f8e..15fc9e17a 100644 --- a/cmd/loadtest/loadtest.go +++ b/cmd/loadtest/loadtest.go @@ -250,6 +250,8 @@ func initializeLoadTestParams(ctx context.Context, c *ethclient.Client) error { } log.Trace().Uint64("chainID", chainID.Uint64()).Msg("Detected Chain ID") + inputLoadTestParams.BigGasPriceMultiplier = big.NewFloat(*inputLoadTestParams.GasPriceMultiplier) + if *inputLoadTestParams.LegacyTransactionMode && *inputLoadTestParams.ForcePriorityGasPrice > 0 { log.Warn().Msg("Cannot set priority gas price in legacy mode") } @@ -481,7 +483,9 @@ func runLoadTest(ctx context.Context) error { log.Error().Err(err).Msg("There was an issue creating the load test summary") } } else { - lightSummary(loadTestResults, loadTestResults[0].RequestTime, time.Now(), rl) + if len(loadTestResults) > 0 { + lightSummary(loadTestResults, loadTestResults[0].RequestTime, time.Now(), rl) + } } cancel() case err = <-errCh: @@ -573,7 +577,7 @@ func mainLoop(ctx context.Context, c *ethclient.Client, rpc *ethrpc.Client) erro } tops, err := bind.NewKeyedTransactorWithChainID(privateKey, chainID) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) // configureTransactOpts will set some parameters meant for load testing that could interfere with the deployment of our contracts tops.GasLimit = 0 tops.GasPrice = nil @@ -778,6 +782,9 @@ func mainLoop(ctx context.Context, c *ethclient.Client, rpc *ethrpc.Client) erro if strings.Contains(tErr.Error(), "could not replace existing") && retryForNonce { retryForNonce = false } + if strings.Contains(tErr.Error(), "fee cap less than block base fee") { + retryForNonce = true + } } @@ -908,8 +915,7 @@ func loadTestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64) return } tops.GasLimit = uint64(21000) - tops = configureTransactOpts(tops) - gasPrice, gasTipCap := getSuggestedGasPrices(ctx, c) + tops = configureTransactOpts(ctx, c, tops) var tx *ethtypes.Transaction if *ltp.LegacyTransactionMode { @@ -918,7 +924,7 @@ func loadTestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64) To: to, Value: amount, Gas: tops.GasLimit, - GasPrice: gasPrice, + GasPrice: tops.GasPrice, Data: nil, }) } else { @@ -927,8 +933,8 @@ func loadTestTransaction(ctx context.Context, c *ethclient.Client, nonce uint64) Nonce: nonce, To: to, Gas: tops.GasLimit, - GasFeeCap: gasPrice, - GasTipCap: gasTipCap, + GasFeeCap: tops.GasFeeCap, + GasTipCap: tops.GasTipCap, Data: nil, Value: amount, } @@ -980,6 +986,14 @@ func getLatestBlockNumber(ctx context.Context, c *ethclient.Client) uint64 { return bn } +func biasGasPrice(price *big.Int) *big.Int { + gasPriceFloat := new(big.Float).SetInt(price) + gasPriceFloat.Mul(gasPriceFloat, inputLoadTestParams.BigGasPriceMultiplier) + result := new(big.Int) + gasPriceFloat.Int(result) + return result +} + func getSuggestedGasPrices(ctx context.Context, c *ethclient.Client) (*big.Int, *big.Int) { // this should be one of the fastest RPC calls, so hopefully there isn't too much overhead calling this bn := getLatestBlockNumber(ctx, c) @@ -993,6 +1007,7 @@ func getSuggestedGasPrices(ctx context.Context, c *ethclient.Client) (*big.Int, if bn <= cachedBlockNumber { return cachedGasPrice, cachedGasTipCap } + // In the case of an EVM compatible system not supporting EIP-1559 var gt *big.Int var tErr error @@ -1001,24 +1016,31 @@ func getSuggestedGasPrices(ctx context.Context, c *ethclient.Client) (*big.Int, tErr = nil } else { gt, tErr = c.SuggestGasTipCap(ctx) + if tErr == nil { + // Bias the value up slightly + gt = biasGasPrice(gt) + } } gp, pErr := c.SuggestGasPrice(ctx) + if pErr == nil { + // Bias the value up slightly + gp = biasGasPrice(gp) + } if pErr == nil && (tErr == nil || !isDynamic) { cachedBlockNumber = bn cachedGasPrice = gp cachedGasTipCap = gt + if inputLoadTestParams.ForceGasPrice != nil && *inputLoadTestParams.ForceGasPrice != 0 { cachedGasPrice = new(big.Int).SetUint64(*inputLoadTestParams.ForceGasPrice) } if inputLoadTestParams.ForcePriorityGasPrice != nil && *inputLoadTestParams.ForcePriorityGasPrice != 0 { cachedGasTipCap = new(big.Int).SetUint64(*inputLoadTestParams.ForcePriorityGasPrice) } - if cachedGasTipCap.Cmp(cachedGasPrice) == 1 { - cachedGasTipCap = cachedGasPrice - } - l := log.Debug().Uint64("cachedBlockNumber", bn).Uint64("cachedgasPrice", cachedGasPrice.Uint64()) + + l := log.Debug().Uint64("cachedBlockNumber", bn).Uint64("cachedGasPrice", cachedGasPrice.Uint64()) if cachedGasTipCap != nil { l = l.Uint64("cachedGasTipCap", cachedGasTipCap.Uint64()) } @@ -1057,7 +1079,7 @@ func loadTestDeploy(ctx context.Context, c *ethclient.Client, nonce uint64) (t1 return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) t1 = time.Now() defer func() { t2 = time.Now() }() @@ -1101,7 +1123,7 @@ func loadTestFunction(ctx context.Context, c *ethclient.Client, nonce uint64, lt return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) t1 = time.Now() defer func() { t2 = time.Now() }() @@ -1143,7 +1165,7 @@ func loadTestCallPrecompiledContract(ctx context.Context, c *ethclient.Client, n return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) t1 = time.Now() defer func() { t2 = time.Now() }() @@ -1178,7 +1200,7 @@ func loadTestIncrement(ctx context.Context, c *ethclient.Client, nonce uint64, l return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) t1 = time.Now() defer func() { t2 = time.Now() }() @@ -1214,7 +1236,7 @@ func loadTestStore(ctx context.Context, c *ethclient.Client, nonce uint64, ltCon return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) inputData := make([]byte, *ltp.ByteCount) _, _ = hexwordRead(inputData) @@ -1257,7 +1279,7 @@ func loadTestERC20(ctx context.Context, c *ethclient.Client, nonce uint64, erc20 return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) t1 = time.Now() defer func() { t2 = time.Now() }() @@ -1300,7 +1322,7 @@ func loadTestERC721(ctx context.Context, c *ethclient.Client, nonce uint64, erc7 return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) t1 = time.Now() defer func() { t2 = time.Now() }() @@ -1336,9 +1358,9 @@ func loadTestRecall(ctx context.Context, c *ethclient.Client, nonce uint64, orig log.Error().Err(err).Msg("Unable create transaction signer") return } - gasPrice, gasTipCap := getSuggestedGasPrices(ctx, c) - tx := rawTransactionToNewTx(originalTx, nonce, gasPrice, gasTipCap) - tops = configureTransactOpts(tops) + + tops = configureTransactOpts(ctx, c, tops) + tx := rawTransactionToNewTx(originalTx, nonce, tops.GasPrice, tops.GasTipCap) stx, err = tops.Signer(*ltp.FromETHAddress, tx) if err != nil { @@ -1512,8 +1534,7 @@ func loadTestContractCall(ctx context.Context, c *ethclient.Client, nonce uint64 amount = ltp.SendAmount } - tops = configureTransactOpts(tops) - gasPrice, gasTipCap := getSuggestedGasPrices(ctx, c) + tops = configureTransactOpts(ctx, c, tops) var stringCallData string @@ -1562,7 +1583,7 @@ func loadTestContractCall(ctx context.Context, c *ethclient.Client, nonce uint64 To: to, Value: amount, Gas: tops.GasLimit, - GasPrice: gasPrice, + GasPrice: tops.GasPrice, Data: calldata, }) } else { @@ -1571,8 +1592,8 @@ func loadTestContractCall(ctx context.Context, c *ethclient.Client, nonce uint64 Nonce: nonce, To: to, Gas: tops.GasLimit, - GasFeeCap: gasPrice, - GasTipCap: gasTipCap, + GasFeeCap: tops.GasFeeCap, + GasTipCap: tops.GasTipCap, Data: calldata, Value: amount, }) @@ -1616,8 +1637,7 @@ func loadTestInscription(ctx context.Context, c *ethclient.Client, nonce uint64) } amount := big.NewInt(0) - tops = configureTransactOpts(tops) - gasPrice, gasTipCap := getSuggestedGasPrices(ctx, c) + tops = configureTransactOpts(ctx, c, tops) calldata := []byte(*ltp.InscriptionContent) if tops.GasLimit == 0 { @@ -1643,7 +1663,7 @@ func loadTestInscription(ctx context.Context, c *ethclient.Client, nonce uint64) To: to, Value: amount, Gas: tops.GasLimit, - GasPrice: gasPrice, + GasPrice: tops.GasPrice, Data: calldata, }) } else { @@ -1652,8 +1672,8 @@ func loadTestInscription(ctx context.Context, c *ethclient.Client, nonce uint64) Nonce: nonce, To: to, Gas: tops.GasLimit, - GasFeeCap: gasPrice, - GasTipCap: gasTipCap, + GasFeeCap: tops.GasFeeCap, + GasTipCap: tops.GasTipCap, Data: calldata, Value: amount, }) @@ -1789,7 +1809,10 @@ func getRandomAddress() *ethcommon.Address { return &realAddr } -func configureTransactOpts(tops *bind.TransactOpts) *bind.TransactOpts { +func configureTransactOpts(ctx context.Context, c *ethclient.Client, tops *bind.TransactOpts) *bind.TransactOpts { + gasPrice, gasTipCap := getSuggestedGasPrices(ctx, c) + tops.GasPrice = gasPrice + ltp := inputLoadTestParams if ltp.ForceGasPrice != nil && *ltp.ForceGasPrice != 0 { @@ -1803,17 +1826,24 @@ func configureTransactOpts(tops *bind.TransactOpts) *bind.TransactOpts { if *ltp.LegacyTransactionMode { return tops } + if ltp.CurrentBaseFee == nil { + log.Fatal().Msg("EIP-1559 not activated. Please use --legacy") + } + + tops.GasPrice = nil + tops.GasTipCap = gasTipCap + tops.GasFeeCap = gasTipCap if ltp.ForcePriorityGasPrice != nil && *ltp.ForcePriorityGasPrice != 0 { tops.GasTipCap = big.NewInt(0).SetUint64(*ltp.ForcePriorityGasPrice) } - - if ltp.CurrentBaseFee == nil { - log.Fatal().Msg("EIP-1559 not activated. Please use --legacy") + if ltp.ForceGasPrice != nil && *ltp.ForceGasPrice != 0 { + tops.GasFeeCap = big.NewInt(0).SetUint64(*ltp.ForceGasPrice) } - tops.GasPrice = nil - tops.GasFeeCap = big.NewInt(0).Add(ltp.CurrentBaseFee, ltp.CurrentGasTipCap) + if tops.GasTipCap.Cmp(tops.GasFeeCap) == 1 { + tops.GasTipCap = new(big.Int).Set(tops.GasFeeCap) + } return tops } diff --git a/cmd/loadtest/uniswapv3.go b/cmd/loadtest/uniswapv3.go index 2515bd206..4e552cc90 100644 --- a/cmd/loadtest/uniswapv3.go +++ b/cmd/loadtest/uniswapv3.go @@ -145,7 +145,7 @@ func runUniswapV3Loadtest(ctx context.Context, c *ethclient.Client, nonce uint64 return } tops.Nonce = new(big.Int).SetUint64(nonce) - tops = configureTransactOpts(tops) + tops = configureTransactOpts(ctx, c, tops) t1 = time.Now() defer func() { t2 = time.Now() }() From ab28ce4769db025865d1170f274e1fd1eff37e3b Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Tue, 18 Mar 2025 09:36:49 -0400 Subject: [PATCH 2/9] feat: adding log of when lt generation stopped --- cmd/loadtest/output.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cmd/loadtest/output.go b/cmd/loadtest/output.go index 8b54838ff..df389c09d 100644 --- a/cmd/loadtest/output.go +++ b/cmd/loadtest/output.go @@ -486,8 +486,10 @@ func lightSummary(lts []loadTestSample, startTime, endTime time.Time, rl *rate.L minLat, _ := stats.Min(latencies) maxLat, _ := stats.Max(latencies) stddevLat, _ := stats.StandardDeviation(latencies) + lastLTSample := lastSample(lts) log.Info().Time("startTime", startTime).Msg("Start time of loadtest (first transaction sent)") + log.Info().Time("loadStopTime", lastLTSample.RequestTime).Msg("End of load generation (last transaction sent)") log.Info().Time("endTime", endTime).Msg("End time of loadtest (final transaction mined)") log.Info().Float64("tps", tps).Msg("Successful Requests Per Second") // Only output total rates per second if there are failed transactions and TPS != RPS @@ -507,3 +509,15 @@ func lightSummary(lts []loadTestSample, startTime, endTime time.Time, rl *rate.L Msg("Rough test summary") log.Info().Uint64("numErrors", numErrors).Msg("Num errors") } + +func lastSample(lts []loadTestSample) loadTestSample { + var maxTime time.Time + var maxIdx int + for idx, lt := range lts { + if maxTime.Before(lt.RequestTime) { + maxTime = lt.RequestTime + maxIdx = idx + } + } + return lts[maxIdx] +} From 2bbc7f4f61cb2b59f77c2a9b4fcb395a5ad0f43d Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Tue, 18 Mar 2025 12:47:59 -0400 Subject: [PATCH 3/9] feat: some fixes related to token reuse --- cmd/loadtest/uniswapv3.go | 10 +++++++++- cmd/loadtest/uniswapv3/swap.go | 7 ++++++- cmd/loadtest/uniswapv3/swapper.go | 5 +++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cmd/loadtest/uniswapv3.go b/cmd/loadtest/uniswapv3.go index 4e552cc90..47f705463 100644 --- a/cmd/loadtest/uniswapv3.go +++ b/cmd/loadtest/uniswapv3.go @@ -60,6 +60,10 @@ func checkUniswapV3LoadtestFlags() error { if *uniswapv3LoadTestParams.SwapAmountInput == 0 { return errors.New("swap amount input has to be greater than zero") } + + if (*uniswapv3LoadTestParams.UniswapPoolToken0 != "") != (*uniswapv3LoadTestParams.UniswapPoolToken1 != "") { + return errors.New("both pool tokens must be empty or specified. Specifying only one token is not allowed") + } return nil } @@ -121,7 +125,11 @@ func initUniswapV3Loadtest(ctx context.Context, c *ethclient.Client, tops *bind. return } - log.Debug().Msg("🎱 Deploying UniswapV3 liquidity pool...") + log.Debug(). + Stringer("token0address", token0.Address). + Stringer("token1address", token1.Address). + Msg("🎱 Deploying UniswapV3 liquidity pool...") + fees := uniswapv3loadtest.PercentageToUniswapFeeTier(*uniswapv3LoadTestParams.PoolFees) poolConfig = *uniswapv3loadtest.NewPool(token0, token1, fees) if err = uniswapv3loadtest.SetupLiquidityPool(ctx, c, tops, cops, uniswapV3Config, poolConfig, recipient); err != nil { diff --git a/cmd/loadtest/uniswapv3/swap.go b/cmd/loadtest/uniswapv3/swap.go index 9d23ed1f3..d471fe823 100644 --- a/cmd/loadtest/uniswapv3/swap.go +++ b/cmd/loadtest/uniswapv3/swap.go @@ -21,7 +21,12 @@ func ExactInputSingleSwap(tops *bind.TransactOpts, swapRouter *uniswapv3.SwapRou swapDirection := getSwapDirection(nonce, poolConfig) // Perform swap. - amountOut := new(big.Int).Mul(amountIn, new(big.Int).Div(big.NewInt(98), big.NewInt(100))) + slippageFactor := new(big.Float).SetFloat64(0.75) + amountInFloat := new(big.Float).SetInt(amountIn) + amountInFloat.Mul(amountInFloat, slippageFactor) + amountOut := new(big.Int) + amountInFloat.Int(amountOut) + tx, err = swapRouter.ExactInputSingle(tops, uniswapv3.IV3SwapRouterExactInputSingleParams{ // The contract address of the inbound token. TokenIn: swapDirection.tokenIn, diff --git a/cmd/loadtest/uniswapv3/swapper.go b/cmd/loadtest/uniswapv3/swapper.go index 41f6c7bba..b042e791b 100644 --- a/cmd/loadtest/uniswapv3/swapper.go +++ b/cmd/loadtest/uniswapv3/swapper.go @@ -48,7 +48,12 @@ func DeployERC20(ctx context.Context, c *ethclient.Client, tops *bind.TransactOp "NFTPositionManager": uniswapV3Config.NonfungiblePositionManager.Address, "SwapRouter02": uniswapV3Config.SwapRouter02.Address, } + if tokenKnownAddress != (common.Address{}) { + log.Info().Stringer("tokenAddress", tokenKnownAddress).Msg("Skipping allowance setup for known token contract") + return nil + } return setUniswapV3Allowances(ctx, c, contract, tops, cops, tokenName, uniswapV3Addresses, recipient) + }, ) if err != nil { From 542f111b0c5f61b69cbceca67c038887013a0a7f Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Tue, 18 Mar 2025 13:26:39 -0400 Subject: [PATCH 4/9] fix: changing from swapper to erc20 --- cmd/loadtest/uniswapv3.go | 6 +++--- cmd/loadtest/uniswapv3/deploy.go | 3 ++- cmd/loadtest/uniswapv3/pool.go | 5 +++-- cmd/loadtest/uniswapv3/swapper.go | 16 ++++++++-------- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/cmd/loadtest/uniswapv3.go b/cmd/loadtest/uniswapv3.go index 47f705463..7259b27fc 100644 --- a/cmd/loadtest/uniswapv3.go +++ b/cmd/loadtest/uniswapv3.go @@ -5,13 +5,13 @@ import ( _ "embed" "errors" "fmt" + "github.com/0xPolygon/polygon-cli/bindings/tokens" ethtypes "github.com/ethereum/go-ethereum/core/types" "math/big" "time" "github.com/spf13/cobra" - "github.com/0xPolygon/polygon-cli/bindings/uniswapv3" uniswapv3loadtest "github.com/0xPolygon/polygon-cli/cmd/loadtest/uniswapv3" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -111,14 +111,14 @@ func initUniswapV3Loadtest(ctx context.Context, c *ethclient.Client, tops *bind. log.Debug().Interface("addresses", uniswapV3Config.GetAddresses()).Msg("UniswapV3 deployed") log.Debug().Msg("🪙 Deploying ERC20 tokens...") - var token0 uniswapv3loadtest.ContractConfig[uniswapv3.Swapper] + var token0 uniswapv3loadtest.ContractConfig[tokens.ERC20] token0, err = uniswapv3loadtest.DeployERC20( ctx, c, tops, cops, uniswapV3Config, "SwapperA", "SA", uniswapv3loadtest.MintAmount, recipient, common.HexToAddress(*uniswapv3LoadTestParams.UniswapPoolToken0)) if err != nil { return } - var token1 uniswapv3loadtest.ContractConfig[uniswapv3.Swapper] + var token1 uniswapv3loadtest.ContractConfig[tokens.ERC20] token1, err = uniswapv3loadtest.DeployERC20( ctx, c, tops, cops, uniswapV3Config, "SwapperB", "SB", uniswapv3loadtest.MintAmount, recipient, common.HexToAddress(*uniswapv3LoadTestParams.UniswapPoolToken1)) if err != nil { diff --git a/cmd/loadtest/uniswapv3/deploy.go b/cmd/loadtest/uniswapv3/deploy.go index ec298437a..3bba192bd 100644 --- a/cmd/loadtest/uniswapv3/deploy.go +++ b/cmd/loadtest/uniswapv3/deploy.go @@ -3,6 +3,7 @@ package uniswapv3loadtest import ( "context" "errors" + "github.com/0xPolygon/polygon-cli/bindings/tokens" "math/big" "reflect" "strings" @@ -65,7 +66,7 @@ type ( // Contract represents a UniswapV3 contract (including WETH9 and Swapper). Contract interface { - uniswapv3.UniswapV3Factory | uniswapv3.UniswapInterfaceMulticall | uniswapv3.ProxyAdmin | uniswapv3.TickLens | uniswapv3.NFTDescriptor | uniswapv3.NonfungibleTokenPositionDescriptor | uniswapv3.TransparentUpgradeableProxy | uniswapv3.NonfungiblePositionManager | uniswapv3.V3Migrator | uniswapv3.UniswapV3Staker | uniswapv3.QuoterV2 | uniswapv3.SwapRouter02 | uniswapv3.WETH9 | uniswapv3.Swapper + uniswapv3.UniswapV3Factory | uniswapv3.UniswapInterfaceMulticall | uniswapv3.ProxyAdmin | uniswapv3.TickLens | uniswapv3.NFTDescriptor | uniswapv3.NonfungibleTokenPositionDescriptor | uniswapv3.TransparentUpgradeableProxy | uniswapv3.NonfungiblePositionManager | uniswapv3.V3Migrator | uniswapv3.UniswapV3Staker | uniswapv3.QuoterV2 | uniswapv3.SwapRouter02 | uniswapv3.WETH9 | uniswapv3.Swapper | tokens.ERC20 } ) diff --git a/cmd/loadtest/uniswapv3/pool.go b/cmd/loadtest/uniswapv3/pool.go index 8730e3585..d875b34ab 100644 --- a/cmd/loadtest/uniswapv3/pool.go +++ b/cmd/loadtest/uniswapv3/pool.go @@ -3,6 +3,7 @@ package uniswapv3loadtest import ( "context" "errors" + "github.com/0xPolygon/polygon-cli/bindings/tokens" "math/big" "time" @@ -51,13 +52,13 @@ func PercentageToUniswapFeeTier(p float64) *big.Int { // PoolConfig represents the configuration of a UniswapV3 pool. type PoolConfig struct { - Token0, Token1 ContractConfig[uniswapv3.Swapper] + Token0, Token1 ContractConfig[tokens.ERC20] ReserveA, ReserveB *big.Int Fees *big.Int } // Create a new `PoolConfig` object. -func NewPool(token0, token1 ContractConfig[uniswapv3.Swapper], fees *big.Int) *PoolConfig { +func NewPool(token0, token1 ContractConfig[tokens.ERC20], fees *big.Int) *PoolConfig { p := PoolConfig{ ReserveA: poolReserveForOneToken, ReserveB: poolReserveForOneToken, diff --git a/cmd/loadtest/uniswapv3/swapper.go b/cmd/loadtest/uniswapv3/swapper.go index b042e791b..7186b1388 100644 --- a/cmd/loadtest/uniswapv3/swapper.go +++ b/cmd/loadtest/uniswapv3/swapper.go @@ -4,9 +4,9 @@ import ( "context" "errors" "fmt" + "github.com/0xPolygon/polygon-cli/bindings/tokens" "math/big" - "github.com/0xPolygon/polygon-cli/bindings/uniswapv3" "github.com/0xPolygon/polygon-cli/util" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/common" @@ -25,23 +25,23 @@ var ( ) // Deploy an ERC20 token. -func DeployERC20(ctx context.Context, c *ethclient.Client, tops *bind.TransactOpts, cops *bind.CallOpts, uniswapV3Config UniswapV3Config, tokenName, tokenSymbol string, amount *big.Int, recipient common.Address, tokenKnownAddress common.Address) (tokenConfig ContractConfig[uniswapv3.Swapper], err error) { +func DeployERC20(ctx context.Context, c *ethclient.Client, tops *bind.TransactOpts, cops *bind.CallOpts, uniswapV3Config UniswapV3Config, tokenName, tokenSymbol string, amount *big.Int, recipient common.Address, tokenKnownAddress common.Address) (tokenConfig ContractConfig[tokens.ERC20], err error) { tokenConfig.Address, tokenConfig.Contract, err = deployOrInstantiateContract( ctx, c, tops, cops, tokenKnownAddress, - func(*bind.TransactOpts, bind.ContractBackend) (common.Address, *types.Transaction, *uniswapv3.Swapper, error) { + func(*bind.TransactOpts, bind.ContractBackend) (common.Address, *types.Transaction, *tokens.ERC20, error) { var address common.Address var tx *types.Transaction - var contract *uniswapv3.Swapper - address, tx, contract, err = uniswapv3.DeploySwapper(tops, c, tokenName, tokenSymbol, amount, recipient) + var contract *tokens.ERC20 + address, tx, contract, err = tokens.DeployERC20(tops, c) if err != nil { return common.Address{}, nil, nil, err } log.Debug().Str("token", tokenName).Interface("amount", amount).Interface("recipient", recipient).Msg("Minted tokens") return address, tx, contract, nil }, - uniswapv3.NewSwapper, - func(contract *uniswapv3.Swapper) error { + tokens.NewERC20, + func(contract *tokens.ERC20) error { // After the contract has been deployed, we authorize a few UniswapV3 addresses to spend those ERC20 tokens. // This is required to be able to perform swaps later. uniswapV3Addresses := map[string]common.Address{ @@ -63,7 +63,7 @@ func DeployERC20(ctx context.Context, c *ethclient.Client, tops *bind.TransactOp } // Approve some UniswapV3 addresses to spend tokens on behalf of the token owner. -func setUniswapV3Allowances(ctx context.Context, c *ethclient.Client, contract *uniswapv3.Swapper, tops *bind.TransactOpts, cops *bind.CallOpts, tokenName string, addresses map[string]common.Address, owner common.Address) error { +func setUniswapV3Allowances(ctx context.Context, c *ethclient.Client, contract *tokens.ERC20, tops *bind.TransactOpts, cops *bind.CallOpts, tokenName string, addresses map[string]common.Address, owner common.Address) error { // Get the ERC20 contract name. erc20Name, err := contract.Name(cops) if err != nil { From e9d6cfc7ed8300c3398f18db5fcdd71aa8ab65db Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Tue, 18 Mar 2025 21:29:56 -0400 Subject: [PATCH 5/9] feat: adding logs for easy re-running --- cmd/loadtest/uniswapv3.go | 23 +++++++++++++++++++---- cmd/loadtest/uniswapv3/deploy.go | 18 +++++++++++------- cmd/loadtest/uniswapv3/swapper.go | 20 ++++++++++++++++---- 3 files changed, 46 insertions(+), 15 deletions(-) diff --git a/cmd/loadtest/uniswapv3.go b/cmd/loadtest/uniswapv3.go index 7259b27fc..d13667a54 100644 --- a/cmd/loadtest/uniswapv3.go +++ b/cmd/loadtest/uniswapv3.go @@ -125,13 +125,28 @@ func initUniswapV3Loadtest(ctx context.Context, c *ethclient.Client, tops *bind. return } - log.Debug(). - Stringer("token0address", token0.Address). - Stringer("token1address", token1.Address). - Msg("🎱 Deploying UniswapV3 liquidity pool...") + log.Info(). + Stringer("--uniswap-factory-v3-address", uniswapV3Config.FactoryV3.Address). + Stringer("--uniswap-migrator-address", uniswapV3Config.Migrator.Address). + Stringer("--uniswap-multicall-address", uniswapV3Config.Multicall.Address). + Stringer("--uniswap-nft-descriptor-lib-address", uniswapV3Config.NFTDescriptorLib.Address). + Stringer("--uniswap-nft-position-descriptor-address", uniswapV3Config.NonfungibleTokenPositionDescriptor.Address). + Stringer("--uniswap-non-fungible-position-manager-address", uniswapV3Config.NonfungiblePositionManager.Address). + Stringer("--uniswap-pool-token-0-address", token0.Address). + Stringer("--uniswap-pool-token-1-address", token1.Address). + Stringer("--uniswap-proxy-admin-address", uniswapV3Config.ProxyAdmin.Address). + Stringer("--uniswap-quoter-v2-address", uniswapV3Config.QuoterV2.Address). + Stringer("--uniswap-staker-address", uniswapV3Config.Staker.Address). + Stringer("--uniswap-swap-router-address", uniswapV3Config.SwapRouter02.Address). + Stringer("--uniswap-tick-lens-address", uniswapV3Config.TickLens.Address). + Stringer("--uniswap-upgradeable-proxy-address", uniswapV3Config.TransparentUpgradeableProxy.Address). + Stringer("--weth9-address", uniswapV3Config.WETH9.Address).Msg("Parameters to re-run") fees := uniswapv3loadtest.PercentageToUniswapFeeTier(*uniswapv3LoadTestParams.PoolFees) poolConfig = *uniswapv3loadtest.NewPool(token0, token1, fees) + if *uniswapv3LoadTestParams.UniswapPoolToken0 != "" { + return + } if err = uniswapv3loadtest.SetupLiquidityPool(ctx, c, tops, cops, uniswapV3Config, poolConfig, recipient); err != nil { return } diff --git a/cmd/loadtest/uniswapv3/deploy.go b/cmd/loadtest/uniswapv3/deploy.go index 3bba192bd..66ec72921 100644 --- a/cmd/loadtest/uniswapv3/deploy.go +++ b/cmd/loadtest/uniswapv3/deploy.go @@ -256,9 +256,11 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa return } - log.Debug().Msg("Step 11: Transfer UniswapV3Factory ownership") - if err = transferUniswapV3FactoryOwnership(config.FactoryV3.Contract, tops, cops, ownerAddress); err != nil { - return + if knownAddresses.FactoryV3 == (common.Address{}) { + log.Debug().Msg("Step 11: Transfer UniswapV3Factory ownership") + if err = transferUniswapV3FactoryOwnership(config.FactoryV3.Contract, tops, cops, ownerAddress); err != nil { + return + } } log.Debug().Msg("Step 12: UniswapV3Staker deployment") @@ -312,10 +314,12 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa if err != nil { return } - - log.Debug().Msg("Step 15: Transfer ProxyAdmin ownership") - if err = transferProxyAdminOwnership(config.ProxyAdmin.Contract, tops, cops, ownerAddress); err != nil { - return + + if knownAddresses.ProxyAdmin == (common.Address{}) { + log.Debug().Msg("Step 15: Transfer ProxyAdmin ownership") + if err = transferProxyAdminOwnership(config.ProxyAdmin.Contract, tops, cops, ownerAddress); err != nil { + return + } } return diff --git a/cmd/loadtest/uniswapv3/swapper.go b/cmd/loadtest/uniswapv3/swapper.go index 7186b1388..9e8407ef6 100644 --- a/cmd/loadtest/uniswapv3/swapper.go +++ b/cmd/loadtest/uniswapv3/swapper.go @@ -48,10 +48,10 @@ func DeployERC20(ctx context.Context, c *ethclient.Client, tops *bind.TransactOp "NFTPositionManager": uniswapV3Config.NonfungiblePositionManager.Address, "SwapRouter02": uniswapV3Config.SwapRouter02.Address, } - if tokenKnownAddress != (common.Address{}) { - log.Info().Stringer("tokenAddress", tokenKnownAddress).Msg("Skipping allowance setup for known token contract") - return nil - } + //if tokenKnownAddress != (common.Address{}) { + // log.Info().Stringer("tokenAddress", tokenKnownAddress).Msg("Skipping allowance setup for known token contract") + // return nil + //} return setUniswapV3Allowances(ctx, c, contract, tops, cops, tokenName, uniswapV3Addresses, recipient) }, @@ -72,6 +72,18 @@ func setUniswapV3Allowances(ctx context.Context, c *ethclient.Client, contract * } for spenderName, spenderAddress := range addresses { + var currentAllowance *big.Int + currentAllowance, err = contract.Allowance(cops, owner, spenderAddress) + + if err == nil && currentAllowance.Cmp(new(big.Int).SetInt64(0)) == 1 { + log.Debug(). + Str("tokenName", fmt.Sprintf("%s_%s", erc20Name, tokenName)). + Interface("spenderAddress", spenderAddress).Str("spenderName", spenderName). + Interface("amount", allowanceAmount). + Msg("Skipping allowance setting") + continue + } + // Approve the spender to spend the tokens on behalf of the owner. if _, err = contract.Approve(tops, spenderAddress, allowanceAmount); err != nil { log.Error().Err(err). From 8e8c0cab94f217bedff293726f7653de3979ad48 Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Tue, 18 Mar 2025 21:39:36 -0400 Subject: [PATCH 6/9] fix: https://github.com/0xPolygon/polygon-cli/pull/527 --- cmd/loadtest/uniswapv3/pool.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/loadtest/uniswapv3/pool.go b/cmd/loadtest/uniswapv3/pool.go index d875b34ab..03530fe15 100644 --- a/cmd/loadtest/uniswapv3/pool.go +++ b/cmd/loadtest/uniswapv3/pool.go @@ -108,8 +108,8 @@ func SetupLiquidityPool(ctx context.Context, c *ethclient.Client, tops *bind.Tra // Provide liquidity if there's none. if liquidity.Cmp(big.NewInt(0)) == 0 { - if provideLiquidity(ctx, c, tops, cops, poolContract, poolConfig, recipient, uniswapV3Config.NonfungiblePositionManager.Contract) != nil { - return err + if errLp := provideLiquidity(ctx, c, tops, cops, poolContract, poolConfig, recipient, uniswapV3Config.NonfungiblePositionManager.Contract); errLp != nil { + return errLp } } else { log.Debug().Msg("Liquidity already provided to the pool") From 07a87580f912e21396dbea95c167ae458dc4daeb Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Tue, 18 Mar 2025 22:11:12 -0400 Subject: [PATCH 7/9] docs: make gen --- doc/polycli_loadtest.md | 1 + doc/polycli_loadtest_uniswapv3.md | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/polycli_loadtest.md b/doc/polycli_loadtest.md index d790e9926..876b617d5 100644 --- a/doc/polycli_loadtest.md +++ b/doc/polycli_loadtest.md @@ -123,6 +123,7 @@ The codebase has a contract that used for load testing. It's written in Solidity --function-signature string The contract's function signature that will be called. The format is '()'. This must be paired up with '--mode contract-call' and '--contract-address'. If the function requires parameters you can pass them with '--function-arg '. --gas-limit uint In environments where the gas limit can't be computed on the fly, we can specify it manually. This can also be used to avoid eth_estimateGas --gas-price uint In environments where the gas price can't be determined automatically, we can specify it manually + --gas-price-multiplier float A multiplier to increase or decrease the gas price (default 1) -h, --help help for loadtest --inscription-content string The inscription content that will be encoded as calldata. This must be paired up with --mode inscription (default "data:,{\"p\":\"erc-20\",\"op\":\"mint\",\"tick\":\"TEST\",\"amt\":\"1\"}") -i, --iterations uint If we're making contract calls, this controls how many times the contract will execute the instruction in a loop. If we are making ERC721 Mints, this indicates the minting batch size (default 1) diff --git a/doc/polycli_loadtest_uniswapv3.md b/doc/polycli_loadtest_uniswapv3.md index c6b2c9b59..f39a2869f 100644 --- a/doc/polycli_loadtest_uniswapv3.md +++ b/doc/polycli_loadtest_uniswapv3.md @@ -89,6 +89,7 @@ The command also inherits flags from parent commands. --eth-amount float The amount of ether to send on every transaction --gas-limit uint In environments where the gas limit can't be computed on the fly, we can specify it manually. This can also be used to avoid eth_estimateGas --gas-price uint In environments where the gas price can't be determined automatically, we can specify it manually + --gas-price-multiplier float A multiplier to increase or decrease the gas price (default 1) -i, --iterations uint If we're making contract calls, this controls how many times the contract will execute the instruction in a loop. If we are making ERC721 Mints, this indicates the minting batch size (default 1) --legacy Send a legacy transaction instead of an EIP1559 transaction. --nonce uint Use this flag to manually set the starting nonce From 07e35732ef33f3e270133bab6d4d59064951e22f Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Wed, 19 Mar 2025 08:35:54 -0400 Subject: [PATCH 8/9] fix: https://github.com/0xPolygon/polygon-cli/pull/554/files/07a87580f912e21396dbea95c167ae458dc4daeb#diff-ab0618933cdbce0b4a7d2b59840edcdf6ac917ae6a36fe8ce70d5fa66677176d --- cmd/loadtest/uniswapv3/swapper.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/cmd/loadtest/uniswapv3/swapper.go b/cmd/loadtest/uniswapv3/swapper.go index 9e8407ef6..2df816932 100644 --- a/cmd/loadtest/uniswapv3/swapper.go +++ b/cmd/loadtest/uniswapv3/swapper.go @@ -48,10 +48,6 @@ func DeployERC20(ctx context.Context, c *ethclient.Client, tops *bind.TransactOp "NFTPositionManager": uniswapV3Config.NonfungiblePositionManager.Address, "SwapRouter02": uniswapV3Config.SwapRouter02.Address, } - //if tokenKnownAddress != (common.Address{}) { - // log.Info().Stringer("tokenAddress", tokenKnownAddress).Msg("Skipping allowance setup for known token contract") - // return nil - //} return setUniswapV3Allowances(ctx, c, contract, tops, cops, tokenName, uniswapV3Addresses, recipient) }, From 1aa354f19cde87acc45faa3b8adc0bb1f5d01601 Mon Sep 17 00:00:00 2001 From: John Hilliard Date: Wed, 19 Mar 2025 10:10:43 -0400 Subject: [PATCH 9/9] feat: dropping swapper --- bindings/uniswapv3/Swapper.abi | 336 -------------- bindings/uniswapv3/Swapper.bin | 1 - bindings/uniswapv3/Swapper.go | 760 ------------------------------- bindings/uniswapv3/Swapper.json | 280 ------------ bindings/uniswapv3/Swapper.sol | 10 - cmd/loadtest/uniswapv3/deploy.go | 4 +- 6 files changed, 2 insertions(+), 1389 deletions(-) delete mode 100644 bindings/uniswapv3/Swapper.abi delete mode 100644 bindings/uniswapv3/Swapper.bin delete mode 100644 bindings/uniswapv3/Swapper.go delete mode 100644 bindings/uniswapv3/Swapper.json delete mode 100644 bindings/uniswapv3/Swapper.sol diff --git a/bindings/uniswapv3/Swapper.abi b/bindings/uniswapv3/Swapper.abi deleted file mode 100644 index bd3f14378..000000000 --- a/bindings/uniswapv3/Swapper.abi +++ /dev/null @@ -1,336 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allowance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "needed", - "type": "uint256" - } - ], - "name": "ERC20InsufficientAllowance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "needed", - "type": "uint256" - } - ], - "name": "ERC20InsufficientBalance", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "approver", - "type": "address" - } - ], - "name": "ERC20InvalidApprover", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "receiver", - "type": "address" - } - ], - "name": "ERC20InvalidReceiver", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "ERC20InvalidSender", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "ERC20InvalidSpender", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/bindings/uniswapv3/Swapper.bin b/bindings/uniswapv3/Swapper.bin deleted file mode 100644 index 84268d5dc..000000000 --- a/bindings/uniswapv3/Swapper.bin +++ /dev/null @@ -1 +0,0 @@ -0x60806040523480156200001157600080fd5b5060405162000d5038038062000d508339810160408190526200003491620002d3565b83836003620000448382620003f7565b506004620000538282620003f7565b5050506200008a816200006b6200009460201b60201c565b6200007890600a620005d8565b620000849085620005f0565b62000099565b5050505062000620565b601290565b6001600160a01b038216620000c95760405163ec442f0560e01b8152600060048201526024015b60405180910390fd5b620000d760008383620000db565b5050565b6001600160a01b0383166200010a578060026000828254620000fe91906200060a565b909155506200017e9050565b6001600160a01b038316600090815260208190526040902054818110156200015f5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401620000c0565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166200019c57600280548290039055620001bb565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200020191815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023657600080fd5b81516001600160401b03808211156200025357620002536200020e565b604051601f8301601f19908116603f011681019082821181831017156200027e576200027e6200020e565b816040528381526020925086838588010111156200029b57600080fd5b600091505b83821015620002bf5785820183015181830184015290820190620002a0565b600093810190920192909252949350505050565b60008060008060808587031215620002ea57600080fd5b84516001600160401b03808211156200030257600080fd5b620003108883890162000224565b955060208701519150808211156200032757600080fd5b50620003368782880162000224565b60408701516060880151919550935090506001600160a01b03811681146200035d57600080fd5b939692955090935050565b600181811c908216806200037d57607f821691505b6020821081036200039e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003f257600081815260208120601f850160051c81016020861015620003cd5750805b601f850160051c820191505b81811015620003ee57828155600101620003d9565b5050505b505050565b81516001600160401b038111156200041357620004136200020e565b6200042b8162000424845462000368565b84620003a4565b602080601f8311600181146200046357600084156200044a5750858301515b600019600386901b1c1916600185901b178555620003ee565b600085815260208120601f198616915b82811015620004945788860151825594840194600190910190840162000473565b5085821015620004b35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200051a578160001904821115620004fe57620004fe620004c3565b808516156200050c57918102915b93841c9390800290620004de565b509250929050565b6000826200053357506001620005d2565b816200054257506000620005d2565b81600181146200055b5760028114620005665762000586565b6001915050620005d2565b60ff8411156200057a576200057a620004c3565b50506001821b620005d2565b5060208310610133831016604e8410600b8410161715620005ab575081810a620005d2565b620005b78383620004d9565b8060001904821115620005ce57620005ce620004c3565b0290505b92915050565b6000620005e960ff84168362000522565b9392505050565b8082028115828204841417620005d257620005d2620004c3565b80820180821115620005d257620005d2620004c3565b61072080620006306000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce567146100fe57806370a082311461010d57806395d89b4114610136578063a9059cbb1461013e578063dd62ed3e1461015157600080fd5b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100d957806323b872dd146100eb575b600080fd5b6100a061018a565b6040516100ad919061056a565b60405180910390f35b6100c96100c43660046105d4565b61021c565b60405190151581526020016100ad565b6002545b6040519081526020016100ad565b6100c96100f93660046105fe565b610236565b604051601281526020016100ad565b6100dd61011b36600461063a565b6001600160a01b031660009081526020819052604090205490565b6100a061025a565b6100c961014c3660046105d4565b610269565b6100dd61015f36600461065c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101999061068f565b80601f01602080910402602001604051908101604052809291908181526020018280546101c59061068f565b80156102125780601f106101e757610100808354040283529160200191610212565b820191906000526020600020905b8154815290600101906020018083116101f557829003601f168201915b5050505050905090565b60003361022a818585610277565b60019150505b92915050565b600033610244858285610289565b61024f85858561030c565b506001949350505050565b6060600480546101999061068f565b60003361022a81858561030c565b610284838383600161036b565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461030657818110156102f757604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6103068484848403600061036b565b50505050565b6001600160a01b03831661033657604051634b637e8f60e11b8152600060048201526024016102ee565b6001600160a01b0382166103605760405163ec442f0560e01b8152600060048201526024016102ee565b610284838383610440565b6001600160a01b0384166103955760405163e602df0560e01b8152600060048201526024016102ee565b6001600160a01b0383166103bf57604051634a1406b160e11b8152600060048201526024016102ee565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561030657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161043291815260200190565b60405180910390a350505050565b6001600160a01b03831661046b57806002600082825461046091906106c9565b909155506104dd9050565b6001600160a01b038316600090815260208190526040902054818110156104be5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016102ee565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166104f957600280548290039055610518565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161055d91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156105975785810183015185820160400152820161057b565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146105cf57600080fd5b919050565b600080604083850312156105e757600080fd5b6105f0836105b8565b946020939093013593505050565b60008060006060848603121561061357600080fd5b61061c846105b8565b925061062a602085016105b8565b9150604084013590509250925092565b60006020828403121561064c57600080fd5b610655826105b8565b9392505050565b6000806040838503121561066f57600080fd5b610678836105b8565b9150610686602084016105b8565b90509250929050565b600181811c908216806106a357607f821691505b6020821081036106c357634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561023057634e487b7160e01b600052601160045260246000fdfea26469706673582212207a5444abec68afa2cdc35bc3cdefa80d6c16d8153ac88fae4e14105578231b6a64736f6c63430008150033 diff --git a/bindings/uniswapv3/Swapper.go b/bindings/uniswapv3/Swapper.go deleted file mode 100644 index 4160761ba..000000000 --- a/bindings/uniswapv3/Swapper.go +++ /dev/null @@ -1,760 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package uniswapv3 - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription - _ = abi.ConvertType -) - -// SwapperMetaData contains all meta data concerning the Swapper contract. -var SwapperMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[{\"internalType\":\"string\",\"name\":\"name\",\"type\":\"string\"},{\"internalType\":\"string\",\"name\":\"symbol\",\"type\":\"string\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"allowance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientAllowance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"needed\",\"type\":\"uint256\"}],\"name\":\"ERC20InsufficientBalance\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"approver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidApprover\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"receiver\",\"type\":\"address\"}],\"name\":\"ERC20InvalidReceiver\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSender\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"ERC20InvalidSpender\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Approval\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"from\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", - Bin: "0x60806040523480156200001157600080fd5b5060405162000d5038038062000d508339810160408190526200003491620002d3565b83836003620000448382620003f7565b506004620000538282620003f7565b5050506200008a816200006b6200009460201b60201c565b6200007890600a620005d8565b620000849085620005f0565b62000099565b5050505062000620565b601290565b6001600160a01b038216620000c95760405163ec442f0560e01b8152600060048201526024015b60405180910390fd5b620000d760008383620000db565b5050565b6001600160a01b0383166200010a578060026000828254620000fe91906200060a565b909155506200017e9050565b6001600160a01b038316600090815260208190526040902054818110156200015f5760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401620000c0565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166200019c57600280548290039055620001bb565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516200020191815260200190565b60405180910390a3505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200023657600080fd5b81516001600160401b03808211156200025357620002536200020e565b604051601f8301601f19908116603f011681019082821181831017156200027e576200027e6200020e565b816040528381526020925086838588010111156200029b57600080fd5b600091505b83821015620002bf5785820183015181830184015290820190620002a0565b600093810190920192909252949350505050565b60008060008060808587031215620002ea57600080fd5b84516001600160401b03808211156200030257600080fd5b620003108883890162000224565b955060208701519150808211156200032757600080fd5b50620003368782880162000224565b60408701516060880151919550935090506001600160a01b03811681146200035d57600080fd5b939692955090935050565b600181811c908216806200037d57607f821691505b6020821081036200039e57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620003f257600081815260208120601f850160051c81016020861015620003cd5750805b601f850160051c820191505b81811015620003ee57828155600101620003d9565b5050505b505050565b81516001600160401b038111156200041357620004136200020e565b6200042b8162000424845462000368565b84620003a4565b602080601f8311600181146200046357600084156200044a5750858301515b600019600386901b1c1916600185901b178555620003ee565b600085815260208120601f198616915b82811015620004945788860151825594840194600190910190840162000473565b5085821015620004b35787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200051a578160001904821115620004fe57620004fe620004c3565b808516156200050c57918102915b93841c9390800290620004de565b509250929050565b6000826200053357506001620005d2565b816200054257506000620005d2565b81600181146200055b5760028114620005665762000586565b6001915050620005d2565b60ff8411156200057a576200057a620004c3565b50506001821b620005d2565b5060208310610133831016604e8410600b8410161715620005ab575081810a620005d2565b620005b78383620004d9565b8060001904821115620005ce57620005ce620004c3565b0290505b92915050565b6000620005e960ff84168362000522565b9392505050565b8082028115828204841417620005d257620005d2620004c3565b80820180821115620005d257620005d2620004c3565b61072080620006306000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce567146100fe57806370a082311461010d57806395d89b4114610136578063a9059cbb1461013e578063dd62ed3e1461015157600080fd5b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100d957806323b872dd146100eb575b600080fd5b6100a061018a565b6040516100ad919061056a565b60405180910390f35b6100c96100c43660046105d4565b61021c565b60405190151581526020016100ad565b6002545b6040519081526020016100ad565b6100c96100f93660046105fe565b610236565b604051601281526020016100ad565b6100dd61011b36600461063a565b6001600160a01b031660009081526020819052604090205490565b6100a061025a565b6100c961014c3660046105d4565b610269565b6100dd61015f36600461065c565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101999061068f565b80601f01602080910402602001604051908101604052809291908181526020018280546101c59061068f565b80156102125780601f106101e757610100808354040283529160200191610212565b820191906000526020600020905b8154815290600101906020018083116101f557829003601f168201915b5050505050905090565b60003361022a818585610277565b60019150505b92915050565b600033610244858285610289565b61024f85858561030c565b506001949350505050565b6060600480546101999061068f565b60003361022a81858561030c565b610284838383600161036b565b505050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461030657818110156102f757604051637dc7a0d960e11b81526001600160a01b038416600482015260248101829052604481018390526064015b60405180910390fd5b6103068484848403600061036b565b50505050565b6001600160a01b03831661033657604051634b637e8f60e11b8152600060048201526024016102ee565b6001600160a01b0382166103605760405163ec442f0560e01b8152600060048201526024016102ee565b610284838383610440565b6001600160a01b0384166103955760405163e602df0560e01b8152600060048201526024016102ee565b6001600160a01b0383166103bf57604051634a1406b160e11b8152600060048201526024016102ee565b6001600160a01b038085166000908152600160209081526040808320938716835292905220829055801561030657826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161043291815260200190565b60405180910390a350505050565b6001600160a01b03831661046b57806002600082825461046091906106c9565b909155506104dd9050565b6001600160a01b038316600090815260208190526040902054818110156104be5760405163391434e360e21b81526001600160a01b038516600482015260248101829052604481018390526064016102ee565b6001600160a01b03841660009081526020819052604090209082900390555b6001600160a01b0382166104f957600280548290039055610518565b6001600160a01b03821660009081526020819052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161055d91815260200190565b60405180910390a3505050565b600060208083528351808285015260005b818110156105975785810183015185820160400152820161057b565b506000604082860101526040601f19601f8301168501019250505092915050565b80356001600160a01b03811681146105cf57600080fd5b919050565b600080604083850312156105e757600080fd5b6105f0836105b8565b946020939093013593505050565b60008060006060848603121561061357600080fd5b61061c846105b8565b925061062a602085016105b8565b9150604084013590509250925092565b60006020828403121561064c57600080fd5b610655826105b8565b9392505050565b6000806040838503121561066f57600080fd5b610678836105b8565b9150610686602084016105b8565b90509250929050565b600181811c908216806106a357607f821691505b6020821081036106c357634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561023057634e487b7160e01b600052601160045260246000fdfea26469706673582212207a5444abec68afa2cdc35bc3cdefa80d6c16d8153ac88fae4e14105578231b6a64736f6c63430008150033", -} - -// SwapperABI is the input ABI used to generate the binding from. -// Deprecated: Use SwapperMetaData.ABI instead. -var SwapperABI = SwapperMetaData.ABI - -// SwapperBin is the compiled bytecode used for deploying new contracts. -// Deprecated: Use SwapperMetaData.Bin instead. -var SwapperBin = SwapperMetaData.Bin - -// DeploySwapper deploys a new Ethereum contract, binding an instance of Swapper to it. -func DeploySwapper(auth *bind.TransactOpts, backend bind.ContractBackend, name string, symbol string, amount *big.Int, recipient common.Address) (common.Address, *types.Transaction, *Swapper, error) { - parsed, err := SwapperMetaData.GetAbi() - if err != nil { - return common.Address{}, nil, nil, err - } - if parsed == nil { - return common.Address{}, nil, nil, errors.New("GetABI returned nil") - } - - address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(SwapperBin), backend, name, symbol, amount, recipient) - if err != nil { - return common.Address{}, nil, nil, err - } - return address, tx, &Swapper{SwapperCaller: SwapperCaller{contract: contract}, SwapperTransactor: SwapperTransactor{contract: contract}, SwapperFilterer: SwapperFilterer{contract: contract}}, nil -} - -// Swapper is an auto generated Go binding around an Ethereum contract. -type Swapper struct { - SwapperCaller // Read-only binding to the contract - SwapperTransactor // Write-only binding to the contract - SwapperFilterer // Log filterer for contract events -} - -// SwapperCaller is an auto generated read-only Go binding around an Ethereum contract. -type SwapperCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SwapperTransactor is an auto generated write-only Go binding around an Ethereum contract. -type SwapperTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SwapperFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type SwapperFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// SwapperSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type SwapperSession struct { - Contract *Swapper // Generic contract binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SwapperCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type SwapperCallerSession struct { - Contract *SwapperCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// SwapperTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type SwapperTransactorSession struct { - Contract *SwapperTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// SwapperRaw is an auto generated low-level Go binding around an Ethereum contract. -type SwapperRaw struct { - Contract *Swapper // Generic contract binding to access the raw methods on -} - -// SwapperCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type SwapperCallerRaw struct { - Contract *SwapperCaller // Generic read-only contract binding to access the raw methods on -} - -// SwapperTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type SwapperTransactorRaw struct { - Contract *SwapperTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewSwapper creates a new instance of Swapper, bound to a specific deployed contract. -func NewSwapper(address common.Address, backend bind.ContractBackend) (*Swapper, error) { - contract, err := bindSwapper(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Swapper{SwapperCaller: SwapperCaller{contract: contract}, SwapperTransactor: SwapperTransactor{contract: contract}, SwapperFilterer: SwapperFilterer{contract: contract}}, nil -} - -// NewSwapperCaller creates a new read-only instance of Swapper, bound to a specific deployed contract. -func NewSwapperCaller(address common.Address, caller bind.ContractCaller) (*SwapperCaller, error) { - contract, err := bindSwapper(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &SwapperCaller{contract: contract}, nil -} - -// NewSwapperTransactor creates a new write-only instance of Swapper, bound to a specific deployed contract. -func NewSwapperTransactor(address common.Address, transactor bind.ContractTransactor) (*SwapperTransactor, error) { - contract, err := bindSwapper(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &SwapperTransactor{contract: contract}, nil -} - -// NewSwapperFilterer creates a new log filterer instance of Swapper, bound to a specific deployed contract. -func NewSwapperFilterer(address common.Address, filterer bind.ContractFilterer) (*SwapperFilterer, error) { - contract, err := bindSwapper(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &SwapperFilterer{contract: contract}, nil -} - -// bindSwapper binds a generic wrapper to an already deployed contract. -func bindSwapper(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := SwapperMetaData.GetAbi() - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Swapper *SwapperRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Swapper.Contract.SwapperCaller.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Swapper *SwapperRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Swapper.Contract.SwapperTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Swapper *SwapperRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Swapper.Contract.SwapperTransactor.contract.Transact(opts, method, params...) -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Swapper *SwapperCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Swapper.Contract.contract.Call(opts, result, method, params...) -} - -// Transfer initiates a plain transaction to move funds to the contract, calling -// its default method if one is available. -func (_Swapper *SwapperTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Swapper.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Swapper *SwapperTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Swapper.Contract.contract.Transact(opts, method, params...) -} - -// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. -// -// Solidity: function allowance(address owner, address spender) view returns(uint256) -func (_Swapper *SwapperCaller) Allowance(opts *bind.CallOpts, owner common.Address, spender common.Address) (*big.Int, error) { - var out []interface{} - err := _Swapper.contract.Call(opts, &out, "allowance", owner, spender) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. -// -// Solidity: function allowance(address owner, address spender) view returns(uint256) -func (_Swapper *SwapperSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { - return _Swapper.Contract.Allowance(&_Swapper.CallOpts, owner, spender) -} - -// Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. -// -// Solidity: function allowance(address owner, address spender) view returns(uint256) -func (_Swapper *SwapperCallerSession) Allowance(owner common.Address, spender common.Address) (*big.Int, error) { - return _Swapper.Contract.Allowance(&_Swapper.CallOpts, owner, spender) -} - -// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. -// -// Solidity: function balanceOf(address account) view returns(uint256) -func (_Swapper *SwapperCaller) BalanceOf(opts *bind.CallOpts, account common.Address) (*big.Int, error) { - var out []interface{} - err := _Swapper.contract.Call(opts, &out, "balanceOf", account) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. -// -// Solidity: function balanceOf(address account) view returns(uint256) -func (_Swapper *SwapperSession) BalanceOf(account common.Address) (*big.Int, error) { - return _Swapper.Contract.BalanceOf(&_Swapper.CallOpts, account) -} - -// BalanceOf is a free data retrieval call binding the contract method 0x70a08231. -// -// Solidity: function balanceOf(address account) view returns(uint256) -func (_Swapper *SwapperCallerSession) BalanceOf(account common.Address) (*big.Int, error) { - return _Swapper.Contract.BalanceOf(&_Swapper.CallOpts, account) -} - -// Decimals is a free data retrieval call binding the contract method 0x313ce567. -// -// Solidity: function decimals() view returns(uint8) -func (_Swapper *SwapperCaller) Decimals(opts *bind.CallOpts) (uint8, error) { - var out []interface{} - err := _Swapper.contract.Call(opts, &out, "decimals") - - if err != nil { - return *new(uint8), err - } - - out0 := *abi.ConvertType(out[0], new(uint8)).(*uint8) - - return out0, err - -} - -// Decimals is a free data retrieval call binding the contract method 0x313ce567. -// -// Solidity: function decimals() view returns(uint8) -func (_Swapper *SwapperSession) Decimals() (uint8, error) { - return _Swapper.Contract.Decimals(&_Swapper.CallOpts) -} - -// Decimals is a free data retrieval call binding the contract method 0x313ce567. -// -// Solidity: function decimals() view returns(uint8) -func (_Swapper *SwapperCallerSession) Decimals() (uint8, error) { - return _Swapper.Contract.Decimals(&_Swapper.CallOpts) -} - -// Name is a free data retrieval call binding the contract method 0x06fdde03. -// -// Solidity: function name() view returns(string) -func (_Swapper *SwapperCaller) Name(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _Swapper.contract.Call(opts, &out, "name") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -// Name is a free data retrieval call binding the contract method 0x06fdde03. -// -// Solidity: function name() view returns(string) -func (_Swapper *SwapperSession) Name() (string, error) { - return _Swapper.Contract.Name(&_Swapper.CallOpts) -} - -// Name is a free data retrieval call binding the contract method 0x06fdde03. -// -// Solidity: function name() view returns(string) -func (_Swapper *SwapperCallerSession) Name() (string, error) { - return _Swapper.Contract.Name(&_Swapper.CallOpts) -} - -// Symbol is a free data retrieval call binding the contract method 0x95d89b41. -// -// Solidity: function symbol() view returns(string) -func (_Swapper *SwapperCaller) Symbol(opts *bind.CallOpts) (string, error) { - var out []interface{} - err := _Swapper.contract.Call(opts, &out, "symbol") - - if err != nil { - return *new(string), err - } - - out0 := *abi.ConvertType(out[0], new(string)).(*string) - - return out0, err - -} - -// Symbol is a free data retrieval call binding the contract method 0x95d89b41. -// -// Solidity: function symbol() view returns(string) -func (_Swapper *SwapperSession) Symbol() (string, error) { - return _Swapper.Contract.Symbol(&_Swapper.CallOpts) -} - -// Symbol is a free data retrieval call binding the contract method 0x95d89b41. -// -// Solidity: function symbol() view returns(string) -func (_Swapper *SwapperCallerSession) Symbol() (string, error) { - return _Swapper.Contract.Symbol(&_Swapper.CallOpts) -} - -// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. -// -// Solidity: function totalSupply() view returns(uint256) -func (_Swapper *SwapperCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Swapper.contract.Call(opts, &out, "totalSupply") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. -// -// Solidity: function totalSupply() view returns(uint256) -func (_Swapper *SwapperSession) TotalSupply() (*big.Int, error) { - return _Swapper.Contract.TotalSupply(&_Swapper.CallOpts) -} - -// TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. -// -// Solidity: function totalSupply() view returns(uint256) -func (_Swapper *SwapperCallerSession) TotalSupply() (*big.Int, error) { - return _Swapper.Contract.TotalSupply(&_Swapper.CallOpts) -} - -// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. -// -// Solidity: function approve(address spender, uint256 value) returns(bool) -func (_Swapper *SwapperTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.contract.Transact(opts, "approve", spender, value) -} - -// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. -// -// Solidity: function approve(address spender, uint256 value) returns(bool) -func (_Swapper *SwapperSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.Contract.Approve(&_Swapper.TransactOpts, spender, value) -} - -// Approve is a paid mutator transaction binding the contract method 0x095ea7b3. -// -// Solidity: function approve(address spender, uint256 value) returns(bool) -func (_Swapper *SwapperTransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.Contract.Approve(&_Swapper.TransactOpts, spender, value) -} - -// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. -// -// Solidity: function transfer(address to, uint256 value) returns(bool) -func (_Swapper *SwapperTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.contract.Transact(opts, "transfer", to, value) -} - -// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. -// -// Solidity: function transfer(address to, uint256 value) returns(bool) -func (_Swapper *SwapperSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.Contract.Transfer(&_Swapper.TransactOpts, to, value) -} - -// Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. -// -// Solidity: function transfer(address to, uint256 value) returns(bool) -func (_Swapper *SwapperTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.Contract.Transfer(&_Swapper.TransactOpts, to, value) -} - -// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. -// -// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) -func (_Swapper *SwapperTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.contract.Transact(opts, "transferFrom", from, to, value) -} - -// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. -// -// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) -func (_Swapper *SwapperSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.Contract.TransferFrom(&_Swapper.TransactOpts, from, to, value) -} - -// TransferFrom is a paid mutator transaction binding the contract method 0x23b872dd. -// -// Solidity: function transferFrom(address from, address to, uint256 value) returns(bool) -func (_Swapper *SwapperTransactorSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { - return _Swapper.Contract.TransferFrom(&_Swapper.TransactOpts, from, to, value) -} - -// SwapperApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the Swapper contract. -type SwapperApprovalIterator struct { - Event *SwapperApproval // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SwapperApprovalIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SwapperApproval) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SwapperApproval) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SwapperApprovalIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SwapperApprovalIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SwapperApproval represents a Approval event raised by the Swapper contract. -type SwapperApproval struct { - Owner common.Address - Spender common.Address - Value *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. -// -// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_Swapper *SwapperFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*SwapperApprovalIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var spenderRule []interface{} - for _, spenderItem := range spender { - spenderRule = append(spenderRule, spenderItem) - } - - logs, sub, err := _Swapper.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) - if err != nil { - return nil, err - } - return &SwapperApprovalIterator{contract: _Swapper.contract, event: "Approval", logs: logs, sub: sub}, nil -} - -// WatchApproval is a free log subscription operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. -// -// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_Swapper *SwapperFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *SwapperApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var spenderRule []interface{} - for _, spenderItem := range spender { - spenderRule = append(spenderRule, spenderItem) - } - - logs, sub, err := _Swapper.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SwapperApproval) - if err := _Swapper.contract.UnpackLog(event, "Approval", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. -// -// Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_Swapper *SwapperFilterer) ParseApproval(log types.Log) (*SwapperApproval, error) { - event := new(SwapperApproval) - if err := _Swapper.contract.UnpackLog(event, "Approval", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// SwapperTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the Swapper contract. -type SwapperTransferIterator struct { - Event *SwapperTransfer // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *SwapperTransferIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(SwapperTransfer) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(SwapperTransfer) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *SwapperTransferIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *SwapperTransferIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// SwapperTransfer represents a Transfer event raised by the Swapper contract. -type SwapperTransfer struct { - From common.Address - To common.Address - Value *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. -// -// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_Swapper *SwapperFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*SwapperTransferIterator, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Swapper.contract.FilterLogs(opts, "Transfer", fromRule, toRule) - if err != nil { - return nil, err - } - return &SwapperTransferIterator{contract: _Swapper.contract, event: "Transfer", logs: logs, sub: sub}, nil -} - -// WatchTransfer is a free log subscription operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. -// -// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_Swapper *SwapperFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *SwapperTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { - - var fromRule []interface{} - for _, fromItem := range from { - fromRule = append(fromRule, fromItem) - } - var toRule []interface{} - for _, toItem := range to { - toRule = append(toRule, toItem) - } - - logs, sub, err := _Swapper.contract.WatchLogs(opts, "Transfer", fromRule, toRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(SwapperTransfer) - if err := _Swapper.contract.UnpackLog(event, "Transfer", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. -// -// Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_Swapper *SwapperFilterer) ParseTransfer(log types.Log) (*SwapperTransfer, error) { - event := new(SwapperTransfer) - if err := _Swapper.contract.UnpackLog(event, "Transfer", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/bindings/uniswapv3/Swapper.json b/bindings/uniswapv3/Swapper.json deleted file mode 100644 index c55bb9fd0..000000000 --- a/bindings/uniswapv3/Swapper.json +++ /dev/null @@ -1,280 +0,0 @@ -{ - "bytecode": "60806040523480156200001157600080fd5b506040518060400160405280600781526020017f53776170706572000000000000000000000000000000000000000000000000008152506040518060400160405280600381526020017f535750000000000000000000000000000000000000000000000000000000000081525081600390816200008f9190620004e4565b508060049081620000a19190620004e4565b505050620000e433620000b9620000ea60201b60201c565b600a620000c791906200075b565b633b9aca00620000d89190620007ac565b620000f360201b60201c565b620008e3565b60006012905090565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160362000165576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200015c9062000858565b60405180910390fd5b62000179600083836200026060201b60201c565b80600260008282546200018d91906200087a565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620002409190620008c6565b60405180910390a36200025c600083836200026560201b60201c565b5050565b505050565b505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620002ec57607f821691505b602082108103620003025762000301620002a4565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b6000600883026200036c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826200032d565b6200037886836200032d565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620003c5620003bf620003b98462000390565b6200039a565b62000390565b9050919050565b6000819050919050565b620003e183620003a4565b620003f9620003f082620003cc565b8484546200033a565b825550505050565b600090565b6200041062000401565b6200041d818484620003d6565b505050565b5b8181101562000445576200043960008262000406565b60018101905062000423565b5050565b601f82111562000494576200045e8162000308565b62000469846200031d565b8101602085101562000479578190505b6200049162000488856200031d565b83018262000422565b50505b505050565b600082821c905092915050565b6000620004b96000198460080262000499565b1980831691505092915050565b6000620004d48383620004a6565b9150826002028217905092915050565b620004ef826200026a565b67ffffffffffffffff8111156200050b576200050a62000275565b5b620005178254620002d3565b6200052482828562000449565b600060209050601f8311600181146200055c576000841562000547578287015190505b620005538582620004c6565b865550620005c3565b601f1984166200056c8662000308565b60005b8281101562000596578489015182556001820191506020850194506020810190506200056f565b86831015620005b65784890151620005b2601f891682620004a6565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b60018511156200065957808604811115620006315762000630620005cb565b5b6001851615620006415780820291505b80810290506200065185620005fa565b945062000611565b94509492505050565b60008262000674576001905062000747565b8162000684576000905062000747565b81600181146200069d5760028114620006a857620006de565b600191505062000747565b60ff841115620006bd57620006bc620005cb565b5b8360020a915084821115620006d757620006d6620005cb565b5b5062000747565b5060208310610133831016604e8410600b8410161715620007185782820a905083811115620007125762000711620005cb565b5b62000747565b62000727848484600162000607565b92509050818404811115620007415762000740620005cb565b5b81810290505b9392505050565b600060ff82169050919050565b6000620007688262000390565b915062000775836200074e565b9250620007a47fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000662565b905092915050565b6000620007b98262000390565b9150620007c68362000390565b9250828202620007d68162000390565b91508282048414831517620007f057620007ef620005cb565b5b5092915050565b600082825260208201905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b600062000840601f83620007f7565b91506200084d8262000808565b602082019050919050565b60006020820190508181036000830152620008738162000831565b9050919050565b6000620008878262000390565b9150620008948362000390565b9250828201905080821115620008af57620008ae620005cb565b5b92915050565b620008c08162000390565b82525050565b6000602082019050620008dd6000830184620008b5565b92915050565b61122f80620008f36000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610b0c565b60405180910390f35b6100e660048036038101906100e19190610bc7565b610308565b6040516100f39190610c22565b60405180910390f35b61010461032b565b6040516101119190610c4c565b60405180910390f35b610134600480360381019061012f9190610c67565b610335565b6040516101419190610c22565b60405180910390f35b610152610364565b60405161015f9190610cd6565b60405180910390f35b610182600480360381019061017d9190610bc7565b61036d565b60405161018f9190610c22565b60405180910390f35b6101b260048036038101906101ad9190610cf1565b6103a4565b6040516101bf9190610c4c565b60405180910390f35b6101d06103ec565b6040516101dd9190610b0c565b60405180910390f35b61020060048036038101906101fb9190610bc7565b61047e565b60405161020d9190610c22565b60405180910390f35b610230600480360381019061022b9190610bc7565b6104f5565b60405161023d9190610c22565b60405180910390f35b610260600480360381019061025b9190610d1e565b610518565b60405161026d9190610c4c565b60405180910390f35b60606003805461028590610d8d565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190610d8d565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b60008061031361059f565b90506103208185856105a7565b600191505092915050565b6000600254905090565b60008061034061059f565b905061034d858285610770565b6103588585856107fc565b60019150509392505050565b60006012905090565b60008061037861059f565b905061039981858561038a8589610518565b6103949190610ded565b6105a7565b600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6060600480546103fb90610d8d565b80601f016020809104026020016040519081016040528092919081815260200182805461042790610d8d565b80156104745780601f1061044957610100808354040283529160200191610474565b820191906000526020600020905b81548152906001019060200180831161045757829003601f168201915b5050505050905090565b60008061048961059f565b905060006104978286610518565b9050838110156104dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104d390610e93565b60405180910390fd5b6104e982868684036105a7565b60019250505092915050565b60008061050061059f565b905061050d8185856107fc565b600191505092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603610616576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060d90610f25565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067c90610fb7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516107639190610c4c565b60405180910390a3505050565b600061077c8484610518565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146107f657818110156107e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107df90611023565b60405180910390fd5b6107f584848484036105a7565b5b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361086b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610862906110b5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036108da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108d190611147565b60405180910390fd5b6108e5838383610a72565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561096b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610962906111d9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610a599190610c4c565b60405180910390a3610a6c848484610a77565b50505050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610ab6578082015181840152602081019050610a9b565b60008484015250505050565b6000601f19601f8301169050919050565b6000610ade82610a7c565b610ae88185610a87565b9350610af8818560208601610a98565b610b0181610ac2565b840191505092915050565b60006020820190508181036000830152610b268184610ad3565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b5e82610b33565b9050919050565b610b6e81610b53565b8114610b7957600080fd5b50565b600081359050610b8b81610b65565b92915050565b6000819050919050565b610ba481610b91565b8114610baf57600080fd5b50565b600081359050610bc181610b9b565b92915050565b60008060408385031215610bde57610bdd610b2e565b5b6000610bec85828601610b7c565b9250506020610bfd85828601610bb2565b9150509250929050565b60008115159050919050565b610c1c81610c07565b82525050565b6000602082019050610c376000830184610c13565b92915050565b610c4681610b91565b82525050565b6000602082019050610c616000830184610c3d565b92915050565b600080600060608486031215610c8057610c7f610b2e565b5b6000610c8e86828701610b7c565b9350506020610c9f86828701610b7c565b9250506040610cb086828701610bb2565b9150509250925092565b600060ff82169050919050565b610cd081610cba565b82525050565b6000602082019050610ceb6000830184610cc7565b92915050565b600060208284031215610d0757610d06610b2e565b5b6000610d1584828501610b7c565b91505092915050565b60008060408385031215610d3557610d34610b2e565b5b6000610d4385828601610b7c565b9250506020610d5485828601610b7c565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680610da557607f821691505b602082108103610db857610db7610d5e565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610df882610b91565b9150610e0383610b91565b9250828201905080821115610e1b57610e1a610dbe565b5b92915050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000610e7d602583610a87565b9150610e8882610e21565b604082019050919050565b60006020820190508181036000830152610eac81610e70565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000610f0f602483610a87565b9150610f1a82610eb3565b604082019050919050565b60006020820190508181036000830152610f3e81610f02565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000610fa1602283610a87565b9150610fac82610f45565b604082019050919050565b60006020820190508181036000830152610fd081610f94565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061100d601d83610a87565b915061101882610fd7565b602082019050919050565b6000602082019050818103600083015261103c81611000565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061109f602583610a87565b91506110aa82611043565b604082019050919050565b600060208201905081810360008301526110ce81611092565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000611131602383610a87565b915061113c826110d5565b604082019050919050565b6000602082019050818103600083015261116081611124565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006111c3602683610a87565b91506111ce82611167565b604082019050919050565b600060208201905081810360008301526111f2816111b6565b905091905056fea2646970667358221220dc1a4f5063d8441cb18d43d984fffaf3b260d4d30e04cbac93dc7be9e89fd3b964736f6c63430008130033", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ] -} diff --git a/bindings/uniswapv3/Swapper.sol b/bindings/uniswapv3/Swapper.sol deleted file mode 100644 index bd4ba7ed4..000000000 --- a/bindings/uniswapv3/Swapper.sol +++ /dev/null @@ -1,10 +0,0 @@ -// SPDX-License-Identifier: UNLICENSED -pragma solidity ^0.8.20; - -import {ERC20 as OpenzeppelinERC20} from "@openzeppelin/token/ERC20/ERC20.sol"; - -contract Swapper is OpenzeppelinERC20 { - constructor(string memory name, string memory symbol, uint256 amount, address recipient) OpenzeppelinERC20(name, symbol) { - _mint(recipient, amount * 10 ** decimals()); - } -} diff --git a/cmd/loadtest/uniswapv3/deploy.go b/cmd/loadtest/uniswapv3/deploy.go index 66ec72921..fc5a8a5e4 100644 --- a/cmd/loadtest/uniswapv3/deploy.go +++ b/cmd/loadtest/uniswapv3/deploy.go @@ -66,7 +66,7 @@ type ( // Contract represents a UniswapV3 contract (including WETH9 and Swapper). Contract interface { - uniswapv3.UniswapV3Factory | uniswapv3.UniswapInterfaceMulticall | uniswapv3.ProxyAdmin | uniswapv3.TickLens | uniswapv3.NFTDescriptor | uniswapv3.NonfungibleTokenPositionDescriptor | uniswapv3.TransparentUpgradeableProxy | uniswapv3.NonfungiblePositionManager | uniswapv3.V3Migrator | uniswapv3.UniswapV3Staker | uniswapv3.QuoterV2 | uniswapv3.SwapRouter02 | uniswapv3.WETH9 | uniswapv3.Swapper | tokens.ERC20 + uniswapv3.UniswapV3Factory | uniswapv3.UniswapInterfaceMulticall | uniswapv3.ProxyAdmin | uniswapv3.TickLens | uniswapv3.NFTDescriptor | uniswapv3.NonfungibleTokenPositionDescriptor | uniswapv3.TransparentUpgradeableProxy | uniswapv3.NonfungiblePositionManager | uniswapv3.V3Migrator | uniswapv3.UniswapV3Staker | uniswapv3.QuoterV2 | uniswapv3.SwapRouter02 | uniswapv3.WETH9 | tokens.ERC20 } ) @@ -314,7 +314,7 @@ func DeployUniswapV3(ctx context.Context, c *ethclient.Client, tops *bind.Transa if err != nil { return } - + if knownAddresses.ProxyAdmin == (common.Address{}) { log.Debug().Msg("Step 15: Transfer ProxyAdmin ownership") if err = transferProxyAdminOwnership(config.ProxyAdmin.Contract, tops, cops, ownerAddress); err != nil {