diff --git a/config/config.go b/config/config.go index 317c8c3052..c2a8f336c6 100644 --- a/config/config.go +++ b/config/config.go @@ -16,7 +16,6 @@ import ( "github.com/0xPolygonHermez/zkevm-node/merkletree" "github.com/0xPolygonHermez/zkevm-node/metrics" "github.com/0xPolygonHermez/zkevm-node/pool" - "github.com/0xPolygonHermez/zkevm-node/pricegetter" "github.com/0xPolygonHermez/zkevm-node/sequencer" "github.com/0xPolygonHermez/zkevm-node/sequencer/broadcast" "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor" @@ -59,7 +58,6 @@ type Config struct { RPC jsonrpc.Config Synchronizer synchronizer.Config Sequencer sequencer.Config - PriceGetter pricegetter.Config Aggregator aggregator.Config NetworkConfig NetworkConfig L2GasPriceSuggester gasprice.Config diff --git a/config/config_test.go b/config/config_test.go index 6b8a062593..6aea545300 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -13,7 +13,6 @@ import ( "github.com/0xPolygonHermez/zkevm-node/config" "github.com/0xPolygonHermez/zkevm-node/config/types" "github.com/0xPolygonHermez/zkevm-node/log" - "github.com/0xPolygonHermez/zkevm-node/pricegetter" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -42,20 +41,12 @@ func Test_Defaults(t *testing.T) { expectedValue: uint64(100), }, { - path: "PriceGetter.Type", - expectedValue: pricegetter.DefaultType, - }, - { - path: "PriceGetter.DefaultPrice", - expectedValue: pricegetter.TokenPrice{Float: new(big.Float).SetInt64(2000)}, - }, - { - path: "Sequencer.WaitPeriodPoolIsEmpty", + path: "Sequencer.NotSyncedWait", expectedValue: types.NewDuration(1 * time.Second), }, { path: "Sequencer.LastBatchVirtualizationTimeMaxWaitPeriod", - expectedValue: types.NewDuration(5 * time.Second), + expectedValue: types.NewDuration(time.Hour), }, { path: "Sequencer.MaxTxsPerBatch", @@ -118,19 +109,19 @@ func Test_Defaults(t *testing.T) { expectedValue: uint64(131072), }, { - path: "Sequencer.Finalizer.GERDeadlineTimeoutInSec", + path: "Sequencer.Finalizer.GERDeadlineTimeout", expectedValue: types.NewDuration(5 * time.Second), }, { - path: "Sequencer.Finalizer.ForcedBatchDeadlineTimeoutInSec", + path: "Sequencer.Finalizer.ForcedBatchDeadlineTimeout", expectedValue: types.NewDuration(60 * time.Second), }, { - path: "Sequencer.Finalizer.SendingToL1DeadlineTimeoutInSec", + path: "Sequencer.Finalizer.SendingToL1DeadlineTimeout", expectedValue: types.NewDuration(20 * time.Second), }, { - path: "Sequencer.Finalizer.SleepDurationInMs", + path: "Sequencer.Finalizer.SleepDuration", expectedValue: types.NewDuration(100 * time.Millisecond), }, { @@ -201,14 +192,6 @@ func Test_Defaults(t *testing.T) { path: "EthTxManager.ForcedGas", expectedValue: uint64(0), }, - { - path: "PriceGetter.Type", - expectedValue: pricegetter.DefaultType, - }, - { - path: "PriceGetter.DefaultPrice", - expectedValue: pricegetter.TokenPrice{Float: new(big.Float).SetInt64(2000)}, - }, { path: "L2GasPriceSuggester.DefaultGasPriceWei", expectedValue: uint64(1000000000), @@ -307,12 +290,12 @@ func Test_Defaults(t *testing.T) { expectedValue: int(8123), }, { - path: "RPC.ReadTimeoutInSec", - expectedValue: time.Duration(60), + path: "RPC.ReadTimeout", + expectedValue: types.NewDuration(60 * time.Second), }, { - path: "RPC.WriteTimeoutInSec", - expectedValue: time.Duration(60), + path: "RPC.WriteTimeout", + expectedValue: types.NewDuration(60 * time.Second), }, { path: "RPC.SequencerNodeURI", diff --git a/config/default.go b/config/default.go index 4489d900c8..ffb1d56dde 100644 --- a/config/default.go +++ b/config/default.go @@ -20,8 +20,8 @@ MaxConns = 200 [Pool] FreeClaimGasLimit = 150000 -MaxTxBytesSize=30132 -MaxTxDataBytesSize=30000 +MaxTxBytesSize = 30132 +MaxTxDataBytesSize = 30000 DefaultMinGasPriceAllowed = 1000000000 MinAllowedGasPriceInterval = "5m" PollMinAllowedGasPriceInterval = "15s" @@ -52,8 +52,8 @@ ForcedGas = 0 [RPC] Host = "0.0.0.0" Port = 8123 -ReadTimeoutInSec = 60 -WriteTimeoutInSec = 60 +ReadTimeout = "60s" +WriteTimeout = "60s" MaxRequestsPerIPAndSecond = 50 SequencerNodeURI = "" BroadcastURI = "127.0.0.1:61090" @@ -70,9 +70,9 @@ GenBlockNumber = 74 TrustedSequencerURL = "" [Sequencer] -WaitPeriodPoolIsEmpty = "1s" +NotSyncedWait = "1s" WaitPeriodSendSequence = "5s" -LastBatchVirtualizationTimeMaxWaitPeriod = "5s" +LastBatchVirtualizationTimeMaxWaitPeriod = "1h" BlocksAmountForTxsToBeDeleted = 100 FrequencyToCheckTxsForDelete = "12h" MaxTxsPerBatch = 150 @@ -98,10 +98,10 @@ TxLifetimeCheckTimeout = "10m" MaxTxLifetime = "3h" MaxTxSizeForL1 = 131072 [Sequencer.Finalizer] - GERDeadlineTimeoutInSec = "5s" - ForcedBatchDeadlineTimeoutInSec = "60s" - SendingToL1DeadlineTimeoutInSec = "20s" - SleepDurationInMs = "100ms" + GERDeadlineTimeout = "5s" + ForcedBatchDeadlineTimeout = "60s" + SendingToL1DeadlineTimeout = "20s" + SleepDuration = "100ms" ResourcePercentageToCloseBatch = 10 GERFinalityNumberOfBlocks = 64 ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" @@ -113,14 +113,9 @@ MaxTxSizeForL1 = 131072 [Sequencer.DBManager] PoolRetrievalInterval = "500ms" -[PriceGetter] -Type = "default" -DefaultPrice = "2000" - [Aggregator] Host = "0.0.0.0" Port = 50081 -ForkId = 2 RetryTime = "5s" VerifyProofInterval = "90s" TxProfitabilityCheckerType = "acceptall" @@ -133,9 +128,6 @@ GeneratingProofCleanupThreshold = "10m" Type = "default" DefaultGasPriceWei = 1000000000 -[Prover] -ProverURI = "0.0.0.0:50051" - [MTClient] URI = "127.0.0.1:50061" diff --git a/config/environments/local/local.node.config.toml b/config/environments/local/local.node.config.toml index 973ef37315..e77cbecbba 100644 --- a/config/environments/local/local.node.config.toml +++ b/config/environments/local/local.node.config.toml @@ -43,8 +43,8 @@ MultiGasProvider = false [RPC] Host = "0.0.0.0" Port = 8545 -ReadTimeoutInSec = 60 -WriteTimeoutInSec = 60 +ReadTimeout = "60s" +WriteTimeout = "60s" MaxRequestsPerIPAndSecond = 5000 SequencerNodeURI = "https://internal.zkevm-test.net:2083/" BroadcastURI = "internal.zkevm-test.net:61090" @@ -61,7 +61,7 @@ GenBlockNumber = 74 TrustedSequencerURL = "" [Sequencer] -WaitPeriodPoolIsEmpty = "1s" +NotSyncedWait = "1s" WaitPeriodSendSequence = "5s" LastBatchVirtualizationTimeMaxWaitPeriod = "5s" BlocksAmountForTxsToBeDeleted = 100 @@ -89,10 +89,10 @@ TxLifetimeCheckTimeout = "10m" MaxTxLifetime = "3h" MaxTxSizeForL1 = 131072 [Sequencer.Finalizer] - GERDeadlineTimeoutInSec = "5s" - ForcedBatchDeadlineTimeoutInSec = "60s" - SendingToL1DeadlineTimeoutInSec = "20s" - SleepDurationInMs = "100ms" + GERDeadlineTimeout = "5s" + ForcedBatchDeadlineTimeout = "60s" + SendingToL1DeadlineTimeout = "20s" + SleepDuration = "100ms" ResourcePercentageToCloseBatch = 10 GERFinalityNumberOfBlocks = 0 ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" @@ -107,7 +107,6 @@ MaxTxSizeForL1 = 131072 [Aggregator] Host = "0.0.0.0" Port = 50081 -ForkId = 2 RetryTime = "5s" VerifyProofInterval = "30s" TxProfitabilityCheckerType = "acceptall" diff --git a/config/environments/public/public.node.config.toml b/config/environments/public/public.node.config.toml index fcf64af9f1..107b3fe2ca 100644 --- a/config/environments/public/public.node.config.toml +++ b/config/environments/public/public.node.config.toml @@ -41,8 +41,8 @@ MultiGasProvider = false [RPC] Host = "0.0.0.0" Port = 8545 -ReadTimeoutInSec = 60 -WriteTimeoutInSec = 60 +ReadTimeout = "60s" +WriteTimeout = "60s" MaxRequestsPerIPAndSecond = 5000 SequencerNodeURI = "https://rpc.public.zkevm-test.net/" BroadcastURI = "public-grpc.zkevm-test.net:61090" diff --git a/config/types/duration_test.go b/config/types/duration_test.go new file mode 100644 index 0000000000..71e06a04ba --- /dev/null +++ b/config/types/duration_test.go @@ -0,0 +1,54 @@ +package types + +import ( + "encoding/json" + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestDurationUnmarshal(t *testing.T) { + type testCase struct { + name string + input string + expectedResult *Duration + expectedErr error + } + + testCases := []testCase{ + { + name: "valid duration", + input: "60s", + expectedResult: &Duration{Duration: time.Minute}, + }, + { + name: "int value", + input: "60", + expectedErr: fmt.Errorf("time: missing unit in duration \"60\""), + }, + { + name: "no duration value", + input: "abc", + expectedErr: fmt.Errorf("time: invalid duration \"abc\""), + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + var d Duration + input, err := json.Marshal(testCase.input) + require.NoError(t, err) + err = json.Unmarshal(input, &d) + + if testCase.expectedResult != nil { + require.Equal(t, (*testCase.expectedResult).Nanoseconds(), d.Nanoseconds()) + } + + if err != nil { + require.Equal(t, testCase.expectedErr.Error(), err.Error()) + } + }) + } +} diff --git a/docker-compose.yml b/docker-compose.yml index 18dab677ab..bcf2729d7c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -107,7 +107,7 @@ services: zkevm-prover: container_name: zkevm-prover restart: unless-stopped - image: hermeznetwork/zkevm-prover:9e70a64 + image: hermeznetwork/zkevm-prover:6d6e3aa depends_on: zkevm-state-db: condition: service_healthy diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000000..79e368fdd8 --- /dev/null +++ b/docs/config.md @@ -0,0 +1,673 @@ +# Config + +This document specifies the use and default values for all the configuration parameters. +Each config parameter can be specified through configuration file, such as [this one](../config/environments/public/public.node.config.toml), or environment variable and has a default value. +Note that some config parameters will be used and some others won't, depending on the components that are being run. + +## Log + +> Used by: all the components + +#### Environment + +- Description: Can be "development" or "production". This will change the format of the logs, for productions logs are displayed in JOSN format +- Default: "development" +- env: ZKEVM_NODE_LOG_ENVIRONMENT + +#### Level + +- Description: Can be "debug", "info", "warn" or "error". This will filter the logs according to it's level +- Default: "debug" +- env: ZKEVM_NODE_LOG_LEVEL + +#### Outputs + +- Description: ~ +- Default: ["stderr"] +- env: ZKEVM_NODE_LOG_OUTPUTS + +## StateDB + +> Used by: all the components + +#### User + +- Description: User name of the DB +- Default: "state_user" +- env: ZKEVM_NODE_STATE_DB_USER + +#### Password + +- Description: Password for the DB user +- Default: "state_password" +- env: ZKEVM_NODE_STATE_DB_PASSWORD + +#### Name + +- Description: Name of the DB +- Default: "state_db" +- env: ZKEVM_NODE_STATE_DB_NAME + +#### Host + +- Description: Host of the DB +- Default: "localhost" +- env: ZKEVM_NODE_STATE_DB_HOST + +#### Port + +- Description: Port of the DB +- Default: "5432" +- env: ZKEVM_NODE_STATE_DB_PORT + +#### EnableLog + +- Description: If set to true the node will log the queries done to the DB +- Default: false +- env: ZKEVM_NODE_STATE_DB_ENABLE_LOG + +#### MaxConns + +- Description: Maximum connections that the node will use towards the DB +- Default: 200 +- env: ZKEVM_NODE_STATE_DB_MAX_CONNS + + +## Pool + +> Used by: `sequencer`, `rpc`, `synchronizer`, `l2gaspricer` + +#### FreeClaimGasLimit + +- Description: If txs exceed this value in its gas limit, they won't be allowed to use 0 gas price +- Default: 150000 +- env: ZKEVM_NODE_POOL_FREE_CLAIM_GAS_LIMIT + +#### MaxTxBytesSize + +- Description: Maximum byte size allowed per tx +- Default: 30132 +- env: ZKEVM_NODE_POOL_MAX_TX_BYTES_SIZE + +#### MaxTxDataBytesSize + +- Description: Maximum byte size data allowed per tx +- Default: 30000 +- env: ZKEVM_NODE_POOL_MAX_TX_DATA_BYTES_SIZE + +#### DefaultMinGasPriceAllowed + +- Description: If there are no updates on the suggested gas price, txs bellow this gas price will be rejected +- Default: 1000000000 +- env: ZKEVM_NODE_POOL_DEFAULT_MIN_GAS_PRICE_ALLOWED + +#### MinAllowedGasPriceInterval + +- Description: Txs bellow the minimum gas price suggested in the previous indicated interval will be rejected +- Default: "5m" +- env: ZKEVM_NODE_POOL_MIN_ALLOWED_GAS_PRICE_INTERVAL + +#### PollMinAllowedGasPriceInterval + +- Description: Frequency to update the minimum gas price allowed +- Default: "15s" +- env: ZKEVM_NODE_POOL_POLL_MIN_ALLOWED_GAS_PRICE_INTERVAL + + +### Pool.DB + +#### User + +- Description: User name of the DB +- Default: "state_user" +- env: ZKEVM_NODE_POOL_DB_USER + +#### Password + +- Description: Password for the DB user +- Default: "state_password" +- env: ZKEVM_NODE_POOL_DB_PASSWORD + +#### Name + +- Description: Name of the DB +- Default: "state_db" +- env: ZKEVM_NODE_POOL_DB_NAME + +#### Host + +- Description: Host of the DB +- Default: "localhost" +- env: ZKEVM_NODE_POOL_DB_HOST + +#### Port + +- Description: Port of the DB +- Default: "5432" +- env: ZKEVM_NODE_POOL_DB_PORT + +#### EnableLog + +- Description: If set to true the node will log the queries done to the DB +- Default: false +- env: ZKEVM_NODE_POOL_DB_ENABLE_LOG + +#### MaxConns + +- Description: Maximum connections that the node will use towards the DB +- Default: 200 +- env: ZKEVM_NODE_POOL_DB_MAX_CONNS + + +## Etherman + +> Used by: `aggregator`, `sequencer`, `synchronizer`, `eth-tx-manager` + +#### URL + +- Description: URL of the L1 JSON RPC node +- Default: "http://localhost:8545" +- env: ZKEVM_NODE_ETHERMAN_URL + +#### L1ChainID + +- Description: Chain ID of the L1 network +- Default: 1337 +- env: ZKEVM_NODE_ETHERMAN_L1_CHAIN_ID + +#### PoEAddr + +- Description: Address of the zkEVM smart contract +- Default: "0x610178dA211FEF7D417bC0e6FeD39F05609AD788" +- env: ZKEVM_NODE_ETHERMAN_POE_ADDR + +#### MaticAddr + +- Description: Address of the MATIC token +- Default: "0x5FbDB2315678afecb367f032d93F642f64180aa3" +- env: ZKEVM_NODE_ETHERMAN_MATIC_ADDR + +#### GlobalExitRootManagerAddr + +- Description: Address of the Global Exit Root Manager contract +- Default: "0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6" +- env: ZKEVM_NODE_ETHERMAN_GLOBAL_EXIT_ROOT_MANAGER_ADDR + +#### MultiGasProvider + +- Description: Indicate if more than one gas provider should be used +- Default: true +- env: ZKEVM_NODE_ETHERMAN_MULTI_GAS_PROVIDER + + +### Etherman.Etherscan + +#### ApiKey + +- Description: If MultiGasProvider is set to true this API key will be used to cnnect to Etherscan in order to get gas price information +- Default: "" +- env: ZKEVM_NODE_ETHERMAN_ETHERSCAN_API_KEY + +## EthTxManager + +> Used by: `eth-tx-manager` + +#### FrequencyToMonitorTxs + +- Description: Frequency in which transactions are checked for status changes +- Default: "1s" +- env: ZKEVM_NODE_ETH_TX_MANAGER_FREQUENCY_TO_MONITOR_TXS + +#### WaitTxToBeMined + +- Description: Period of time used to wait for a tx to be mined. If tx is not mined in this period of time the manager will try to send a new one +- Default: "2m" +- env: ZKEVM_NODE_ETH_TX_MANAGER_WAIT_TX_TO_BEMINED + +#### ForcedGas + +- Description: If this value is greater than 0, txs being sent to L1 will use this value for gas limit **when gas estimation fails** +- Default: 0 +- env: ZKEVM_NODE_ETH_TX_MANAGER_FORCED_GAS + + +## RPC + +> Used by: `rpc` + + + +#### Host + +- Description: Host of the server +- Default: "0.0.0.0" +- env: ZKEVM_NODE_RPC_HOST + +#### Port + +- Description: Port of the server +- Default: 8123 +- env: ZKEVM_NODE_RPC_PORT + +#### ReadTimeout + +- Description: Maximum time allowed to read requests +- Default: 60 +- env: ZKEVM_NODE_RPC_READ_TIMEOUT + +#### WriteTimeout + +- Description: Maximum time allowed to write requests +- Default: 60 +- env: ZKEVM_NODE_RPC_WRITE_TIMEOUT + +#### MaxRequestsPerIPAndSecond + +- Description: Maximum amount of requests per second allowed per IP address +- Default: 50 +- env: ZKEVM_NODE_RPC_MAX_REQUESTS_PER_IP_PER_SECOND + +#### SequencerNodeURI + +- Description: RPC URL of the trusted sequencer. Used to proxy some pool related endpoints (such as sending txs) +- Default: "" +- env: ZKEVM_NODE_RPC_SEQUENCER_NODE_URI + +#### BroadcastURI + +- Description: URL of the broadcast service (deprecated) +- Default: "127.0.0.1:61090" +- env: ZKEVM_NODE_RPC_BROADCAST_URI + +#### DefaultSenderAddress + +- Description: Used to set the "from" of a tx when not provided for unsigned tx methods +- Default: "0x1111111111111111111111111111111111111111" +- env: ZKEVM_NODE_RPC_DEFAULT_SENDER_ADDRESS + +#### EnableL2SuggestedGasPricePolling + +- Description: When true, gas price suggestions will be updated +- Default: true +- env: ZKEVM_NODE_RPC_ENABLE_L2_SUGGESTED_GAS_PRICE_POLLING + + +## Synchronizer + +> Used by: `synchronizer` + +#### SyncInterval + +- Description: Amount of time waited between sync loops +- Default: "0s" +- env: ZKEVM_NODE_SYNCHRONIZER_SYNC_INTERVAL + +#### SyncChunkSize + +- Description: Amount of L1 blocks fetched per sync loop +- Default: 100 +- env: ZKEVM_NODE_SYNCHRONIZER_CHUNK_SIZE + +#### GenBlockNumber + +- Description: L1 block in which the rollup smart contracts were deployed +- Default: 67 +- env: ZKEVM_NODE_SYNCHRONIZER_GEN_BLOKC_NUMBER + +## Sequencer + +> Used by: `sequencer` + +#### NotSyncedWait + +- Description: Time too wait when the sequencer is waiting for the synchronizer to catch up with L1 +- Default: "1s" +- env: ZKEVM_NODE_SEQUENCER_NOT_SYNCED_WAIT + +#### WaitPeriodSendSequence + +- Description: Frequency in which the send sequences to L1 loop is run (doesn't mean that sequences will be sent with this frequency) +- Default: "5s" +- env: ZKEVM_NODE_SEQUENCER_WAIT_PERIOD_SEND_SEQUENCE + +#### LastBatchVirtualizationTimeMaxWaitPeriod + +- Description: If there has not been batches sent to L1 for longer than the specified duration, a batch will be sent even if the L1 tx could be more packed +- Default: "1h" +- env: ZKEVM_NODE_SEQUENCER_LAST_BATCH_VIRTUALIZATION_TIME_MAX_WAIT_PERIOD + +#### BlocksAmountForTxsToBeDeleted + +- Description: Will delete txs from the pool that have been mined on L1 (virtual state) for more than the indicated amount of L1 blocks +- Default: 100 +- env: ZKEVM_NODE_SEQUENCER_BLOCKS_AMOUNT_FORTXS_TO_BE_DELETED + +#### FrequencyToCheckTxsForDelete + +- Description: Frequency in which the deletion process of already mined txs will happen +- Default: "12h" +- env: ZKEVM_NODE_SEQUENCER_FREQUENCY_TO_CHECK_TXS_FOR_DELETE + +#### MaxTxsPerBatch + +- Description: Maximum amount of txs that the sequencer will include in a batch +- Default: 150 +- env: ZKEVM_NODE_SEQUENCER_MAX_TXS_PER_BATCH + +#### MaxBatchBytesSize + +- Description: Sequencer will close a batch before it reaches the indicated size +- Default: 129848 +- env: ZKEVM_NODE_SEQUENCER_MAX_BATCH_BYTES_SIZE + +#### MaxCumulativeGasUsed + +- Description: Sequencer will close a batch before it consumes the indicated amount of gas +- Default: 30000000 +- env: ZKEVM_NODE_SEQUENCER_MAX_CUMULATIVE_GAS_USED + +#### MaxKeccakHashes + +- Description: Sequencer will close a batch before it consumes the indicated amount of Keccack hashes +- Default: 468 +- env: ZKEVM_NODE_SEQUENCER_MAX_KECCAK_HASHES + +#### MaxPoseidonHashes + +- Description: Sequencer will close a batch before it consumes the indicated amount of Poseidon hashes +- Default: 279620 +- env: ZKEVM_NODE_SEQUENCER_MAX_POSEIDON_HASHES + +#### MaxPoseidonPaddings + +- Description: Sequencer will close a batch before it consumes the indicated amount of Poseidon paddings +- Default: 149796 +- env: ZKEVM_NODE_SEQUENCER_MAX_POSEIDON_PADDINGS + +#### MaxMemAligns + +- Description: Sequencer will close a batch before it consumes the indicated amount of memory alignments +- Default: 262144 +- env: ZKEVM_NODE_SEQUENCER_MAX_MEM_ALIGNS + +#### MaxArithmetics + +- Description: Sequencer will close a batch before it consumes the indicated amount of arithmetic operations +- Default: 262144 +- env: ZKEVM_NODE_SEQUENCER_MAX_ARITHEMTICS + +#### MaxBinaries + +- Description: Sequencer will close a batch before it consumes the indicated amount of binary operations +- Default: 262144 +- env: ZKEVM_NODE_SEQUENCER_MAX_BINARIES + +#### MaxSteps + +- Description: Sequencer will close a batch before it consumes the indicated amount of steps +- Default: 8388608 +- env: ZKEVM_NODE_SEQUENCER_MAX_STEPS + +#### WeightBatchBytesSize + +- Description: Factor multiplied on the size by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_BATCH_BYTE_SIZE + +#### WeightCumulativeGasUsed + +- Description: Factor multiplied on the gas used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_CUMULATIVE_GAS_USED + +#### WeightKeccakHashes + +- Description: Factor multiplied on the keccack hashes used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_KECCACK_HASHES + +#### WeightPoseidonHashes + +- Description: Factor multiplied on the Poseidon hashes used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_POSEIDON_HASHES + +#### WeightPoseidonPaddings + +- Description: Factor multiplied on the Poseidon paddings used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_POSEIDON_PADDINGS + +#### WeightMemAligns + +- Description: Factor multiplied on the mem aligns used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_MEM_ALIGNS + +#### WeightArithmetics + +- Description: Factor multiplied on the arithemtics used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_ARITHMETICS + +#### WeightBinaries + +- Description: Factor multiplied on the binnaries used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_BINNARIES + +#### WeightSteps + +- Description: Factor multiplied on the steps used by a tx to set the efficiency score +- Default: 1 +- env: ZKEVM_NODE_SEQUENCER_WEIGHT_STEPS + +#### TxLifetimeCheckTimeout + +- Description: Frequency in which the expire logic for pending txs will be triggered +- Default: "10m" +- env: ZKEVM_NODE_SEQUENCER_TX_LIFETIME_CHECK_TIMEOUT + +#### MaxTxLifetime + +- Description: Maximum time for txs to be in pending state +- Default: "3h" +- env: ZKEVM_NODE_SEQUENCER_MAX_TX_LIFETIME + +#### MaxTxSizeForL1 + +- Description: Max size of an L1 tx +- Default: 131072 +- env: ZKEVM_NODE_SEQUENCER_MAX_TX_SIZE_FOR_L1 + +### Sequencer.Finalizer + +#### GERDeadlineTimeout + +- Description: Grace period for the finalizer to update the GER in a new batch without having to close the current open one in a forced way +- Default: 5s +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_GER_DEADLINE_TIMEOUT + +#### ForcedBatchDeadlineTimeout + +- Description: Grace period for the finalizer to update include forced batches in a new batch without having to close the current open one in a forced way +- Default: 60s +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_FORCED_BATCH_DEADLINE_TIMEOUT + +#### SendingToL1DeadlineTimeout + +- Description: Grace period for the finalizer to close the current open batch +- Default: 20s +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_SENDING_TO_L1_DEADLINE_TIMEOUT + +#### SleepDuration + +- Description: Sleep time for the finalizer if there are no new processable txs +- Default: 100ms +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_SLEEP_DURATION + +#### ResourcePercentageToCloseBatch + +- Description: If a given resource of a batch exceeds this percentadge and there are no fitting txs in the worker, close batch +- Default: 10 +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_RESOURCE_PERCENTAGE_TO_CLOSE_BATCH + +#### GERFinalityNumberOfBlocks + +- Description: Amount of (L1) blocks to consider that a tx that updates the GER is final +- Default: 64 +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_GER_FINALITY_NUMBER_OF_BLOCKS + +#### ClosingSignalsManagerWaitForCheckingL1Timeout + +- Description: Waiting period between iterations for checking L1 timeout +- Default: 10s +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_CLOSING_SIGNALS_MANAGER_WAIT_FOR_CHECKING_L1_TIMEOUT + +#### ClosingSignalsManagerWaitForCheckingGER + +- Description: Waiting period between iterations for checking new GERs +- Default: 10s +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_CLOSING_SIGNALS_MANAGER_WAIT_FOR_CHECKING_GER + +#### ClosingSignalsManagerWaitForCheckingForcedBatches + +- Description: Waiting period between iterations for checking new forced batches +- Default: 10s +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_CLOSING_SIGNALS_MANAGER_WAIT_FOR_CHECKING_FORCED_BATCHES + +#### ForcedBatchesFinalityNumberOfBlocks + +- Description: Amount of (L1) blocks to consider that a tx that forces a batch is final +- Default: 64 +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_FORCED_BATCHES_FINALITY_NUMBER_OF_BLOCKS + +#### SenderAddress + +- Description: Address of the trusted sequencer +- Default: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 +- env: ZKEVM_NODE_SEQUENCER_FINALIZER_SENDER_ADDRESS + +## Aggregator + +Used by: `aggregator` + +#### Host + +- Description: Host for the gRPC interface in which provers will conect to +- Default: "0.0.0.0" +- env: ZKEVM_NODE_AGGREGATOR_HOST + +#### Port + +- Description: Port for the gRPC interface in which provers will conect to +- Default: 50081 +- env: ZKEVM_NODE_AGGREGATOR_PORT + +#### RetryTime + +- Description: RetryTime is the time the aggregator main loop sleeps if there are no proofs to aggregate or batches to generate proofs. It is also used in the isSynced loop +- Default: "5s" +- env: ZKEVM_NODE_AGGREGATOR_RETRY_TIME + +#### VerifyProofInterval + +- Description: VerifyProofInterval is the interval of time to verify/send an proof in L1 +- Default: "90s" +- env: ZKEVM_NODE_AGGREGATOR_VERIFY_PROOF_INTERVAL + +#### TxProfitabilityCheckerType + +- Description: type for checking is it profitable for aggregator to validate batch +- Default: "acceptall" +- env: ZKEVM_NODE_AGGREGATOR_TX_PROFITABILITY_CHECKER_TYPE + +#### TxProfitabilityMinReward + +- Description: min reward for base tx profitability checker when aggregator will validate batch this parameter is used for the base tx profitability checker +- Default: "1.1" +- env: ZKEVM_NODE_AGGREGATOR_TX_PROFITABILITY_MIN_REWARD + +#### ProofStatePollingInterval + +- Description: is the interval time to polling the prover about the generation state of a proof +- Default: "5s" +- env: ZKEVM_NODE_AGGREGATOR_PROOF_STATE_POLLING_INTERVAL + +#### CleanupLockedProofsInterval + +- Description: is the interval of time to clean up locked proofs. +- Default: "2m" +- env: ZKEVM_NODE_AGGREGATOR_CLEANUP_LOCKED_PROOFS_INTERVAL + +#### GeneratingProofCleanupThreshold + +- Description: represents the time interval after which a proof in generating state is considered to be stuck and allowed to be cleared. +- Default: "10m" +- env: ZKEVM_NODE_AGGREGATOR_GENERATING_PROOF_CLEANUP_TRESHOLD + + +## L2GasPriceSuggester + +> Used by: `l2gaspricer` + +#### Type + +- Description: type of L2 gas suggestion strategy. Available values: + - "default": default gas price from config is set + - "lastnbatches": calculate average gas tip from last n batches. + - "follower": calculate the gas price basing on the L1 gasPrice. +- Default: "default" +- env: ZKEVM_NODE_L2_GAS_PRICE_SUGGESTER_TYPE + +#### DefaultGasPriceWei + +- Description: suggested gas price when using the `Type: default` +- Default: 1000000000 +- env: ZKEVM_NODE_L2_GAS_PRICE_SUGGESTER_DEFAULT_GAS_PRICE_WEI + +## MTClient + +> Used by: all components + +#### URI + +- Description: URI of the MT service aka HashDB, which is part of the prover binary +- Default: "127.0.0.1:50061" +- env: ZKEVM_NODE_MT_CLIENT + +## Executor + +> Used by: all components + +#### URI + +- Description: URI of the executor, which is part of the prover binary +- Default: "127.0.0.1:50071" +- env: ZKEVM_NODE_MT_CLIENT + +## BroadcastServer + +> Deprecated + +## Metrics + +> Used by: all components + +#### Host + +- Description: host of the Prometheus server +- Default: "0.0.0.0" +- env: ZKEVM_NODE_METRICS_HOST + +#### Port + +- Description: port of the Prometheus server +- Default: 9091 +- env: ZKEVM_NODE_METRICS_ + +#### Enabled + +- Description: enable/disable Prometheus server +- Default: false +- env: ZKEVM_NODE_METRICS_ \ No newline at end of file diff --git a/jsonrpc/config.go b/jsonrpc/config.go index 70f0587cf5..744650b08c 100644 --- a/jsonrpc/config.go +++ b/jsonrpc/config.go @@ -1,15 +1,13 @@ package jsonrpc -import ( - "time" -) +import "github.com/0xPolygonHermez/zkevm-node/config/types" // Config represents the configuration of the json rpc type Config struct { - Host string `mapstructure:"Host"` - Port int `mapstructure:"Port"` - ReadTimeoutInSec time.Duration `mapstructure:"ReadTimeoutInSec"` - WriteTimeoutInSec time.Duration `mapstructure:"WriteTimeoutInSec"` + Host string `mapstructure:"Host"` + Port int `mapstructure:"Port"` + ReadTimeout types.Duration `mapstructure:"ReadTimeout"` + WriteTimeout types.Duration `mapstructure:"WriteTimeout"` MaxRequestsPerIPAndSecond float64 `mapstructure:"MaxRequestsPerIPAndSecond"` diff --git a/jsonrpc/server.go b/jsonrpc/server.go index d3892c656c..0bee6bf0b7 100644 --- a/jsonrpc/server.go +++ b/jsonrpc/server.go @@ -124,8 +124,8 @@ func (s *Server) startHTTP() error { s.srv = &http.Server{ Handler: mux, - ReadTimeout: s.config.ReadTimeoutInSec * time.Second, - WriteTimeout: s.config.WriteTimeoutInSec * time.Second, + ReadTimeout: s.config.ReadTimeout.Duration, + WriteTimeout: s.config.WriteTimeout.Duration, } log.Infof("http server started: %s", address) if err := s.srv.Serve(lis); err != nil { @@ -161,8 +161,8 @@ func (s *Server) startWS() { s.wsSrv = &http.Server{ Handler: mux, - ReadTimeout: s.config.ReadTimeoutInSec * time.Second, - WriteTimeout: s.config.WriteTimeoutInSec * time.Second, + ReadTimeout: s.config.ReadTimeout.Duration, + WriteTimeout: s.config.WriteTimeout.Duration, } s.wsUpgrader = websocket.Upgrader{ ReadBufferSize: wsBufferSizeLimitInBytes, diff --git a/pricegetter/config.go b/pricegetter/config.go deleted file mode 100644 index 6cf22d1404..0000000000 --- a/pricegetter/config.go +++ /dev/null @@ -1,52 +0,0 @@ -package pricegetter - -import ( - "fmt" - "math/big" - - "github.com/0xPolygonHermez/zkevm-node/config/types" - "github.com/0xPolygonHermez/zkevm-node/pricegetter/priceprovider" -) - -// TokenPrice is a wrapper type that parses token amount to big float -type TokenPrice struct { - *big.Float `validate:"required"` -} - -// UnmarshalText unmarshal token amount from float string to big int -func (t *TokenPrice) UnmarshalText(data []byte) error { - amount, ok := new(big.Float).SetString(string(data)) - if !ok { - return fmt.Errorf("failed to unmarshal string to float") - } - t.Float = amount - - return nil -} - -// Type for the pricegetter -type Type string - -const ( - // SyncType synchronous request to price provider - SyncType Type = "sync" - // AsyncType update price every n second - AsyncType Type = "async" - // DefaultType get default price from the config - DefaultType Type = "default" -) - -// Config represents the configuration of the pricegetter -type Config struct { - // Type is price getter type - Type Type `mapstructure:"Type"` - - // PriceProvider config - PriceProvider priceprovider.Config `mapstructure:"PriceProvider"` - - // UpdateFrequency is price updating frequency, used only for the async type - UpdateFrequency types.Duration `mapstructure:"UpdateFrequency"` - - // DefaultPrice is used only for the default type - DefaultPrice TokenPrice `mapstructure:"DefaultPrice"` -} diff --git a/pricegetter/pricegetter.go b/pricegetter/pricegetter.go deleted file mode 100644 index bff2364b03..0000000000 --- a/pricegetter/pricegetter.go +++ /dev/null @@ -1,113 +0,0 @@ -package pricegetter - -import ( - "context" - "fmt" - "math/big" - "time" - - "github.com/0xPolygonHermez/zkevm-node/log" - "github.com/0xPolygonHermez/zkevm-node/pricegetter/priceprovider" - "github.com/0xPolygonHermez/zkevm-node/pricegetter/priceprovider/uniswap" -) - -// Client for the pricegetter -type Client interface { - // Start price getter client - Start(ctx context.Context) - // GetEthToMaticPrice getting eth to matic price - GetEthToMaticPrice(ctx context.Context) (*big.Float, error) -} - -// NewClient inits price getter client -func NewClient(cfg Config) (Client, error) { - var ( - priceProvider priceprovider.PriceProvider - err error - ) - switch cfg.PriceProvider.Type { - case priceprovider.UniswapType: - priceProvider, err = uniswap.NewPriceProvider(cfg.PriceProvider.URL) - if err != nil { - return nil, err - } - } - switch cfg.Type { - case SyncType: - return &syncClient{priceProvider: priceProvider}, nil - case AsyncType: - return &asyncClient{ - cfg: cfg, - priceProvider: priceProvider, - price: nil, - lastUpdated: time.Time{}, - }, nil - case DefaultType: - return &defaultClient{defaultPrice: cfg.DefaultPrice.Float}, nil - } - return nil, fmt.Errorf("pricegetter type is not specified") -} - -// defaultClient using default price set by config -type defaultClient struct { - defaultPrice *big.Float -} - -// GetEthToMaticPrice getting default price -func (c *defaultClient) GetEthToMaticPrice(ctx context.Context) (*big.Float, error) { - return c.defaultPrice, nil -} - -// Start function for default client -func (c *defaultClient) Start(ctx context.Context) {} - -// syncClient using synchronous request -type syncClient struct { - priceProvider priceprovider.PriceProvider -} - -// GetEthToMaticPrice getting price from the price provider -func (c *syncClient) GetEthToMaticPrice(ctx context.Context) (*big.Float, error) { - return c.priceProvider.GetEthToMaticPrice(ctx) -} - -// Start starting sync client -func (c *syncClient) Start(ctx context.Context) {} - -// asyncClient -type asyncClient struct { - cfg Config - priceProvider priceprovider.PriceProvider - price *big.Float - lastUpdated time.Time -} - -// SyncPrice syncing price with the price provider every n second -func (c *asyncClient) syncPrice(ctx context.Context) { - ticker := time.NewTicker(c.cfg.UpdateFrequency.Duration) - defer ticker.Stop() - var err error - for { - c.price, err = c.priceProvider.GetEthToMaticPrice(ctx) - if err != nil { - log.Errorf("failed to get price matic price, err: %v", err) - } else { - c.lastUpdated = time.Now() - } - select { - case <-ticker.C: - // nothing - case <-ctx.Done(): - return - } - } -} - -// GetEthToMaticPrice get price, that is syncing every n second -func (c *asyncClient) GetEthToMaticPrice(ctx context.Context) (*big.Float, error) { - return c.price, nil -} - -func (c *asyncClient) Start(ctx context.Context) { - go c.syncPrice(ctx) -} diff --git a/pricegetter/priceprovider/abi/uniswap.abi b/pricegetter/priceprovider/abi/uniswap.abi deleted file mode 100644 index 49cc338ed3..0000000000 --- a/pricegetter/priceprovider/abi/uniswap.abi +++ /dev/null @@ -1,988 +0,0 @@ -[ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "name": "Collect", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "name": "CollectProtocol", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "paid0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "paid1", - "type": "uint256" - } - ], - "name": "Flash", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint16", - "name": "observationCardinalityNextOld", - "type": "uint16" - }, - { - "indexed": false, - "internalType": "uint16", - "name": "observationCardinalityNextNew", - "type": "uint16" - } - ], - "name": "IncreaseObservationCardinalityNext", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - }, - { - "indexed": false, - "internalType": "int24", - "name": "tick", - "type": "int24" - } - ], - "name": "Initialize", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "indexed": true, - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol0Old", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol1Old", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol0New", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "feeProtocol1New", - "type": "uint8" - } - ], - "name": "SetFeeProtocol", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "indexed": false, - "internalType": "int256", - "name": "amount0", - "type": "int256" - }, - { - "indexed": false, - "internalType": "int256", - "name": "amount1", - "type": "int256" - }, - { - "indexed": false, - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - }, - { - "indexed": false, - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "indexed": false, - "internalType": "int24", - "name": "tick", - "type": "int24" - } - ], - "name": "Swap", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "amount", - "type": "uint128" - } - ], - "name": "burn", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "amount0Requested", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1Requested", - "type": "uint128" - } - ], - "name": "collect", - "outputs": [ - { - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint128", - "name": "amount0Requested", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1Requested", - "type": "uint128" - } - ], - "name": "collectProtocol", - "outputs": [ - { - "internalType": "uint128", - "name": "amount0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "amount1", - "type": "uint128" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [ - { - "internalType": "uint24", - "name": "", - "type": "uint24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeGrowthGlobal0X128", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "feeGrowthGlobal1X128", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "flash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint16", - "name": "observationCardinalityNext", - "type": "uint16" - } - ], - "name": "increaseObservationCardinalityNext", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "liquidity", - "outputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxLiquidityPerTick", - "outputs": [ - { - "internalType": "uint128", - "name": "", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - }, - { - "internalType": "uint128", - "name": "amount", - "type": "uint128" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "observations", - "outputs": [ - { - "internalType": "uint32", - "name": "blockTimestamp", - "type": "uint32" - }, - { - "internalType": "int56", - "name": "tickCumulative", - "type": "int56" - }, - { - "internalType": "uint160", - "name": "secondsPerLiquidityCumulativeX128", - "type": "uint160" - }, - { - "internalType": "bool", - "name": "initialized", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32[]", - "name": "secondsAgos", - "type": "uint32[]" - } - ], - "name": "observe", - "outputs": [ - { - "internalType": "int56[]", - "name": "tickCumulatives", - "type": "int56[]" - }, - { - "internalType": "uint160[]", - "name": "secondsPerLiquidityCumulativeX128s", - "type": "uint160[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "positions", - "outputs": [ - { - "internalType": "uint128", - "name": "liquidity", - "type": "uint128" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside0LastX128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthInside1LastX128", - "type": "uint256" - }, - { - "internalType": "uint128", - "name": "tokensOwed0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "tokensOwed1", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "protocolFees", - "outputs": [ - { - "internalType": "uint128", - "name": "token0", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "token1", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "feeProtocol0", - "type": "uint8" - }, - { - "internalType": "uint8", - "name": "feeProtocol1", - "type": "uint8" - } - ], - "name": "setFeeProtocol", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "slot0", - "outputs": [ - { - "internalType": "uint160", - "name": "sqrtPriceX96", - "type": "uint160" - }, - { - "internalType": "int24", - "name": "tick", - "type": "int24" - }, - { - "internalType": "uint16", - "name": "observationIndex", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinality", - "type": "uint16" - }, - { - "internalType": "uint16", - "name": "observationCardinalityNext", - "type": "uint16" - }, - { - "internalType": "uint8", - "name": "feeProtocol", - "type": "uint8" - }, - { - "internalType": "bool", - "name": "unlocked", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "int24", - "name": "tickLower", - "type": "int24" - }, - { - "internalType": "int24", - "name": "tickUpper", - "type": "int24" - } - ], - "name": "snapshotCumulativesInside", - "outputs": [ - { - "internalType": "int56", - "name": "tickCumulativeInside", - "type": "int56" - }, - { - "internalType": "uint160", - "name": "secondsPerLiquidityInsideX128", - "type": "uint160" - }, - { - "internalType": "uint32", - "name": "secondsInside", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "bool", - "name": "zeroForOne", - "type": "bool" - }, - { - "internalType": "int256", - "name": "amountSpecified", - "type": "int256" - }, - { - "internalType": "uint160", - "name": "sqrtPriceLimitX96", - "type": "uint160" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "swap", - "outputs": [ - { - "internalType": "int256", - "name": "amount0", - "type": "int256" - }, - { - "internalType": "int256", - "name": "amount1", - "type": "int256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "int16", - "name": "", - "type": "int16" - } - ], - "name": "tickBitmap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tickSpacing", - "outputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "int24", - "name": "", - "type": "int24" - } - ], - "name": "ticks", - "outputs": [ - { - "internalType": "uint128", - "name": "liquidityGross", - "type": "uint128" - }, - { - "internalType": "int128", - "name": "liquidityNet", - "type": "int128" - }, - { - "internalType": "uint256", - "name": "feeGrowthOutside0X128", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeGrowthOutside1X128", - "type": "uint256" - }, - { - "internalType": "int56", - "name": "tickCumulativeOutside", - "type": "int56" - }, - { - "internalType": "uint160", - "name": "secondsPerLiquidityOutsideX128", - "type": "uint160" - }, - { - "internalType": "uint32", - "name": "secondsOutside", - "type": "uint32" - }, - { - "internalType": "bool", - "name": "initialized", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/pricegetter/priceprovider/config.go b/pricegetter/priceprovider/config.go deleted file mode 100644 index 3c459b70c6..0000000000 --- a/pricegetter/priceprovider/config.go +++ /dev/null @@ -1,18 +0,0 @@ -package priceprovider - -// Type for the price provider -type Type string - -const ( - // UniswapType for uniswap price provider - UniswapType Type = "uniswap" -) - -// Config represents the configuration of the pricegetter -type Config struct { - // URL is Ethereum network url, if type is uniswap - URL string `mapstructure:"URL"` - - // Type is price getter type - Type Type `mapstructure:"Type"` -} diff --git a/pricegetter/priceprovider/priceprovider.go b/pricegetter/priceprovider/priceprovider.go deleted file mode 100644 index 2d94b97f7f..0000000000 --- a/pricegetter/priceprovider/priceprovider.go +++ /dev/null @@ -1,12 +0,0 @@ -package priceprovider - -import ( - "context" - "math/big" -) - -// PriceProvider get price from different data sources -type PriceProvider interface { - // GetEthToMaticPrice getting price from the specified provider - GetEthToMaticPrice(ctx context.Context) (*big.Float, error) -} diff --git a/pricegetter/priceprovider/script.sh b/pricegetter/priceprovider/script.sh deleted file mode 100755 index 6318ea223f..0000000000 --- a/pricegetter/priceprovider/script.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -set -e - -gen() { - local package=$1 - - abigen --abi abi/${package}.abi --pkg=${package} --out=${package}/${package}.go -} - -gen uniswap \ No newline at end of file diff --git a/pricegetter/priceprovider/uniswap/client.go b/pricegetter/priceprovider/uniswap/client.go deleted file mode 100644 index 8a67bd68be..0000000000 --- a/pricegetter/priceprovider/uniswap/client.go +++ /dev/null @@ -1,57 +0,0 @@ -package uniswap - -import ( - "context" - "fmt" - "math/big" - - "github.com/0xPolygonHermez/zkevm-node/log" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/ethclient" -) - -var ( - x96 = new(big.Float).SetInt(big.NewInt(0).Exp(big.NewInt(2), big.NewInt(96), nil)) // nolint:gomnd - uniswapAddressEthMaticPool = common.HexToAddress("0x290a6a7460b308ee3f19023d2d00de604bcf5b42") -) - -// PriceProvider price proved which takes price from the eth/matic pool from uniswap -type PriceProvider struct { - Uni *Uniswap -} - -// NewPriceProvider init uniswap price provider -func NewPriceProvider(URL string) (*PriceProvider, error) { - ethClient, err := ethclient.Dial(URL) - if err != nil { - log.Errorf("error connecting to %s: %+v", URL, err) - return nil, err - } - - uni, err := NewUniswap(uniswapAddressEthMaticPool, ethClient) - if err != nil { - return nil, err - } - return &PriceProvider{Uni: uni}, nil -} - -// SqrtPriceX96ToPrice convert uniswap v3 sqrt price in x96 format to big.Float -// calculation taken from here - https://docs.uniswap.org/sdk/guides/fetching-prices#understanding-sqrtprice -func sqrtPriceX96ToPrice(sqrtPriceX96 *big.Int) (price *big.Float) { - d := big.NewFloat(0).Quo(new(big.Float).SetInt(sqrtPriceX96), x96) - p := big.NewFloat(0).Mul(d, d) - - price = big.NewFloat(0).Quo(big.NewFloat(1), p) - return -} - -// GetEthToMaticPrice price from the uniswap pool contract -func (c *PriceProvider) GetEthToMaticPrice(ctx context.Context) (*big.Float, error) { - slot, err := c.Uni.Slot0(&bind.CallOpts{Context: ctx}) - if err != nil { - return nil, fmt.Errorf("failed to get matic price from uniswap: %v", err) - } - - return sqrtPriceX96ToPrice(slot.SqrtPriceX96), nil -} diff --git a/pricegetter/priceprovider/uniswap/uniswap.go b/pricegetter/priceprovider/uniswap/uniswap.go deleted file mode 100644 index d9acd97afe..0000000000 --- a/pricegetter/priceprovider/uniswap/uniswap.go +++ /dev/null @@ -1,2454 +0,0 @@ -// Code generated - DO NOT EDIT. -// This file is a generated binding and any manual changes will be lost. - -package uniswap - -import ( - "errors" - "math/big" - "strings" - - ethereum "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/event" -) - -// Reference imports to suppress errors if they are not otherwise used. -var ( - _ = errors.New - _ = big.NewInt - _ = strings.NewReader - _ = ethereum.NotFound - _ = bind.Bind - _ = common.Big1 - _ = types.BloomLookup - _ = event.NewSubscription -) - -// UniswapMetaData contains all meta data concerning the Uniswap contract. -var UniswapMetaData = &bind.MetaData{ - ABI: "[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"int24\",\"name\":\"tickLower\",\"type\":\"int24\"},{\"indexed\":true,\"internalType\":\"int24\",\"name\":\"tickUpper\",\"type\":\"int24\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"amount\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"name\":\"Burn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"int24\",\"name\":\"tickLower\",\"type\":\"int24\"},{\"indexed\":true,\"internalType\":\"int24\",\"name\":\"tickUpper\",\"type\":\"int24\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"amount0\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"amount1\",\"type\":\"uint128\"}],\"name\":\"Collect\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"amount0\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"amount1\",\"type\":\"uint128\"}],\"name\":\"CollectProtocol\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"paid0\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"paid1\",\"type\":\"uint256\"}],\"name\":\"Flash\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"observationCardinalityNextOld\",\"type\":\"uint16\"},{\"indexed\":false,\"internalType\":\"uint16\",\"name\":\"observationCardinalityNextNew\",\"type\":\"uint16\"}],\"name\":\"IncreaseObservationCardinalityNext\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint160\",\"name\":\"sqrtPriceX96\",\"type\":\"uint160\"},{\"indexed\":false,\"internalType\":\"int24\",\"name\":\"tick\",\"type\":\"int24\"}],\"name\":\"Initialize\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"int24\",\"name\":\"tickLower\",\"type\":\"int24\"},{\"indexed\":true,\"internalType\":\"int24\",\"name\":\"tickUpper\",\"type\":\"int24\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"amount\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"name\":\"Mint\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"feeProtocol0Old\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"feeProtocol1Old\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"feeProtocol0New\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"feeProtocol1New\",\"type\":\"uint8\"}],\"name\":\"SetFeeProtocol\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"amount0\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"int256\",\"name\":\"amount1\",\"type\":\"int256\"},{\"indexed\":false,\"internalType\":\"uint160\",\"name\":\"sqrtPriceX96\",\"type\":\"uint160\"},{\"indexed\":false,\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"indexed\":false,\"internalType\":\"int24\",\"name\":\"tick\",\"type\":\"int24\"}],\"name\":\"Swap\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"int24\",\"name\":\"tickLower\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"tickUpper\",\"type\":\"int24\"},{\"internalType\":\"uint128\",\"name\":\"amount\",\"type\":\"uint128\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int24\",\"name\":\"tickLower\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"tickUpper\",\"type\":\"int24\"},{\"internalType\":\"uint128\",\"name\":\"amount0Requested\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"amount1Requested\",\"type\":\"uint128\"}],\"name\":\"collect\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"amount0\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"amount1\",\"type\":\"uint128\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint128\",\"name\":\"amount0Requested\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"amount1Requested\",\"type\":\"uint128\"}],\"name\":\"collectProtocol\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"amount0\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"amount1\",\"type\":\"uint128\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fee\",\"outputs\":[{\"internalType\":\"uint24\",\"name\":\"\",\"type\":\"uint24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeGrowthGlobal0X128\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"feeGrowthGlobal1X128\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"flash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint16\",\"name\":\"observationCardinalityNext\",\"type\":\"uint16\"}],\"name\":\"increaseObservationCardinalityNext\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint160\",\"name\":\"sqrtPriceX96\",\"type\":\"uint160\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"liquidity\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxLiquidityPerTick\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"int24\",\"name\":\"tickLower\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"tickUpper\",\"type\":\"int24\"},{\"internalType\":\"uint128\",\"name\":\"amount\",\"type\":\"uint128\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"mint\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amount0\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"amount1\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"observations\",\"outputs\":[{\"internalType\":\"uint32\",\"name\":\"blockTimestamp\",\"type\":\"uint32\"},{\"internalType\":\"int56\",\"name\":\"tickCumulative\",\"type\":\"int56\"},{\"internalType\":\"uint160\",\"name\":\"secondsPerLiquidityCumulativeX128\",\"type\":\"uint160\"},{\"internalType\":\"bool\",\"name\":\"initialized\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint32[]\",\"name\":\"secondsAgos\",\"type\":\"uint32[]\"}],\"name\":\"observe\",\"outputs\":[{\"internalType\":\"int56[]\",\"name\":\"tickCumulatives\",\"type\":\"int56[]\"},{\"internalType\":\"uint160[]\",\"name\":\"secondsPerLiquidityCumulativeX128s\",\"type\":\"uint160[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"positions\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidity\",\"type\":\"uint128\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside0LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthInside1LastX128\",\"type\":\"uint256\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed0\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"tokensOwed1\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"protocolFees\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"token0\",\"type\":\"uint128\"},{\"internalType\":\"uint128\",\"name\":\"token1\",\"type\":\"uint128\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint8\",\"name\":\"feeProtocol0\",\"type\":\"uint8\"},{\"internalType\":\"uint8\",\"name\":\"feeProtocol1\",\"type\":\"uint8\"}],\"name\":\"setFeeProtocol\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"slot0\",\"outputs\":[{\"internalType\":\"uint160\",\"name\":\"sqrtPriceX96\",\"type\":\"uint160\"},{\"internalType\":\"int24\",\"name\":\"tick\",\"type\":\"int24\"},{\"internalType\":\"uint16\",\"name\":\"observationIndex\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"observationCardinality\",\"type\":\"uint16\"},{\"internalType\":\"uint16\",\"name\":\"observationCardinalityNext\",\"type\":\"uint16\"},{\"internalType\":\"uint8\",\"name\":\"feeProtocol\",\"type\":\"uint8\"},{\"internalType\":\"bool\",\"name\":\"unlocked\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int24\",\"name\":\"tickLower\",\"type\":\"int24\"},{\"internalType\":\"int24\",\"name\":\"tickUpper\",\"type\":\"int24\"}],\"name\":\"snapshotCumulativesInside\",\"outputs\":[{\"internalType\":\"int56\",\"name\":\"tickCumulativeInside\",\"type\":\"int56\"},{\"internalType\":\"uint160\",\"name\":\"secondsPerLiquidityInsideX128\",\"type\":\"uint160\"},{\"internalType\":\"uint32\",\"name\":\"secondsInside\",\"type\":\"uint32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"zeroForOne\",\"type\":\"bool\"},{\"internalType\":\"int256\",\"name\":\"amountSpecified\",\"type\":\"int256\"},{\"internalType\":\"uint160\",\"name\":\"sqrtPriceLimitX96\",\"type\":\"uint160\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"swap\",\"outputs\":[{\"internalType\":\"int256\",\"name\":\"amount0\",\"type\":\"int256\"},{\"internalType\":\"int256\",\"name\":\"amount1\",\"type\":\"int256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int16\",\"name\":\"\",\"type\":\"int16\"}],\"name\":\"tickBitmap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"tickSpacing\",\"outputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"int24\",\"name\":\"\",\"type\":\"int24\"}],\"name\":\"ticks\",\"outputs\":[{\"internalType\":\"uint128\",\"name\":\"liquidityGross\",\"type\":\"uint128\"},{\"internalType\":\"int128\",\"name\":\"liquidityNet\",\"type\":\"int128\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthOutside0X128\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"feeGrowthOutside1X128\",\"type\":\"uint256\"},{\"internalType\":\"int56\",\"name\":\"tickCumulativeOutside\",\"type\":\"int56\"},{\"internalType\":\"uint160\",\"name\":\"secondsPerLiquidityOutsideX128\",\"type\":\"uint160\"},{\"internalType\":\"uint32\",\"name\":\"secondsOutside\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"initialized\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token0\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"token1\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}]", -} - -// UniswapABI is the input ABI used to generate the binding from. -// Deprecated: Use UniswapMetaData.ABI instead. -var UniswapABI = UniswapMetaData.ABI - -// Uniswap is an auto generated Go binding around an Ethereum contract. -type Uniswap struct { - UniswapCaller // Read-only binding to the contract - UniswapTransactor // Write-only binding to the contract - UniswapFilterer // Log filterer for contract events -} - -// UniswapCaller is an auto generated read-only Go binding around an Ethereum contract. -type UniswapCaller struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// UniswapTransactor is an auto generated write-only Go binding around an Ethereum contract. -type UniswapTransactor struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// UniswapFilterer is an auto generated log filtering Go binding around an Ethereum contract events. -type UniswapFilterer struct { - contract *bind.BoundContract // Generic contract wrapper for the low level calls -} - -// UniswapSession is an auto generated Go binding around an Ethereum contract, -// with pre-set call and transact options. -type UniswapSession struct { - Contract *Uniswap // 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 -} - -// UniswapCallerSession is an auto generated read-only Go binding around an Ethereum contract, -// with pre-set call options. -type UniswapCallerSession struct { - Contract *UniswapCaller // Generic contract caller binding to set the session for - CallOpts bind.CallOpts // Call options to use throughout this session -} - -// UniswapTransactorSession is an auto generated write-only Go binding around an Ethereum contract, -// with pre-set transact options. -type UniswapTransactorSession struct { - Contract *UniswapTransactor // Generic contract transactor binding to set the session for - TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session -} - -// UniswapRaw is an auto generated low-level Go binding around an Ethereum contract. -type UniswapRaw struct { - Contract *Uniswap // Generic contract binding to access the raw methods on -} - -// UniswapCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. -type UniswapCallerRaw struct { - Contract *UniswapCaller // Generic read-only contract binding to access the raw methods on -} - -// UniswapTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. -type UniswapTransactorRaw struct { - Contract *UniswapTransactor // Generic write-only contract binding to access the raw methods on -} - -// NewUniswap creates a new instance of Uniswap, bound to a specific deployed contract. -func NewUniswap(address common.Address, backend bind.ContractBackend) (*Uniswap, error) { - contract, err := bindUniswap(address, backend, backend, backend) - if err != nil { - return nil, err - } - return &Uniswap{UniswapCaller: UniswapCaller{contract: contract}, UniswapTransactor: UniswapTransactor{contract: contract}, UniswapFilterer: UniswapFilterer{contract: contract}}, nil -} - -// NewUniswapCaller creates a new read-only instance of Uniswap, bound to a specific deployed contract. -func NewUniswapCaller(address common.Address, caller bind.ContractCaller) (*UniswapCaller, error) { - contract, err := bindUniswap(address, caller, nil, nil) - if err != nil { - return nil, err - } - return &UniswapCaller{contract: contract}, nil -} - -// NewUniswapTransactor creates a new write-only instance of Uniswap, bound to a specific deployed contract. -func NewUniswapTransactor(address common.Address, transactor bind.ContractTransactor) (*UniswapTransactor, error) { - contract, err := bindUniswap(address, nil, transactor, nil) - if err != nil { - return nil, err - } - return &UniswapTransactor{contract: contract}, nil -} - -// NewUniswapFilterer creates a new log filterer instance of Uniswap, bound to a specific deployed contract. -func NewUniswapFilterer(address common.Address, filterer bind.ContractFilterer) (*UniswapFilterer, error) { - contract, err := bindUniswap(address, nil, nil, filterer) - if err != nil { - return nil, err - } - return &UniswapFilterer{contract: contract}, nil -} - -// bindUniswap binds a generic wrapper to an already deployed contract. -func bindUniswap(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { - parsed, err := abi.JSON(strings.NewReader(UniswapABI)) - if err != nil { - return nil, err - } - return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil -} - -// Call invokes the (constant) contract method with params as input values and -// sets the output to result. The result type might be a single field for simple -// returns, a slice of interfaces for anonymous returns and a struct for named -// returns. -func (_Uniswap *UniswapRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Uniswap.Contract.UniswapCaller.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 (_Uniswap *UniswapRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Uniswap.Contract.UniswapTransactor.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Uniswap *UniswapRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Uniswap.Contract.UniswapTransactor.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 (_Uniswap *UniswapCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error { - return _Uniswap.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 (_Uniswap *UniswapTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { - return _Uniswap.Contract.contract.Transfer(opts) -} - -// Transact invokes the (paid) contract method with params as input values. -func (_Uniswap *UniswapTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { - return _Uniswap.Contract.contract.Transact(opts, method, params...) -} - -// Factory is a free data retrieval call binding the contract method 0xc45a0155. -// -// Solidity: function factory() view returns(address) -func (_Uniswap *UniswapCaller) Factory(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "factory") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Factory is a free data retrieval call binding the contract method 0xc45a0155. -// -// Solidity: function factory() view returns(address) -func (_Uniswap *UniswapSession) Factory() (common.Address, error) { - return _Uniswap.Contract.Factory(&_Uniswap.CallOpts) -} - -// Factory is a free data retrieval call binding the contract method 0xc45a0155. -// -// Solidity: function factory() view returns(address) -func (_Uniswap *UniswapCallerSession) Factory() (common.Address, error) { - return _Uniswap.Contract.Factory(&_Uniswap.CallOpts) -} - -// Fee is a free data retrieval call binding the contract method 0xddca3f43. -// -// Solidity: function fee() view returns(uint24) -func (_Uniswap *UniswapCaller) Fee(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "fee") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// Fee is a free data retrieval call binding the contract method 0xddca3f43. -// -// Solidity: function fee() view returns(uint24) -func (_Uniswap *UniswapSession) Fee() (*big.Int, error) { - return _Uniswap.Contract.Fee(&_Uniswap.CallOpts) -} - -// Fee is a free data retrieval call binding the contract method 0xddca3f43. -// -// Solidity: function fee() view returns(uint24) -func (_Uniswap *UniswapCallerSession) Fee() (*big.Int, error) { - return _Uniswap.Contract.Fee(&_Uniswap.CallOpts) -} - -// FeeGrowthGlobal0X128 is a free data retrieval call binding the contract method 0xf3058399. -// -// Solidity: function feeGrowthGlobal0X128() view returns(uint256) -func (_Uniswap *UniswapCaller) FeeGrowthGlobal0X128(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "feeGrowthGlobal0X128") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// FeeGrowthGlobal0X128 is a free data retrieval call binding the contract method 0xf3058399. -// -// Solidity: function feeGrowthGlobal0X128() view returns(uint256) -func (_Uniswap *UniswapSession) FeeGrowthGlobal0X128() (*big.Int, error) { - return _Uniswap.Contract.FeeGrowthGlobal0X128(&_Uniswap.CallOpts) -} - -// FeeGrowthGlobal0X128 is a free data retrieval call binding the contract method 0xf3058399. -// -// Solidity: function feeGrowthGlobal0X128() view returns(uint256) -func (_Uniswap *UniswapCallerSession) FeeGrowthGlobal0X128() (*big.Int, error) { - return _Uniswap.Contract.FeeGrowthGlobal0X128(&_Uniswap.CallOpts) -} - -// FeeGrowthGlobal1X128 is a free data retrieval call binding the contract method 0x46141319. -// -// Solidity: function feeGrowthGlobal1X128() view returns(uint256) -func (_Uniswap *UniswapCaller) FeeGrowthGlobal1X128(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "feeGrowthGlobal1X128") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// FeeGrowthGlobal1X128 is a free data retrieval call binding the contract method 0x46141319. -// -// Solidity: function feeGrowthGlobal1X128() view returns(uint256) -func (_Uniswap *UniswapSession) FeeGrowthGlobal1X128() (*big.Int, error) { - return _Uniswap.Contract.FeeGrowthGlobal1X128(&_Uniswap.CallOpts) -} - -// FeeGrowthGlobal1X128 is a free data retrieval call binding the contract method 0x46141319. -// -// Solidity: function feeGrowthGlobal1X128() view returns(uint256) -func (_Uniswap *UniswapCallerSession) FeeGrowthGlobal1X128() (*big.Int, error) { - return _Uniswap.Contract.FeeGrowthGlobal1X128(&_Uniswap.CallOpts) -} - -// Liquidity is a free data retrieval call binding the contract method 0x1a686502. -// -// Solidity: function liquidity() view returns(uint128) -func (_Uniswap *UniswapCaller) Liquidity(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "liquidity") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// Liquidity is a free data retrieval call binding the contract method 0x1a686502. -// -// Solidity: function liquidity() view returns(uint128) -func (_Uniswap *UniswapSession) Liquidity() (*big.Int, error) { - return _Uniswap.Contract.Liquidity(&_Uniswap.CallOpts) -} - -// Liquidity is a free data retrieval call binding the contract method 0x1a686502. -// -// Solidity: function liquidity() view returns(uint128) -func (_Uniswap *UniswapCallerSession) Liquidity() (*big.Int, error) { - return _Uniswap.Contract.Liquidity(&_Uniswap.CallOpts) -} - -// MaxLiquidityPerTick is a free data retrieval call binding the contract method 0x70cf754a. -// -// Solidity: function maxLiquidityPerTick() view returns(uint128) -func (_Uniswap *UniswapCaller) MaxLiquidityPerTick(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "maxLiquidityPerTick") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// MaxLiquidityPerTick is a free data retrieval call binding the contract method 0x70cf754a. -// -// Solidity: function maxLiquidityPerTick() view returns(uint128) -func (_Uniswap *UniswapSession) MaxLiquidityPerTick() (*big.Int, error) { - return _Uniswap.Contract.MaxLiquidityPerTick(&_Uniswap.CallOpts) -} - -// MaxLiquidityPerTick is a free data retrieval call binding the contract method 0x70cf754a. -// -// Solidity: function maxLiquidityPerTick() view returns(uint128) -func (_Uniswap *UniswapCallerSession) MaxLiquidityPerTick() (*big.Int, error) { - return _Uniswap.Contract.MaxLiquidityPerTick(&_Uniswap.CallOpts) -} - -// Observations is a free data retrieval call binding the contract method 0x252c09d7. -// -// Solidity: function observations(uint256 ) view returns(uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized) -func (_Uniswap *UniswapCaller) Observations(opts *bind.CallOpts, arg0 *big.Int) (struct { - BlockTimestamp uint32 - TickCumulative *big.Int - SecondsPerLiquidityCumulativeX128 *big.Int - Initialized bool -}, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "observations", arg0) - - outstruct := new(struct { - BlockTimestamp uint32 - TickCumulative *big.Int - SecondsPerLiquidityCumulativeX128 *big.Int - Initialized bool - }) - if err != nil { - return *outstruct, err - } - - outstruct.BlockTimestamp = *abi.ConvertType(out[0], new(uint32)).(*uint32) - outstruct.TickCumulative = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.SecondsPerLiquidityCumulativeX128 = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.Initialized = *abi.ConvertType(out[3], new(bool)).(*bool) - - return *outstruct, err - -} - -// Observations is a free data retrieval call binding the contract method 0x252c09d7. -// -// Solidity: function observations(uint256 ) view returns(uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized) -func (_Uniswap *UniswapSession) Observations(arg0 *big.Int) (struct { - BlockTimestamp uint32 - TickCumulative *big.Int - SecondsPerLiquidityCumulativeX128 *big.Int - Initialized bool -}, error) { - return _Uniswap.Contract.Observations(&_Uniswap.CallOpts, arg0) -} - -// Observations is a free data retrieval call binding the contract method 0x252c09d7. -// -// Solidity: function observations(uint256 ) view returns(uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized) -func (_Uniswap *UniswapCallerSession) Observations(arg0 *big.Int) (struct { - BlockTimestamp uint32 - TickCumulative *big.Int - SecondsPerLiquidityCumulativeX128 *big.Int - Initialized bool -}, error) { - return _Uniswap.Contract.Observations(&_Uniswap.CallOpts, arg0) -} - -// Observe is a free data retrieval call binding the contract method 0x883bdbfd. -// -// Solidity: function observe(uint32[] secondsAgos) view returns(int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s) -func (_Uniswap *UniswapCaller) Observe(opts *bind.CallOpts, secondsAgos []uint32) (struct { - TickCumulatives []*big.Int - SecondsPerLiquidityCumulativeX128s []*big.Int -}, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "observe", secondsAgos) - - outstruct := new(struct { - TickCumulatives []*big.Int - SecondsPerLiquidityCumulativeX128s []*big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.TickCumulatives = *abi.ConvertType(out[0], new([]*big.Int)).(*[]*big.Int) - outstruct.SecondsPerLiquidityCumulativeX128s = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) - - return *outstruct, err - -} - -// Observe is a free data retrieval call binding the contract method 0x883bdbfd. -// -// Solidity: function observe(uint32[] secondsAgos) view returns(int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s) -func (_Uniswap *UniswapSession) Observe(secondsAgos []uint32) (struct { - TickCumulatives []*big.Int - SecondsPerLiquidityCumulativeX128s []*big.Int -}, error) { - return _Uniswap.Contract.Observe(&_Uniswap.CallOpts, secondsAgos) -} - -// Observe is a free data retrieval call binding the contract method 0x883bdbfd. -// -// Solidity: function observe(uint32[] secondsAgos) view returns(int56[] tickCumulatives, uint160[] secondsPerLiquidityCumulativeX128s) -func (_Uniswap *UniswapCallerSession) Observe(secondsAgos []uint32) (struct { - TickCumulatives []*big.Int - SecondsPerLiquidityCumulativeX128s []*big.Int -}, error) { - return _Uniswap.Contract.Observe(&_Uniswap.CallOpts, secondsAgos) -} - -// Positions is a free data retrieval call binding the contract method 0x514ea4bf. -// -// Solidity: function positions(bytes32 ) view returns(uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1) -func (_Uniswap *UniswapCaller) Positions(opts *bind.CallOpts, arg0 [32]byte) (struct { - Liquidity *big.Int - FeeGrowthInside0LastX128 *big.Int - FeeGrowthInside1LastX128 *big.Int - TokensOwed0 *big.Int - TokensOwed1 *big.Int -}, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "positions", arg0) - - outstruct := new(struct { - Liquidity *big.Int - FeeGrowthInside0LastX128 *big.Int - FeeGrowthInside1LastX128 *big.Int - TokensOwed0 *big.Int - TokensOwed1 *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Liquidity = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.FeeGrowthInside0LastX128 = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.FeeGrowthInside1LastX128 = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.TokensOwed0 = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) - outstruct.TokensOwed1 = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// Positions is a free data retrieval call binding the contract method 0x514ea4bf. -// -// Solidity: function positions(bytes32 ) view returns(uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1) -func (_Uniswap *UniswapSession) Positions(arg0 [32]byte) (struct { - Liquidity *big.Int - FeeGrowthInside0LastX128 *big.Int - FeeGrowthInside1LastX128 *big.Int - TokensOwed0 *big.Int - TokensOwed1 *big.Int -}, error) { - return _Uniswap.Contract.Positions(&_Uniswap.CallOpts, arg0) -} - -// Positions is a free data retrieval call binding the contract method 0x514ea4bf. -// -// Solidity: function positions(bytes32 ) view returns(uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1) -func (_Uniswap *UniswapCallerSession) Positions(arg0 [32]byte) (struct { - Liquidity *big.Int - FeeGrowthInside0LastX128 *big.Int - FeeGrowthInside1LastX128 *big.Int - TokensOwed0 *big.Int - TokensOwed1 *big.Int -}, error) { - return _Uniswap.Contract.Positions(&_Uniswap.CallOpts, arg0) -} - -// ProtocolFees is a free data retrieval call binding the contract method 0x1ad8b03b. -// -// Solidity: function protocolFees() view returns(uint128 token0, uint128 token1) -func (_Uniswap *UniswapCaller) ProtocolFees(opts *bind.CallOpts) (struct { - Token0 *big.Int - Token1 *big.Int -}, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "protocolFees") - - outstruct := new(struct { - Token0 *big.Int - Token1 *big.Int - }) - if err != nil { - return *outstruct, err - } - - outstruct.Token0 = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.Token1 = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - - return *outstruct, err - -} - -// ProtocolFees is a free data retrieval call binding the contract method 0x1ad8b03b. -// -// Solidity: function protocolFees() view returns(uint128 token0, uint128 token1) -func (_Uniswap *UniswapSession) ProtocolFees() (struct { - Token0 *big.Int - Token1 *big.Int -}, error) { - return _Uniswap.Contract.ProtocolFees(&_Uniswap.CallOpts) -} - -// ProtocolFees is a free data retrieval call binding the contract method 0x1ad8b03b. -// -// Solidity: function protocolFees() view returns(uint128 token0, uint128 token1) -func (_Uniswap *UniswapCallerSession) ProtocolFees() (struct { - Token0 *big.Int - Token1 *big.Int -}, error) { - return _Uniswap.Contract.ProtocolFees(&_Uniswap.CallOpts) -} - -// Slot0 is a free data retrieval call binding the contract method 0x3850c7bd. -// -// Solidity: function slot0() view returns(uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked) -func (_Uniswap *UniswapCaller) Slot0(opts *bind.CallOpts) (struct { - SqrtPriceX96 *big.Int - Tick *big.Int - ObservationIndex uint16 - ObservationCardinality uint16 - ObservationCardinalityNext uint16 - FeeProtocol uint8 - Unlocked bool -}, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "slot0") - - outstruct := new(struct { - SqrtPriceX96 *big.Int - Tick *big.Int - ObservationIndex uint16 - ObservationCardinality uint16 - ObservationCardinalityNext uint16 - FeeProtocol uint8 - Unlocked bool - }) - if err != nil { - return *outstruct, err - } - - outstruct.SqrtPriceX96 = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.Tick = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.ObservationIndex = *abi.ConvertType(out[2], new(uint16)).(*uint16) - outstruct.ObservationCardinality = *abi.ConvertType(out[3], new(uint16)).(*uint16) - outstruct.ObservationCardinalityNext = *abi.ConvertType(out[4], new(uint16)).(*uint16) - outstruct.FeeProtocol = *abi.ConvertType(out[5], new(uint8)).(*uint8) - outstruct.Unlocked = *abi.ConvertType(out[6], new(bool)).(*bool) - - return *outstruct, err - -} - -// Slot0 is a free data retrieval call binding the contract method 0x3850c7bd. -// -// Solidity: function slot0() view returns(uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked) -func (_Uniswap *UniswapSession) Slot0() (struct { - SqrtPriceX96 *big.Int - Tick *big.Int - ObservationIndex uint16 - ObservationCardinality uint16 - ObservationCardinalityNext uint16 - FeeProtocol uint8 - Unlocked bool -}, error) { - return _Uniswap.Contract.Slot0(&_Uniswap.CallOpts) -} - -// Slot0 is a free data retrieval call binding the contract method 0x3850c7bd. -// -// Solidity: function slot0() view returns(uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked) -func (_Uniswap *UniswapCallerSession) Slot0() (struct { - SqrtPriceX96 *big.Int - Tick *big.Int - ObservationIndex uint16 - ObservationCardinality uint16 - ObservationCardinalityNext uint16 - FeeProtocol uint8 - Unlocked bool -}, error) { - return _Uniswap.Contract.Slot0(&_Uniswap.CallOpts) -} - -// SnapshotCumulativesInside is a free data retrieval call binding the contract method 0xa38807f2. -// -// Solidity: function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) view returns(int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside) -func (_Uniswap *UniswapCaller) SnapshotCumulativesInside(opts *bind.CallOpts, tickLower *big.Int, tickUpper *big.Int) (struct { - TickCumulativeInside *big.Int - SecondsPerLiquidityInsideX128 *big.Int - SecondsInside uint32 -}, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "snapshotCumulativesInside", tickLower, tickUpper) - - outstruct := new(struct { - TickCumulativeInside *big.Int - SecondsPerLiquidityInsideX128 *big.Int - SecondsInside uint32 - }) - if err != nil { - return *outstruct, err - } - - outstruct.TickCumulativeInside = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.SecondsPerLiquidityInsideX128 = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.SecondsInside = *abi.ConvertType(out[2], new(uint32)).(*uint32) - - return *outstruct, err - -} - -// SnapshotCumulativesInside is a free data retrieval call binding the contract method 0xa38807f2. -// -// Solidity: function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) view returns(int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside) -func (_Uniswap *UniswapSession) SnapshotCumulativesInside(tickLower *big.Int, tickUpper *big.Int) (struct { - TickCumulativeInside *big.Int - SecondsPerLiquidityInsideX128 *big.Int - SecondsInside uint32 -}, error) { - return _Uniswap.Contract.SnapshotCumulativesInside(&_Uniswap.CallOpts, tickLower, tickUpper) -} - -// SnapshotCumulativesInside is a free data retrieval call binding the contract method 0xa38807f2. -// -// Solidity: function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) view returns(int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside) -func (_Uniswap *UniswapCallerSession) SnapshotCumulativesInside(tickLower *big.Int, tickUpper *big.Int) (struct { - TickCumulativeInside *big.Int - SecondsPerLiquidityInsideX128 *big.Int - SecondsInside uint32 -}, error) { - return _Uniswap.Contract.SnapshotCumulativesInside(&_Uniswap.CallOpts, tickLower, tickUpper) -} - -// TickBitmap is a free data retrieval call binding the contract method 0x5339c296. -// -// Solidity: function tickBitmap(int16 ) view returns(uint256) -func (_Uniswap *UniswapCaller) TickBitmap(opts *bind.CallOpts, arg0 int16) (*big.Int, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "tickBitmap", arg0) - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// TickBitmap is a free data retrieval call binding the contract method 0x5339c296. -// -// Solidity: function tickBitmap(int16 ) view returns(uint256) -func (_Uniswap *UniswapSession) TickBitmap(arg0 int16) (*big.Int, error) { - return _Uniswap.Contract.TickBitmap(&_Uniswap.CallOpts, arg0) -} - -// TickBitmap is a free data retrieval call binding the contract method 0x5339c296. -// -// Solidity: function tickBitmap(int16 ) view returns(uint256) -func (_Uniswap *UniswapCallerSession) TickBitmap(arg0 int16) (*big.Int, error) { - return _Uniswap.Contract.TickBitmap(&_Uniswap.CallOpts, arg0) -} - -// TickSpacing is a free data retrieval call binding the contract method 0xd0c93a7c. -// -// Solidity: function tickSpacing() view returns(int24) -func (_Uniswap *UniswapCaller) TickSpacing(opts *bind.CallOpts) (*big.Int, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "tickSpacing") - - if err != nil { - return *new(*big.Int), err - } - - out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - - return out0, err - -} - -// TickSpacing is a free data retrieval call binding the contract method 0xd0c93a7c. -// -// Solidity: function tickSpacing() view returns(int24) -func (_Uniswap *UniswapSession) TickSpacing() (*big.Int, error) { - return _Uniswap.Contract.TickSpacing(&_Uniswap.CallOpts) -} - -// TickSpacing is a free data retrieval call binding the contract method 0xd0c93a7c. -// -// Solidity: function tickSpacing() view returns(int24) -func (_Uniswap *UniswapCallerSession) TickSpacing() (*big.Int, error) { - return _Uniswap.Contract.TickSpacing(&_Uniswap.CallOpts) -} - -// Ticks is a free data retrieval call binding the contract method 0xf30dba93. -// -// Solidity: function ticks(int24 ) view returns(uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized) -func (_Uniswap *UniswapCaller) Ticks(opts *bind.CallOpts, arg0 *big.Int) (struct { - LiquidityGross *big.Int - LiquidityNet *big.Int - FeeGrowthOutside0X128 *big.Int - FeeGrowthOutside1X128 *big.Int - TickCumulativeOutside *big.Int - SecondsPerLiquidityOutsideX128 *big.Int - SecondsOutside uint32 - Initialized bool -}, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "ticks", arg0) - - outstruct := new(struct { - LiquidityGross *big.Int - LiquidityNet *big.Int - FeeGrowthOutside0X128 *big.Int - FeeGrowthOutside1X128 *big.Int - TickCumulativeOutside *big.Int - SecondsPerLiquidityOutsideX128 *big.Int - SecondsOutside uint32 - Initialized bool - }) - if err != nil { - return *outstruct, err - } - - outstruct.LiquidityGross = *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) - outstruct.LiquidityNet = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.FeeGrowthOutside0X128 = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) - outstruct.FeeGrowthOutside1X128 = *abi.ConvertType(out[3], new(*big.Int)).(**big.Int) - outstruct.TickCumulativeOutside = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) - outstruct.SecondsPerLiquidityOutsideX128 = *abi.ConvertType(out[5], new(*big.Int)).(**big.Int) - outstruct.SecondsOutside = *abi.ConvertType(out[6], new(uint32)).(*uint32) - outstruct.Initialized = *abi.ConvertType(out[7], new(bool)).(*bool) - - return *outstruct, err - -} - -// Ticks is a free data retrieval call binding the contract method 0xf30dba93. -// -// Solidity: function ticks(int24 ) view returns(uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized) -func (_Uniswap *UniswapSession) Ticks(arg0 *big.Int) (struct { - LiquidityGross *big.Int - LiquidityNet *big.Int - FeeGrowthOutside0X128 *big.Int - FeeGrowthOutside1X128 *big.Int - TickCumulativeOutside *big.Int - SecondsPerLiquidityOutsideX128 *big.Int - SecondsOutside uint32 - Initialized bool -}, error) { - return _Uniswap.Contract.Ticks(&_Uniswap.CallOpts, arg0) -} - -// Ticks is a free data retrieval call binding the contract method 0xf30dba93. -// -// Solidity: function ticks(int24 ) view returns(uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized) -func (_Uniswap *UniswapCallerSession) Ticks(arg0 *big.Int) (struct { - LiquidityGross *big.Int - LiquidityNet *big.Int - FeeGrowthOutside0X128 *big.Int - FeeGrowthOutside1X128 *big.Int - TickCumulativeOutside *big.Int - SecondsPerLiquidityOutsideX128 *big.Int - SecondsOutside uint32 - Initialized bool -}, error) { - return _Uniswap.Contract.Ticks(&_Uniswap.CallOpts, arg0) -} - -// Token0 is a free data retrieval call binding the contract method 0x0dfe1681. -// -// Solidity: function token0() view returns(address) -func (_Uniswap *UniswapCaller) Token0(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "token0") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token0 is a free data retrieval call binding the contract method 0x0dfe1681. -// -// Solidity: function token0() view returns(address) -func (_Uniswap *UniswapSession) Token0() (common.Address, error) { - return _Uniswap.Contract.Token0(&_Uniswap.CallOpts) -} - -// Token0 is a free data retrieval call binding the contract method 0x0dfe1681. -// -// Solidity: function token0() view returns(address) -func (_Uniswap *UniswapCallerSession) Token0() (common.Address, error) { - return _Uniswap.Contract.Token0(&_Uniswap.CallOpts) -} - -// Token1 is a free data retrieval call binding the contract method 0xd21220a7. -// -// Solidity: function token1() view returns(address) -func (_Uniswap *UniswapCaller) Token1(opts *bind.CallOpts) (common.Address, error) { - var out []interface{} - err := _Uniswap.contract.Call(opts, &out, "token1") - - if err != nil { - return *new(common.Address), err - } - - out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) - - return out0, err - -} - -// Token1 is a free data retrieval call binding the contract method 0xd21220a7. -// -// Solidity: function token1() view returns(address) -func (_Uniswap *UniswapSession) Token1() (common.Address, error) { - return _Uniswap.Contract.Token1(&_Uniswap.CallOpts) -} - -// Token1 is a free data retrieval call binding the contract method 0xd21220a7. -// -// Solidity: function token1() view returns(address) -func (_Uniswap *UniswapCallerSession) Token1() (common.Address, error) { - return _Uniswap.Contract.Token1(&_Uniswap.CallOpts) -} - -// Burn is a paid mutator transaction binding the contract method 0xa34123a7. -// -// Solidity: function burn(int24 tickLower, int24 tickUpper, uint128 amount) returns(uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapTransactor) Burn(opts *bind.TransactOpts, tickLower *big.Int, tickUpper *big.Int, amount *big.Int) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "burn", tickLower, tickUpper, amount) -} - -// Burn is a paid mutator transaction binding the contract method 0xa34123a7. -// -// Solidity: function burn(int24 tickLower, int24 tickUpper, uint128 amount) returns(uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapSession) Burn(tickLower *big.Int, tickUpper *big.Int, amount *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.Burn(&_Uniswap.TransactOpts, tickLower, tickUpper, amount) -} - -// Burn is a paid mutator transaction binding the contract method 0xa34123a7. -// -// Solidity: function burn(int24 tickLower, int24 tickUpper, uint128 amount) returns(uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapTransactorSession) Burn(tickLower *big.Int, tickUpper *big.Int, amount *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.Burn(&_Uniswap.TransactOpts, tickLower, tickUpper, amount) -} - -// Collect is a paid mutator transaction binding the contract method 0x4f1eb3d8. -// -// Solidity: function collect(address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested) returns(uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapTransactor) Collect(opts *bind.TransactOpts, recipient common.Address, tickLower *big.Int, tickUpper *big.Int, amount0Requested *big.Int, amount1Requested *big.Int) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "collect", recipient, tickLower, tickUpper, amount0Requested, amount1Requested) -} - -// Collect is a paid mutator transaction binding the contract method 0x4f1eb3d8. -// -// Solidity: function collect(address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested) returns(uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapSession) Collect(recipient common.Address, tickLower *big.Int, tickUpper *big.Int, amount0Requested *big.Int, amount1Requested *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.Collect(&_Uniswap.TransactOpts, recipient, tickLower, tickUpper, amount0Requested, amount1Requested) -} - -// Collect is a paid mutator transaction binding the contract method 0x4f1eb3d8. -// -// Solidity: function collect(address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested) returns(uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapTransactorSession) Collect(recipient common.Address, tickLower *big.Int, tickUpper *big.Int, amount0Requested *big.Int, amount1Requested *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.Collect(&_Uniswap.TransactOpts, recipient, tickLower, tickUpper, amount0Requested, amount1Requested) -} - -// CollectProtocol is a paid mutator transaction binding the contract method 0x85b66729. -// -// Solidity: function collectProtocol(address recipient, uint128 amount0Requested, uint128 amount1Requested) returns(uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapTransactor) CollectProtocol(opts *bind.TransactOpts, recipient common.Address, amount0Requested *big.Int, amount1Requested *big.Int) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "collectProtocol", recipient, amount0Requested, amount1Requested) -} - -// CollectProtocol is a paid mutator transaction binding the contract method 0x85b66729. -// -// Solidity: function collectProtocol(address recipient, uint128 amount0Requested, uint128 amount1Requested) returns(uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapSession) CollectProtocol(recipient common.Address, amount0Requested *big.Int, amount1Requested *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.CollectProtocol(&_Uniswap.TransactOpts, recipient, amount0Requested, amount1Requested) -} - -// CollectProtocol is a paid mutator transaction binding the contract method 0x85b66729. -// -// Solidity: function collectProtocol(address recipient, uint128 amount0Requested, uint128 amount1Requested) returns(uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapTransactorSession) CollectProtocol(recipient common.Address, amount0Requested *big.Int, amount1Requested *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.CollectProtocol(&_Uniswap.TransactOpts, recipient, amount0Requested, amount1Requested) -} - -// Flash is a paid mutator transaction binding the contract method 0x490e6cbc. -// -// Solidity: function flash(address recipient, uint256 amount0, uint256 amount1, bytes data) returns() -func (_Uniswap *UniswapTransactor) Flash(opts *bind.TransactOpts, recipient common.Address, amount0 *big.Int, amount1 *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "flash", recipient, amount0, amount1, data) -} - -// Flash is a paid mutator transaction binding the contract method 0x490e6cbc. -// -// Solidity: function flash(address recipient, uint256 amount0, uint256 amount1, bytes data) returns() -func (_Uniswap *UniswapSession) Flash(recipient common.Address, amount0 *big.Int, amount1 *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.Contract.Flash(&_Uniswap.TransactOpts, recipient, amount0, amount1, data) -} - -// Flash is a paid mutator transaction binding the contract method 0x490e6cbc. -// -// Solidity: function flash(address recipient, uint256 amount0, uint256 amount1, bytes data) returns() -func (_Uniswap *UniswapTransactorSession) Flash(recipient common.Address, amount0 *big.Int, amount1 *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.Contract.Flash(&_Uniswap.TransactOpts, recipient, amount0, amount1, data) -} - -// IncreaseObservationCardinalityNext is a paid mutator transaction binding the contract method 0x32148f67. -// -// Solidity: function increaseObservationCardinalityNext(uint16 observationCardinalityNext) returns() -func (_Uniswap *UniswapTransactor) IncreaseObservationCardinalityNext(opts *bind.TransactOpts, observationCardinalityNext uint16) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "increaseObservationCardinalityNext", observationCardinalityNext) -} - -// IncreaseObservationCardinalityNext is a paid mutator transaction binding the contract method 0x32148f67. -// -// Solidity: function increaseObservationCardinalityNext(uint16 observationCardinalityNext) returns() -func (_Uniswap *UniswapSession) IncreaseObservationCardinalityNext(observationCardinalityNext uint16) (*types.Transaction, error) { - return _Uniswap.Contract.IncreaseObservationCardinalityNext(&_Uniswap.TransactOpts, observationCardinalityNext) -} - -// IncreaseObservationCardinalityNext is a paid mutator transaction binding the contract method 0x32148f67. -// -// Solidity: function increaseObservationCardinalityNext(uint16 observationCardinalityNext) returns() -func (_Uniswap *UniswapTransactorSession) IncreaseObservationCardinalityNext(observationCardinalityNext uint16) (*types.Transaction, error) { - return _Uniswap.Contract.IncreaseObservationCardinalityNext(&_Uniswap.TransactOpts, observationCardinalityNext) -} - -// Initialize is a paid mutator transaction binding the contract method 0xf637731d. -// -// Solidity: function initialize(uint160 sqrtPriceX96) returns() -func (_Uniswap *UniswapTransactor) Initialize(opts *bind.TransactOpts, sqrtPriceX96 *big.Int) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "initialize", sqrtPriceX96) -} - -// Initialize is a paid mutator transaction binding the contract method 0xf637731d. -// -// Solidity: function initialize(uint160 sqrtPriceX96) returns() -func (_Uniswap *UniswapSession) Initialize(sqrtPriceX96 *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.Initialize(&_Uniswap.TransactOpts, sqrtPriceX96) -} - -// Initialize is a paid mutator transaction binding the contract method 0xf637731d. -// -// Solidity: function initialize(uint160 sqrtPriceX96) returns() -func (_Uniswap *UniswapTransactorSession) Initialize(sqrtPriceX96 *big.Int) (*types.Transaction, error) { - return _Uniswap.Contract.Initialize(&_Uniswap.TransactOpts, sqrtPriceX96) -} - -// Mint is a paid mutator transaction binding the contract method 0x3c8a7d8d. -// -// Solidity: function mint(address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes data) returns(uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapTransactor) Mint(opts *bind.TransactOpts, recipient common.Address, tickLower *big.Int, tickUpper *big.Int, amount *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "mint", recipient, tickLower, tickUpper, amount, data) -} - -// Mint is a paid mutator transaction binding the contract method 0x3c8a7d8d. -// -// Solidity: function mint(address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes data) returns(uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapSession) Mint(recipient common.Address, tickLower *big.Int, tickUpper *big.Int, amount *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.Contract.Mint(&_Uniswap.TransactOpts, recipient, tickLower, tickUpper, amount, data) -} - -// Mint is a paid mutator transaction binding the contract method 0x3c8a7d8d. -// -// Solidity: function mint(address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes data) returns(uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapTransactorSession) Mint(recipient common.Address, tickLower *big.Int, tickUpper *big.Int, amount *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.Contract.Mint(&_Uniswap.TransactOpts, recipient, tickLower, tickUpper, amount, data) -} - -// SetFeeProtocol is a paid mutator transaction binding the contract method 0x8206a4d1. -// -// Solidity: function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) returns() -func (_Uniswap *UniswapTransactor) SetFeeProtocol(opts *bind.TransactOpts, feeProtocol0 uint8, feeProtocol1 uint8) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "setFeeProtocol", feeProtocol0, feeProtocol1) -} - -// SetFeeProtocol is a paid mutator transaction binding the contract method 0x8206a4d1. -// -// Solidity: function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) returns() -func (_Uniswap *UniswapSession) SetFeeProtocol(feeProtocol0 uint8, feeProtocol1 uint8) (*types.Transaction, error) { - return _Uniswap.Contract.SetFeeProtocol(&_Uniswap.TransactOpts, feeProtocol0, feeProtocol1) -} - -// SetFeeProtocol is a paid mutator transaction binding the contract method 0x8206a4d1. -// -// Solidity: function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) returns() -func (_Uniswap *UniswapTransactorSession) SetFeeProtocol(feeProtocol0 uint8, feeProtocol1 uint8) (*types.Transaction, error) { - return _Uniswap.Contract.SetFeeProtocol(&_Uniswap.TransactOpts, feeProtocol0, feeProtocol1) -} - -// Swap is a paid mutator transaction binding the contract method 0x128acb08. -// -// Solidity: function swap(address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes data) returns(int256 amount0, int256 amount1) -func (_Uniswap *UniswapTransactor) Swap(opts *bind.TransactOpts, recipient common.Address, zeroForOne bool, amountSpecified *big.Int, sqrtPriceLimitX96 *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.contract.Transact(opts, "swap", recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data) -} - -// Swap is a paid mutator transaction binding the contract method 0x128acb08. -// -// Solidity: function swap(address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes data) returns(int256 amount0, int256 amount1) -func (_Uniswap *UniswapSession) Swap(recipient common.Address, zeroForOne bool, amountSpecified *big.Int, sqrtPriceLimitX96 *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.Contract.Swap(&_Uniswap.TransactOpts, recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data) -} - -// Swap is a paid mutator transaction binding the contract method 0x128acb08. -// -// Solidity: function swap(address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes data) returns(int256 amount0, int256 amount1) -func (_Uniswap *UniswapTransactorSession) Swap(recipient common.Address, zeroForOne bool, amountSpecified *big.Int, sqrtPriceLimitX96 *big.Int, data []byte) (*types.Transaction, error) { - return _Uniswap.Contract.Swap(&_Uniswap.TransactOpts, recipient, zeroForOne, amountSpecified, sqrtPriceLimitX96, data) -} - -// UniswapBurnIterator is returned from FilterBurn and is used to iterate over the raw logs and unpacked data for Burn events raised by the Uniswap contract. -type UniswapBurnIterator struct { - Event *UniswapBurn // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapBurnIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapBurn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapBurn) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapBurnIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapBurnIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapBurn represents a Burn event raised by the Uniswap contract. -type UniswapBurn struct { - Owner common.Address - TickLower *big.Int - TickUpper *big.Int - Amount *big.Int - Amount0 *big.Int - Amount1 *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterBurn is a free log retrieval operation binding the contract event 0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c. -// -// Solidity: event Burn(address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapFilterer) FilterBurn(opts *bind.FilterOpts, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (*UniswapBurnIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var tickLowerRule []interface{} - for _, tickLowerItem := range tickLower { - tickLowerRule = append(tickLowerRule, tickLowerItem) - } - var tickUpperRule []interface{} - for _, tickUpperItem := range tickUpper { - tickUpperRule = append(tickUpperRule, tickUpperItem) - } - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "Burn", ownerRule, tickLowerRule, tickUpperRule) - if err != nil { - return nil, err - } - return &UniswapBurnIterator{contract: _Uniswap.contract, event: "Burn", logs: logs, sub: sub}, nil -} - -// WatchBurn is a free log subscription operation binding the contract event 0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c. -// -// Solidity: event Burn(address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapFilterer) WatchBurn(opts *bind.WatchOpts, sink chan<- *UniswapBurn, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var tickLowerRule []interface{} - for _, tickLowerItem := range tickLower { - tickLowerRule = append(tickLowerRule, tickLowerItem) - } - var tickUpperRule []interface{} - for _, tickUpperItem := range tickUpper { - tickUpperRule = append(tickUpperRule, tickUpperItem) - } - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "Burn", ownerRule, tickLowerRule, tickUpperRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapBurn) - if err := _Uniswap.contract.UnpackLog(event, "Burn", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseBurn is a log parse operation binding the contract event 0x0c396cd989a39f4459b5fa1aed6a9a8dcdbc45908acfd67e028cd568da98982c. -// -// Solidity: event Burn(address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapFilterer) ParseBurn(log types.Log) (*UniswapBurn, error) { - event := new(UniswapBurn) - if err := _Uniswap.contract.UnpackLog(event, "Burn", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapCollectIterator is returned from FilterCollect and is used to iterate over the raw logs and unpacked data for Collect events raised by the Uniswap contract. -type UniswapCollectIterator struct { - Event *UniswapCollect // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapCollectIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapCollect) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapCollect) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapCollectIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapCollectIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapCollect represents a Collect event raised by the Uniswap contract. -type UniswapCollect struct { - Owner common.Address - Recipient common.Address - TickLower *big.Int - TickUpper *big.Int - Amount0 *big.Int - Amount1 *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterCollect is a free log retrieval operation binding the contract event 0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0. -// -// Solidity: event Collect(address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapFilterer) FilterCollect(opts *bind.FilterOpts, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (*UniswapCollectIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - - var tickLowerRule []interface{} - for _, tickLowerItem := range tickLower { - tickLowerRule = append(tickLowerRule, tickLowerItem) - } - var tickUpperRule []interface{} - for _, tickUpperItem := range tickUpper { - tickUpperRule = append(tickUpperRule, tickUpperItem) - } - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "Collect", ownerRule, tickLowerRule, tickUpperRule) - if err != nil { - return nil, err - } - return &UniswapCollectIterator{contract: _Uniswap.contract, event: "Collect", logs: logs, sub: sub}, nil -} - -// WatchCollect is a free log subscription operation binding the contract event 0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0. -// -// Solidity: event Collect(address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapFilterer) WatchCollect(opts *bind.WatchOpts, sink chan<- *UniswapCollect, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - - var tickLowerRule []interface{} - for _, tickLowerItem := range tickLower { - tickLowerRule = append(tickLowerRule, tickLowerItem) - } - var tickUpperRule []interface{} - for _, tickUpperItem := range tickUpper { - tickUpperRule = append(tickUpperRule, tickUpperItem) - } - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "Collect", ownerRule, tickLowerRule, tickUpperRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapCollect) - if err := _Uniswap.contract.UnpackLog(event, "Collect", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseCollect is a log parse operation binding the contract event 0x70935338e69775456a85ddef226c395fb668b63fa0115f5f20610b388e6ca9c0. -// -// Solidity: event Collect(address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapFilterer) ParseCollect(log types.Log) (*UniswapCollect, error) { - event := new(UniswapCollect) - if err := _Uniswap.contract.UnpackLog(event, "Collect", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapCollectProtocolIterator is returned from FilterCollectProtocol and is used to iterate over the raw logs and unpacked data for CollectProtocol events raised by the Uniswap contract. -type UniswapCollectProtocolIterator struct { - Event *UniswapCollectProtocol // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapCollectProtocolIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapCollectProtocol) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapCollectProtocol) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapCollectProtocolIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapCollectProtocolIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapCollectProtocol represents a CollectProtocol event raised by the Uniswap contract. -type UniswapCollectProtocol struct { - Sender common.Address - Recipient common.Address - Amount0 *big.Int - Amount1 *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterCollectProtocol is a free log retrieval operation binding the contract event 0x596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151. -// -// Solidity: event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapFilterer) FilterCollectProtocol(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*UniswapCollectProtocolIterator, error) { - - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) - } - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "CollectProtocol", senderRule, recipientRule) - if err != nil { - return nil, err - } - return &UniswapCollectProtocolIterator{contract: _Uniswap.contract, event: "CollectProtocol", logs: logs, sub: sub}, nil -} - -// WatchCollectProtocol is a free log subscription operation binding the contract event 0x596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151. -// -// Solidity: event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapFilterer) WatchCollectProtocol(opts *bind.WatchOpts, sink chan<- *UniswapCollectProtocol, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) - } - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "CollectProtocol", senderRule, recipientRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapCollectProtocol) - if err := _Uniswap.contract.UnpackLog(event, "CollectProtocol", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseCollectProtocol is a log parse operation binding the contract event 0x596b573906218d3411850b26a6b437d6c4522fdb43d2d2386263f86d50b8b151. -// -// Solidity: event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1) -func (_Uniswap *UniswapFilterer) ParseCollectProtocol(log types.Log) (*UniswapCollectProtocol, error) { - event := new(UniswapCollectProtocol) - if err := _Uniswap.contract.UnpackLog(event, "CollectProtocol", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapFlashIterator is returned from FilterFlash and is used to iterate over the raw logs and unpacked data for Flash events raised by the Uniswap contract. -type UniswapFlashIterator struct { - Event *UniswapFlash // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapFlashIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapFlash) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapFlash) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapFlashIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapFlashIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapFlash represents a Flash event raised by the Uniswap contract. -type UniswapFlash struct { - Sender common.Address - Recipient common.Address - Amount0 *big.Int - Amount1 *big.Int - Paid0 *big.Int - Paid1 *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterFlash is a free log retrieval operation binding the contract event 0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633. -// -// Solidity: event Flash(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1) -func (_Uniswap *UniswapFilterer) FilterFlash(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*UniswapFlashIterator, error) { - - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) - } - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "Flash", senderRule, recipientRule) - if err != nil { - return nil, err - } - return &UniswapFlashIterator{contract: _Uniswap.contract, event: "Flash", logs: logs, sub: sub}, nil -} - -// WatchFlash is a free log subscription operation binding the contract event 0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633. -// -// Solidity: event Flash(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1) -func (_Uniswap *UniswapFilterer) WatchFlash(opts *bind.WatchOpts, sink chan<- *UniswapFlash, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) - } - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "Flash", senderRule, recipientRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapFlash) - if err := _Uniswap.contract.UnpackLog(event, "Flash", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseFlash is a log parse operation binding the contract event 0xbdbdb71d7860376ba52b25a5028beea23581364a40522f6bcfb86bb1f2dca633. -// -// Solidity: event Flash(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1) -func (_Uniswap *UniswapFilterer) ParseFlash(log types.Log) (*UniswapFlash, error) { - event := new(UniswapFlash) - if err := _Uniswap.contract.UnpackLog(event, "Flash", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapIncreaseObservationCardinalityNextIterator is returned from FilterIncreaseObservationCardinalityNext and is used to iterate over the raw logs and unpacked data for IncreaseObservationCardinalityNext events raised by the Uniswap contract. -type UniswapIncreaseObservationCardinalityNextIterator struct { - Event *UniswapIncreaseObservationCardinalityNext // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapIncreaseObservationCardinalityNextIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapIncreaseObservationCardinalityNext) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapIncreaseObservationCardinalityNext) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapIncreaseObservationCardinalityNextIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapIncreaseObservationCardinalityNextIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapIncreaseObservationCardinalityNext represents a IncreaseObservationCardinalityNext event raised by the Uniswap contract. -type UniswapIncreaseObservationCardinalityNext struct { - ObservationCardinalityNextOld uint16 - ObservationCardinalityNextNew uint16 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterIncreaseObservationCardinalityNext is a free log retrieval operation binding the contract event 0xac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a. -// -// Solidity: event IncreaseObservationCardinalityNext(uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew) -func (_Uniswap *UniswapFilterer) FilterIncreaseObservationCardinalityNext(opts *bind.FilterOpts) (*UniswapIncreaseObservationCardinalityNextIterator, error) { - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "IncreaseObservationCardinalityNext") - if err != nil { - return nil, err - } - return &UniswapIncreaseObservationCardinalityNextIterator{contract: _Uniswap.contract, event: "IncreaseObservationCardinalityNext", logs: logs, sub: sub}, nil -} - -// WatchIncreaseObservationCardinalityNext is a free log subscription operation binding the contract event 0xac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a. -// -// Solidity: event IncreaseObservationCardinalityNext(uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew) -func (_Uniswap *UniswapFilterer) WatchIncreaseObservationCardinalityNext(opts *bind.WatchOpts, sink chan<- *UniswapIncreaseObservationCardinalityNext) (event.Subscription, error) { - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "IncreaseObservationCardinalityNext") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapIncreaseObservationCardinalityNext) - if err := _Uniswap.contract.UnpackLog(event, "IncreaseObservationCardinalityNext", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseIncreaseObservationCardinalityNext is a log parse operation binding the contract event 0xac49e518f90a358f652e4400164f05a5d8f7e35e7747279bc3a93dbf584e125a. -// -// Solidity: event IncreaseObservationCardinalityNext(uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew) -func (_Uniswap *UniswapFilterer) ParseIncreaseObservationCardinalityNext(log types.Log) (*UniswapIncreaseObservationCardinalityNext, error) { - event := new(UniswapIncreaseObservationCardinalityNext) - if err := _Uniswap.contract.UnpackLog(event, "IncreaseObservationCardinalityNext", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapInitializeIterator is returned from FilterInitialize and is used to iterate over the raw logs and unpacked data for Initialize events raised by the Uniswap contract. -type UniswapInitializeIterator struct { - Event *UniswapInitialize // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapInitializeIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapInitialize) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapInitialize) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapInitializeIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapInitializeIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapInitialize represents a Initialize event raised by the Uniswap contract. -type UniswapInitialize struct { - SqrtPriceX96 *big.Int - Tick *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterInitialize is a free log retrieval operation binding the contract event 0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95. -// -// Solidity: event Initialize(uint160 sqrtPriceX96, int24 tick) -func (_Uniswap *UniswapFilterer) FilterInitialize(opts *bind.FilterOpts) (*UniswapInitializeIterator, error) { - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "Initialize") - if err != nil { - return nil, err - } - return &UniswapInitializeIterator{contract: _Uniswap.contract, event: "Initialize", logs: logs, sub: sub}, nil -} - -// WatchInitialize is a free log subscription operation binding the contract event 0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95. -// -// Solidity: event Initialize(uint160 sqrtPriceX96, int24 tick) -func (_Uniswap *UniswapFilterer) WatchInitialize(opts *bind.WatchOpts, sink chan<- *UniswapInitialize) (event.Subscription, error) { - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "Initialize") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapInitialize) - if err := _Uniswap.contract.UnpackLog(event, "Initialize", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseInitialize is a log parse operation binding the contract event 0x98636036cb66a9c19a37435efc1e90142190214e8abeb821bdba3f2990dd4c95. -// -// Solidity: event Initialize(uint160 sqrtPriceX96, int24 tick) -func (_Uniswap *UniswapFilterer) ParseInitialize(log types.Log) (*UniswapInitialize, error) { - event := new(UniswapInitialize) - if err := _Uniswap.contract.UnpackLog(event, "Initialize", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapMintIterator is returned from FilterMint and is used to iterate over the raw logs and unpacked data for Mint events raised by the Uniswap contract. -type UniswapMintIterator struct { - Event *UniswapMint // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapMintIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapMint) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapMint) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapMintIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapMintIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapMint represents a Mint event raised by the Uniswap contract. -type UniswapMint struct { - Sender common.Address - Owner common.Address - TickLower *big.Int - TickUpper *big.Int - Amount *big.Int - Amount0 *big.Int - Amount1 *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterMint is a free log retrieval operation binding the contract event 0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde. -// -// Solidity: event Mint(address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapFilterer) FilterMint(opts *bind.FilterOpts, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (*UniswapMintIterator, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var tickLowerRule []interface{} - for _, tickLowerItem := range tickLower { - tickLowerRule = append(tickLowerRule, tickLowerItem) - } - var tickUpperRule []interface{} - for _, tickUpperItem := range tickUpper { - tickUpperRule = append(tickUpperRule, tickUpperItem) - } - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "Mint", ownerRule, tickLowerRule, tickUpperRule) - if err != nil { - return nil, err - } - return &UniswapMintIterator{contract: _Uniswap.contract, event: "Mint", logs: logs, sub: sub}, nil -} - -// WatchMint is a free log subscription operation binding the contract event 0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde. -// -// Solidity: event Mint(address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapFilterer) WatchMint(opts *bind.WatchOpts, sink chan<- *UniswapMint, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (event.Subscription, error) { - - var ownerRule []interface{} - for _, ownerItem := range owner { - ownerRule = append(ownerRule, ownerItem) - } - var tickLowerRule []interface{} - for _, tickLowerItem := range tickLower { - tickLowerRule = append(tickLowerRule, tickLowerItem) - } - var tickUpperRule []interface{} - for _, tickUpperItem := range tickUpper { - tickUpperRule = append(tickUpperRule, tickUpperItem) - } - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "Mint", ownerRule, tickLowerRule, tickUpperRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapMint) - if err := _Uniswap.contract.UnpackLog(event, "Mint", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseMint is a log parse operation binding the contract event 0x7a53080ba414158be7ec69b987b5fb7d07dee101fe85488f0853ae16239d0bde. -// -// Solidity: event Mint(address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) -func (_Uniswap *UniswapFilterer) ParseMint(log types.Log) (*UniswapMint, error) { - event := new(UniswapMint) - if err := _Uniswap.contract.UnpackLog(event, "Mint", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapSetFeeProtocolIterator is returned from FilterSetFeeProtocol and is used to iterate over the raw logs and unpacked data for SetFeeProtocol events raised by the Uniswap contract. -type UniswapSetFeeProtocolIterator struct { - Event *UniswapSetFeeProtocol // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapSetFeeProtocolIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapSetFeeProtocol) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapSetFeeProtocol) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapSetFeeProtocolIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapSetFeeProtocolIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapSetFeeProtocol represents a SetFeeProtocol event raised by the Uniswap contract. -type UniswapSetFeeProtocol struct { - FeeProtocol0Old uint8 - FeeProtocol1Old uint8 - FeeProtocol0New uint8 - FeeProtocol1New uint8 - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSetFeeProtocol is a free log retrieval operation binding the contract event 0x973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b133. -// -// Solidity: event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New) -func (_Uniswap *UniswapFilterer) FilterSetFeeProtocol(opts *bind.FilterOpts) (*UniswapSetFeeProtocolIterator, error) { - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "SetFeeProtocol") - if err != nil { - return nil, err - } - return &UniswapSetFeeProtocolIterator{contract: _Uniswap.contract, event: "SetFeeProtocol", logs: logs, sub: sub}, nil -} - -// WatchSetFeeProtocol is a free log subscription operation binding the contract event 0x973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b133. -// -// Solidity: event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New) -func (_Uniswap *UniswapFilterer) WatchSetFeeProtocol(opts *bind.WatchOpts, sink chan<- *UniswapSetFeeProtocol) (event.Subscription, error) { - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "SetFeeProtocol") - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapSetFeeProtocol) - if err := _Uniswap.contract.UnpackLog(event, "SetFeeProtocol", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSetFeeProtocol is a log parse operation binding the contract event 0x973d8d92bb299f4af6ce49b52a8adb85ae46b9f214c4c4fc06ac77401237b133. -// -// Solidity: event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New) -func (_Uniswap *UniswapFilterer) ParseSetFeeProtocol(log types.Log) (*UniswapSetFeeProtocol, error) { - event := new(UniswapSetFeeProtocol) - if err := _Uniswap.contract.UnpackLog(event, "SetFeeProtocol", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} - -// UniswapSwapIterator is returned from FilterSwap and is used to iterate over the raw logs and unpacked data for Swap events raised by the Uniswap contract. -type UniswapSwapIterator struct { - Event *UniswapSwap // Event containing the contract specifics and raw log - - contract *bind.BoundContract // Generic contract to use for unpacking event data - event string // Event name to use for unpacking event data - - logs chan types.Log // Log channel receiving the found contract events - sub ethereum.Subscription // Subscription for errors, completion and termination - done bool // Whether the subscription completed delivering logs - fail error // Occurred error to stop iteration -} - -// Next advances the iterator to the subsequent event, returning whether there -// are any more events found. In case of a retrieval or parsing error, false is -// returned and Error() can be queried for the exact failure. -func (it *UniswapSwapIterator) Next() bool { - // If the iterator failed, stop iterating - if it.fail != nil { - return false - } - // If the iterator completed, deliver directly whatever's available - if it.done { - select { - case log := <-it.logs: - it.Event = new(UniswapSwap) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - default: - return false - } - } - // Iterator still in progress, wait for either a data or an error event - select { - case log := <-it.logs: - it.Event = new(UniswapSwap) - if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { - it.fail = err - return false - } - it.Event.Raw = log - return true - - case err := <-it.sub.Err(): - it.done = true - it.fail = err - return it.Next() - } -} - -// Error returns any retrieval or parsing error occurred during filtering. -func (it *UniswapSwapIterator) Error() error { - return it.fail -} - -// Close terminates the iteration process, releasing any pending underlying -// resources. -func (it *UniswapSwapIterator) Close() error { - it.sub.Unsubscribe() - return nil -} - -// UniswapSwap represents a Swap event raised by the Uniswap contract. -type UniswapSwap struct { - Sender common.Address - Recipient common.Address - Amount0 *big.Int - Amount1 *big.Int - SqrtPriceX96 *big.Int - Liquidity *big.Int - Tick *big.Int - Raw types.Log // Blockchain specific contextual infos -} - -// FilterSwap is a free log retrieval operation binding the contract event 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67. -// -// Solidity: event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick) -func (_Uniswap *UniswapFilterer) FilterSwap(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*UniswapSwapIterator, error) { - - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) - } - - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "Swap", senderRule, recipientRule) - if err != nil { - return nil, err - } - return &UniswapSwapIterator{contract: _Uniswap.contract, event: "Swap", logs: logs, sub: sub}, nil -} - -// WatchSwap is a free log subscription operation binding the contract event 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67. -// -// Solidity: event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick) -func (_Uniswap *UniswapFilterer) WatchSwap(opts *bind.WatchOpts, sink chan<- *UniswapSwap, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - - var senderRule []interface{} - for _, senderItem := range sender { - senderRule = append(senderRule, senderItem) - } - var recipientRule []interface{} - for _, recipientItem := range recipient { - recipientRule = append(recipientRule, recipientItem) - } - - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "Swap", senderRule, recipientRule) - if err != nil { - return nil, err - } - return event.NewSubscription(func(quit <-chan struct{}) error { - defer sub.Unsubscribe() - for { - select { - case log := <-logs: - // New log arrived, parse the event and forward to the user - event := new(UniswapSwap) - if err := _Uniswap.contract.UnpackLog(event, "Swap", log); err != nil { - return err - } - event.Raw = log - - select { - case sink <- event: - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - case err := <-sub.Err(): - return err - case <-quit: - return nil - } - } - }), nil -} - -// ParseSwap is a log parse operation binding the contract event 0xc42079f94a6350d7e6235f29174924f928cc2ac818eb64fed8004e115fbcca67. -// -// Solidity: event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick) -func (_Uniswap *UniswapFilterer) ParseSwap(log types.Log) (*UniswapSwap, error) { - event := new(UniswapSwap) - if err := _Uniswap.contract.UnpackLog(event, "Swap", log); err != nil { - return nil, err - } - event.Raw = log - return event, nil -} diff --git a/sequencer/config.go b/sequencer/config.go index fc37fd64c9..755e2a8f83 100644 --- a/sequencer/config.go +++ b/sequencer/config.go @@ -10,9 +10,9 @@ type Config struct { // trying to send a sequence to L1 WaitPeriodSendSequence types.Duration `mapstructure:"WaitPeriodSendSequence"` - // WaitPeriodPoolIsEmpty is the time the sequencer waits until + // NotSyncedWait is the time the sequencer waits until // trying to add new txs to the state - WaitPeriodPoolIsEmpty types.Duration `mapstructure:"WaitPeriodPoolIsEmpty"` + NotSyncedWait types.Duration `mapstructure:"NotSyncedWait"` // LastBatchVirtualizationTimeMaxWaitPeriod is time since sequences should be sent LastBatchVirtualizationTimeMaxWaitPeriod types.Duration `mapstructure:"LastBatchVirtualizationTimeMaxWaitPeriod"` @@ -102,17 +102,17 @@ type Config struct { // FinalizerCfg contains the finalizer's configuration properties type FinalizerCfg struct { - // GERDeadlineTimeoutInSec is the time the finalizer waits after receiving closing signal to update Global Exit Root - GERDeadlineTimeoutInSec types.Duration `mapstructure:"GERDeadlineTimeoutInSec"` + // GERDeadlineTimeout is the time the finalizer waits after receiving closing signal to update Global Exit Root + GERDeadlineTimeout types.Duration `mapstructure:"GERDeadlineTimeout"` - // SendingToL1DeadlineTimeoutInSec is the time the finalizer waits after receiving closing signal to process Forced Batches - ForcedBatchDeadlineTimeoutInSec types.Duration `mapstructure:"ForcedBatchDeadlineTimeoutInSec"` + // ForcedBatchDeadlineTimeout is the time the finalizer waits after receiving closing signal to process Forced Batches + ForcedBatchDeadlineTimeout types.Duration `mapstructure:"ForcedBatchDeadlineTimeout"` - // SendingToL1DeadlineTimeoutInSec is the time the finalizer waits after receiving closing signal to sends a batch to L1 - SendingToL1DeadlineTimeoutInSec types.Duration `mapstructure:"SendingToL1DeadlineTimeoutInSec"` + // SendingToL1DeadlineTimeout is the time the finalizer waits after receiving closing signal to sends a batch to L1 + SendingToL1DeadlineTimeout types.Duration `mapstructure:"SendingToL1DeadlineTimeout"` - // SleepDurationInMs is the time the finalizer sleeps between each iteration, if there are no transactions to be processed - SleepDurationInMs types.Duration `mapstructure:"SleepDurationInMs"` + // SleepDuration is the time the finalizer sleeps between each iteration, if there are no transactions to be processed + SleepDuration types.Duration `mapstructure:"SleepDuration"` // ResourcePercentageToCloseBatch is the percentage window of the resource left out for the batch to be closed ResourcePercentageToCloseBatch uint32 `mapstructure:"ResourcePercentageToCloseBatch"` diff --git a/sequencer/finalizer.go b/sequencer/finalizer.go index 1861caf6b7..182ca868c9 100644 --- a/sequencer/finalizer.go +++ b/sequencer/finalizer.go @@ -213,9 +213,9 @@ func (f *finalizer) finalizeBatches(ctx context.Context) { f.sharedResourcesMux.Unlock() } else { // wait for new txs - log.Debugf("no transactions to be processed. Sleeping for %v", f.cfg.SleepDurationInMs.Duration) - if f.cfg.SleepDurationInMs.Duration > 0 { - time.Sleep(f.cfg.SleepDurationInMs.Duration) + log.Debugf("no transactions to be processed. Sleeping for %v", f.cfg.SleepDuration.Duration) + if f.cfg.SleepDuration.Duration > 0 { + time.Sleep(f.cfg.SleepDuration.Duration) } } @@ -871,15 +871,15 @@ func (f *finalizer) isBatchAlmostFull() bool { } func (f *finalizer) setNextForcedBatchDeadline() { - f.nextForcedBatchDeadline = now().Unix() + int64(f.cfg.ForcedBatchDeadlineTimeoutInSec.Duration.Seconds()) + f.nextForcedBatchDeadline = now().Unix() + int64(f.cfg.ForcedBatchDeadlineTimeout.Duration.Seconds()) } func (f *finalizer) setNextGERDeadline() { - f.nextGERDeadline = now().Unix() + int64(f.cfg.GERDeadlineTimeoutInSec.Duration.Seconds()) + f.nextGERDeadline = now().Unix() + int64(f.cfg.GERDeadlineTimeout.Duration.Seconds()) } func (f *finalizer) setNextSendingToL1Deadline() { - f.nextSendingToL1Deadline = now().Unix() + int64(f.cfg.SendingToL1DeadlineTimeoutInSec.Duration.Seconds()) + f.nextSendingToL1Deadline = now().Unix() + int64(f.cfg.SendingToL1DeadlineTimeout.Duration.Seconds()) } func (f *finalizer) getConstraintThresholdUint64(input uint64) uint64 { diff --git a/sequencer/finalizer_test.go b/sequencer/finalizer_test.go index 38c05e9c13..f39be59832 100644 --- a/sequencer/finalizer_test.go +++ b/sequencer/finalizer_test.go @@ -52,16 +52,16 @@ var ( SendingToL1TimeoutCh: make(chan bool), } cfg = FinalizerCfg{ - GERDeadlineTimeoutInSec: cfgTypes.Duration{ + GERDeadlineTimeout: cfgTypes.Duration{ Duration: 60, }, - ForcedBatchDeadlineTimeoutInSec: cfgTypes.Duration{ + ForcedBatchDeadlineTimeout: cfgTypes.Duration{ Duration: 60, }, - SendingToL1DeadlineTimeoutInSec: cfgTypes.Duration{ + SendingToL1DeadlineTimeout: cfgTypes.Duration{ Duration: 60, }, - SleepDurationInMs: cfgTypes.Duration{ + SleepDuration: cfgTypes.Duration{ Duration: 60, }, ClosingSignalsManagerWaitForCheckingL1Timeout: cfgTypes.Duration{ @@ -1025,7 +1025,7 @@ func TestFinalizer_setNextForcedBatchDeadline(t *testing.T) { defer func() { now = time.Now }() - expected := now().Unix() + int64(f.cfg.ForcedBatchDeadlineTimeoutInSec.Duration.Seconds()) + expected := now().Unix() + int64(f.cfg.ForcedBatchDeadlineTimeout.Duration.Seconds()) // act f.setNextForcedBatchDeadline() @@ -1041,7 +1041,7 @@ func TestFinalizer_setNextGERDeadline(t *testing.T) { defer func() { now = time.Now }() - expected := now().Unix() + int64(f.cfg.GERDeadlineTimeoutInSec.Duration.Seconds()) + expected := now().Unix() + int64(f.cfg.GERDeadlineTimeout.Duration.Seconds()) // act f.setNextGERDeadline() @@ -1057,7 +1057,7 @@ func TestFinalizer_setNextSendingToL1Deadline(t *testing.T) { defer func() { now = time.Now }() - expected := now().Unix() + int64(f.cfg.SendingToL1DeadlineTimeoutInSec.Duration.Seconds()) + expected := now().Unix() + int64(f.cfg.SendingToL1DeadlineTimeout.Duration.Seconds()) // act f.setNextSendingToL1Deadline() diff --git a/sequencer/sequencer.go b/sequencer/sequencer.go index ed190c06fb..5e1238323e 100644 --- a/sequencer/sequencer.go +++ b/sequencer/sequencer.go @@ -106,7 +106,7 @@ func New(cfg Config, txPool txPool, state stateInterface, etherman etherman, man func (s *Sequencer) Start(ctx context.Context) { for !s.isSynced(ctx) { log.Infof("waiting for synchronizer to sync...") - time.Sleep(s.cfg.WaitPeriodPoolIsEmpty.Duration) + time.Sleep(s.cfg.NotSyncedWait.Duration) } metrics.Register() @@ -163,9 +163,7 @@ func (s *Sequencer) Start(ctx context.Context) { go closingSignalsManager.Start() go s.trackOldTxs(ctx) - tickerProcessTxs := time.NewTicker(s.cfg.WaitPeriodPoolIsEmpty.Duration) tickerSendSequence := time.NewTicker(s.cfg.WaitPeriodSendSequence.Duration) - defer tickerProcessTxs.Stop() defer tickerSendSequence.Stop() go func() { @@ -203,7 +201,7 @@ func (s *Sequencer) bootstrap(ctx context.Context, dbManager *dbManager, finaliz for err != nil { if errors.Is(err, state.ErrStateNotSynchronized) { log.Warnf("state is not synchronized, trying to get last batch num once again...") - time.Sleep(s.cfg.WaitPeriodPoolIsEmpty.Duration) + time.Sleep(s.cfg.NotSyncedWait.Duration) batchNum, err = dbManager.GetLastBatchNumber(ctx) } else { log.Fatalf("failed to get last batch number, err: %v", err) diff --git a/sequencer/sequencesender.go b/sequencer/sequencesender.go index 4c05bf2603..c02f621e34 100644 --- a/sequencer/sequencesender.go +++ b/sequencer/sequencesender.go @@ -173,11 +173,8 @@ func (s *Sequencer) getSequencesToSend(ctx context.Context) ([]types.Sequence, e return sequences, nil } if lastBatchVirtualizationTime.Before(time.Now().Add(-s.cfg.LastBatchVirtualizationTimeMaxWaitPeriod.Duration)) { - // TODO: implement check profitability - // if s.checker.IsSendSequencesProfitable(new(big.Int).SetUint64(estimatedGas), sequences) { log.Info("sequence should be sent to L1, because too long since didn't send anything to L1") return sequences, nil - //} } log.Info("not enough time has passed since last batch was virtualized, and the sequence could be bigger") diff --git a/test/config/debug.node.config.toml b/test/config/debug.node.config.toml index 94f1ff6cbd..73d766db3d 100644 --- a/test/config/debug.node.config.toml +++ b/test/config/debug.node.config.toml @@ -43,8 +43,8 @@ MultiGasProvider = false [RPC] Host = "0.0.0.0" Port = 8123 -ReadTimeoutInSec = 60 -WriteTimeoutInSec = 60 +ReadTimeout = "60s" +WriteTimeout = "60s" MaxRequestsPerIPAndSecond = 10000 SequencerNodeURI = "" BroadcastURI = "127.0.0.1:61090" @@ -61,7 +61,7 @@ GenBlockNumber = 74 TrustedSequencerURL = "" [Sequencer] -WaitPeriodPoolIsEmpty = "1s" +NotSyncedWait = "1s" WaitPeriodSendSequence = "5s" LastBatchVirtualizationTimeMaxWaitPeriod = "5s" BlocksAmountForTxsToBeDeleted = 100 @@ -89,10 +89,10 @@ TxLifetimeCheckTimeout = "10m" MaxTxLifetime = "3h" MaxTxSizeForL1 = 131072 [Sequencer.Finalizer] - GERDeadlineTimeoutInSec = "1s" - ForcedBatchDeadlineTimeoutInSec = "60s" - SendingToL1DeadlineTimeoutInSec = "20s" - SleepDurationInMs = "100ms" + GERDeadlineTimeout = "1s" + ForcedBatchDeadlineTimeout = "60s" + SendingToL1DeadlineTimeout = "20s" + SleepDuration = "100ms" ResourcePercentageToCloseBatch = 10 GERFinalityNumberOfBlocks = 0 ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" @@ -107,7 +107,6 @@ MaxTxSizeForL1 = 131072 [Aggregator] Host = "0.0.0.0" Port = 50081 -ForkId = 2 RetryTime = "5s" VerifyProofInterval = "30s" TxProfitabilityCheckerType = "acceptall" diff --git a/test/config/test.node.config.toml b/test/config/test.node.config.toml index eac76c6f21..9c359a991f 100644 --- a/test/config/test.node.config.toml +++ b/test/config/test.node.config.toml @@ -43,8 +43,8 @@ MultiGasProvider = false [RPC] Host = "0.0.0.0" Port = 8123 -ReadTimeoutInSec = 60 -WriteTimeoutInSec = 60 +ReadTimeout = "60s" +WriteTimeout = "60s" MaxRequestsPerIPAndSecond = 5000 SequencerNodeURI = "" BroadcastURI = "127.0.0.1:61090" @@ -61,7 +61,7 @@ GenBlockNumber = 74 TrustedSequencerURL = "" [Sequencer] -WaitPeriodPoolIsEmpty = "1s" +NotSyncedWait = "1s" WaitPeriodSendSequence = "15s" LastBatchVirtualizationTimeMaxWaitPeriod = "10s" BlocksAmountForTxsToBeDeleted = 100 @@ -89,10 +89,10 @@ TxLifetimeCheckTimeout = "10m" MaxTxLifetime = "3h" MaxTxSizeForL1 = 131072 [Sequencer.Finalizer] - GERDeadlineTimeoutInSec = "2s" - ForcedBatchDeadlineTimeoutInSec = "60s" - SendingToL1DeadlineTimeoutInSec = "20s" - SleepDurationInMs = "100ms" + GERDeadlineTimeout = "2s" + ForcedBatchDeadlineTimeout = "60s" + SendingToL1DeadlineTimeout = "20s" + SleepDuration = "100ms" ResourcePercentageToCloseBatch = 10 GERFinalityNumberOfBlocks = 0 ClosingSignalsManagerWaitForCheckingL1Timeout = "10s" @@ -107,7 +107,6 @@ MaxTxSizeForL1 = 131072 [Aggregator] Host = "0.0.0.0" Port = 50081 -ForkId = 2 RetryTime = "5s" VerifyProofInterval = "30s" TxProfitabilityCheckerType = "acceptall" diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 7ad4ff3a58..78bea4e515 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -337,7 +337,7 @@ services: zkevm-prover: container_name: zkevm-prover - image: hermeznetwork/zkevm-prover:9e70a64 + image: hermeznetwork/zkevm-prover:6d6e3aa ports: # - 50051:50051 # Prover - 50052:50052 # Mock prover @@ -423,7 +423,7 @@ services: zkevm-permissionless-prover: container_name: zkevm-permissionless-prover - image: hermeznetwork/zkevm-prover:9e70a64 + image: hermeznetwork/zkevm-prover:6d6e3aa ports: # - 50058:50058 # Prover - 50059:50052 # Mock prover