diff --git a/modules/pool/abi/FxPool.json b/modules/pool/abi/FxPool.json new file mode 100644 index 000000000..75eb2ed77 --- /dev/null +++ b/modules/pool/abi/FxPool.json @@ -0,0 +1,553 @@ +[ + { + "inputs": [ + { "internalType": "address[]", "name": "_assetsToRegister", "type": "address[]" }, + { "internalType": "contract IVault", "name": "vault", "type": "address" }, + { "internalType": "uint256", "name": "_protocolPercentFee", "type": "uint256" }, + { "internalType": "string", "name": "_name", "type": "string" }, + { "internalType": "string", "name": "_symbol", "type": "string" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "numeraire", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "reserve", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "weight", "type": "uint256" } + ], + "name": "AssetIncluded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "derivative", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "numeraire", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "reserve", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "assimilator", "type": "address" } + ], + "name": "AssimilatorIncluded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "newCollector", "type": "address" }], + "name": "ChangeCollectorAddress", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "bool", "name": "isEmergency", "type": "bool" }], + "name": "EmergencyAlarm", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "lptAmountBurned", "type": "uint256" }, + { "indexed": false, "internalType": "uint256[]", "name": "amountsWithdrawn", "type": "uint256[]" } + ], + "name": "EmergencyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "feesCollected", "type": "uint256" }], + "name": "FeesAccrued", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "recipient", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "feesCollected", "type": "uint256" } + ], + "name": "FeesCollected", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "lptAmountBurned", "type": "uint256" }, + { "indexed": false, "internalType": "uint256[]", "name": "amountsWithdrawn", "type": "uint256[]" } + ], + "name": "OnExitPool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "indexed": false, "internalType": "uint256", "name": "lptAmountMinted", "type": "uint256" }, + { "indexed": false, "internalType": "uint256[]", "name": "amountsDeposited", "type": "uint256[]" } + ], + "name": "OnJoinPool", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "previousOwner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "newOwner", "type": "address" } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint256", "name": "alpha", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "beta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "delta", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "epsilon", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "lambda", "type": "uint256" } + ], + "name": "ParametersSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "address", "name": "updater", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "newProtocolPercentage", "type": "uint256" } + ], + "name": "ProtocolFeeShareUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "trader", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "origin", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "target", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "originAmount", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "targetAmount", "type": "uint256" } + ], + "name": "Trade", + "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": [{ "indexed": false, "internalType": "address", "name": "account", "type": "address" }], + "name": "Unpaused", + "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": "_derivative", "type": "address" }], + "name": "assimilator", + "outputs": [{ "internalType": "address", "name": "assimilator_", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "collectorAddress", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "curve", + "outputs": [ + { "internalType": "int128", "name": "alpha", "type": "int128" }, + { "internalType": "int128", "name": "beta", "type": "int128" }, + { "internalType": "int128", "name": "delta", "type": "int128" }, + { "internalType": "int128", "name": "epsilon", "type": "int128" }, + { "internalType": "int128", "name": "lambda", "type": "int128" }, + { "internalType": "uint256", "name": "cap", "type": "uint256" }, + { "internalType": "contract IVault", "name": "vault", "type": "address" }, + { "internalType": "address", "name": "fxPoolAddress", "type": "address" }, + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "decreaseAllowance", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "derivatives", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "emergency", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPoolId", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getVault", + "outputs": [{ "internalType": "contract IVault", "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": [ + { "internalType": "address[]", "name": "_assets", "type": "address[]" }, + { "internalType": "uint256[]", "name": "_assetWeights", "type": "uint256[]" } + ], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "liquidity", + "outputs": [ + { "internalType": "uint256", "name": "total_", "type": "uint256" }, + { "internalType": "uint256[]", "name": "individual_", "type": "uint256[]" } + ], + "stateMutability": "view", + "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": "uint256", "name": "", "type": "uint256" }], + "name": "numeraires", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "sender", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "bytes", "name": "userData", "type": "bytes" } + ], + "name": "onExitPool", + "outputs": [ + { "internalType": "uint256[]", "name": "amountsOut", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "dueProtocolFeeAmounts", "type": "uint256[]" } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "bytes32", "name": "poolId", "type": "bytes32" }, + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "recipient", "type": "address" }, + { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "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": "swapRequest", + "type": "tuple" + }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "onSwap", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "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": [], + "name": "protocolPercentFee", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "reserves", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_cap", "type": "uint256" }], + "name": "setCap", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_collectorAddress", "type": "address" }], + "name": "setCollectorAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "bool", "name": "_emergency", "type": "bool" }], + "name": "setEmergency", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_alpha", "type": "uint256" }, + { "internalType": "uint256", "name": "_beta", "type": "uint256" }, + { "internalType": "uint256", "name": "_feeAtHalt", "type": "uint256" }, + { "internalType": "uint256", "name": "_epsilon", "type": "uint256" }, + { "internalType": "uint256", "name": "_lambda", "type": "uint256" } + ], + "name": "setParams", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "setPaused", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "uint256", "name": "_protocolPercentFee", "type": "uint256" }], + "name": "setProtocolPercentFee", + "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": [], + "name": "totalUnclaimedFeesInNumeraire", + "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": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "totalDepositNumeraire", "type": "uint256" }], + "name": "viewDeposit", + "outputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "uint256[]", "name": "", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "viewParameters", + "outputs": [ + { "internalType": "uint256", "name": "alpha_", "type": "uint256" }, + { "internalType": "uint256", "name": "beta_", "type": "uint256" }, + { "internalType": "uint256", "name": "delta_", "type": "uint256" }, + { "internalType": "uint256", "name": "epsilon_", "type": "uint256" }, + { "internalType": "uint256", "name": "lambda_", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_curvesToBurn", "type": "uint256" }], + "name": "viewWithdraw", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/modules/pool/lib/pool-onchain-data.ts b/modules/pool/lib/pool-onchain-data.ts index 189c5f62e..ca333d132 100644 --- a/modules/pool/lib/pool-onchain-data.ts +++ b/modules/pool/lib/pool-onchain-data.ts @@ -13,6 +13,7 @@ import WeightedPoolAbi from '../abi/WeightedPool.json'; import StablePoolAbi from '../abi/StablePool.json'; import MetaStablePoolAbi from '../abi/MetaStablePool.json'; import StablePhantomPoolAbi from '../abi/StablePhantomPool.json'; +import FxPoolAbi from '../abi/FxPool.json'; import { JsonFragment } from '@ethersproject/abi'; interface PoolInput { @@ -60,6 +61,7 @@ const abi: JsonFragment[] = Object.values( ...StablePhantomPoolAbi, ...MetaStablePoolAbi, ...ComposableStablePoolAbi, + ...FxPoolAbi, //...WeightedPoolV2Abi, ].map((row) => [row.name, row]), ),