From 6cc74fbea31301e5c0d1d9f35299f51a31bfc03e Mon Sep 17 00:00:00 2001 From: Bharath Date: Fri, 3 May 2024 16:50:38 +0530 Subject: [PATCH] refactor --- .idea/workspace.xml | 31 +- cmd/blob-spammer/main.go | 2 +- .../looper/abi.json | 0 contractinfos/looper/bytecode | 1 + scenarios/combined/combined.go | 348 --------- scenarios/conflicting/conflicting.go | 347 --------- scenarios/deploytx/deploytx.go | 4 +- scenarios/eoatx/eoatx.go | 5 +- scenarios/erctx/erctx.go | 22 +- .../largetx/{abis => contracts}/looper.go | 22 + scenarios/largetx/largetx.go | 172 +++-- scenarios/normal/normal.go | 300 -------- scenarios/replacements/replacements.go | 348 --------- scenarios/scenarios.go | 12 - .../{uniswap-pair.go => uniswap-v2-pair.go} | 698 +++++++++--------- scenarios/univ2tx/univ2tx.go | 4 +- scenarios/wallets/wallets.go | 61 -- scenariotypes/scenario.go | 2 +- tester/tester.go | 49 -- 19 files changed, 514 insertions(+), 1914 deletions(-) rename scenarios/largetx/abis/looper.abi.json => contractinfos/looper/abi.json (100%) create mode 100644 contractinfos/looper/bytecode delete mode 100644 scenarios/combined/combined.go delete mode 100644 scenarios/conflicting/conflicting.go rename scenarios/largetx/{abis => contracts}/looper.go (82%) delete mode 100644 scenarios/normal/normal.go delete mode 100644 scenarios/replacements/replacements.go rename scenarios/univ2tx/contracts/{uniswap-pair.go => uniswap-v2-pair.go} (62%) delete mode 100644 scenarios/wallets/wallets.go diff --git a/.idea/workspace.xml b/.idea/workspace.xml index d6b5555..2e67132 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,33 +5,25 @@ - - - - - - - - - - - + - - + + + + - - + + - + + + - - + diff --git a/cmd/blob-spammer/main.go b/cmd/blob-spammer/main.go index 4633f08..741edd3 100644 --- a/cmd/blob-spammer/main.go +++ b/cmd/blob-spammer/main.go @@ -124,7 +124,7 @@ func main() { panic(err) } - err = scenario.Run(tester) + err = scenario.Run() if err != nil { panic(err) } diff --git a/scenarios/largetx/abis/looper.abi.json b/contractinfos/looper/abi.json similarity index 100% rename from scenarios/largetx/abis/looper.abi.json rename to contractinfos/looper/abi.json diff --git a/contractinfos/looper/bytecode b/contractinfos/looper/bytecode new file mode 100644 index 0000000..1f00d80 --- /dev/null +++ b/contractinfos/looper/bytecode @@ -0,0 +1 @@ +0x608060405234801561001057600080fd5b506101c5806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80638f491c6514610030575b600080fd5b61004361003e3660046100ee565b610059565b604051610050919061011f565b60405180910390f35b606060008267ffffffffffffffff1667ffffffffffffffff81111561008057610080610163565b6040519080825280602002602001820160405280156100a9578160200160208202803683370190505b50905060005b8367ffffffffffffffff168110156100e757808282815181106100d4576100d4610179565b60209081029190910101526001016100af565b5092915050565b60006020828403121561010057600080fd5b813567ffffffffffffffff8116811461011857600080fd5b9392505050565b6020808252825182820181905260009190848201906040850190845b818110156101575783518352928401929184019160010161013b565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220b226884699e16cc47ae01a4cc201e790347695464df17edde46bbab26872400364736f6c63430008180033 \ No newline at end of file diff --git a/scenarios/combined/combined.go b/scenarios/combined/combined.go deleted file mode 100644 index 1cd9f38..0000000 --- a/scenarios/combined/combined.go +++ /dev/null @@ -1,348 +0,0 @@ -package combined - -import ( - "fmt" - "math/big" - "math/rand" - "sync" - "time" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/holiman/uint256" - "github.com/sirupsen/logrus" - "github.com/spf13/pflag" - - "github.com/ethpandaops/goomy-blob/scenariotypes" - "github.com/ethpandaops/goomy-blob/tester" - "github.com/ethpandaops/goomy-blob/txbuilder" - "github.com/ethpandaops/goomy-blob/utils" -) - -type ScenarioOptions struct { - TotalCount uint64 - Throughput uint64 - Sidecars uint64 - MaxPending uint64 - MaxWallets uint64 - Replace uint64 - MaxReplacements uint64 - Rebroadcast uint64 - BaseFee uint64 - TipFee uint64 - BlobFee uint64 -} - -type Scenario struct { - options ScenarioOptions - logger *logrus.Entry - tester *tester.Tester - - pendingCount uint64 - pendingChan chan bool - pendingWGroup sync.WaitGroup -} - -func NewScenario() scenariotypes.Scenario { - return &Scenario{ - logger: logrus.WithField("scenario", "combined"), - } -} - -func (s *Scenario) Flags(flags *pflag.FlagSet) error { - flags.Uint64VarP(&s.options.TotalCount, "count", "c", 0, "Total number of blob transactions to send") - flags.Uint64VarP(&s.options.Throughput, "throughput", "t", 0, "Number of blob transactions to send per slot") - flags.Uint64VarP(&s.options.Sidecars, "sidecars", "b", 3, "Maximum number of blob sidecars per blob transactions") - flags.Uint64Var(&s.options.MaxPending, "max-pending", 0, "Maximum number of pending transactions") - flags.Uint64Var(&s.options.MaxWallets, "max-wallets", 0, "Maximum number of child wallets to use") - flags.Uint64Var(&s.options.Replace, "replace", 30, "Number of seconds to wait before replace a transaction") - flags.Uint64Var(&s.options.MaxReplacements, "max-replace", 4, "Maximum number of replacement transactions") - flags.Uint64Var(&s.options.Rebroadcast, "rebroadcast", 30, "Number of seconds to wait before re-broadcasting a transaction") - flags.Uint64Var(&s.options.BaseFee, "basefee", 20, "Max fee per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.TipFee, "tipfee", 2, "Max tip per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.BlobFee, "blobfee", 20, "Max blob fee to use in blob transactions (in gwei)") - return nil -} - -func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { - if s.options.TotalCount == 0 && s.options.Throughput == 0 { - return fmt.Errorf("neither total count nor throughput limit set, must define at least one of them") - } - - if s.options.MaxWallets > 0 { - testerCfg.WalletCount = s.options.MaxWallets - } else if s.options.TotalCount > 0 { - if s.options.TotalCount < 1000 { - testerCfg.WalletCount = s.options.TotalCount - } else { - testerCfg.WalletCount = 1000 - } - } else { - if s.options.Throughput*10 < 1000 { - testerCfg.WalletCount = s.options.Throughput * 10 - } else { - testerCfg.WalletCount = 1000 - } - } - - if s.options.MaxPending > 0 { - s.pendingChan = make(chan bool, s.options.MaxPending) - } - - return nil -} - -func (s *Scenario) Setup(testerCfg *tester.Tester) error { - return nil -} - -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester - txIdxCounter := uint64(0) - counterMutex := sync.Mutex{} - waitGroup := sync.WaitGroup{} - pendingCount := uint64(0) - txCount := uint64(0) - startTime := time.Now() - - s.logger.Infof("starting scenario: combined") - - for { - txIdx := txIdxCounter - txIdxCounter++ - - if s.pendingChan != nil { - // await pending transactions - s.pendingChan <- true - } - waitGroup.Add(1) - counterMutex.Lock() - pendingCount++ - counterMutex.Unlock() - - go func(txIdx uint64) { - defer func() { - counterMutex.Lock() - pendingCount-- - counterMutex.Unlock() - waitGroup.Done() - }() - - logger := s.logger - tx, client, err := s.sendBlobTx(txIdx, 0, 0) - if client != nil { - logger = logger.WithField("rpc", client.GetName()) - } - if err != nil { - logger.Warnf("blob tx %6d.0 failed: %v", txIdx+1, err) - if s.pendingChan != nil { - <-s.pendingChan - } - return - } - - counterMutex.Lock() - txCount++ - counterMutex.Unlock() - logger.Infof("blob tx %6d.0 sent: %v (%v sidecars)", txIdx+1, tx.Hash().String(), len(tx.BlobTxSidecar().Blobs)) - }(txIdx) - - count := txCount + pendingCount - if s.options.TotalCount > 0 && count >= s.options.TotalCount { - break - } - if s.options.Throughput > 0 { - for count/((uint64(time.Since(startTime).Seconds())/utils.SecondsPerSlot)+1) >= s.options.Throughput { - time.Sleep(100 * time.Millisecond) - } - } - } - waitGroup.Wait() - - s.logger.Infof("finished sending transactions, awaiting block inclusion...") - s.pendingWGroup.Wait() - s.logger.Infof("all transactions included!") - - return nil -} - -func (s *Scenario) sendBlobTx(txIdx uint64, replacementIdx uint64, txNonce uint64) (*types.Transaction, *txbuilder.Client, error) { - client := s.tester.GetClient(tester.SelectByIndex, int(txIdx)) - wallet := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)) - - if rand.Intn(100) < 20 { - // 20% chance to send transaction via another client - // will cause some replacement txs being sent via different clients than the original tx - client = s.tester.GetClient(tester.SelectRandom, 0) - } - - var feeCap *big.Int - var tipCap *big.Int - var blobFee *big.Int - - if s.options.BaseFee > 0 { - feeCap = new(big.Int).Mul(big.NewInt(int64(s.options.BaseFee)), big.NewInt(1000000000)) - } - if s.options.TipFee > 0 { - tipCap = new(big.Int).Mul(big.NewInt(int64(s.options.TipFee)), big.NewInt(1000000000)) - } - if s.options.BlobFee > 0 { - blobFee = new(big.Int).Mul(big.NewInt(int64(s.options.BlobFee)), big.NewInt(1000000000)) - } - - if feeCap == nil || tipCap == nil { - // get suggested fee from client - var err error - feeCap, tipCap, err = client.GetSuggestedFee() - if err != nil { - return nil, client, err - } - } - - if feeCap.Cmp(big.NewInt(1000000000)) < 0 { - feeCap = big.NewInt(1000000000) - } - if tipCap.Cmp(big.NewInt(1000000000)) < 0 { - tipCap = big.NewInt(1000000000) - } - if blobFee == nil { - blobFee = big.NewInt(1000000000) - } - - for i := 0; i < int(replacementIdx); i++ { - // x3 fee for each replacement tx - feeCap = feeCap.Mul(feeCap, big.NewInt(3)) - tipCap = tipCap.Mul(tipCap, big.NewInt(3)) - blobFee = blobFee.Mul(blobFee, big.NewInt(3)) - } - - blobCount := uint64(rand.Int63n(int64(s.options.Sidecars)) + 1) - blobRefs := make([][]string, blobCount) - for i := 0; i < int(blobCount); i++ { - blobLabel := fmt.Sprintf("0x1611AA0000%08dFF%02dFF%04dFEED", txIdx, i, replacementIdx) - - specialBlob := rand.Intn(50) - switch specialBlob { - case 0: // special blob commitment - all 0x0 - blobRefs[i] = []string{"0x0"} - case 1, 2: // reuse well known blob - blobRefs[i] = []string{"repeat:0x42:1337"} - case 3, 4: // duplicate commitment - if i == 0 { - blobRefs[i] = []string{blobLabel, "random"} - } else { - blobRefs[i] = []string{"copy:0"} - } - - default: // random blob data - blobRefs[i] = []string{blobLabel, "random"} - } - } - - toAddr := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)+1).GetAddress() - blobTx, err := txbuilder.BuildBlobTx(&txbuilder.TxMetadata{ - GasFeeCap: uint256.MustFromBig(feeCap), - GasTipCap: uint256.MustFromBig(tipCap), - BlobFeeCap: uint256.MustFromBig(blobFee), - Gas: 21000, - To: &toAddr, - Value: uint256.NewInt(0), - }, blobRefs) - if err != nil { - return nil, client, err - } - - var tx *types.Transaction - if replacementIdx == 0 { - tx, err = wallet.BuildBlobTx(blobTx) - } else { - tx, err = wallet.ReplaceBlobTx(blobTx, txNonce) - } - if err != nil { - return nil, client, err - } - - err = client.SendTransaction(tx) - if err != nil { - return nil, client, err - } - - s.pendingWGroup.Add(1) - go s.awaitTx(txIdx, tx, client, wallet, replacementIdx) - - return tx, client, nil -} - -func (s *Scenario) awaitTx(txIdx uint64, tx *types.Transaction, client *txbuilder.Client, wallet *txbuilder.Wallet, replacementIdx uint64) { - var awaitConfirmation bool = true - defer func() { - awaitConfirmation = false - if replacementIdx == 0 { - if s.pendingChan != nil { - <-s.pendingChan - } - } - s.pendingWGroup.Done() - }() - if s.options.Replace > 0 && replacementIdx < s.options.MaxReplacements && rand.Intn(100) < 70 { - go s.delayedReplace(txIdx, tx, &awaitConfirmation, replacementIdx) - } else if s.options.Rebroadcast > 0 { - go s.delayedResend(txIdx, tx, &awaitConfirmation, replacementIdx) - } - - receipt, blockNum, err := client.AwaitTransaction(tx) - if err != nil { - s.logger.WithField("client", client.GetName()).Warnf("blob tx %6d.%v: await receipt failed: %v", txIdx+1, replacementIdx, err) - return - } - if receipt == nil { - return - } - - effectiveGasPrice := receipt.EffectiveGasPrice - if effectiveGasPrice == nil { - effectiveGasPrice = big.NewInt(0) - } - blobGasPrice := receipt.BlobGasPrice - if blobGasPrice == nil { - blobGasPrice = big.NewInt(0) - } - feeAmount := new(big.Int).Mul(effectiveGasPrice, big.NewInt(int64(receipt.GasUsed))) - totalAmount := new(big.Int).Add(tx.Value(), feeAmount) - wallet.SubBalance(totalAmount) - - gweiTotalFee := new(big.Int).Div(totalAmount, big.NewInt(1000000000)) - gweiBaseFee := new(big.Int).Div(effectiveGasPrice, big.NewInt(1000000000)) - gweiBlobFee := new(big.Int).Div(blobGasPrice, big.NewInt(1000000000)) - - s.logger.WithField("client", client.GetName()).Infof("blob tx %6d.%v confirmed in block #%v! total fee: %v gwei (base: %v, blob: %v)", txIdx+1, replacementIdx, blockNum, gweiTotalFee, gweiBaseFee, gweiBlobFee) -} - -func (s *Scenario) delayedResend(txIdx uint64, tx *types.Transaction, awaitConfirmation *bool, replacementIdx uint64) { - for { - time.Sleep(time.Duration(s.options.Rebroadcast) * time.Second) - - if !*awaitConfirmation { - break - } - - client := s.tester.GetClient(tester.SelectRandom, 0) - client.SendTransaction(tx) - s.logger.WithField("client", client.GetName()).Debugf("blob tx %6d.%v re-broadcasted.", txIdx+1, replacementIdx) - } -} - -func (s *Scenario) delayedReplace(txIdx uint64, tx *types.Transaction, awaitConfirmation *bool, replacementIdx uint64) { - time.Sleep(time.Duration(rand.Intn(int(s.options.Replace))+2) * time.Second) - - if !*awaitConfirmation { - return - } - - replaceTx, client, err := s.sendBlobTx(txIdx, replacementIdx+1, tx.Nonce()) - if err != nil { - s.logger.WithField("client", client.GetName()).Warnf("blob tx %6d.%v replacement failed: %v", txIdx+1, replacementIdx+1, err) - s.delayedResend(txIdx, tx, awaitConfirmation, replacementIdx) - return - } - s.logger.WithField("client", client.GetName()).Infof("blob tx %6d.%v sent: %v (%v sidecars)", txIdx+1, replacementIdx+1, replaceTx.Hash().String(), len(tx.BlobTxSidecar().Blobs)) -} diff --git a/scenarios/conflicting/conflicting.go b/scenarios/conflicting/conflicting.go deleted file mode 100644 index 0397444..0000000 --- a/scenarios/conflicting/conflicting.go +++ /dev/null @@ -1,347 +0,0 @@ -package conflicting - -import ( - "fmt" - "math/big" - "math/rand" - "sync" - "time" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/holiman/uint256" - "github.com/sirupsen/logrus" - "github.com/spf13/pflag" - - "github.com/ethpandaops/goomy-blob/scenariotypes" - "github.com/ethpandaops/goomy-blob/tester" - "github.com/ethpandaops/goomy-blob/txbuilder" - "github.com/ethpandaops/goomy-blob/utils" -) - -type ScenarioOptions struct { - TotalCount uint64 - Throughput uint64 - Sidecars uint64 - MaxPending uint64 - MaxWallets uint64 - Rebroadcast uint64 - BaseFee uint64 - TipFee uint64 - BlobFee uint64 -} - -type Scenario struct { - options ScenarioOptions - logger *logrus.Entry - tester *tester.Tester - - pendingCount uint64 - pendingChan chan bool - pendingWGroup sync.WaitGroup -} - -func NewScenario() scenariotypes.Scenario { - return &Scenario{ - logger: logrus.WithField("scenario", "conflicting"), - } -} - -func (s *Scenario) Flags(flags *pflag.FlagSet) error { - flags.Uint64VarP(&s.options.TotalCount, "count", "c", 0, "Total number of blob transactions to send") - flags.Uint64VarP(&s.options.Throughput, "throughput", "t", 0, "Number of blob transactions to send per slot") - flags.Uint64VarP(&s.options.Sidecars, "sidecars", "b", 3, "Number of blob sidecars per blob transactions") - flags.Uint64Var(&s.options.MaxPending, "max-pending", 0, "Maximum number of pending transactions") - flags.Uint64Var(&s.options.MaxWallets, "max-wallets", 0, "Maximum number of child wallets to use") - flags.Uint64Var(&s.options.Rebroadcast, "rebroadcast", 60, "Number of seconds to wait before re-broadcasting a transaction") - flags.Uint64Var(&s.options.BaseFee, "basefee", 20, "Max fee per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.TipFee, "tipfee", 2, "Max tip per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.BlobFee, "blobfee", 20, "Max blob fee to use in blob transactions (in gwei)") - return nil -} - -func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { - if s.options.TotalCount == 0 && s.options.Throughput == 0 { - return fmt.Errorf("neither total count nor throughput limit set, must define at least one of them") - } - - if s.options.MaxWallets > 0 { - testerCfg.WalletCount = s.options.MaxWallets - } else if s.options.TotalCount > 0 { - if s.options.TotalCount < 1000 { - testerCfg.WalletCount = s.options.TotalCount - } else { - testerCfg.WalletCount = 1000 - } - } else { - if s.options.Throughput*10 < 1000 { - testerCfg.WalletCount = s.options.Throughput * 10 - } else { - testerCfg.WalletCount = 1000 - } - } - - if s.options.MaxPending > 0 { - s.pendingChan = make(chan bool, s.options.MaxPending) - } - - return nil -} - -func (s *Scenario) Setup(testerCfg *tester.Tester) error { - return nil -} - -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester - txIdxCounter := uint64(0) - counterMutex := sync.Mutex{} - waitGroup := sync.WaitGroup{} - pendingCount := uint64(0) - txCount := uint64(0) - startTime := time.Now() - - s.logger.Infof("starting scenario: conflicting") - - for { - txIdx := txIdxCounter - txIdxCounter++ - - if s.pendingChan != nil { - // await pending transactions - s.pendingChan <- true - } - waitGroup.Add(1) - counterMutex.Lock() - pendingCount++ - counterMutex.Unlock() - - go func(txIdx uint64) { - defer func() { - counterMutex.Lock() - pendingCount-- - counterMutex.Unlock() - waitGroup.Done() - }() - - logger := s.logger - tx, client, err := s.sendBlobTx(txIdx) - if client != nil { - logger = logger.WithField("rpc", client.GetName()) - } - if err != nil { - logger.Warnf("could not send blob transaction: %v", err) - <-s.pendingChan - return - } - - counterMutex.Lock() - txCount++ - counterMutex.Unlock() - logger.Infof("sent blob tx #%6d: %v (%v sidecars)", txIdx+1, tx.Hash().String(), len(tx.BlobTxSidecar().Blobs)) - }(txIdx) - - count := txCount + pendingCount - if s.options.TotalCount > 0 && count >= s.options.TotalCount { - break - } - if s.options.Throughput > 0 { - for count/((uint64(time.Since(startTime).Seconds())/utils.SecondsPerSlot)+1) >= s.options.Throughput { - time.Sleep(100 * time.Millisecond) - } - } - } - waitGroup.Wait() - - s.logger.Infof("finished sending transactions, awaiting block inclusion...") - s.pendingWGroup.Wait() - s.logger.Infof("finished sending transactions, awaiting block inclusion...") - - return nil -} - -func (s *Scenario) sendBlobTx(txIdx uint64) (*types.Transaction, *txbuilder.Client, error) { - client := s.tester.GetClient(tester.SelectByIndex, int(txIdx)) - client2 := s.tester.GetClient(tester.SelectRandom, 0) - wallet := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)) - - var feeCap *big.Int - var tipCap *big.Int - var blobFee *big.Int - - if s.options.BaseFee > 0 { - feeCap = new(big.Int).Mul(big.NewInt(int64(s.options.BaseFee)), big.NewInt(1000000000)) - } - if s.options.TipFee > 0 { - tipCap = new(big.Int).Mul(big.NewInt(int64(s.options.TipFee)), big.NewInt(1000000000)) - } - if s.options.BlobFee > 0 { - blobFee = new(big.Int).Mul(big.NewInt(int64(s.options.BlobFee)), big.NewInt(1000000000)) - } - - if feeCap == nil || tipCap == nil { - var err error - feeCap, tipCap, err = client.GetSuggestedFee() - if err != nil { - return nil, client, err - } - } - - if feeCap.Cmp(big.NewInt(1000000000)) < 0 { - feeCap = big.NewInt(1000000000) - } - if tipCap.Cmp(big.NewInt(1000000000)) < 0 { - tipCap = big.NewInt(1000000000) - } - if blobFee == nil { - blobFee = big.NewInt(1000000000) - } - - blobCount := uint64(rand.Int63n(int64(s.options.Sidecars)) + 1) - blobRefs := make([][]string, blobCount) - for i := 0; i < int(blobCount); i++ { - blobLabel := fmt.Sprintf("0x1611AA0000%08dFF%02dFF%04dFEED", txIdx, i, 0) - - specialBlob := rand.Intn(50) - switch specialBlob { - case 0: // special blob commitment - all 0x0 - blobRefs[i] = []string{"0x0"} - case 1, 2: // reuse well known blob - blobRefs[i] = []string{"repeat:0x42:1337"} - case 3, 4: // duplicate commitment - if i == 0 { - blobRefs[i] = []string{blobLabel, "random"} - } else { - blobRefs[i] = []string{"copy:0"} - } - - default: // random blob data - blobRefs[i] = []string{blobLabel, "random"} - } - } - - toAddr := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)+1).GetAddress() - blobTx, err := txbuilder.BuildBlobTx(&txbuilder.TxMetadata{ - GasFeeCap: uint256.MustFromBig(feeCap), - GasTipCap: uint256.MustFromBig(tipCap), - BlobFeeCap: uint256.MustFromBig(blobFee), - Gas: 21000, - To: &toAddr, - Value: uint256.NewInt(0), - }, blobRefs) - if err != nil { - return nil, nil, err - } - normalTx, err := txbuilder.DynFeeTx(&txbuilder.TxMetadata{ - GasFeeCap: uint256.MustFromBig(feeCap), - GasTipCap: uint256.MustFromBig(tipCap), - Gas: 21000, - To: &toAddr, - Value: uint256.NewInt(0), - }) - if err != nil { - return nil, nil, err - } - - tx1, err := wallet.BuildBlobTx(blobTx) - if err != nil { - return nil, nil, err - } - tx2, err := wallet.ReplaceDynamicFeeTx(normalTx, tx1.Nonce()) - if err != nil { - return nil, nil, err - } - - // send both tx at exactly the same time - wg := sync.WaitGroup{} - wg.Add(2) - var err1, err2 error - go func() { - err1 = client.SendTransaction(tx1) - if err1 != nil { - s.logger.WithField("client", client.GetName()).Warnf("error while sending blob tx %v: %v", txIdx, err1) - } - wg.Done() - }() - go func() { - delayMs := time.Duration(rand.Int63n(500)) * time.Millisecond - time.Sleep(delayMs) - err2 = client2.SendTransaction(tx2) - if err2 != nil { - s.logger.WithField("client", client2.GetName()).Warnf("error while sending dynfee tx %v: %v", txIdx, err2) - } - wg.Done() - }() - wg.Wait() - - replacementIdx := uint64(0) - if err1 == nil { - s.pendingWGroup.Add(1) - go s.awaitTxs(txIdx, tx1, client, wallet, replacementIdx, "blob") - replacementIdx++ - } - if err2 == nil { - s.pendingWGroup.Add(1) - go s.awaitTxs(txIdx, tx2, client2, wallet, replacementIdx, "dynfee") - replacementIdx++ - } - if replacementIdx == 0 { - return nil, nil, err1 - } - - return tx1, client, nil -} - -func (s *Scenario) awaitTxs(txIdx uint64, tx *types.Transaction, client *txbuilder.Client, wallet *txbuilder.Wallet, replacementIdx uint64, txLabel string) { - var awaitConfirmation bool = true - defer func() { - awaitConfirmation = false - if s.pendingChan != nil { - <-s.pendingChan - } - s.pendingWGroup.Done() - }() - if s.options.Rebroadcast > 0 { - go s.delayedResend(txIdx, tx, &awaitConfirmation) - } - - receipt, blockNum, err := client.AwaitTransaction(tx) - if err != nil { - s.logger.WithField("client", client.GetName()).Warnf("error while awaiting tx receipt: %v", err) - return - } - if receipt == nil { - return - } - - effectiveGasPrice := receipt.EffectiveGasPrice - if effectiveGasPrice == nil { - effectiveGasPrice = big.NewInt(0) - } - blobGasPrice := receipt.BlobGasPrice - if blobGasPrice == nil { - blobGasPrice = big.NewInt(0) - } - feeAmount := new(big.Int).Mul(effectiveGasPrice, big.NewInt(int64(receipt.GasUsed))) - totalAmount := new(big.Int).Add(tx.Value(), feeAmount) - wallet.SubBalance(totalAmount) - - gweiTotalFee := new(big.Int).Div(totalAmount, big.NewInt(1000000000)) - gweiBaseFee := new(big.Int).Div(effectiveGasPrice, big.NewInt(1000000000)) - gweiBlobFee := new(big.Int).Div(blobGasPrice, big.NewInt(1000000000)) - - s.logger.WithField("client", client.GetName()).Infof(" transaction %d/%v confirmed in block #%v. total fee: %v gwei (base: %v, blob: %v)", txIdx+1, txLabel, blockNum, gweiTotalFee, gweiBaseFee, gweiBlobFee) -} - -func (s *Scenario) delayedResend(txIdx uint64, tx *types.Transaction, awaitConfirmation *bool) { - for { - time.Sleep(time.Duration(s.options.Rebroadcast) * time.Second) - - if !*awaitConfirmation { - break - } - - client := s.tester.GetClient(tester.SelectRandom, 0) - client.SendTransaction(tx) - s.logger.WithField("client", client.GetName()).Infof(" transaction %d re-broadcasted.", txIdx+1) - } -} diff --git a/scenarios/deploytx/deploytx.go b/scenarios/deploytx/deploytx.go index ca0c77e..50bc73b 100644 --- a/scenarios/deploytx/deploytx.go +++ b/scenarios/deploytx/deploytx.go @@ -118,11 +118,11 @@ func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { } func (s *Scenario) Setup(testerCfg *tester.Tester) error { + s.tester = testerCfg return nil } -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester +func (s *Scenario) Run() error { txIdxCounter := uint64(0) counterMutex := sync.Mutex{} waitGroup := sync.WaitGroup{} diff --git a/scenarios/eoatx/eoatx.go b/scenarios/eoatx/eoatx.go index 75d98aa..80f5d37 100644 --- a/scenarios/eoatx/eoatx.go +++ b/scenarios/eoatx/eoatx.go @@ -92,11 +92,12 @@ func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { } func (s *Scenario) Setup(testerCfg *tester.Tester) error { + s.tester = testerCfg + return nil } -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester +func (s *Scenario) Run() error { txIdxCounter := uint64(0) counterMutex := sync.Mutex{} waitGroup := sync.WaitGroup{} diff --git a/scenarios/erctx/erctx.go b/scenarios/erctx/erctx.go index 346142c..27f48a4 100644 --- a/scenarios/erctx/erctx.go +++ b/scenarios/erctx/erctx.go @@ -96,11 +96,22 @@ func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { // TODO - move contract deployment to Setup func (s *Scenario) Setup(testerCfg *tester.Tester) error { + s.logger.Infof("setting up scenario: erctx") + s.tester = testerCfg + + s.logger.Infof("deploying token contract...") + contractReceipt, _, err := s.sendDeploymentTx() + if err != nil { + s.logger.Errorf("could not deploy token contract: %v", err) + return err + } + s.contractAddr = contractReceipt.ContractAddress + s.logger.Infof("deployed token contract: %v (confirmed in block #%v)", s.contractAddr.String(), contractReceipt.BlockNumber.String()) + return nil } -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester +func (s *Scenario) Run() error { txIdxCounter := uint64(0) counterMutex := sync.Mutex{} waitGroup := sync.WaitGroup{} @@ -109,13 +120,6 @@ func (s *Scenario) Run(tester *tester.Tester) error { startTime := time.Now() s.logger.Infof("starting scenario: erctx") - contractReceipt, _, err := s.sendDeploymentTx() - if err != nil { - s.logger.Errorf("could not deploy token contract: %v", err) - return err - } - s.contractAddr = contractReceipt.ContractAddress - s.logger.Infof("deployed token contract: %v (confirmed in block #%v)", s.contractAddr.String(), contractReceipt.BlockNumber.String()) for { txIdx := txIdxCounter diff --git a/scenarios/largetx/abis/looper.go b/scenarios/largetx/contracts/looper.go similarity index 82% rename from scenarios/largetx/abis/looper.go rename to scenarios/largetx/contracts/looper.go index e98e82c..e26eb67 100644 --- a/scenarios/largetx/abis/looper.go +++ b/scenarios/largetx/contracts/looper.go @@ -32,12 +32,34 @@ var ( // LooperMetaData contains all meta data concerning the Looper contract. var LooperMetaData = &bind.MetaData{ ABI: "[{\"type\":\"function\",\"name\":\"loop_it\",\"inputs\":[{\"name\":\"no_of_times_to_loop\",\"type\":\"uint64\",\"internalType\":\"uint64\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256[]\",\"internalType\":\"uint256[]\"}],\"stateMutability\":\"nonpayable\"}]", + Bin: "0x608060405234801561001057600080fd5b506101c5806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80638f491c6514610030575b600080fd5b61004361003e3660046100ee565b610059565b604051610050919061011f565b60405180910390f35b606060008267ffffffffffffffff1667ffffffffffffffff81111561008057610080610163565b6040519080825280602002602001820160405280156100a9578160200160208202803683370190505b50905060005b8367ffffffffffffffff168110156100e757808282815181106100d4576100d4610179565b60209081029190910101526001016100af565b5092915050565b60006020828403121561010057600080fd5b813567ffffffffffffffff8116811461011857600080fd5b9392505050565b6020808252825182820181905260009190848201906040850190845b818110156101575783518352928401929184019160010161013b565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea2646970667358221220b226884699e16cc47ae01a4cc201e790347695464df17edde46bbab26872400364736f6c63430008180033", } // LooperABI is the input ABI used to generate the binding from. // Deprecated: Use LooperMetaData.ABI instead. var LooperABI = LooperMetaData.ABI +// LooperBin is the compiled bytecode used for deploying new contracts. +// Deprecated: Use LooperMetaData.Bin instead. +var LooperBin = LooperMetaData.Bin + +// DeployLooper deploys a new Ethereum contract, binding an instance of Looper to it. +func DeployLooper(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Looper, error) { + parsed, err := LooperMetaData.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(LooperBin), backend) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Looper{LooperCaller: LooperCaller{contract: contract}, LooperTransactor: LooperTransactor{contract: contract}, LooperFilterer: LooperFilterer{contract: contract}}, nil +} + // Looper is an auto generated Go binding around an Ethereum contract. type Looper struct { LooperCaller // Read-only binding to the contract diff --git a/scenarios/largetx/largetx.go b/scenarios/largetx/largetx.go index fb7609f..7a6904b 100644 --- a/scenarios/largetx/largetx.go +++ b/scenarios/largetx/largetx.go @@ -4,7 +4,7 @@ import ( "context" "fmt" "github.com/ethereum/go-ethereum/accounts/abi/bind" - largetx "github.com/ethpandaops/goomy-blob/scenarios/largetx/abis" + largetx "github.com/ethpandaops/goomy-blob/scenarios/largetx/contracts" "github.com/ethpandaops/goomy-blob/utils" "math/big" "os" @@ -39,8 +39,8 @@ type Scenario struct { logger *logrus.Entry tester *tester.Tester - contractAddr common.Address - loopCount uint64 + looperContractAddr common.Address + loopCount uint64 pendingCount uint64 pendingChan chan bool @@ -96,13 +96,23 @@ func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { return nil } -// TODO - move contract deployment here func (s *Scenario) Setup(testerCfg *tester.Tester) error { + s.logger.Infof("setting up scenario: largetx") + s.tester = testerCfg + s.logger.Infof("deploying looper contract...") + receipt, _, err := s.DeployLooperContract() + if err != nil { + return err + } + + s.looperContractAddr = receipt.ContractAddress + + s.logger.Infof("deployed looper contract at %v", s.looperContractAddr.String()) + return nil } -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester +func (s *Scenario) Run() error { txIdxCounter := uint64(0) counterMutex := sync.Mutex{} waitGroup := sync.WaitGroup{} @@ -111,15 +121,6 @@ func (s *Scenario) Run(tester *tester.Tester) error { startTime := time.Now() s.logger.Infof("starting scenario: largetx") - s.logger.Infof("deploying looper contract...") - receipt, _, err := s.DeployLooperContract() - if err != nil { - return err - } - - s.contractAddr = receipt.ContractAddress - - s.logger.Infof("deployed looper contract at %v", s.contractAddr.String()) for { txIdx := txIdxCounter @@ -179,59 +180,23 @@ func (s *Scenario) Run(tester *tester.Tester) error { } func (s *Scenario) DeployLooperContract() (*types.Receipt, *txbuilder.Client, error) { + wallet := s.tester.GetRootWallet() client := s.tester.GetClient(tester.SelectByIndex, 0) - wallet := s.tester.GetWallet(tester.SelectByIndex, 0) - - var feeCap *big.Int - var tipCap *big.Int - - if s.options.BaseFee > 0 { - feeCap = new(big.Int).Mul(big.NewInt(int64(s.options.BaseFee)), big.NewInt(1000000000)) - } - if s.options.TipFee > 0 { - tipCap = new(big.Int).Mul(big.NewInt(int64(s.options.TipFee)), big.NewInt(1000000000)) - } - - if feeCap == nil || tipCap == nil { - var err error - feeCap, tipCap, err = client.GetSuggestedFee() - if err != nil { - return nil, client, err - } - } - if feeCap.Cmp(big.NewInt(1000000000)) < 0 { - feeCap = big.NewInt(1000000000) - } - if tipCap.Cmp(big.NewInt(1000000000)) < 0 { - tipCap = big.NewInt(1000000000) - } - - txData, err := txbuilder.DynFeeTx(&txbuilder.TxMetadata{ - GasFeeCap: uint256.MustFromBig(feeCap), - GasTipCap: uint256.MustFromBig(tipCap), - Gas: 200000, - To: nil, - Value: uint256.NewInt(0), - Data: common.FromHex(LOOPER_CONTRACT_BYTECODE), - }) + transactor, err := s.GetTransactor(wallet, false, big.NewInt(0)) if err != nil { return nil, nil, err } - tx, err := wallet.BuildDynamicFeeTx(txData) + _, deployTx, _, err := largetx.DeployLooper(transactor, client.GetEthClient()) if err != nil { return nil, nil, err - } - err = client.SendTransaction(tx) - if err != nil { - return nil, client, err } - receipt, _, err := client.AwaitTransaction(tx) + receipt, _, err := s.SendAndAwaitTx(wallet, deployTx, SendTxOpts{Gas: 3000000}) if err != nil { - return nil, client, err + return nil, nil, err } return receipt, client, nil @@ -266,20 +231,16 @@ func (s *Scenario) sendTx(txIdx uint64) (*types.Transaction, *txbuilder.Client, tipCap = big.NewInt(1000000000) } - looperContract, err := largetx.NewLooper(s.contractAddr, client.GetEthClient()) + looperContract, err := s.GetLooperContract() if err != nil { - s.logger.Errorf("could not create contract instance: %v", err) return nil, nil, err } - transactor, err := bind.NewKeyedTransactorWithChainID(wallet.GetPrivateKey(), wallet.GetChainId()) + transactor, err := s.GetTransactor(wallet, false, big.NewInt(0)) if err != nil { return nil, nil, err } - transactor.Context = context.Background() - transactor.NoSend = true - s.logger.Infof("looping %d times in contract %v", s.loopCount, s.contractAddr.String()) loopItTx, err := looperContract.LoopIt(transactor, s.loopCount) if err != nil { s.logger.Errorf("could not generate transaction: %v", err) @@ -290,7 +251,7 @@ func (s *Scenario) sendTx(txIdx uint64) (*types.Transaction, *txbuilder.Client, GasFeeCap: uint256.MustFromBig(feeCap), GasTipCap: uint256.MustFromBig(tipCap), Gas: loopItTx.Gas(), - To: &s.contractAddr, + To: &s.looperContractAddr, Value: uint256.NewInt(0), Data: loopItTx.Data(), }) @@ -315,7 +276,7 @@ func (s *Scenario) sendTx(txIdx uint64) (*types.Transaction, *txbuilder.Client, } func (s *Scenario) awaitTx(txIdx uint64, tx *types.Transaction, client *txbuilder.Client, wallet *txbuilder.Wallet) { - var awaitConfirmation bool = true + var awaitConfirmation = true defer func() { awaitConfirmation = false if s.pendingChan != nil { @@ -364,3 +325,86 @@ func (s *Scenario) timeTicker(txIdx uint64, tx *types.Transaction, awaitConfirma os.Exit(1) } } + +func (s *Scenario) GetTransactor(wallet *txbuilder.Wallet, noSend bool, value *big.Int) (*bind.TransactOpts, error) { + transactor, err := bind.NewKeyedTransactorWithChainID(wallet.GetPrivateKey(), wallet.GetChainId()) + if err != nil { + return nil, err + } + transactor.Context = context.Background() + transactor.NoSend = noSend + transactor.Value = value + + return transactor, nil +} + +type SendTxOpts struct { + Gas uint64 +} + +func (s *Scenario) SendAndAwaitTx(wallet *txbuilder.Wallet, tx *types.Transaction, opts SendTxOpts) (*types.Receipt, *txbuilder.Client, error) { + client := s.tester.GetClient(tester.SelectByIndex, 0) + + var feeCap *big.Int + var tipCap *big.Int + + if s.options.BaseFee > 0 { + feeCap = new(big.Int).Mul(big.NewInt(int64(s.options.BaseFee)), big.NewInt(1000000000)) + } + if s.options.TipFee > 0 { + tipCap = new(big.Int).Mul(big.NewInt(int64(s.options.TipFee)), big.NewInt(1000000000)) + } + + if feeCap == nil || tipCap == nil { + var err error + feeCap, tipCap, err = client.GetSuggestedFee() + if err != nil { + return nil, client, err + } + } + + if feeCap.Cmp(big.NewInt(1000000000)) < 0 { + feeCap = big.NewInt(1000000000) + } + if tipCap.Cmp(big.NewInt(1000000000)) < 0 { + tipCap = big.NewInt(1000000000) + } + + gas := tx.Gas() + if opts.Gas != 0 { + gas = opts.Gas + } + + dynamicTxData, err := txbuilder.DynFeeTx(&txbuilder.TxMetadata{ + GasFeeCap: uint256.MustFromBig(feeCap), + GasTipCap: uint256.MustFromBig(tipCap), + Gas: gas, + To: tx.To(), + Value: uint256.NewInt(tx.Value().Uint64()), + Data: tx.Data(), + }) + if err != nil { + return nil, nil, err + } + finalTx, err := wallet.BuildDynamicFeeTx(dynamicTxData) + if err != nil { + return nil, nil, err + } + + err = client.SendTransaction(finalTx) + if err != nil { + return nil, client, err + } + + receipt, _, err := client.AwaitTransaction(finalTx) + if err != nil { + return nil, client, err + } + + return receipt, client, nil +} + +func (s *Scenario) GetLooperContract() (*largetx.Looper, error) { + client := s.tester.GetClient(tester.SelectByIndex, 0) + return largetx.NewLooper(s.looperContractAddr, client.GetEthClient()) +} diff --git a/scenarios/normal/normal.go b/scenarios/normal/normal.go deleted file mode 100644 index 7db97e7..0000000 --- a/scenarios/normal/normal.go +++ /dev/null @@ -1,300 +0,0 @@ -package normal - -import ( - "fmt" - "math/big" - "math/rand" - "sync" - "time" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/holiman/uint256" - "github.com/sirupsen/logrus" - "github.com/spf13/pflag" - - "github.com/ethpandaops/goomy-blob/scenariotypes" - "github.com/ethpandaops/goomy-blob/tester" - "github.com/ethpandaops/goomy-blob/txbuilder" - "github.com/ethpandaops/goomy-blob/utils" -) - -type ScenarioOptions struct { - TotalCount uint64 - Throughput uint64 - Sidecars uint64 - MaxPending uint64 - MaxWallets uint64 - Rebroadcast uint64 - BaseFee uint64 - TipFee uint64 - BlobFee uint64 -} - -type Scenario struct { - options ScenarioOptions - logger *logrus.Entry - tester *tester.Tester - - pendingCount uint64 - pendingChan chan bool - pendingWGroup sync.WaitGroup -} - -func NewScenario() scenariotypes.Scenario { - return &Scenario{ - logger: logrus.WithField("scenario", "normal"), - } -} - -func (s *Scenario) Flags(flags *pflag.FlagSet) error { - flags.Uint64VarP(&s.options.TotalCount, "count", "c", 0, "Total number of blob transactions to send") - flags.Uint64VarP(&s.options.Throughput, "throughput", "t", 0, "Number of blob transactions to send per slot") - flags.Uint64VarP(&s.options.Sidecars, "sidecars", "b", 1, "Number of blob sidecars per blob transactions") - flags.Uint64Var(&s.options.MaxPending, "max-pending", 0, "Maximum number of pending transactions") - flags.Uint64Var(&s.options.MaxWallets, "max-wallets", 0, "Maximum number of child wallets to use") - flags.Uint64Var(&s.options.Rebroadcast, "rebroadcast", 120, "Number of seconds to wait before re-broadcasting a transaction") - flags.Uint64Var(&s.options.BaseFee, "basefee", 20, "Max fee per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.TipFee, "tipfee", 2, "Max tip per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.BlobFee, "blobfee", 20, "Max blob fee to use in blob transactions (in gwei)") - return nil -} - -func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { - if s.options.TotalCount == 0 && s.options.Throughput == 0 { - return fmt.Errorf("neither total count nor throughput limit set, must define at least one of them") - } - - if s.options.MaxWallets > 0 { - testerCfg.WalletCount = s.options.MaxWallets - } else if s.options.TotalCount > 0 { - if s.options.TotalCount < 1000 { - testerCfg.WalletCount = s.options.TotalCount - } else { - testerCfg.WalletCount = 1000 - } - } else { - if s.options.Throughput*10 < 1000 { - testerCfg.WalletCount = s.options.Throughput * 10 - } else { - testerCfg.WalletCount = 1000 - } - } - - if s.options.MaxPending > 0 { - s.pendingChan = make(chan bool, s.options.MaxPending) - } - - return nil -} - -func (s *Scenario) Setup(testerCfg *tester.Tester) error { - return nil -} - -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester - txIdxCounter := uint64(0) - counterMutex := sync.Mutex{} - waitGroup := sync.WaitGroup{} - pendingCount := uint64(0) - txCount := uint64(0) - startTime := time.Now() - - s.logger.Infof("starting scenario: normal") - - for { - txIdx := txIdxCounter - txIdxCounter++ - - if s.pendingChan != nil { - // await pending transactions - s.pendingChan <- true - } - waitGroup.Add(1) - counterMutex.Lock() - pendingCount++ - counterMutex.Unlock() - - go func(txIdx uint64) { - defer func() { - counterMutex.Lock() - pendingCount-- - counterMutex.Unlock() - waitGroup.Done() - }() - - logger := s.logger - tx, client, err := s.sendBlobTx(txIdx) - if client != nil { - logger = logger.WithField("rpc", client.GetName()) - } - if err != nil { - logger.Warnf("could not send blob transaction: %v", err) - <-s.pendingChan - return - } - - counterMutex.Lock() - txCount++ - counterMutex.Unlock() - logger.Infof("sent blob tx #%6d: %v (%v sidecars)", txIdx+1, tx.Hash().String(), len(tx.BlobTxSidecar().Blobs)) - }(txIdx) - - count := txCount + pendingCount - if s.options.TotalCount > 0 && count >= s.options.TotalCount { - break - } - if s.options.Throughput > 0 { - for count/((uint64(time.Since(startTime).Seconds())/utils.SecondsPerSlot)+1) >= s.options.Throughput { - time.Sleep(100 * time.Millisecond) - } - } - } - waitGroup.Wait() - - s.logger.Infof("finished sending transactions, awaiting block inclusion...") - s.pendingWGroup.Wait() - s.logger.Infof("finished sending transactions, awaiting block inclusion...") - - return nil -} - -func (s *Scenario) sendBlobTx(txIdx uint64) (*types.Transaction, *txbuilder.Client, error) { - client := s.tester.GetClient(tester.SelectByIndex, int(txIdx)) - wallet := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)) - - var feeCap *big.Int - var tipCap *big.Int - var blobFee *big.Int - - if s.options.BaseFee > 0 { - feeCap = new(big.Int).Mul(big.NewInt(int64(s.options.BaseFee)), big.NewInt(1000000)) - } - if s.options.TipFee > 0 { - tipCap = new(big.Int).Mul(big.NewInt(int64(s.options.TipFee)), big.NewInt(1000000)) - } - if s.options.BlobFee > 0 { - blobFee = new(big.Int).Mul(big.NewInt(int64(s.options.BlobFee)), big.NewInt(1000000)) - } - - if feeCap == nil || tipCap == nil { - var err error - feeCap, tipCap, err = client.GetSuggestedFee() - if err != nil { - return nil, client, err - } - } - - if feeCap.Cmp(big.NewInt(1000000)) < 0 { - feeCap = big.NewInt(1000000) - } - if tipCap.Cmp(big.NewInt(1000000)) < 0 { - tipCap = big.NewInt(1000000) - } - if blobFee == nil { - blobFee = big.NewInt(1000000) - } - - blobCount := uint64(rand.Int63n(int64(s.options.Sidecars)) + 1) - blobRefs := make([][]string, blobCount) - for i := 0; i < int(blobCount); i++ { - blobLabel := fmt.Sprintf("0x1611AA0000%08dFF%02dFF%04dFEED", txIdx, i, 0) - - specialBlob := rand.Intn(50) - switch specialBlob { - case 0: // special blob commitment - all 0x0 - blobRefs[i] = []string{"0x0"} - case 1, 2: // reuse well known blob - blobRefs[i] = []string{"repeat:0x42:1337"} - case 3, 4: // duplicate commitment - if i == 0 { - blobRefs[i] = []string{blobLabel, "random"} - } else { - blobRefs[i] = []string{"copy:0"} - } - - default: // random blob data - blobRefs[i] = []string{blobLabel, "random"} - } - } - - toAddr := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)+1).GetAddress() - blobTx, err := txbuilder.BuildBlobTx(&txbuilder.TxMetadata{ - GasFeeCap: uint256.MustFromBig(feeCap), - GasTipCap: uint256.MustFromBig(tipCap), - BlobFeeCap: uint256.MustFromBig(blobFee), - Gas: 21000, - To: &toAddr, - Value: uint256.NewInt(0), - }, blobRefs) - if err != nil { - return nil, nil, err - } - - tx, err := wallet.BuildBlobTx(blobTx) - if err != nil { - return nil, nil, err - } - - err = client.SendTransaction(tx) - if err != nil { - return nil, client, err - } - - s.pendingWGroup.Add(1) - go s.awaitTx(txIdx, tx, client, wallet) - - return tx, client, nil -} - -func (s *Scenario) awaitTx(txIdx uint64, tx *types.Transaction, client *txbuilder.Client, wallet *txbuilder.Wallet) { - var awaitConfirmation bool = true - defer func() { - awaitConfirmation = false - if s.pendingChan != nil { - <-s.pendingChan - } - s.pendingWGroup.Done() - }() - if s.options.Rebroadcast > 0 { - go s.delayedResend(txIdx, tx, &awaitConfirmation) - } - - receipt, blockNum, err := client.AwaitTransaction(tx) - if err != nil { - s.logger.WithField("client", client.GetName()).Warnf("error while awaiting tx receipt: %v", err) - return - } - - effectiveGasPrice := receipt.EffectiveGasPrice - if effectiveGasPrice == nil { - effectiveGasPrice = big.NewInt(0) - } - blobGasPrice := receipt.BlobGasPrice - if blobGasPrice == nil { - blobGasPrice = big.NewInt(0) - } - feeAmount := new(big.Int).Mul(effectiveGasPrice, big.NewInt(int64(receipt.GasUsed))) - totalAmount := new(big.Int).Add(tx.Value(), feeAmount) - wallet.SubBalance(totalAmount) - - gweiTotalFee := new(big.Int).Div(totalAmount, big.NewInt(1000000)) - gweiBaseFee := new(big.Int).Div(effectiveGasPrice, big.NewInt(1000000)) - gweiBlobFee := new(big.Int).Div(blobGasPrice, big.NewInt(1000000)) - - s.logger.WithField("client", client.GetName()).Infof(" transaction %d confirmed in block #%v. total fee: %v gwei (base: %v, blob: %v)", txIdx+1, blockNum, gweiTotalFee, gweiBaseFee, gweiBlobFee) -} - -func (s *Scenario) delayedResend(txIdx uint64, tx *types.Transaction, awaitConfirmation *bool) { - for { - time.Sleep(time.Duration(s.options.Rebroadcast) * time.Second) - - if !*awaitConfirmation { - break - } - - client := s.tester.GetClient(tester.SelectRandom, 0) - client.SendTransaction(tx) - s.logger.WithField("client", client.GetName()).Infof(" transaction %d re-broadcasted.", txIdx+1) - } -} diff --git a/scenarios/replacements/replacements.go b/scenarios/replacements/replacements.go deleted file mode 100644 index b6a4cd6..0000000 --- a/scenarios/replacements/replacements.go +++ /dev/null @@ -1,348 +0,0 @@ -package replacements - -import ( - "fmt" - "math/big" - "math/rand" - "sync" - "time" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/holiman/uint256" - "github.com/sirupsen/logrus" - "github.com/spf13/pflag" - - "github.com/ethpandaops/goomy-blob/scenariotypes" - "github.com/ethpandaops/goomy-blob/tester" - "github.com/ethpandaops/goomy-blob/txbuilder" - "github.com/ethpandaops/goomy-blob/utils" -) - -type ScenarioOptions struct { - TotalCount uint64 - Throughput uint64 - Sidecars uint64 - MaxPending uint64 - MaxWallets uint64 - Replace uint64 - MaxReplacements uint64 - Rebroadcast uint64 - BaseFee uint64 - TipFee uint64 - BlobFee uint64 -} - -type Scenario struct { - options ScenarioOptions - logger *logrus.Entry - tester *tester.Tester - - pendingCount uint64 - pendingChan chan bool - pendingWGroup sync.WaitGroup -} - -func NewScenario() scenariotypes.Scenario { - return &Scenario{ - logger: logrus.WithField("scenario", "replacements"), - } -} - -func (s *Scenario) Flags(flags *pflag.FlagSet) error { - flags.Uint64VarP(&s.options.TotalCount, "count", "c", 0, "Total number of blob transactions to send") - flags.Uint64VarP(&s.options.Throughput, "throughput", "t", 0, "Number of blob transactions to send per slot") - flags.Uint64VarP(&s.options.Sidecars, "sidecars", "b", 1, "Number of blob sidecars per blob transactions") - flags.Uint64Var(&s.options.MaxPending, "max-pending", 0, "Maximum number of pending transactions") - flags.Uint64Var(&s.options.MaxWallets, "max-wallets", 0, "Maximum number of child wallets to use") - flags.Uint64Var(&s.options.Replace, "replace", 10, "Number of seconds to wait before replace a transaction") - flags.Uint64Var(&s.options.MaxReplacements, "max-replace", 5, "Maximum number of replacement transactions") - flags.Uint64Var(&s.options.Rebroadcast, "rebroadcast", 120, "Number of seconds to wait before re-broadcasting a transaction") - flags.Uint64Var(&s.options.BaseFee, "basefee", 20, "Max fee per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.TipFee, "tipfee", 2, "Max tip per gas to use in blob transactions (in gwei)") - flags.Uint64Var(&s.options.BlobFee, "blobfee", 20, "Max blob fee to use in blob transactions (in gwei)") - return nil -} - -func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { - if s.options.TotalCount == 0 && s.options.Throughput == 0 { - return fmt.Errorf("neither total count nor throughput limit set, must define at least one of them") - } - - if s.options.MaxWallets > 0 { - testerCfg.WalletCount = s.options.MaxWallets - } else if s.options.TotalCount > 0 { - if s.options.TotalCount < 1000 { - testerCfg.WalletCount = s.options.TotalCount - } else { - testerCfg.WalletCount = 1000 - } - } else { - if s.options.Throughput*10 < 1000 { - testerCfg.WalletCount = s.options.Throughput * 10 - } else { - testerCfg.WalletCount = 1000 - } - } - - if s.options.MaxPending > 0 { - s.pendingChan = make(chan bool, s.options.MaxPending) - } - - return nil -} - -func (s *Scenario) Setup(testerCfg *tester.Tester) error { - return nil -} - -func (s *Scenario) Run(tester *tester.Tester) error { - s.tester = tester - txIdxCounter := uint64(0) - counterMutex := sync.Mutex{} - waitGroup := sync.WaitGroup{} - pendingCount := uint64(0) - txCount := uint64(0) - startTime := time.Now() - - s.logger.Infof("starting scenario: replacements") - - for { - txIdx := txIdxCounter - txIdxCounter++ - - if s.pendingChan != nil { - // await pending transactions - s.pendingChan <- true - } - waitGroup.Add(1) - counterMutex.Lock() - pendingCount++ - counterMutex.Unlock() - - go func(txIdx uint64) { - defer func() { - counterMutex.Lock() - pendingCount-- - counterMutex.Unlock() - waitGroup.Done() - }() - - logger := s.logger - tx, client, err := s.sendBlobTx(txIdx, 0, 0) - if client != nil { - logger = logger.WithField("rpc", client.GetName()) - } - if err != nil { - logger.Warnf("blob tx %6d.0 failed: %v", txIdx+1, err) - if s.pendingChan != nil { - <-s.pendingChan - } - return - } - - counterMutex.Lock() - txCount++ - counterMutex.Unlock() - logger.Infof("blob tx %6d.0 sent: %v (%v sidecars)", txIdx+1, tx.Hash().String(), len(tx.BlobTxSidecar().Blobs)) - }(txIdx) - - count := txCount + pendingCount - if s.options.TotalCount > 0 && count >= s.options.TotalCount { - break - } - if s.options.Throughput > 0 { - for count/((uint64(time.Since(startTime).Seconds())/utils.SecondsPerSlot)+1) >= s.options.Throughput { - time.Sleep(100 * time.Millisecond) - } - } - } - waitGroup.Wait() - - s.logger.Infof("finished sending transactions, awaiting block inclusion...") - s.pendingWGroup.Wait() - s.logger.Infof("all transactions included!") - - return nil -} - -func (s *Scenario) sendBlobTx(txIdx uint64, replacementIdx uint64, txNonce uint64) (*types.Transaction, *txbuilder.Client, error) { - client := s.tester.GetClient(tester.SelectByIndex, int(txIdx)) - wallet := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)) - - if rand.Intn(100) < 50 { - // 50% chance to send transaction via another client - // will cause some replacement txs being sent via different clients than the original tx - client = s.tester.GetClient(tester.SelectRandom, 0) - } - - var feeCap *big.Int - var tipCap *big.Int - var blobFee *big.Int - - if s.options.BaseFee > 0 { - feeCap = new(big.Int).Mul(big.NewInt(int64(s.options.BaseFee)), big.NewInt(1000000000)) - } - if s.options.TipFee > 0 { - tipCap = new(big.Int).Mul(big.NewInt(int64(s.options.TipFee)), big.NewInt(1000000000)) - } - if s.options.BlobFee > 0 { - blobFee = new(big.Int).Mul(big.NewInt(int64(s.options.BlobFee)), big.NewInt(1000000000)) - } - - if feeCap == nil || tipCap == nil { - // get suggested fee from client - var err error - feeCap, tipCap, err = client.GetSuggestedFee() - if err != nil { - return nil, client, err - } - } - - if feeCap.Cmp(big.NewInt(1000000000)) < 0 { - feeCap = big.NewInt(1000000000) - } - if tipCap.Cmp(big.NewInt(1000000000)) < 0 { - tipCap = big.NewInt(1000000000) - } - if blobFee == nil { - blobFee = big.NewInt(1000000000) - } - - for i := 0; i < int(replacementIdx); i++ { - // x3 fee for each replacement tx - feeCap = feeCap.Mul(feeCap, big.NewInt(3)) - tipCap = tipCap.Mul(tipCap, big.NewInt(3)) - blobFee = blobFee.Mul(blobFee, big.NewInt(3)) - } - - blobCount := uint64(rand.Int63n(int64(s.options.Sidecars)) + 1) - blobRefs := make([][]string, blobCount) - for i := 0; i < int(blobCount); i++ { - blobLabel := fmt.Sprintf("0x1611AA0000%08dFF%02dFF%04dFEED", txIdx, i, replacementIdx) - - specialBlob := rand.Intn(50) - switch specialBlob { - case 0: // special blob commitment - all 0x0 - blobRefs[i] = []string{"0x0"} - case 1, 2: // reuse well known blob - blobRefs[i] = []string{"repeat:0x42:1337"} - case 3, 4: // duplicate commitment - if i == 0 { - blobRefs[i] = []string{blobLabel, "random"} - } else { - blobRefs[i] = []string{"copy:0"} - } - - default: // random blob data - blobRefs[i] = []string{blobLabel, "random"} - } - } - - toAddr := s.tester.GetWallet(tester.SelectByIndex, int(txIdx)+1).GetAddress() - blobTx, err := txbuilder.BuildBlobTx(&txbuilder.TxMetadata{ - GasFeeCap: uint256.MustFromBig(feeCap), - GasTipCap: uint256.MustFromBig(tipCap), - BlobFeeCap: uint256.MustFromBig(blobFee), - Gas: 21000, - To: &toAddr, - Value: uint256.NewInt(0), - }, blobRefs) - if err != nil { - return nil, client, err - } - - var tx *types.Transaction - if replacementIdx == 0 { - tx, err = wallet.BuildBlobTx(blobTx) - } else { - tx, err = wallet.ReplaceBlobTx(blobTx, txNonce) - } - if err != nil { - return nil, client, err - } - - err = client.SendTransaction(tx) - if err != nil { - return nil, client, err - } - - s.pendingWGroup.Add(1) - go s.awaitTx(txIdx, tx, client, wallet, replacementIdx) - - return tx, client, nil -} - -func (s *Scenario) awaitTx(txIdx uint64, tx *types.Transaction, client *txbuilder.Client, wallet *txbuilder.Wallet, replacementIdx uint64) { - var awaitConfirmation bool = true - defer func() { - awaitConfirmation = false - if replacementIdx == 0 { - if s.pendingChan != nil { - <-s.pendingChan - } - } - s.pendingWGroup.Done() - }() - if s.options.Replace > 0 && replacementIdx < s.options.MaxReplacements && rand.Intn(100) < 70 { - go s.delayedReplace(txIdx, tx, &awaitConfirmation, replacementIdx) - } else if s.options.Rebroadcast > 0 { - go s.delayedResend(txIdx, tx, &awaitConfirmation, replacementIdx) - } - - receipt, blockNum, err := client.AwaitTransaction(tx) - if err != nil { - s.logger.WithField("client", client.GetName()).Warnf("blob tx %6d.%v: await receipt failed: %v", txIdx+1, replacementIdx, err) - return - } - if receipt == nil { - return - } - - effectiveGasPrice := receipt.EffectiveGasPrice - if effectiveGasPrice == nil { - effectiveGasPrice = big.NewInt(0) - } - blobGasPrice := receipt.BlobGasPrice - if blobGasPrice == nil { - blobGasPrice = big.NewInt(0) - } - feeAmount := new(big.Int).Mul(effectiveGasPrice, big.NewInt(int64(receipt.GasUsed))) - totalAmount := new(big.Int).Add(tx.Value(), feeAmount) - wallet.SubBalance(totalAmount) - - gweiTotalFee := new(big.Int).Div(totalAmount, big.NewInt(1000000000)) - gweiBaseFee := new(big.Int).Div(effectiveGasPrice, big.NewInt(1000000000)) - gweiBlobFee := new(big.Int).Div(blobGasPrice, big.NewInt(1000000000)) - - s.logger.WithField("client", client.GetName()).Infof("blob tx %6d.%v confirmed in block #%v! total fee: %v gwei (base: %v, blob: %v)", txIdx+1, replacementIdx, blockNum, gweiTotalFee, gweiBaseFee, gweiBlobFee) -} - -func (s *Scenario) delayedResend(txIdx uint64, tx *types.Transaction, awaitConfirmation *bool, replacementIdx uint64) { - for { - time.Sleep(time.Duration(s.options.Rebroadcast) * time.Second) - - if !*awaitConfirmation { - break - } - - client := s.tester.GetClient(tester.SelectRandom, 0) - client.SendTransaction(tx) - s.logger.WithField("client", client.GetName()).Debugf("blob tx %6d.%v re-broadcasted.", txIdx+1, replacementIdx) - } -} - -func (s *Scenario) delayedReplace(txIdx uint64, tx *types.Transaction, awaitConfirmation *bool, replacementIdx uint64) { - time.Sleep(time.Duration(rand.Intn(int(s.options.Replace))+2) * time.Second) - - if !*awaitConfirmation { - return - } - - replaceTx, client, err := s.sendBlobTx(txIdx, replacementIdx+1, tx.Nonce()) - if err != nil { - s.logger.WithField("client", client.GetName()).Warnf("blob tx %6d.%v replacement failed: %v", txIdx+1, replacementIdx+1, err) - s.delayedResend(txIdx, tx, awaitConfirmation, replacementIdx) - return - } - s.logger.WithField("client", client.GetName()).Infof("blob tx %6d.%v sent: %v (%v sidecars)", txIdx+1, replacementIdx+1, replaceTx.Hash().String(), len(tx.BlobTxSidecar().Blobs)) -} diff --git a/scenarios/scenarios.go b/scenarios/scenarios.go index d7b043d..a3d9706 100644 --- a/scenarios/scenarios.go +++ b/scenarios/scenarios.go @@ -1,30 +1,18 @@ package scenarios import ( - "github.com/ethpandaops/goomy-blob/scenarios/combined" - "github.com/ethpandaops/goomy-blob/scenarios/conflicting" "github.com/ethpandaops/goomy-blob/scenarios/deploytx" "github.com/ethpandaops/goomy-blob/scenarios/eoatx" "github.com/ethpandaops/goomy-blob/scenarios/erctx" "github.com/ethpandaops/goomy-blob/scenarios/largetx" - "github.com/ethpandaops/goomy-blob/scenarios/normal" - "github.com/ethpandaops/goomy-blob/scenarios/replacements" "github.com/ethpandaops/goomy-blob/scenarios/univ2tx" - "github.com/ethpandaops/goomy-blob/scenarios/wallets" "github.com/ethpandaops/goomy-blob/scenariotypes" ) var Scenarios map[string]func() scenariotypes.Scenario = map[string]func() scenariotypes.Scenario{ - "combined": combined.NewScenario, - "conflicting": conflicting.NewScenario, - "normal": normal.NewScenario, - "replacements": replacements.NewScenario, - "eoatx": eoatx.NewScenario, "erctx": erctx.NewScenario, "largetx": largetx.NewScenario, "univ2tx": univ2tx.NewScenario, "deploytx": deploytx.NewScenario, - - "wallets": wallets.NewScenario, } diff --git a/scenarios/univ2tx/contracts/uniswap-pair.go b/scenarios/univ2tx/contracts/uniswap-v2-pair.go similarity index 62% rename from scenarios/univ2tx/contracts/uniswap-pair.go rename to scenarios/univ2tx/contracts/uniswap-v2-pair.go index af7fcef..c8e374f 100644 --- a/scenarios/univ2tx/contracts/uniswap-pair.go +++ b/scenarios/univ2tx/contracts/uniswap-v2-pair.go @@ -29,113 +29,113 @@ var ( _ = abi.ConvertType ) -// UniswapPairMetaData contains all meta data concerning the UniswapPair contract. -var UniswapPairMetaData = &bind.MetaData{ +// UniswapV2PairMetaData contains all meta data concerning the UniswapV2Pair contract. +var UniswapV2PairMetaData = &bind.MetaData{ ABI: "[{\"inputs\":[],\"payable\":false,\"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\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Burn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"name\":\"Mint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0In\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1In\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0Out\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1Out\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"Swap\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint112\",\"name\":\"reserve0\",\"type\":\"uint112\"},{\"indexed\":false,\"internalType\":\"uint112\",\"name\":\"reserve1\",\"type\":\"uint112\"}],\"name\":\"Sync\",\"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\"},{\"constant\":true,\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"MINIMUM_LIQUIDITY\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"PERMIT_TYPEHASH\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getReserves\",\"outputs\":[{\"internalType\":\"uint112\",\"name\":\"_reserve0\",\"type\":\"uint112\"},{\"internalType\":\"uint112\",\"name\":\"_reserve1\",\"type\":\"uint112\"},{\"internalType\":\"uint32\",\"name\":\"_blockTimestampLast\",\"type\":\"uint32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"_token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_token1\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"kLast\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"liquidity\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"nonces\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"name\":\"permit\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"price0CumulativeLast\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"price1CumulativeLast\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"}],\"name\":\"skim\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0Out\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1Out\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"swap\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"sync\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"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\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]", } -// UniswapPairABI is the input ABI used to generate the binding from. -// Deprecated: Use UniswapPairMetaData.ABI instead. -var UniswapPairABI = UniswapPairMetaData.ABI +// UniswapV2PairABI is the input ABI used to generate the binding from. +// Deprecated: Use UniswapV2PairMetaData.ABI instead. +var UniswapV2PairABI = UniswapV2PairMetaData.ABI -// UniswapPair is an auto generated Go binding around an Ethereum contract. -type UniswapPair struct { - UniswapPairCaller // Read-only binding to the contract - UniswapPairTransactor // Write-only binding to the contract - UniswapPairFilterer // Log filterer for contract events +// UniswapV2Pair is an auto generated Go binding around an Ethereum contract. +type UniswapV2Pair struct { + UniswapV2PairCaller // Read-only binding to the contract + UniswapV2PairTransactor // Write-only binding to the contract + UniswapV2PairFilterer // Log filterer for contract events } -// UniswapPairCaller is an auto generated read-only Go binding around an Ethereum contract. -type UniswapPairCaller struct { +// UniswapV2PairCaller is an auto generated read-only Go binding around an Ethereum contract. +type UniswapV2PairCaller struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// UniswapPairTransactor is an auto generated write-only Go binding around an Ethereum contract. -type UniswapPairTransactor struct { +// UniswapV2PairTransactor is an auto generated write-only Go binding around an Ethereum contract. +type UniswapV2PairTransactor struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// UniswapPairFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type UniswapPairFilterer struct { +// UniswapV2PairFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type UniswapV2PairFilterer struct { contract *bind.BoundContract // Generic contract wrapper for the low level calls } -// UniswapPairSession is an auto generated Go binding around an Ethereum contract, +// UniswapV2PairSession is an auto generated Go binding around an Ethereum contract, // with pre-set call and transact options. -type UniswapPairSession struct { - Contract *UniswapPair // Generic contract binding to set the session for +type UniswapV2PairSession struct { + Contract *UniswapV2Pair // 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 } -// UniswapPairCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// UniswapV2PairCallerSession is an auto generated read-only Go binding around an Ethereum contract, // with pre-set call options. -type UniswapPairCallerSession struct { - Contract *UniswapPairCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session +type UniswapV2PairCallerSession struct { + Contract *UniswapV2PairCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session } -// UniswapPairTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// UniswapV2PairTransactorSession is an auto generated write-only Go binding around an Ethereum contract, // with pre-set transact options. -type UniswapPairTransactorSession struct { - Contract *UniswapPairTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +type UniswapV2PairTransactorSession struct { + Contract *UniswapV2PairTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session } -// UniswapPairRaw is an auto generated low-level Go binding around an Ethereum contract. -type UniswapPairRaw struct { - Contract *UniswapPair // Generic contract binding to access the raw methods on +// UniswapV2PairRaw is an auto generated low-level Go binding around an Ethereum contract. +type UniswapV2PairRaw struct { + Contract *UniswapV2Pair // Generic contract binding to access the raw methods on } -// UniswapPairCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type UniswapPairCallerRaw struct { - Contract *UniswapPairCaller // Generic read-only contract binding to access the raw methods on +// UniswapV2PairCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type UniswapV2PairCallerRaw struct { + Contract *UniswapV2PairCaller // Generic read-only contract binding to access the raw methods on } -// UniswapPairTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type UniswapPairTransactorRaw struct { - Contract *UniswapPairTransactor // Generic write-only contract binding to access the raw methods on +// UniswapV2PairTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type UniswapV2PairTransactorRaw struct { + Contract *UniswapV2PairTransactor // Generic write-only contract binding to access the raw methods on } -// NewUniswapPair creates a new instance of UniswapPair, bound to a specific deployed contract. -func NewUniswapPair(address common.Address, backend bind.ContractBackend) (*UniswapPair, error) { - contract, err := bindUniswapPair(address, backend, backend, backend) +// NewUniswapV2Pair creates a new instance of UniswapV2Pair, bound to a specific deployed contract. +func NewUniswapV2Pair(address common.Address, backend bind.ContractBackend) (*UniswapV2Pair, error) { + contract, err := bindUniswapV2Pair(address, backend, backend, backend) if err != nil { return nil, err } - return &UniswapPair{UniswapPairCaller: UniswapPairCaller{contract: contract}, UniswapPairTransactor: UniswapPairTransactor{contract: contract}, UniswapPairFilterer: UniswapPairFilterer{contract: contract}}, nil + return &UniswapV2Pair{UniswapV2PairCaller: UniswapV2PairCaller{contract: contract}, UniswapV2PairTransactor: UniswapV2PairTransactor{contract: contract}, UniswapV2PairFilterer: UniswapV2PairFilterer{contract: contract}}, nil } -// NewUniswapPairCaller creates a new read-only instance of UniswapPair, bound to a specific deployed contract. -func NewUniswapPairCaller(address common.Address, caller bind.ContractCaller) (*UniswapPairCaller, error) { - contract, err := bindUniswapPair(address, caller, nil, nil) +// NewUniswapV2PairCaller creates a new read-only instance of UniswapV2Pair, bound to a specific deployed contract. +func NewUniswapV2PairCaller(address common.Address, caller bind.ContractCaller) (*UniswapV2PairCaller, error) { + contract, err := bindUniswapV2Pair(address, caller, nil, nil) if err != nil { return nil, err } - return &UniswapPairCaller{contract: contract}, nil + return &UniswapV2PairCaller{contract: contract}, nil } -// NewUniswapPairTransactor creates a new write-only instance of UniswapPair, bound to a specific deployed contract. -func NewUniswapPairTransactor(address common.Address, transactor bind.ContractTransactor) (*UniswapPairTransactor, error) { - contract, err := bindUniswapPair(address, nil, transactor, nil) +// NewUniswapV2PairTransactor creates a new write-only instance of UniswapV2Pair, bound to a specific deployed contract. +func NewUniswapV2PairTransactor(address common.Address, transactor bind.ContractTransactor) (*UniswapV2PairTransactor, error) { + contract, err := bindUniswapV2Pair(address, nil, transactor, nil) if err != nil { return nil, err } - return &UniswapPairTransactor{contract: contract}, nil + return &UniswapV2PairTransactor{contract: contract}, nil } -// NewUniswapPairFilterer creates a new log filterer instance of UniswapPair, bound to a specific deployed contract. -func NewUniswapPairFilterer(address common.Address, filterer bind.ContractFilterer) (*UniswapPairFilterer, error) { - contract, err := bindUniswapPair(address, nil, nil, filterer) +// NewUniswapV2PairFilterer creates a new log filterer instance of UniswapV2Pair, bound to a specific deployed contract. +func NewUniswapV2PairFilterer(address common.Address, filterer bind.ContractFilterer) (*UniswapV2PairFilterer, error) { + contract, err := bindUniswapV2Pair(address, nil, nil, filterer) if err != nil { return nil, err } - return &UniswapPairFilterer{contract: contract}, nil + return &UniswapV2PairFilterer{contract: contract}, nil } -// bindUniswapPair binds a generic wrapper to an already deployed contract. -func bindUniswapPair(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := UniswapPairMetaData.GetAbi() +// bindUniswapV2Pair binds a generic wrapper to an already deployed contract. +func bindUniswapV2Pair(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := UniswapV2PairMetaData.GetAbi() if err != nil { return nil, err } @@ -146,46 +146,46 @@ func bindUniswapPair(address common.Address, caller bind.ContractCaller, transac // 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 (_UniswapPair *UniswapPairRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _UniswapPair.Contract.UniswapPairCaller.contract.Call(opts, result, method, params...) +func (_UniswapV2Pair *UniswapV2PairRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _UniswapV2Pair.Contract.UniswapV2PairCaller.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 (_UniswapPair *UniswapPairRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _UniswapPair.Contract.UniswapPairTransactor.contract.Transfer(opts) +func (_UniswapV2Pair *UniswapV2PairRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.UniswapV2PairTransactor.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_UniswapPair *UniswapPairRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _UniswapPair.Contract.UniswapPairTransactor.contract.Transact(opts, method, params...) +func (_UniswapV2Pair *UniswapV2PairRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.UniswapV2PairTransactor.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 (_UniswapPair *UniswapPairCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _UniswapPair.Contract.contract.Call(opts, result, method, params...) +func (_UniswapV2Pair *UniswapV2PairCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { + return _UniswapV2Pair.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 (_UniswapPair *UniswapPairTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _UniswapPair.Contract.contract.Transfer(opts) +func (_UniswapV2Pair *UniswapV2PairTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.contract.Transfer(opts) } // Transact invokes the (paid) contract method with params as input values. -func (_UniswapPair *UniswapPairTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _UniswapPair.Contract.contract.Transact(opts, method, params...) +func (_UniswapV2Pair *UniswapV2PairTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.contract.Transact(opts, method, params...) } // DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. // // Solidity: function DOMAIN_SEPARATOR() view returns(bytes32) -func (_UniswapPair *UniswapPairCaller) DOMAINSEPARATOR(opts *bind.CallOpts) ([32]byte, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) DOMAINSEPARATOR(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "DOMAIN_SEPARATOR") + err := _UniswapV2Pair.contract.Call(opts, &out, "DOMAIN_SEPARATOR") if err != nil { return *new([32]byte), err @@ -200,23 +200,23 @@ func (_UniswapPair *UniswapPairCaller) DOMAINSEPARATOR(opts *bind.CallOpts) ([32 // DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. // // Solidity: function DOMAIN_SEPARATOR() view returns(bytes32) -func (_UniswapPair *UniswapPairSession) DOMAINSEPARATOR() ([32]byte, error) { - return _UniswapPair.Contract.DOMAINSEPARATOR(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) DOMAINSEPARATOR() ([32]byte, error) { + return _UniswapV2Pair.Contract.DOMAINSEPARATOR(&_UniswapV2Pair.CallOpts) } // DOMAINSEPARATOR is a free data retrieval call binding the contract method 0x3644e515. // // Solidity: function DOMAIN_SEPARATOR() view returns(bytes32) -func (_UniswapPair *UniswapPairCallerSession) DOMAINSEPARATOR() ([32]byte, error) { - return _UniswapPair.Contract.DOMAINSEPARATOR(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) DOMAINSEPARATOR() ([32]byte, error) { + return _UniswapV2Pair.Contract.DOMAINSEPARATOR(&_UniswapV2Pair.CallOpts) } // MINIMUMLIQUIDITY is a free data retrieval call binding the contract method 0xba9a7a56. // // Solidity: function MINIMUM_LIQUIDITY() view returns(uint256) -func (_UniswapPair *UniswapPairCaller) MINIMUMLIQUIDITY(opts *bind.CallOpts) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) MINIMUMLIQUIDITY(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "MINIMUM_LIQUIDITY") + err := _UniswapV2Pair.contract.Call(opts, &out, "MINIMUM_LIQUIDITY") if err != nil { return *new(*big.Int), err @@ -231,23 +231,23 @@ func (_UniswapPair *UniswapPairCaller) MINIMUMLIQUIDITY(opts *bind.CallOpts) (*b // MINIMUMLIQUIDITY is a free data retrieval call binding the contract method 0xba9a7a56. // // Solidity: function MINIMUM_LIQUIDITY() view returns(uint256) -func (_UniswapPair *UniswapPairSession) MINIMUMLIQUIDITY() (*big.Int, error) { - return _UniswapPair.Contract.MINIMUMLIQUIDITY(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) MINIMUMLIQUIDITY() (*big.Int, error) { + return _UniswapV2Pair.Contract.MINIMUMLIQUIDITY(&_UniswapV2Pair.CallOpts) } // MINIMUMLIQUIDITY is a free data retrieval call binding the contract method 0xba9a7a56. // // Solidity: function MINIMUM_LIQUIDITY() view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) MINIMUMLIQUIDITY() (*big.Int, error) { - return _UniswapPair.Contract.MINIMUMLIQUIDITY(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) MINIMUMLIQUIDITY() (*big.Int, error) { + return _UniswapV2Pair.Contract.MINIMUMLIQUIDITY(&_UniswapV2Pair.CallOpts) } // PERMITTYPEHASH is a free data retrieval call binding the contract method 0x30adf81f. // // Solidity: function PERMIT_TYPEHASH() view returns(bytes32) -func (_UniswapPair *UniswapPairCaller) PERMITTYPEHASH(opts *bind.CallOpts) ([32]byte, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) PERMITTYPEHASH(opts *bind.CallOpts) ([32]byte, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "PERMIT_TYPEHASH") + err := _UniswapV2Pair.contract.Call(opts, &out, "PERMIT_TYPEHASH") if err != nil { return *new([32]byte), err @@ -262,23 +262,23 @@ func (_UniswapPair *UniswapPairCaller) PERMITTYPEHASH(opts *bind.CallOpts) ([32] // PERMITTYPEHASH is a free data retrieval call binding the contract method 0x30adf81f. // // Solidity: function PERMIT_TYPEHASH() view returns(bytes32) -func (_UniswapPair *UniswapPairSession) PERMITTYPEHASH() ([32]byte, error) { - return _UniswapPair.Contract.PERMITTYPEHASH(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) PERMITTYPEHASH() ([32]byte, error) { + return _UniswapV2Pair.Contract.PERMITTYPEHASH(&_UniswapV2Pair.CallOpts) } // PERMITTYPEHASH is a free data retrieval call binding the contract method 0x30adf81f. // // Solidity: function PERMIT_TYPEHASH() view returns(bytes32) -func (_UniswapPair *UniswapPairCallerSession) PERMITTYPEHASH() ([32]byte, error) { - return _UniswapPair.Contract.PERMITTYPEHASH(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) PERMITTYPEHASH() ([32]byte, error) { + return _UniswapV2Pair.Contract.PERMITTYPEHASH(&_UniswapV2Pair.CallOpts) } // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. // // Solidity: function allowance(address , address ) view returns(uint256) -func (_UniswapPair *UniswapPairCaller) Allowance(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Allowance(opts *bind.CallOpts, arg0 common.Address, arg1 common.Address) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "allowance", arg0, arg1) + err := _UniswapV2Pair.contract.Call(opts, &out, "allowance", arg0, arg1) if err != nil { return *new(*big.Int), err @@ -293,23 +293,23 @@ func (_UniswapPair *UniswapPairCaller) Allowance(opts *bind.CallOpts, arg0 commo // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. // // Solidity: function allowance(address , address ) view returns(uint256) -func (_UniswapPair *UniswapPairSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error) { - return _UniswapPair.Contract.Allowance(&_UniswapPair.CallOpts, arg0, arg1) +func (_UniswapV2Pair *UniswapV2PairSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _UniswapV2Pair.Contract.Allowance(&_UniswapV2Pair.CallOpts, arg0, arg1) } // Allowance is a free data retrieval call binding the contract method 0xdd62ed3e. // // Solidity: function allowance(address , address ) view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error) { - return _UniswapPair.Contract.Allowance(&_UniswapPair.CallOpts, arg0, arg1) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Allowance(arg0 common.Address, arg1 common.Address) (*big.Int, error) { + return _UniswapV2Pair.Contract.Allowance(&_UniswapV2Pair.CallOpts, arg0, arg1) } // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. // // Solidity: function balanceOf(address ) view returns(uint256) -func (_UniswapPair *UniswapPairCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) BalanceOf(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "balanceOf", arg0) + err := _UniswapV2Pair.contract.Call(opts, &out, "balanceOf", arg0) if err != nil { return *new(*big.Int), err @@ -324,23 +324,23 @@ func (_UniswapPair *UniswapPairCaller) BalanceOf(opts *bind.CallOpts, arg0 commo // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. // // Solidity: function balanceOf(address ) view returns(uint256) -func (_UniswapPair *UniswapPairSession) BalanceOf(arg0 common.Address) (*big.Int, error) { - return _UniswapPair.Contract.BalanceOf(&_UniswapPair.CallOpts, arg0) +func (_UniswapV2Pair *UniswapV2PairSession) BalanceOf(arg0 common.Address) (*big.Int, error) { + return _UniswapV2Pair.Contract.BalanceOf(&_UniswapV2Pair.CallOpts, arg0) } // BalanceOf is a free data retrieval call binding the contract method 0x70a08231. // // Solidity: function balanceOf(address ) view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) { - return _UniswapPair.Contract.BalanceOf(&_UniswapPair.CallOpts, arg0) +func (_UniswapV2Pair *UniswapV2PairCallerSession) BalanceOf(arg0 common.Address) (*big.Int, error) { + return _UniswapV2Pair.Contract.BalanceOf(&_UniswapV2Pair.CallOpts, arg0) } // Decimals is a free data retrieval call binding the contract method 0x313ce567. // // Solidity: function decimals() view returns(uint8) -func (_UniswapPair *UniswapPairCaller) Decimals(opts *bind.CallOpts) (uint8, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Decimals(opts *bind.CallOpts) (uint8, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "decimals") + err := _UniswapV2Pair.contract.Call(opts, &out, "decimals") if err != nil { return *new(uint8), err @@ -355,23 +355,23 @@ func (_UniswapPair *UniswapPairCaller) Decimals(opts *bind.CallOpts) (uint8, err // Decimals is a free data retrieval call binding the contract method 0x313ce567. // // Solidity: function decimals() view returns(uint8) -func (_UniswapPair *UniswapPairSession) Decimals() (uint8, error) { - return _UniswapPair.Contract.Decimals(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Decimals() (uint8, error) { + return _UniswapV2Pair.Contract.Decimals(&_UniswapV2Pair.CallOpts) } // Decimals is a free data retrieval call binding the contract method 0x313ce567. // // Solidity: function decimals() view returns(uint8) -func (_UniswapPair *UniswapPairCallerSession) Decimals() (uint8, error) { - return _UniswapPair.Contract.Decimals(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Decimals() (uint8, error) { + return _UniswapV2Pair.Contract.Decimals(&_UniswapV2Pair.CallOpts) } // Factory is a free data retrieval call binding the contract method 0xc45a0155. // // Solidity: function factory() view returns(address) -func (_UniswapPair *UniswapPairCaller) Factory(opts *bind.CallOpts) (common.Address, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Factory(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "factory") + err := _UniswapV2Pair.contract.Call(opts, &out, "factory") if err != nil { return *new(common.Address), err @@ -386,27 +386,27 @@ func (_UniswapPair *UniswapPairCaller) Factory(opts *bind.CallOpts) (common.Addr // Factory is a free data retrieval call binding the contract method 0xc45a0155. // // Solidity: function factory() view returns(address) -func (_UniswapPair *UniswapPairSession) Factory() (common.Address, error) { - return _UniswapPair.Contract.Factory(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Factory() (common.Address, error) { + return _UniswapV2Pair.Contract.Factory(&_UniswapV2Pair.CallOpts) } // Factory is a free data retrieval call binding the contract method 0xc45a0155. // // Solidity: function factory() view returns(address) -func (_UniswapPair *UniswapPairCallerSession) Factory() (common.Address, error) { - return _UniswapPair.Contract.Factory(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Factory() (common.Address, error) { + return _UniswapV2Pair.Contract.Factory(&_UniswapV2Pair.CallOpts) } // GetReserves is a free data retrieval call binding the contract method 0x0902f1ac. // // Solidity: function getReserves() view returns(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) -func (_UniswapPair *UniswapPairCaller) GetReserves(opts *bind.CallOpts) (struct { +func (_UniswapV2Pair *UniswapV2PairCaller) GetReserves(opts *bind.CallOpts) (struct { Reserve0 *big.Int Reserve1 *big.Int BlockTimestampLast uint32 }, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "getReserves") + err := _UniswapV2Pair.contract.Call(opts, &out, "getReserves") outstruct := new(struct { Reserve0 *big.Int @@ -428,31 +428,31 @@ func (_UniswapPair *UniswapPairCaller) GetReserves(opts *bind.CallOpts) (struct // GetReserves is a free data retrieval call binding the contract method 0x0902f1ac. // // Solidity: function getReserves() view returns(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) -func (_UniswapPair *UniswapPairSession) GetReserves() (struct { +func (_UniswapV2Pair *UniswapV2PairSession) GetReserves() (struct { Reserve0 *big.Int Reserve1 *big.Int BlockTimestampLast uint32 }, error) { - return _UniswapPair.Contract.GetReserves(&_UniswapPair.CallOpts) + return _UniswapV2Pair.Contract.GetReserves(&_UniswapV2Pair.CallOpts) } // GetReserves is a free data retrieval call binding the contract method 0x0902f1ac. // // Solidity: function getReserves() view returns(uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) -func (_UniswapPair *UniswapPairCallerSession) GetReserves() (struct { +func (_UniswapV2Pair *UniswapV2PairCallerSession) GetReserves() (struct { Reserve0 *big.Int Reserve1 *big.Int BlockTimestampLast uint32 }, error) { - return _UniswapPair.Contract.GetReserves(&_UniswapPair.CallOpts) + return _UniswapV2Pair.Contract.GetReserves(&_UniswapV2Pair.CallOpts) } // KLast is a free data retrieval call binding the contract method 0x7464fc3d. // // Solidity: function kLast() view returns(uint256) -func (_UniswapPair *UniswapPairCaller) KLast(opts *bind.CallOpts) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) KLast(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "kLast") + err := _UniswapV2Pair.contract.Call(opts, &out, "kLast") if err != nil { return *new(*big.Int), err @@ -467,23 +467,23 @@ func (_UniswapPair *UniswapPairCaller) KLast(opts *bind.CallOpts) (*big.Int, err // KLast is a free data retrieval call binding the contract method 0x7464fc3d. // // Solidity: function kLast() view returns(uint256) -func (_UniswapPair *UniswapPairSession) KLast() (*big.Int, error) { - return _UniswapPair.Contract.KLast(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) KLast() (*big.Int, error) { + return _UniswapV2Pair.Contract.KLast(&_UniswapV2Pair.CallOpts) } // KLast is a free data retrieval call binding the contract method 0x7464fc3d. // // Solidity: function kLast() view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) KLast() (*big.Int, error) { - return _UniswapPair.Contract.KLast(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) KLast() (*big.Int, error) { + return _UniswapV2Pair.Contract.KLast(&_UniswapV2Pair.CallOpts) } // Name is a free data retrieval call binding the contract method 0x06fdde03. // // Solidity: function name() view returns(string) -func (_UniswapPair *UniswapPairCaller) Name(opts *bind.CallOpts) (string, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Name(opts *bind.CallOpts) (string, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "name") + err := _UniswapV2Pair.contract.Call(opts, &out, "name") if err != nil { return *new(string), err @@ -498,23 +498,23 @@ func (_UniswapPair *UniswapPairCaller) Name(opts *bind.CallOpts) (string, error) // Name is a free data retrieval call binding the contract method 0x06fdde03. // // Solidity: function name() view returns(string) -func (_UniswapPair *UniswapPairSession) Name() (string, error) { - return _UniswapPair.Contract.Name(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Name() (string, error) { + return _UniswapV2Pair.Contract.Name(&_UniswapV2Pair.CallOpts) } // Name is a free data retrieval call binding the contract method 0x06fdde03. // // Solidity: function name() view returns(string) -func (_UniswapPair *UniswapPairCallerSession) Name() (string, error) { - return _UniswapPair.Contract.Name(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Name() (string, error) { + return _UniswapV2Pair.Contract.Name(&_UniswapV2Pair.CallOpts) } // Nonces is a free data retrieval call binding the contract method 0x7ecebe00. // // Solidity: function nonces(address ) view returns(uint256) -func (_UniswapPair *UniswapPairCaller) Nonces(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Nonces(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "nonces", arg0) + err := _UniswapV2Pair.contract.Call(opts, &out, "nonces", arg0) if err != nil { return *new(*big.Int), err @@ -529,23 +529,23 @@ func (_UniswapPair *UniswapPairCaller) Nonces(opts *bind.CallOpts, arg0 common.A // Nonces is a free data retrieval call binding the contract method 0x7ecebe00. // // Solidity: function nonces(address ) view returns(uint256) -func (_UniswapPair *UniswapPairSession) Nonces(arg0 common.Address) (*big.Int, error) { - return _UniswapPair.Contract.Nonces(&_UniswapPair.CallOpts, arg0) +func (_UniswapV2Pair *UniswapV2PairSession) Nonces(arg0 common.Address) (*big.Int, error) { + return _UniswapV2Pair.Contract.Nonces(&_UniswapV2Pair.CallOpts, arg0) } // Nonces is a free data retrieval call binding the contract method 0x7ecebe00. // // Solidity: function nonces(address ) view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) Nonces(arg0 common.Address) (*big.Int, error) { - return _UniswapPair.Contract.Nonces(&_UniswapPair.CallOpts, arg0) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Nonces(arg0 common.Address) (*big.Int, error) { + return _UniswapV2Pair.Contract.Nonces(&_UniswapV2Pair.CallOpts, arg0) } // Price0CumulativeLast is a free data retrieval call binding the contract method 0x5909c0d5. // // Solidity: function price0CumulativeLast() view returns(uint256) -func (_UniswapPair *UniswapPairCaller) Price0CumulativeLast(opts *bind.CallOpts) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Price0CumulativeLast(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "price0CumulativeLast") + err := _UniswapV2Pair.contract.Call(opts, &out, "price0CumulativeLast") if err != nil { return *new(*big.Int), err @@ -560,23 +560,23 @@ func (_UniswapPair *UniswapPairCaller) Price0CumulativeLast(opts *bind.CallOpts) // Price0CumulativeLast is a free data retrieval call binding the contract method 0x5909c0d5. // // Solidity: function price0CumulativeLast() view returns(uint256) -func (_UniswapPair *UniswapPairSession) Price0CumulativeLast() (*big.Int, error) { - return _UniswapPair.Contract.Price0CumulativeLast(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Price0CumulativeLast() (*big.Int, error) { + return _UniswapV2Pair.Contract.Price0CumulativeLast(&_UniswapV2Pair.CallOpts) } // Price0CumulativeLast is a free data retrieval call binding the contract method 0x5909c0d5. // // Solidity: function price0CumulativeLast() view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) Price0CumulativeLast() (*big.Int, error) { - return _UniswapPair.Contract.Price0CumulativeLast(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Price0CumulativeLast() (*big.Int, error) { + return _UniswapV2Pair.Contract.Price0CumulativeLast(&_UniswapV2Pair.CallOpts) } // Price1CumulativeLast is a free data retrieval call binding the contract method 0x5a3d5493. // // Solidity: function price1CumulativeLast() view returns(uint256) -func (_UniswapPair *UniswapPairCaller) Price1CumulativeLast(opts *bind.CallOpts) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Price1CumulativeLast(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "price1CumulativeLast") + err := _UniswapV2Pair.contract.Call(opts, &out, "price1CumulativeLast") if err != nil { return *new(*big.Int), err @@ -591,23 +591,23 @@ func (_UniswapPair *UniswapPairCaller) Price1CumulativeLast(opts *bind.CallOpts) // Price1CumulativeLast is a free data retrieval call binding the contract method 0x5a3d5493. // // Solidity: function price1CumulativeLast() view returns(uint256) -func (_UniswapPair *UniswapPairSession) Price1CumulativeLast() (*big.Int, error) { - return _UniswapPair.Contract.Price1CumulativeLast(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Price1CumulativeLast() (*big.Int, error) { + return _UniswapV2Pair.Contract.Price1CumulativeLast(&_UniswapV2Pair.CallOpts) } // Price1CumulativeLast is a free data retrieval call binding the contract method 0x5a3d5493. // // Solidity: function price1CumulativeLast() view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) Price1CumulativeLast() (*big.Int, error) { - return _UniswapPair.Contract.Price1CumulativeLast(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Price1CumulativeLast() (*big.Int, error) { + return _UniswapV2Pair.Contract.Price1CumulativeLast(&_UniswapV2Pair.CallOpts) } // Symbol is a free data retrieval call binding the contract method 0x95d89b41. // // Solidity: function symbol() view returns(string) -func (_UniswapPair *UniswapPairCaller) Symbol(opts *bind.CallOpts) (string, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Symbol(opts *bind.CallOpts) (string, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "symbol") + err := _UniswapV2Pair.contract.Call(opts, &out, "symbol") if err != nil { return *new(string), err @@ -622,23 +622,23 @@ func (_UniswapPair *UniswapPairCaller) Symbol(opts *bind.CallOpts) (string, erro // Symbol is a free data retrieval call binding the contract method 0x95d89b41. // // Solidity: function symbol() view returns(string) -func (_UniswapPair *UniswapPairSession) Symbol() (string, error) { - return _UniswapPair.Contract.Symbol(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Symbol() (string, error) { + return _UniswapV2Pair.Contract.Symbol(&_UniswapV2Pair.CallOpts) } // Symbol is a free data retrieval call binding the contract method 0x95d89b41. // // Solidity: function symbol() view returns(string) -func (_UniswapPair *UniswapPairCallerSession) Symbol() (string, error) { - return _UniswapPair.Contract.Symbol(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Symbol() (string, error) { + return _UniswapV2Pair.Contract.Symbol(&_UniswapV2Pair.CallOpts) } // Token0 is a free data retrieval call binding the contract method 0x0dfe1681. // // Solidity: function token0() view returns(address) -func (_UniswapPair *UniswapPairCaller) Token0(opts *bind.CallOpts) (common.Address, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Token0(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "token0") + err := _UniswapV2Pair.contract.Call(opts, &out, "token0") if err != nil { return *new(common.Address), err @@ -653,23 +653,23 @@ func (_UniswapPair *UniswapPairCaller) Token0(opts *bind.CallOpts) (common.Addre // Token0 is a free data retrieval call binding the contract method 0x0dfe1681. // // Solidity: function token0() view returns(address) -func (_UniswapPair *UniswapPairSession) Token0() (common.Address, error) { - return _UniswapPair.Contract.Token0(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Token0() (common.Address, error) { + return _UniswapV2Pair.Contract.Token0(&_UniswapV2Pair.CallOpts) } // Token0 is a free data retrieval call binding the contract method 0x0dfe1681. // // Solidity: function token0() view returns(address) -func (_UniswapPair *UniswapPairCallerSession) Token0() (common.Address, error) { - return _UniswapPair.Contract.Token0(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Token0() (common.Address, error) { + return _UniswapV2Pair.Contract.Token0(&_UniswapV2Pair.CallOpts) } // Token1 is a free data retrieval call binding the contract method 0xd21220a7. // // Solidity: function token1() view returns(address) -func (_UniswapPair *UniswapPairCaller) Token1(opts *bind.CallOpts) (common.Address, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) Token1(opts *bind.CallOpts) (common.Address, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "token1") + err := _UniswapV2Pair.contract.Call(opts, &out, "token1") if err != nil { return *new(common.Address), err @@ -684,23 +684,23 @@ func (_UniswapPair *UniswapPairCaller) Token1(opts *bind.CallOpts) (common.Addre // Token1 is a free data retrieval call binding the contract method 0xd21220a7. // // Solidity: function token1() view returns(address) -func (_UniswapPair *UniswapPairSession) Token1() (common.Address, error) { - return _UniswapPair.Contract.Token1(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Token1() (common.Address, error) { + return _UniswapV2Pair.Contract.Token1(&_UniswapV2Pair.CallOpts) } // Token1 is a free data retrieval call binding the contract method 0xd21220a7. // // Solidity: function token1() view returns(address) -func (_UniswapPair *UniswapPairCallerSession) Token1() (common.Address, error) { - return _UniswapPair.Contract.Token1(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) Token1() (common.Address, error) { + return _UniswapV2Pair.Contract.Token1(&_UniswapV2Pair.CallOpts) } // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. // // Solidity: function totalSupply() view returns(uint256) -func (_UniswapPair *UniswapPairCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { +func (_UniswapV2Pair *UniswapV2PairCaller) TotalSupply(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} - err := _UniswapPair.contract.Call(opts, &out, "totalSupply") + err := _UniswapV2Pair.contract.Call(opts, &out, "totalSupply") if err != nil { return *new(*big.Int), err @@ -715,230 +715,230 @@ func (_UniswapPair *UniswapPairCaller) TotalSupply(opts *bind.CallOpts) (*big.In // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. // // Solidity: function totalSupply() view returns(uint256) -func (_UniswapPair *UniswapPairSession) TotalSupply() (*big.Int, error) { - return _UniswapPair.Contract.TotalSupply(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairSession) TotalSupply() (*big.Int, error) { + return _UniswapV2Pair.Contract.TotalSupply(&_UniswapV2Pair.CallOpts) } // TotalSupply is a free data retrieval call binding the contract method 0x18160ddd. // // Solidity: function totalSupply() view returns(uint256) -func (_UniswapPair *UniswapPairCallerSession) TotalSupply() (*big.Int, error) { - return _UniswapPair.Contract.TotalSupply(&_UniswapPair.CallOpts) +func (_UniswapV2Pair *UniswapV2PairCallerSession) TotalSupply() (*big.Int, error) { + return _UniswapV2Pair.Contract.TotalSupply(&_UniswapV2Pair.CallOpts) } // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // // Solidity: function approve(address spender, uint256 value) returns(bool) -func (_UniswapPair *UniswapPairTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "approve", spender, value) +func (_UniswapV2Pair *UniswapV2PairTransactor) Approve(opts *bind.TransactOpts, spender common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.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 (_UniswapPair *UniswapPairSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.Contract.Approve(&_UniswapPair.TransactOpts, spender, value) +func (_UniswapV2Pair *UniswapV2PairSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Approve(&_UniswapV2Pair.TransactOpts, spender, value) } // Approve is a paid mutator transaction binding the contract method 0x095ea7b3. // // Solidity: function approve(address spender, uint256 value) returns(bool) -func (_UniswapPair *UniswapPairTransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.Contract.Approve(&_UniswapPair.TransactOpts, spender, value) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Approve(spender common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Approve(&_UniswapV2Pair.TransactOpts, spender, value) } // Burn is a paid mutator transaction binding the contract method 0x89afcb44. // // Solidity: function burn(address to) returns(uint256 amount0, uint256 amount1) -func (_UniswapPair *UniswapPairTransactor) Burn(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "burn", to) +func (_UniswapV2Pair *UniswapV2PairTransactor) Burn(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.contract.Transact(opts, "burn", to) } // Burn is a paid mutator transaction binding the contract method 0x89afcb44. // // Solidity: function burn(address to) returns(uint256 amount0, uint256 amount1) -func (_UniswapPair *UniswapPairSession) Burn(to common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Burn(&_UniswapPair.TransactOpts, to) +func (_UniswapV2Pair *UniswapV2PairSession) Burn(to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Burn(&_UniswapV2Pair.TransactOpts, to) } // Burn is a paid mutator transaction binding the contract method 0x89afcb44. // // Solidity: function burn(address to) returns(uint256 amount0, uint256 amount1) -func (_UniswapPair *UniswapPairTransactorSession) Burn(to common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Burn(&_UniswapPair.TransactOpts, to) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Burn(to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Burn(&_UniswapV2Pair.TransactOpts, to) } // Initialize is a paid mutator transaction binding the contract method 0x485cc955. // // Solidity: function initialize(address _token0, address _token1) returns() -func (_UniswapPair *UniswapPairTransactor) Initialize(opts *bind.TransactOpts, _token0 common.Address, _token1 common.Address) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "initialize", _token0, _token1) +func (_UniswapV2Pair *UniswapV2PairTransactor) Initialize(opts *bind.TransactOpts, _token0 common.Address, _token1 common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.contract.Transact(opts, "initialize", _token0, _token1) } // Initialize is a paid mutator transaction binding the contract method 0x485cc955. // // Solidity: function initialize(address _token0, address _token1) returns() -func (_UniswapPair *UniswapPairSession) Initialize(_token0 common.Address, _token1 common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Initialize(&_UniswapPair.TransactOpts, _token0, _token1) +func (_UniswapV2Pair *UniswapV2PairSession) Initialize(_token0 common.Address, _token1 common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Initialize(&_UniswapV2Pair.TransactOpts, _token0, _token1) } // Initialize is a paid mutator transaction binding the contract method 0x485cc955. // // Solidity: function initialize(address _token0, address _token1) returns() -func (_UniswapPair *UniswapPairTransactorSession) Initialize(_token0 common.Address, _token1 common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Initialize(&_UniswapPair.TransactOpts, _token0, _token1) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Initialize(_token0 common.Address, _token1 common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Initialize(&_UniswapV2Pair.TransactOpts, _token0, _token1) } // Mint is a paid mutator transaction binding the contract method 0x6a627842. // // Solidity: function mint(address to) returns(uint256 liquidity) -func (_UniswapPair *UniswapPairTransactor) Mint(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "mint", to) +func (_UniswapV2Pair *UniswapV2PairTransactor) Mint(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.contract.Transact(opts, "mint", to) } // Mint is a paid mutator transaction binding the contract method 0x6a627842. // // Solidity: function mint(address to) returns(uint256 liquidity) -func (_UniswapPair *UniswapPairSession) Mint(to common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Mint(&_UniswapPair.TransactOpts, to) +func (_UniswapV2Pair *UniswapV2PairSession) Mint(to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Mint(&_UniswapV2Pair.TransactOpts, to) } // Mint is a paid mutator transaction binding the contract method 0x6a627842. // // Solidity: function mint(address to) returns(uint256 liquidity) -func (_UniswapPair *UniswapPairTransactorSession) Mint(to common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Mint(&_UniswapPair.TransactOpts, to) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Mint(to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Mint(&_UniswapV2Pair.TransactOpts, to) } // Permit is a paid mutator transaction binding the contract method 0xd505accf. // // Solidity: function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) returns() -func (_UniswapPair *UniswapPairTransactor) Permit(opts *bind.TransactOpts, owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "permit", owner, spender, value, deadline, v, r, s) +func (_UniswapV2Pair *UniswapV2PairTransactor) Permit(opts *bind.TransactOpts, owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _UniswapV2Pair.contract.Transact(opts, "permit", owner, spender, value, deadline, v, r, s) } // Permit is a paid mutator transaction binding the contract method 0xd505accf. // // Solidity: function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) returns() -func (_UniswapPair *UniswapPairSession) Permit(owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { - return _UniswapPair.Contract.Permit(&_UniswapPair.TransactOpts, owner, spender, value, deadline, v, r, s) +func (_UniswapV2Pair *UniswapV2PairSession) Permit(owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Permit(&_UniswapV2Pair.TransactOpts, owner, spender, value, deadline, v, r, s) } // Permit is a paid mutator transaction binding the contract method 0xd505accf. // // Solidity: function permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) returns() -func (_UniswapPair *UniswapPairTransactorSession) Permit(owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { - return _UniswapPair.Contract.Permit(&_UniswapPair.TransactOpts, owner, spender, value, deadline, v, r, s) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Permit(owner common.Address, spender common.Address, value *big.Int, deadline *big.Int, v uint8, r [32]byte, s [32]byte) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Permit(&_UniswapV2Pair.TransactOpts, owner, spender, value, deadline, v, r, s) } // Skim is a paid mutator transaction binding the contract method 0xbc25cf77. // // Solidity: function skim(address to) returns() -func (_UniswapPair *UniswapPairTransactor) Skim(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "skim", to) +func (_UniswapV2Pair *UniswapV2PairTransactor) Skim(opts *bind.TransactOpts, to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.contract.Transact(opts, "skim", to) } // Skim is a paid mutator transaction binding the contract method 0xbc25cf77. // // Solidity: function skim(address to) returns() -func (_UniswapPair *UniswapPairSession) Skim(to common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Skim(&_UniswapPair.TransactOpts, to) +func (_UniswapV2Pair *UniswapV2PairSession) Skim(to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Skim(&_UniswapV2Pair.TransactOpts, to) } // Skim is a paid mutator transaction binding the contract method 0xbc25cf77. // // Solidity: function skim(address to) returns() -func (_UniswapPair *UniswapPairTransactorSession) Skim(to common.Address) (*types.Transaction, error) { - return _UniswapPair.Contract.Skim(&_UniswapPair.TransactOpts, to) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Skim(to common.Address) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Skim(&_UniswapV2Pair.TransactOpts, to) } // Swap is a paid mutator transaction binding the contract method 0x022c0d9f. // // Solidity: function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes data) returns() -func (_UniswapPair *UniswapPairTransactor) Swap(opts *bind.TransactOpts, amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "swap", amount0Out, amount1Out, to, data) +func (_UniswapV2Pair *UniswapV2PairTransactor) Swap(opts *bind.TransactOpts, amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) { + return _UniswapV2Pair.contract.Transact(opts, "swap", amount0Out, amount1Out, to, data) } // Swap is a paid mutator transaction binding the contract method 0x022c0d9f. // // Solidity: function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes data) returns() -func (_UniswapPair *UniswapPairSession) Swap(amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) { - return _UniswapPair.Contract.Swap(&_UniswapPair.TransactOpts, amount0Out, amount1Out, to, data) +func (_UniswapV2Pair *UniswapV2PairSession) Swap(amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Swap(&_UniswapV2Pair.TransactOpts, amount0Out, amount1Out, to, data) } // Swap is a paid mutator transaction binding the contract method 0x022c0d9f. // // Solidity: function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes data) returns() -func (_UniswapPair *UniswapPairTransactorSession) Swap(amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) { - return _UniswapPair.Contract.Swap(&_UniswapPair.TransactOpts, amount0Out, amount1Out, to, data) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Swap(amount0Out *big.Int, amount1Out *big.Int, to common.Address, data []byte) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Swap(&_UniswapV2Pair.TransactOpts, amount0Out, amount1Out, to, data) } // Sync is a paid mutator transaction binding the contract method 0xfff6cae9. // // Solidity: function sync() returns() -func (_UniswapPair *UniswapPairTransactor) Sync(opts *bind.TransactOpts) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "sync") +func (_UniswapV2Pair *UniswapV2PairTransactor) Sync(opts *bind.TransactOpts) (*types.Transaction, error) { + return _UniswapV2Pair.contract.Transact(opts, "sync") } // Sync is a paid mutator transaction binding the contract method 0xfff6cae9. // // Solidity: function sync() returns() -func (_UniswapPair *UniswapPairSession) Sync() (*types.Transaction, error) { - return _UniswapPair.Contract.Sync(&_UniswapPair.TransactOpts) +func (_UniswapV2Pair *UniswapV2PairSession) Sync() (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Sync(&_UniswapV2Pair.TransactOpts) } // Sync is a paid mutator transaction binding the contract method 0xfff6cae9. // // Solidity: function sync() returns() -func (_UniswapPair *UniswapPairTransactorSession) Sync() (*types.Transaction, error) { - return _UniswapPair.Contract.Sync(&_UniswapPair.TransactOpts) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Sync() (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Sync(&_UniswapV2Pair.TransactOpts) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address to, uint256 value) returns(bool) -func (_UniswapPair *UniswapPairTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "transfer", to, value) +func (_UniswapV2Pair *UniswapV2PairTransactor) Transfer(opts *bind.TransactOpts, to common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.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 (_UniswapPair *UniswapPairSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.Contract.Transfer(&_UniswapPair.TransactOpts, to, value) +func (_UniswapV2Pair *UniswapV2PairSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Transfer(&_UniswapV2Pair.TransactOpts, to, value) } // Transfer is a paid mutator transaction binding the contract method 0xa9059cbb. // // Solidity: function transfer(address to, uint256 value) returns(bool) -func (_UniswapPair *UniswapPairTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.Contract.Transfer(&_UniswapPair.TransactOpts, to, value) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) Transfer(to common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.Transfer(&_UniswapV2Pair.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 (_UniswapPair *UniswapPairTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.contract.Transact(opts, "transferFrom", from, to, value) +func (_UniswapV2Pair *UniswapV2PairTransactor) TransferFrom(opts *bind.TransactOpts, from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.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 (_UniswapPair *UniswapPairSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.Contract.TransferFrom(&_UniswapPair.TransactOpts, from, to, value) +func (_UniswapV2Pair *UniswapV2PairSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.TransferFrom(&_UniswapV2Pair.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 (_UniswapPair *UniswapPairTransactorSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { - return _UniswapPair.Contract.TransferFrom(&_UniswapPair.TransactOpts, from, to, value) +func (_UniswapV2Pair *UniswapV2PairTransactorSession) TransferFrom(from common.Address, to common.Address, value *big.Int) (*types.Transaction, error) { + return _UniswapV2Pair.Contract.TransferFrom(&_UniswapV2Pair.TransactOpts, from, to, value) } -// UniswapPairApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the UniswapPair contract. -type UniswapPairApprovalIterator struct { - Event *UniswapPairApproval // Event containing the contract specifics and raw log +// UniswapV2PairApprovalIterator is returned from FilterApproval and is used to iterate over the raw logs and unpacked data for Approval events raised by the UniswapV2Pair contract. +type UniswapV2PairApprovalIterator struct { + Event *UniswapV2PairApproval // 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 @@ -952,7 +952,7 @@ type UniswapPairApprovalIterator struct { // 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 *UniswapPairApprovalIterator) Next() bool { +func (it *UniswapV2PairApprovalIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -961,7 +961,7 @@ func (it *UniswapPairApprovalIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(UniswapPairApproval) + it.Event = new(UniswapV2PairApproval) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -976,7 +976,7 @@ func (it *UniswapPairApprovalIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(UniswapPairApproval) + it.Event = new(UniswapV2PairApproval) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -992,19 +992,19 @@ func (it *UniswapPairApprovalIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapPairApprovalIterator) Error() error { +func (it *UniswapV2PairApprovalIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *UniswapPairApprovalIterator) Close() error { +func (it *UniswapV2PairApprovalIterator) Close() error { it.sub.Unsubscribe() return nil } -// UniswapPairApproval represents a Approval event raised by the UniswapPair contract. -type UniswapPairApproval struct { +// UniswapV2PairApproval represents a Approval event raised by the UniswapV2Pair contract. +type UniswapV2PairApproval struct { Owner common.Address Spender common.Address Value *big.Int @@ -1014,7 +1014,7 @@ type UniswapPairApproval struct { // FilterApproval is a free log retrieval operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. // // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_UniswapPair *UniswapPairFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*UniswapPairApprovalIterator, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) FilterApproval(opts *bind.FilterOpts, owner []common.Address, spender []common.Address) (*UniswapV2PairApprovalIterator, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -1025,17 +1025,17 @@ func (_UniswapPair *UniswapPairFilterer) FilterApproval(opts *bind.FilterOpts, o spenderRule = append(spenderRule, spenderItem) } - logs, sub, err := _UniswapPair.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) + logs, sub, err := _UniswapV2Pair.contract.FilterLogs(opts, "Approval", ownerRule, spenderRule) if err != nil { return nil, err } - return &UniswapPairApprovalIterator{contract: _UniswapPair.contract, event: "Approval", logs: logs, sub: sub}, nil + return &UniswapV2PairApprovalIterator{contract: _UniswapV2Pair.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 (_UniswapPair *UniswapPairFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *UniswapPairApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) WatchApproval(opts *bind.WatchOpts, sink chan<- *UniswapV2PairApproval, owner []common.Address, spender []common.Address) (event.Subscription, error) { var ownerRule []interface{} for _, ownerItem := range owner { @@ -1046,7 +1046,7 @@ func (_UniswapPair *UniswapPairFilterer) WatchApproval(opts *bind.WatchOpts, sin spenderRule = append(spenderRule, spenderItem) } - logs, sub, err := _UniswapPair.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) + logs, sub, err := _UniswapV2Pair.contract.WatchLogs(opts, "Approval", ownerRule, spenderRule) if err != nil { return nil, err } @@ -1056,8 +1056,8 @@ func (_UniswapPair *UniswapPairFilterer) WatchApproval(opts *bind.WatchOpts, sin select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(UniswapPairApproval) - if err := _UniswapPair.contract.UnpackLog(event, "Approval", log); err != nil { + event := new(UniswapV2PairApproval) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Approval", log); err != nil { return err } event.Raw = log @@ -1081,18 +1081,18 @@ func (_UniswapPair *UniswapPairFilterer) WatchApproval(opts *bind.WatchOpts, sin // ParseApproval is a log parse operation binding the contract event 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925. // // Solidity: event Approval(address indexed owner, address indexed spender, uint256 value) -func (_UniswapPair *UniswapPairFilterer) ParseApproval(log types.Log) (*UniswapPairApproval, error) { - event := new(UniswapPairApproval) - if err := _UniswapPair.contract.UnpackLog(event, "Approval", log); err != nil { +func (_UniswapV2Pair *UniswapV2PairFilterer) ParseApproval(log types.Log) (*UniswapV2PairApproval, error) { + event := new(UniswapV2PairApproval) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Approval", log); err != nil { return nil, err } event.Raw = log return event, nil } -// UniswapPairBurnIterator is returned from FilterBurn and is used to iterate over the raw logs and unpacked data for Burn events raised by the UniswapPair contract. -type UniswapPairBurnIterator struct { - Event *UniswapPairBurn // Event containing the contract specifics and raw log +// UniswapV2PairBurnIterator is returned from FilterBurn and is used to iterate over the raw logs and unpacked data for Burn events raised by the UniswapV2Pair contract. +type UniswapV2PairBurnIterator struct { + Event *UniswapV2PairBurn // 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 @@ -1106,7 +1106,7 @@ type UniswapPairBurnIterator struct { // 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 *UniswapPairBurnIterator) Next() bool { +func (it *UniswapV2PairBurnIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1115,7 +1115,7 @@ func (it *UniswapPairBurnIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(UniswapPairBurn) + it.Event = new(UniswapV2PairBurn) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1130,7 +1130,7 @@ func (it *UniswapPairBurnIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(UniswapPairBurn) + it.Event = new(UniswapV2PairBurn) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1146,19 +1146,19 @@ func (it *UniswapPairBurnIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapPairBurnIterator) Error() error { +func (it *UniswapV2PairBurnIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *UniswapPairBurnIterator) Close() error { +func (it *UniswapV2PairBurnIterator) Close() error { it.sub.Unsubscribe() return nil } -// UniswapPairBurn represents a Burn event raised by the UniswapPair contract. -type UniswapPairBurn struct { +// UniswapV2PairBurn represents a Burn event raised by the UniswapV2Pair contract. +type UniswapV2PairBurn struct { Sender common.Address Amount0 *big.Int Amount1 *big.Int @@ -1169,7 +1169,7 @@ type UniswapPairBurn struct { // FilterBurn is a free log retrieval operation binding the contract event 0xdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496. // // Solidity: event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to) -func (_UniswapPair *UniswapPairFilterer) FilterBurn(opts *bind.FilterOpts, sender []common.Address, to []common.Address) (*UniswapPairBurnIterator, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) FilterBurn(opts *bind.FilterOpts, sender []common.Address, to []common.Address) (*UniswapV2PairBurnIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -1181,17 +1181,17 @@ func (_UniswapPair *UniswapPairFilterer) FilterBurn(opts *bind.FilterOpts, sende toRule = append(toRule, toItem) } - logs, sub, err := _UniswapPair.contract.FilterLogs(opts, "Burn", senderRule, toRule) + logs, sub, err := _UniswapV2Pair.contract.FilterLogs(opts, "Burn", senderRule, toRule) if err != nil { return nil, err } - return &UniswapPairBurnIterator{contract: _UniswapPair.contract, event: "Burn", logs: logs, sub: sub}, nil + return &UniswapV2PairBurnIterator{contract: _UniswapV2Pair.contract, event: "Burn", logs: logs, sub: sub}, nil } // WatchBurn is a free log subscription operation binding the contract event 0xdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496. // // Solidity: event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to) -func (_UniswapPair *UniswapPairFilterer) WatchBurn(opts *bind.WatchOpts, sink chan<- *UniswapPairBurn, sender []common.Address, to []common.Address) (event.Subscription, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) WatchBurn(opts *bind.WatchOpts, sink chan<- *UniswapV2PairBurn, sender []common.Address, to []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -1203,7 +1203,7 @@ func (_UniswapPair *UniswapPairFilterer) WatchBurn(opts *bind.WatchOpts, sink ch toRule = append(toRule, toItem) } - logs, sub, err := _UniswapPair.contract.WatchLogs(opts, "Burn", senderRule, toRule) + logs, sub, err := _UniswapV2Pair.contract.WatchLogs(opts, "Burn", senderRule, toRule) if err != nil { return nil, err } @@ -1213,8 +1213,8 @@ func (_UniswapPair *UniswapPairFilterer) WatchBurn(opts *bind.WatchOpts, sink ch select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(UniswapPairBurn) - if err := _UniswapPair.contract.UnpackLog(event, "Burn", log); err != nil { + event := new(UniswapV2PairBurn) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Burn", log); err != nil { return err } event.Raw = log @@ -1238,18 +1238,18 @@ func (_UniswapPair *UniswapPairFilterer) WatchBurn(opts *bind.WatchOpts, sink ch // ParseBurn is a log parse operation binding the contract event 0xdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496. // // Solidity: event Burn(address indexed sender, uint256 amount0, uint256 amount1, address indexed to) -func (_UniswapPair *UniswapPairFilterer) ParseBurn(log types.Log) (*UniswapPairBurn, error) { - event := new(UniswapPairBurn) - if err := _UniswapPair.contract.UnpackLog(event, "Burn", log); err != nil { +func (_UniswapV2Pair *UniswapV2PairFilterer) ParseBurn(log types.Log) (*UniswapV2PairBurn, error) { + event := new(UniswapV2PairBurn) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Burn", log); err != nil { return nil, err } event.Raw = log return event, nil } -// UniswapPairMintIterator is returned from FilterMint and is used to iterate over the raw logs and unpacked data for Mint events raised by the UniswapPair contract. -type UniswapPairMintIterator struct { - Event *UniswapPairMint // Event containing the contract specifics and raw log +// UniswapV2PairMintIterator is returned from FilterMint and is used to iterate over the raw logs and unpacked data for Mint events raised by the UniswapV2Pair contract. +type UniswapV2PairMintIterator struct { + Event *UniswapV2PairMint // 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 @@ -1263,7 +1263,7 @@ type UniswapPairMintIterator struct { // 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 *UniswapPairMintIterator) Next() bool { +func (it *UniswapV2PairMintIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1272,7 +1272,7 @@ func (it *UniswapPairMintIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(UniswapPairMint) + it.Event = new(UniswapV2PairMint) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1287,7 +1287,7 @@ func (it *UniswapPairMintIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(UniswapPairMint) + it.Event = new(UniswapV2PairMint) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1303,19 +1303,19 @@ func (it *UniswapPairMintIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapPairMintIterator) Error() error { +func (it *UniswapV2PairMintIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *UniswapPairMintIterator) Close() error { +func (it *UniswapV2PairMintIterator) Close() error { it.sub.Unsubscribe() return nil } -// UniswapPairMint represents a Mint event raised by the UniswapPair contract. -type UniswapPairMint struct { +// UniswapV2PairMint represents a Mint event raised by the UniswapV2Pair contract. +type UniswapV2PairMint struct { Sender common.Address Amount0 *big.Int Amount1 *big.Int @@ -1325,31 +1325,31 @@ type UniswapPairMint struct { // FilterMint is a free log retrieval operation binding the contract event 0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f. // // Solidity: event Mint(address indexed sender, uint256 amount0, uint256 amount1) -func (_UniswapPair *UniswapPairFilterer) FilterMint(opts *bind.FilterOpts, sender []common.Address) (*UniswapPairMintIterator, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) FilterMint(opts *bind.FilterOpts, sender []common.Address) (*UniswapV2PairMintIterator, error) { var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) } - logs, sub, err := _UniswapPair.contract.FilterLogs(opts, "Mint", senderRule) + logs, sub, err := _UniswapV2Pair.contract.FilterLogs(opts, "Mint", senderRule) if err != nil { return nil, err } - return &UniswapPairMintIterator{contract: _UniswapPair.contract, event: "Mint", logs: logs, sub: sub}, nil + return &UniswapV2PairMintIterator{contract: _UniswapV2Pair.contract, event: "Mint", logs: logs, sub: sub}, nil } // WatchMint is a free log subscription operation binding the contract event 0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f. // // Solidity: event Mint(address indexed sender, uint256 amount0, uint256 amount1) -func (_UniswapPair *UniswapPairFilterer) WatchMint(opts *bind.WatchOpts, sink chan<- *UniswapPairMint, sender []common.Address) (event.Subscription, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) WatchMint(opts *bind.WatchOpts, sink chan<- *UniswapV2PairMint, sender []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) } - logs, sub, err := _UniswapPair.contract.WatchLogs(opts, "Mint", senderRule) + logs, sub, err := _UniswapV2Pair.contract.WatchLogs(opts, "Mint", senderRule) if err != nil { return nil, err } @@ -1359,8 +1359,8 @@ func (_UniswapPair *UniswapPairFilterer) WatchMint(opts *bind.WatchOpts, sink ch select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(UniswapPairMint) - if err := _UniswapPair.contract.UnpackLog(event, "Mint", log); err != nil { + event := new(UniswapV2PairMint) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Mint", log); err != nil { return err } event.Raw = log @@ -1384,18 +1384,18 @@ func (_UniswapPair *UniswapPairFilterer) WatchMint(opts *bind.WatchOpts, sink ch // ParseMint is a log parse operation binding the contract event 0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f. // // Solidity: event Mint(address indexed sender, uint256 amount0, uint256 amount1) -func (_UniswapPair *UniswapPairFilterer) ParseMint(log types.Log) (*UniswapPairMint, error) { - event := new(UniswapPairMint) - if err := _UniswapPair.contract.UnpackLog(event, "Mint", log); err != nil { +func (_UniswapV2Pair *UniswapV2PairFilterer) ParseMint(log types.Log) (*UniswapV2PairMint, error) { + event := new(UniswapV2PairMint) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Mint", log); err != nil { return nil, err } event.Raw = log return event, nil } -// UniswapPairSwapIterator is returned from FilterSwap and is used to iterate over the raw logs and unpacked data for Swap events raised by the UniswapPair contract. -type UniswapPairSwapIterator struct { - Event *UniswapPairSwap // Event containing the contract specifics and raw log +// UniswapV2PairSwapIterator is returned from FilterSwap and is used to iterate over the raw logs and unpacked data for Swap events raised by the UniswapV2Pair contract. +type UniswapV2PairSwapIterator struct { + Event *UniswapV2PairSwap // 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 @@ -1409,7 +1409,7 @@ type UniswapPairSwapIterator struct { // 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 *UniswapPairSwapIterator) Next() bool { +func (it *UniswapV2PairSwapIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1418,7 +1418,7 @@ func (it *UniswapPairSwapIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(UniswapPairSwap) + it.Event = new(UniswapV2PairSwap) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1433,7 +1433,7 @@ func (it *UniswapPairSwapIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(UniswapPairSwap) + it.Event = new(UniswapV2PairSwap) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1449,19 +1449,19 @@ func (it *UniswapPairSwapIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapPairSwapIterator) Error() error { +func (it *UniswapV2PairSwapIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *UniswapPairSwapIterator) Close() error { +func (it *UniswapV2PairSwapIterator) Close() error { it.sub.Unsubscribe() return nil } -// UniswapPairSwap represents a Swap event raised by the UniswapPair contract. -type UniswapPairSwap struct { +// UniswapV2PairSwap represents a Swap event raised by the UniswapV2Pair contract. +type UniswapV2PairSwap struct { Sender common.Address Amount0In *big.Int Amount1In *big.Int @@ -1474,7 +1474,7 @@ type UniswapPairSwap struct { // FilterSwap is a free log retrieval operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822. // // Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to) -func (_UniswapPair *UniswapPairFilterer) FilterSwap(opts *bind.FilterOpts, sender []common.Address, to []common.Address) (*UniswapPairSwapIterator, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) FilterSwap(opts *bind.FilterOpts, sender []common.Address, to []common.Address) (*UniswapV2PairSwapIterator, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -1486,17 +1486,17 @@ func (_UniswapPair *UniswapPairFilterer) FilterSwap(opts *bind.FilterOpts, sende toRule = append(toRule, toItem) } - logs, sub, err := _UniswapPair.contract.FilterLogs(opts, "Swap", senderRule, toRule) + logs, sub, err := _UniswapV2Pair.contract.FilterLogs(opts, "Swap", senderRule, toRule) if err != nil { return nil, err } - return &UniswapPairSwapIterator{contract: _UniswapPair.contract, event: "Swap", logs: logs, sub: sub}, nil + return &UniswapV2PairSwapIterator{contract: _UniswapV2Pair.contract, event: "Swap", logs: logs, sub: sub}, nil } // WatchSwap is a free log subscription operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822. // // Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to) -func (_UniswapPair *UniswapPairFilterer) WatchSwap(opts *bind.WatchOpts, sink chan<- *UniswapPairSwap, sender []common.Address, to []common.Address) (event.Subscription, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) WatchSwap(opts *bind.WatchOpts, sink chan<- *UniswapV2PairSwap, sender []common.Address, to []common.Address) (event.Subscription, error) { var senderRule []interface{} for _, senderItem := range sender { @@ -1508,7 +1508,7 @@ func (_UniswapPair *UniswapPairFilterer) WatchSwap(opts *bind.WatchOpts, sink ch toRule = append(toRule, toItem) } - logs, sub, err := _UniswapPair.contract.WatchLogs(opts, "Swap", senderRule, toRule) + logs, sub, err := _UniswapV2Pair.contract.WatchLogs(opts, "Swap", senderRule, toRule) if err != nil { return nil, err } @@ -1518,8 +1518,8 @@ func (_UniswapPair *UniswapPairFilterer) WatchSwap(opts *bind.WatchOpts, sink ch select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(UniswapPairSwap) - if err := _UniswapPair.contract.UnpackLog(event, "Swap", log); err != nil { + event := new(UniswapV2PairSwap) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Swap", log); err != nil { return err } event.Raw = log @@ -1543,18 +1543,18 @@ func (_UniswapPair *UniswapPairFilterer) WatchSwap(opts *bind.WatchOpts, sink ch // ParseSwap is a log parse operation binding the contract event 0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822. // // Solidity: event Swap(address indexed sender, uint256 amount0In, uint256 amount1In, uint256 amount0Out, uint256 amount1Out, address indexed to) -func (_UniswapPair *UniswapPairFilterer) ParseSwap(log types.Log) (*UniswapPairSwap, error) { - event := new(UniswapPairSwap) - if err := _UniswapPair.contract.UnpackLog(event, "Swap", log); err != nil { +func (_UniswapV2Pair *UniswapV2PairFilterer) ParseSwap(log types.Log) (*UniswapV2PairSwap, error) { + event := new(UniswapV2PairSwap) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Swap", log); err != nil { return nil, err } event.Raw = log return event, nil } -// UniswapPairSyncIterator is returned from FilterSync and is used to iterate over the raw logs and unpacked data for Sync events raised by the UniswapPair contract. -type UniswapPairSyncIterator struct { - Event *UniswapPairSync // Event containing the contract specifics and raw log +// UniswapV2PairSyncIterator is returned from FilterSync and is used to iterate over the raw logs and unpacked data for Sync events raised by the UniswapV2Pair contract. +type UniswapV2PairSyncIterator struct { + Event *UniswapV2PairSync // 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 @@ -1568,7 +1568,7 @@ type UniswapPairSyncIterator struct { // 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 *UniswapPairSyncIterator) Next() bool { +func (it *UniswapV2PairSyncIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1577,7 +1577,7 @@ func (it *UniswapPairSyncIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(UniswapPairSync) + it.Event = new(UniswapV2PairSync) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1592,7 +1592,7 @@ func (it *UniswapPairSyncIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(UniswapPairSync) + it.Event = new(UniswapV2PairSync) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1608,19 +1608,19 @@ func (it *UniswapPairSyncIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapPairSyncIterator) Error() error { +func (it *UniswapV2PairSyncIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *UniswapPairSyncIterator) Close() error { +func (it *UniswapV2PairSyncIterator) Close() error { it.sub.Unsubscribe() return nil } -// UniswapPairSync represents a Sync event raised by the UniswapPair contract. -type UniswapPairSync struct { +// UniswapV2PairSync represents a Sync event raised by the UniswapV2Pair contract. +type UniswapV2PairSync struct { Reserve0 *big.Int Reserve1 *big.Int Raw types.Log // Blockchain specific contextual infos @@ -1629,21 +1629,21 @@ type UniswapPairSync struct { // FilterSync is a free log retrieval operation binding the contract event 0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1. // // Solidity: event Sync(uint112 reserve0, uint112 reserve1) -func (_UniswapPair *UniswapPairFilterer) FilterSync(opts *bind.FilterOpts) (*UniswapPairSyncIterator, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) FilterSync(opts *bind.FilterOpts) (*UniswapV2PairSyncIterator, error) { - logs, sub, err := _UniswapPair.contract.FilterLogs(opts, "Sync") + logs, sub, err := _UniswapV2Pair.contract.FilterLogs(opts, "Sync") if err != nil { return nil, err } - return &UniswapPairSyncIterator{contract: _UniswapPair.contract, event: "Sync", logs: logs, sub: sub}, nil + return &UniswapV2PairSyncIterator{contract: _UniswapV2Pair.contract, event: "Sync", logs: logs, sub: sub}, nil } // WatchSync is a free log subscription operation binding the contract event 0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1. // // Solidity: event Sync(uint112 reserve0, uint112 reserve1) -func (_UniswapPair *UniswapPairFilterer) WatchSync(opts *bind.WatchOpts, sink chan<- *UniswapPairSync) (event.Subscription, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) WatchSync(opts *bind.WatchOpts, sink chan<- *UniswapV2PairSync) (event.Subscription, error) { - logs, sub, err := _UniswapPair.contract.WatchLogs(opts, "Sync") + logs, sub, err := _UniswapV2Pair.contract.WatchLogs(opts, "Sync") if err != nil { return nil, err } @@ -1653,8 +1653,8 @@ func (_UniswapPair *UniswapPairFilterer) WatchSync(opts *bind.WatchOpts, sink ch select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(UniswapPairSync) - if err := _UniswapPair.contract.UnpackLog(event, "Sync", log); err != nil { + event := new(UniswapV2PairSync) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Sync", log); err != nil { return err } event.Raw = log @@ -1678,18 +1678,18 @@ func (_UniswapPair *UniswapPairFilterer) WatchSync(opts *bind.WatchOpts, sink ch // ParseSync is a log parse operation binding the contract event 0x1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1. // // Solidity: event Sync(uint112 reserve0, uint112 reserve1) -func (_UniswapPair *UniswapPairFilterer) ParseSync(log types.Log) (*UniswapPairSync, error) { - event := new(UniswapPairSync) - if err := _UniswapPair.contract.UnpackLog(event, "Sync", log); err != nil { +func (_UniswapV2Pair *UniswapV2PairFilterer) ParseSync(log types.Log) (*UniswapV2PairSync, error) { + event := new(UniswapV2PairSync) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Sync", log); err != nil { return nil, err } event.Raw = log return event, nil } -// UniswapPairTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the UniswapPair contract. -type UniswapPairTransferIterator struct { - Event *UniswapPairTransfer // Event containing the contract specifics and raw log +// UniswapV2PairTransferIterator is returned from FilterTransfer and is used to iterate over the raw logs and unpacked data for Transfer events raised by the UniswapV2Pair contract. +type UniswapV2PairTransferIterator struct { + Event *UniswapV2PairTransfer // 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 @@ -1703,7 +1703,7 @@ type UniswapPairTransferIterator struct { // 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 *UniswapPairTransferIterator) Next() bool { +func (it *UniswapV2PairTransferIterator) Next() bool { // If the iterator failed, stop iterating if it.fail != nil { return false @@ -1712,7 +1712,7 @@ func (it *UniswapPairTransferIterator) Next() bool { if it.done { select { case log := <-it.logs: - it.Event = new(UniswapPairTransfer) + it.Event = new(UniswapV2PairTransfer) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1727,7 +1727,7 @@ func (it *UniswapPairTransferIterator) Next() bool { // Iterator still in progress, wait for either a data or an error event select { case log := <-it.logs: - it.Event = new(UniswapPairTransfer) + it.Event = new(UniswapV2PairTransfer) if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { it.fail = err return false @@ -1743,19 +1743,19 @@ func (it *UniswapPairTransferIterator) Next() bool { } // Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapPairTransferIterator) Error() error { +func (it *UniswapV2PairTransferIterator) Error() error { return it.fail } // Close terminates the iteration process, releasing any pending underlying // resources. -func (it *UniswapPairTransferIterator) Close() error { +func (it *UniswapV2PairTransferIterator) Close() error { it.sub.Unsubscribe() return nil } -// UniswapPairTransfer represents a Transfer event raised by the UniswapPair contract. -type UniswapPairTransfer struct { +// UniswapV2PairTransfer represents a Transfer event raised by the UniswapV2Pair contract. +type UniswapV2PairTransfer struct { From common.Address To common.Address Value *big.Int @@ -1765,7 +1765,7 @@ type UniswapPairTransfer struct { // FilterTransfer is a free log retrieval operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. // // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_UniswapPair *UniswapPairFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*UniswapPairTransferIterator, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) FilterTransfer(opts *bind.FilterOpts, from []common.Address, to []common.Address) (*UniswapV2PairTransferIterator, error) { var fromRule []interface{} for _, fromItem := range from { @@ -1776,17 +1776,17 @@ func (_UniswapPair *UniswapPairFilterer) FilterTransfer(opts *bind.FilterOpts, f toRule = append(toRule, toItem) } - logs, sub, err := _UniswapPair.contract.FilterLogs(opts, "Transfer", fromRule, toRule) + logs, sub, err := _UniswapV2Pair.contract.FilterLogs(opts, "Transfer", fromRule, toRule) if err != nil { return nil, err } - return &UniswapPairTransferIterator{contract: _UniswapPair.contract, event: "Transfer", logs: logs, sub: sub}, nil + return &UniswapV2PairTransferIterator{contract: _UniswapV2Pair.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 (_UniswapPair *UniswapPairFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *UniswapPairTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { +func (_UniswapV2Pair *UniswapV2PairFilterer) WatchTransfer(opts *bind.WatchOpts, sink chan<- *UniswapV2PairTransfer, from []common.Address, to []common.Address) (event.Subscription, error) { var fromRule []interface{} for _, fromItem := range from { @@ -1797,7 +1797,7 @@ func (_UniswapPair *UniswapPairFilterer) WatchTransfer(opts *bind.WatchOpts, sin toRule = append(toRule, toItem) } - logs, sub, err := _UniswapPair.contract.WatchLogs(opts, "Transfer", fromRule, toRule) + logs, sub, err := _UniswapV2Pair.contract.WatchLogs(opts, "Transfer", fromRule, toRule) if err != nil { return nil, err } @@ -1807,8 +1807,8 @@ func (_UniswapPair *UniswapPairFilterer) WatchTransfer(opts *bind.WatchOpts, sin select { case log := <-logs: // New log arrived, parse the event and forward to the user - event := new(UniswapPairTransfer) - if err := _UniswapPair.contract.UnpackLog(event, "Transfer", log); err != nil { + event := new(UniswapV2PairTransfer) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Transfer", log); err != nil { return err } event.Raw = log @@ -1832,9 +1832,9 @@ func (_UniswapPair *UniswapPairFilterer) WatchTransfer(opts *bind.WatchOpts, sin // ParseTransfer is a log parse operation binding the contract event 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef. // // Solidity: event Transfer(address indexed from, address indexed to, uint256 value) -func (_UniswapPair *UniswapPairFilterer) ParseTransfer(log types.Log) (*UniswapPairTransfer, error) { - event := new(UniswapPairTransfer) - if err := _UniswapPair.contract.UnpackLog(event, "Transfer", log); err != nil { +func (_UniswapV2Pair *UniswapV2PairFilterer) ParseTransfer(log types.Log) (*UniswapV2PairTransfer, error) { + event := new(UniswapV2PairTransfer) + if err := _UniswapV2Pair.contract.UnpackLog(event, "Transfer", log); err != nil { return nil, err } event.Raw = log diff --git a/scenarios/univ2tx/univ2tx.go b/scenarios/univ2tx/univ2tx.go index 66fa6a9..3317500 100644 --- a/scenarios/univ2tx/univ2tx.go +++ b/scenarios/univ2tx/univ2tx.go @@ -234,7 +234,7 @@ func (s *Scenario) Setup(testerCfg *tester.Tester) error { return nil } -func (s *Scenario) Run(testerInstance *tester.Tester) error { +func (s *Scenario) Run() error { txIdxCounter := uint64(0) counterMutex := sync.Mutex{} waitGroup := sync.WaitGroup{} @@ -875,7 +875,7 @@ func (s *Scenario) GetDaiAllowance(wallet *txbuilder.Wallet, to common.Address) func (s *Scenario) GetPairReserves() (*big.Int, *big.Int, error) { client := s.tester.GetClient(tester.SelectByIndex, 0) - pairContract, err := univ2tx.NewUniswapPair(s.pairContract, client.GetEthClient()) + pairContract, err := univ2tx.NewUniswapV2Pair(s.pairContract, client.GetEthClient()) if err != nil { return nil, nil, err } diff --git a/scenarios/wallets/wallets.go b/scenarios/wallets/wallets.go deleted file mode 100644 index d207c7c..0000000 --- a/scenarios/wallets/wallets.go +++ /dev/null @@ -1,61 +0,0 @@ -package wallets - -import ( - "github.com/holiman/uint256" - "github.com/sirupsen/logrus" - "github.com/spf13/pflag" - - "github.com/ethpandaops/goomy-blob/scenariotypes" - "github.com/ethpandaops/goomy-blob/tester" - "github.com/ethpandaops/goomy-blob/utils" -) - -type ScenarioOptions struct { - Wallets uint64 -} - -type Scenario struct { - options ScenarioOptions - logger *logrus.Entry - wallets uint64 -} - -func NewScenario() scenariotypes.Scenario { - return &Scenario{ - logger: logrus.WithField("scenario", "wallets"), - } -} - -func (s *Scenario) Flags(flags *pflag.FlagSet) error { - flags.Uint64VarP(&s.options.Wallets, "max-wallets", "w", 0, "Maximum number of child wallets to use") - return nil -} - -func (s *Scenario) Setup(testerCfg *tester.Tester) error { - return nil -} - -func (s *Scenario) Init(testerCfg *tester.TesterConfig) error { - if s.options.Wallets > 0 { - testerCfg.WalletCount = s.options.Wallets - } else { - testerCfg.WalletCount = 1000 - } - s.wallets = testerCfg.WalletCount - return nil -} - -func (s *Scenario) Run(t *tester.Tester) error { - wallet := t.GetRootWallet() - s.logger.Infof("Root Wallet %v nonce: %6d balance: %v ETH", wallet.GetAddress().String(), wallet.GetNonce(), utils.WeiToEther(uint256.MustFromBig(wallet.GetBalance()))) - client := t.GetClient(tester.SelectByIndex, 0) - - for i := 0; i < int(s.wallets); i++ { - wallet := t.GetWallet(tester.SelectByIndex, i) - pendingNonce, _ := client.GetPendingNonceAt(wallet.GetAddress()) - - s.logger.Infof("Child Wallet %4d %v nonce: %6d (%6d) balance: %v ETH", i+1, wallet.GetAddress().String(), wallet.GetNonce(), pendingNonce, utils.WeiToEther(uint256.MustFromBig(wallet.GetBalance()))) - } - - return nil -} diff --git a/scenariotypes/scenario.go b/scenariotypes/scenario.go index 99b0014..924fc01 100644 --- a/scenariotypes/scenario.go +++ b/scenariotypes/scenario.go @@ -9,5 +9,5 @@ type Scenario interface { Flags(flags *pflag.FlagSet) error Init(testerCfg *tester.TesterConfig) error Setup(testerCfg *tester.Tester) error - Run(tester *tester.Tester) error + Run() error } diff --git a/tester/tester.go b/tester/tester.go index 043afce..c02ba79 100644 --- a/tester/tester.go +++ b/tester/tester.go @@ -4,8 +4,6 @@ import ( "context" "fmt" "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethpandaops/goomy-blob/scenarios/univ2tx/contracts" "math/big" "math/rand" "sync" @@ -175,53 +173,6 @@ func (tester *Tester) GetRootWallet() *txbuilder.Wallet { return tester.rootWallet } -func (tester *Tester) DeployWethContract() (*univ3tx.Weth, common.Address, error) { - client := tester.GetClient(SelectByIndex, 0) - wallet := tester.GetRootWallet() - - transactor, err := tester.GetWalletTransactor(wallet, false, nil) - if err != nil { - tester.logger.Warnf("could not get transactor: %v", err) - return nil, common.Address{}, err - } - - contractAddress, _, weth, err := univ3tx.DeployWeth(transactor, client.GetEthClient()) - if err != nil { - tester.logger.Warnf("could not deploy WETH contract: %v", err) - return nil, common.Address{}, err - } - - tester.logger.Infof("deployed WETH contract at %v", contractAddress.String()) - - return weth, contractAddress, nil -} - -func (tester *Tester) DeployDaiContract() (*univ3tx.Dai, common.Address, error) { - client := tester.GetClient(SelectByIndex, 0) - wallet := tester.GetRootWallet() - - transactor, err := tester.GetWalletTransactor(wallet, false, nil) - if err != nil { - tester.logger.Warnf("could not get transactor: %v", err) - return nil, common.Address{}, err - } - - chainId, err := client.GetChainId() - if err != nil { - return nil, common.Address{}, err - } - - contractAddress, _, dai, err := univ3tx.DeployDai(transactor, client.GetEthClient(), chainId) - if err != nil { - tester.logger.Warnf("could not deploy DAI contract: %v", err) - return nil, common.Address{}, err - } - - tester.logger.Infof("deployed DAI contract at %v", contractAddress.String()) - - return dai, contractAddress, nil -} - func (tester *Tester) GetWalletTransactor(wallet *txbuilder.Wallet, noSend bool, value *big.Int) (*bind.TransactOpts, error) { transactor, err := bind.NewKeyedTransactorWithChainID(wallet.GetPrivateKey(), wallet.GetChainId()) if err != nil {