From 775dc46000cdcae9126e724c6e3818e5c6f618b8 Mon Sep 17 00:00:00 2001 From: Josh Guha Date: Wed, 22 Nov 2023 11:51:28 +0000 Subject: [PATCH] Add Gyro2V2 pool --- abis/Gyro2V2Pool.json | 1371 ++++++++++++++++++++++++++++++++++ abis/Gyro2V2PoolFactory.json | 205 +++++ manifest.template.yaml | 39 +- networks.yaml | 5 +- src/mappings/poolFactory.ts | 25 +- 5 files changed, 1640 insertions(+), 5 deletions(-) create mode 100644 abis/Gyro2V2Pool.json create mode 100644 abis/Gyro2V2PoolFactory.json diff --git a/abis/Gyro2V2Pool.json b/abis/Gyro2V2Pool.json new file mode 100644 index 00000000..5872e82a --- /dev/null +++ b/abis/Gyro2V2Pool.json @@ -0,0 +1,1371 @@ +[ + { + "inputs": [ + { + "components": [ + { + "components": [ + { + "internalType": "contract IVault", + "name": "vault", + "type": "address" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "contract IERC20", + "name": "token0", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "token1", + "type": "address" + }, + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pauseWindowDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodDuration", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "internalType": "struct ExtensibleWeightedPool2Tokens.NewPoolParams", + "name": "baseParams", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "sqrtAlpha", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "sqrtBeta", + "type": "uint256" + }, + { + "internalType": "address", + "name": "rateProvider0", + "type": "address" + }, + { + "internalType": "address", + "name": "rateProvider1", + "type": "address" + }, + { + "internalType": "address", + "name": "capManager", + "type": "address" + }, + { + "components": [ + { + "internalType": "bool", + "name": "capEnabled", + "type": "bool" + }, + { + "internalType": "uint120", + "name": "perAddressCap", + "type": "uint120" + }, + { + "internalType": "uint128", + "name": "globalCap", + "type": "uint128" + } + ], + "internalType": "struct ICappedLiquidity.CapParams", + "name": "capParams", + "type": "tuple" + }, + { + "internalType": "address", + "name": "pauseManager", + "type": "address" + } + ], + "internalType": "struct Gyro2CLPPool.GyroParams", + "name": "params", + "type": "tuple" + }, + { + "internalType": "address", + "name": "configAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "capManager", + "type": "address" + } + ], + "name": "CapManagerUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "capEnabled", + "type": "bool" + }, + { + "internalType": "uint120", + "name": "perAddressCap", + "type": "uint120" + }, + { + "internalType": "uint128", + "name": "globalCap", + "type": "uint128" + } + ], + "indexed": false, + "internalType": "struct ICappedLiquidity.CapParams", + "name": "params", + "type": "tuple" + } + ], + "name": "CapParamsUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "oldPauseManager", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newPauseManager", + "type": "address" + } + ], + "name": "PauseManagerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "PausedLocally", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "PausedStateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "name": "SwapFeePercentageChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "UnpausedLocally", + "type": "event" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balanceTokenIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceTokenOut", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "tokenInIsToken0", + "type": "bool" + } + ], + "name": "calculateCurrentValues", + "outputs": [ + { + "internalType": "uint256", + "name": "currentInvariant", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "virtualParamIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "virtualParamOut", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "capManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "capParams", + "outputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "capEnabled", + "type": "bool" + }, + { + "internalType": "uint120", + "name": "perAddressCap", + "type": "uint120" + }, + { + "internalType": "uint128", + "name": "globalCap", + "type": "uint128" + } + ], + "internalType": "struct ICappedLiquidity.CapParams", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_pauseManager", + "type": "address" + } + ], + "name": "changePauseManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "selector", + "type": "bytes4" + } + ], + "name": "getActionId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getActualSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAuthorizer", + "outputs": [ + { + "internalType": "contract IAuthorizer", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getInvariant", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getInvariantDivActualSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getLastInvariant", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMiscData", + "outputs": [ + { + "internalType": "int256", + "name": "logInvariant", + "type": "int256" + }, + { + "internalType": "int256", + "name": "logTotalSupply", + "type": "int256" + }, + { + "internalType": "uint256", + "name": "oracleSampleCreationTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "oracleIndex", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "oracleEnabled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNormalizedWeights", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPausedState", + "outputs": [ + { + "internalType": "bool", + "name": "paused", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "pauseWindowEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodEndTime", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "spotPrice", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSqrtParameters", + "outputs": [ + { + "internalType": "uint256[2]", + "name": "", + "type": "uint256[2]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getSwapFeePercentage", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenRates", + "outputs": [ + { + "internalType": "uint256", + "name": "rate0", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rate1", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVault", + "outputs": [ + { + "internalType": "contract IVault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVirtualParameters", + "outputs": [ + { + "internalType": "uint256[]", + "name": "virtualParams", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gyroConfig", + "outputs": [ + { + "internalType": "contract IGyroConfig", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "name": "onExitPool", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "name": "onJoinPool", + "outputs": [ + { + "internalType": "uint256[]", + "name": "amountsIn", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "dueProtocolFeeAmounts", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "enum IVault.SwapKind", + "name": "kind", + "type": "uint8" + }, + { + "internalType": "contract IERC20", + "name": "tokenIn", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "tokenOut", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "internalType": "struct IPoolSwapStructs.SwapRequest", + "name": "request", + "type": "tuple" + }, + { + "internalType": "uint256", + "name": "balanceTokenIn", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "balanceTokenOut", + "type": "uint256" + } + ], + "name": "onSwap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "pauseManager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "name": "queryExit", + "outputs": [ + { + "internalType": "uint256", + "name": "bptIn", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "amountsOut", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "poolId", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "balances", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "lastChangeBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "protocolSwapFeePercentage", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "userData", + "type": "bytes" + } + ], + "name": "queryJoin", + "outputs": [ + { + "internalType": "uint256", + "name": "bptOut", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "amountsIn", + "type": "uint256[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rateProvider0", + "outputs": [ + { + "internalType": "contract IRateProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rateProvider1", + "outputs": [ + { + "internalType": "contract IRateProvider", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_capManager", + "type": "address" + } + ], + "name": "setCapManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bool", + "name": "capEnabled", + "type": "bool" + }, + { + "internalType": "uint120", + "name": "perAddressCap", + "type": "uint120" + }, + { + "internalType": "uint128", + "name": "globalCap", + "type": "uint128" + } + ], + "internalType": "struct ICappedLiquidity.CapParams", + "name": "params", + "type": "tuple" + } + ], + "name": "setCapParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "paused", + "type": "bool" + } + ], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + } + ], + "name": "setSwapFeePercentage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/abis/Gyro2V2PoolFactory.json b/abis/Gyro2V2PoolFactory.json new file mode 100644 index 00000000..02efbc26 --- /dev/null +++ b/abis/Gyro2V2PoolFactory.json @@ -0,0 +1,205 @@ +[ + { + "inputs": [ + { + "internalType": "contract IVault", + "name": "vault", + "type": "address" + }, + { + "internalType": "address", + "name": "_gyroConfigAddress", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "PoolCreated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "sqrts", + "type": "uint256[]" + }, + { + "internalType": "address[]", + "name": "rateProviders", + "type": "address[]" + }, + { + "internalType": "uint256", + "name": "swapFeePercentage", + "type": "uint256" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "capManager", + "type": "address" + }, + { + "components": [ + { + "internalType": "bool", + "name": "capEnabled", + "type": "bool" + }, + { + "internalType": "uint120", + "name": "perAddressCap", + "type": "uint120" + }, + { + "internalType": "uint128", + "name": "globalCap", + "type": "uint128" + } + ], + "internalType": "struct ICappedLiquidity.CapParams", + "name": "capParams", + "type": "tuple" + }, + { + "internalType": "address", + "name": "pauseManager", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "pauseWindowDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "bufferPeriodDuration", + "type": "uint256" + } + ], + "internalType": "struct ILocallyPausable.PauseParams", + "name": "pauseParams", + "type": "tuple" + } + ], + "name": "create", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getCreationCode", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getCreationCodeContracts", + "outputs": [ + { + "internalType": "address", + "name": "contractA", + "type": "address" + }, + { + "internalType": "address", + "name": "contractB", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVault", + "outputs": [ + { + "internalType": "contract IVault", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "gyroConfigAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "pool", + "type": "address" + } + ], + "name": "isPoolFromFactory", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } +] diff --git a/manifest.template.yaml b/manifest.template.yaml index 03aa6702..bc9e8faa 100644 --- a/manifest.template.yaml +++ b/manifest.template.yaml @@ -1438,12 +1438,45 @@ dataSources: file: ./abis/WeightedPool.json - name: Gyro2Pool file: ./abis/Gyro2Pool.json + - name: Gyro2V2Pool + file: ./abis/Gyro2V2Pool.json - name: Gyro2PoolFactory file: ./abis/Gyro2PoolFactory.json eventHandlers: - event: PoolCreated(indexed address) handler: handleNewGyro2Pool {{/if}} + {{#if Gyro2V2PoolFactory}} + - kind: ethereum/contract + name: Gyro2V2PoolFactory + network: {{network}} + source: + address: '{{Gyro2V2PoolFactory.address}}' + abi: Gyro2V2PoolFactory + startBlock: {{Gyro2V2PoolFactory.startBlock}} + mapping: + kind: ethereum/events + apiVersion: 0.0.5 + language: wasm/assemblyscript + file: ./src/mappings/poolFactory.ts + entities: + - Balancer + - Pool + abis: + - name: Vault + file: ./abis/Vault.json + - name: ERC20 + file: ./abis/ERC20.json + - name: WeightedPool + file: ./abis/WeightedPool.json + - name: Gyro2V2Pool + file: ./abis/Gyro2V2Pool.json + - name: Gyro2V2PoolFactory + file: ./abis/Gyro2V2PoolFactory.json + eventHandlers: + - event: PoolCreated(indexed address) + handler: handleNewGyro2V2Pool + {{/if}} {{#if Gyro3PoolFactory}} - kind: ethereum/contract name: Gyro3PoolFactory @@ -2057,7 +2090,7 @@ templates: name: Gyro2Pool network: {{network}} source: - abi: Gyro2Pool + abi: Gyro2V2Pool mapping: kind: ethereum/events apiVersion: 0.0.5 @@ -2070,8 +2103,8 @@ templates: - PoolToken - GradualWeightUpdate abis: - - name: Gyro2Pool - file: ./abis/Gyro2Pool.json + - name: Gyro2V2Pool + file: ./abis/Gyro2V2Pool.json - name: Vault file: ./abis/Vault.json eventHandlers: diff --git a/networks.yaml b/networks.yaml index f45bef7f..699d0750 100644 --- a/networks.yaml +++ b/networks.yaml @@ -129,6 +129,9 @@ mainnet: GyroEV2PoolFactory: address: "0x412a5B2e7a678471985542757A6855847D4931D5" startBlock: 17672894 + Gyro2V2PoolFactory: + address: "0x579653927BF509B361F6e3813f5D4B95331d98c9" + startBlock: 18577307 goerli: network: goerli EventEmitter: @@ -351,7 +354,7 @@ polygon: arbitrum: network: arbitrum-one graft: - # GyroEV2 startBlock + # GyroEV2 startBlock block: 124858976 # always make sure the base subgraph has not been pruned # it should be possible to run time travel queries on it going back to the vault's startBlock diff --git a/src/mappings/poolFactory.ts b/src/mappings/poolFactory.ts index 42a6dfb9..7f44cbd3 100644 --- a/src/mappings/poolFactory.ts +++ b/src/mappings/poolFactory.ts @@ -456,7 +456,7 @@ function handleNewLinearPool(event: PoolCreated, poolType: string, poolTypeVersi LinearPoolTemplate.create(poolAddress); } -export function handleNewGyro2Pool(event: PoolCreated): void { +function createGyro2Pool(event: PoolCreated, poolTypeVersion: i32 = 1): void { let poolAddress: Address = event.params.pool; let poolContract = Gyro2Pool.bind(poolAddress); @@ -470,6 +470,7 @@ export function handleNewGyro2Pool(event: PoolCreated): void { let pool = handleNewPool(event, poolId, swapFee); pool.poolType = PoolType.Gyro2; + pool.poolTypeVersion = poolTypeVersion; let sqrtParamsCall = poolContract.try_getSqrtParameters(); pool.sqrtAlpha = scaleDown(sqrtParamsCall.value[0], 18); pool.sqrtBeta = scaleDown(sqrtParamsCall.value[1], 18); @@ -478,6 +479,20 @@ export function handleNewGyro2Pool(event: PoolCreated): void { if (tokens == null) return; pool.tokensList = tokens; + if (poolTypeVersion == 2) { + let rateProvider0Call = poolContract.try_rateProvider0(); + let rateProvider1Call = poolContract.try_rateProvider1(); + + let blockTimestamp = event.block.timestamp.toI32(); + + if (!rateProvider0Call.reverted) { + setPriceRateProvider(poolId.toHex(), changetype
(tokens[0]), rateProvider0Call.value, 0, blockTimestamp); + } + if (!rateProvider1Call.reverted) { + setPriceRateProvider(poolId.toHex(), changetype
(tokens[1]), rateProvider1Call.value, 0, blockTimestamp); + } + } + pool.save(); handleNewPoolTokens(pool, tokens); @@ -485,6 +500,14 @@ export function handleNewGyro2Pool(event: PoolCreated): void { Gyro2PoolTemplate.create(event.params.pool); } +export function handleNewGyro2Pool(event: PoolCreated): void { + createGyro2Pool(event); +} + +export function handleNewGyro2V2Pool(event: PoolCreated): void { + createGyro2Pool(event, 2); +} + export function handleNewGyro3Pool(event: PoolCreated): void { let poolAddress: Address = event.params.pool;