From df15de433cbbe4eb12ab96489dcf3038ca4750a9 Mon Sep 17 00:00:00 2001 From: fedorovdg Date: Mon, 13 Nov 2023 17:54:51 +0400 Subject: [PATCH 1/2] fix: fixed totalLiquidity and ABI for factory-stable-ng --- src/constants/abis/factory-stable-ng.json | 997 +++++++++++- .../plain-stableswap-ng.json | 1332 ++++++++++++++++- src/curve.ts | 2 +- src/factory/factory-api.ts | 6 +- src/pools/PoolTemplate.ts | 5 +- src/utils.ts | 10 +- test/stats.test.ts | 2 +- 7 files changed, 2343 insertions(+), 11 deletions(-) diff --git a/src/constants/abis/factory-stable-ng.json b/src/constants/abis/factory-stable-ng.json index 36e886a6..8e2b7363 100644 --- a/src/constants/abis/factory-stable-ng.json +++ b/src/constants/abis/factory-stable-ng.json @@ -1 +1,996 @@ -[{"name":"BasePoolAdded","inputs":[{"name":"base_pool","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"PlainPoolDeployed","inputs":[{"name":"coins","type":"address[]","indexed":false},{"name":"A","type":"uint256","indexed":false},{"name":"fee","type":"uint256","indexed":false},{"name":"deployer","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"MetaPoolDeployed","inputs":[{"name":"coin","type":"address","indexed":false},{"name":"base_pool","type":"address","indexed":false},{"name":"A","type":"uint256","indexed":false},{"name":"fee","type":"uint256","indexed":false},{"name":"deployer","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"LiquidityGaugeDeployed","inputs":[{"name":"pool","type":"address","indexed":false},{"name":"gauge","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_fee_receiver","type":"address"},{"name":"_owner","type":"address"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"find_pool_for_coins","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"find_pool_for_coins","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"get_base_pool","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"get_n_coins","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_meta_n_coins","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_coins","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"address[]"}]},{"stateMutability":"view","type":"function","name":"get_underlying_coins","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"address[]"}]},{"stateMutability":"view","type":"function","name":"get_decimals","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"get_underlying_decimals","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"get_metapool_rates","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"get_balances","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"get_underlying_balances","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"get_A","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_fees","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_admin_balances","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"get_coin_indices","inputs":[{"name":"_pool","type":"address"},{"name":"_from","type":"address"},{"name":"_to","type":"address"}],"outputs":[{"name":"","type":"int128"},{"name":"","type":"int128"},{"name":"","type":"bool"}]},{"stateMutability":"view","type":"function","name":"get_gauge","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"get_implementation_address","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"is_meta","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"view","type":"function","name":"get_pool_asset_types","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"uint8[]"}]},{"stateMutability":"nonpayable","type":"function","name":"deploy_plain_pool","inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_coins","type":"address[]"},{"name":"_A","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_offpeg_fee_multiplier","type":"uint256"},{"name":"_ma_exp_time","type":"uint256"},{"name":"_implementation_idx","type":"uint256"},{"name":"_asset_types","type":"uint8[]"},{"name":"_method_ids","type":"bytes4[]"},{"name":"_oracles","type":"address[]"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"deploy_metapool","inputs":[{"name":"_base_pool","type":"address"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_coin","type":"address"},{"name":"_A","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_offpeg_fee_multiplier","type":"uint256"},{"name":"_ma_exp_time","type":"uint256"},{"name":"_implementation_idx","type":"uint256"},{"name":"_asset_type","type":"uint8"},{"name":"_method_id","type":"bytes4"},{"name":"_oracle","type":"address"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"deploy_gauge","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"add_base_pool","inputs":[{"name":"_base_pool","type":"address"},{"name":"_base_lp_token","type":"address"},{"name":"_asset_types","type":"uint8[]"},{"name":"_n_coins","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_pool_implementations","inputs":[{"name":"_implementation_index","type":"uint256"},{"name":"_implementation","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_metapool_implementations","inputs":[{"name":"_implementation_index","type":"uint256"},{"name":"_implementation","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_math_implementation","inputs":[{"name":"_math_implementation","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_gauge_implementation","inputs":[{"name":"_gauge_implementation","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_views_implementation","inputs":[{"name":"_views_implementation","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"_addr","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"accept_transfer_ownership","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_fee_receiver","inputs":[{"name":"_pool","type":"address"},{"name":"_fee_receiver","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"add_asset_type","inputs":[{"name":"_id","type":"uint8"},{"name":"_name","type":"string"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"future_admin","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"asset_types","inputs":[{"name":"arg0","type":"uint8"}],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"pool_list","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"pool_count","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"base_pool_list","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"base_pool_count","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"base_pool_data","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"tuple","components":[{"name":"lp_token","type":"address"},{"name":"coins","type":"address[]"},{"name":"decimals","type":"uint256"},{"name":"n_coins","type":"uint256"},{"name":"asset_types","type":"uint8[]"}]}]},{"stateMutability":"view","type":"function","name":"base_pool_assets","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"view","type":"function","name":"pool_implementations","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"metapool_implementations","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"math_implementation","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"gauge_implementation","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"views_implementation","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"fee_receiver","inputs":[],"outputs":[{"name":"","type":"address"}]}] \ No newline at end of file +[ + { + "name": "BasePoolAdded", + "inputs": [ + { + "name": "base_pool", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "PlainPoolDeployed", + "inputs": [ + { + "name": "coins", + "type": "address[]", + "indexed": false + }, + { + "name": "A", + "type": "uint256", + "indexed": false + }, + { + "name": "fee", + "type": "uint256", + "indexed": false + }, + { + "name": "deployer", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "MetaPoolDeployed", + "inputs": [ + { + "name": "coin", + "type": "address", + "indexed": false + }, + { + "name": "base_pool", + "type": "address", + "indexed": false + }, + { + "name": "A", + "type": "uint256", + "indexed": false + }, + { + "name": "fee", + "type": "uint256", + "indexed": false + }, + { + "name": "deployer", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "LiquidityGaugeDeployed", + "inputs": [ + { + "name": "pool", + "type": "address", + "indexed": false + }, + { + "name": "gauge", + "type": "address", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [ + { + "name": "_fee_receiver", + "type": "address" + }, + { + "name": "_owner", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "find_pool_for_coins", + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "find_pool_for_coins", + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "i", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_base_pool", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_n_coins", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_meta_n_coins", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_coins", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_underlying_coins", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_decimals", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_underlying_decimals", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_metapool_rates", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_balances", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_underlying_balances", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_A", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_fees", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_admin_balances", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_coin_indices", + "inputs": [ + { + "name": "_pool", + "type": "address" + }, + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "int128" + }, + { + "name": "", + "type": "int128" + }, + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_gauge", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_implementation_address", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "is_meta", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_pool_asset_types", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint8[]" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deploy_plain_pool", + "inputs": [ + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_coins", + "type": "address[]" + }, + { + "name": "_A", + "type": "uint256" + }, + { + "name": "_fee", + "type": "uint256" + }, + { + "name": "_offpeg_fee_multiplier", + "type": "uint256" + }, + { + "name": "_ma_exp_time", + "type": "uint256" + }, + { + "name": "_implementation_idx", + "type": "uint256" + }, + { + "name": "_asset_types", + "type": "uint8[]" + }, + { + "name": "_method_ids", + "type": "bytes4[]" + }, + { + "name": "_oracles", + "type": "address[]" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deploy_metapool", + "inputs": [ + { + "name": "_base_pool", + "type": "address" + }, + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_coin", + "type": "address" + }, + { + "name": "_A", + "type": "uint256" + }, + { + "name": "_fee", + "type": "uint256" + }, + { + "name": "_offpeg_fee_multiplier", + "type": "uint256" + }, + { + "name": "_ma_exp_time", + "type": "uint256" + }, + { + "name": "_implementation_idx", + "type": "uint256" + }, + { + "name": "_asset_type", + "type": "uint8" + }, + { + "name": "_method_id", + "type": "bytes4" + }, + { + "name": "_oracle", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "deploy_gauge", + "inputs": [ + { + "name": "_pool", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_base_pool", + "inputs": [ + { + "name": "_base_pool", + "type": "address" + }, + { + "name": "_base_lp_token", + "type": "address" + }, + { + "name": "_asset_types", + "type": "uint8[]" + }, + { + "name": "_n_coins", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_pool_implementations", + "inputs": [ + { + "name": "_implementation_index", + "type": "uint256" + }, + { + "name": "_implementation", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_metapool_implementations", + "inputs": [ + { + "name": "_implementation_index", + "type": "uint256" + }, + { + "name": "_implementation", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_math_implementation", + "inputs": [ + { + "name": "_math_implementation", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_gauge_implementation", + "inputs": [ + { + "name": "_gauge_implementation", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_views_implementation", + "inputs": [ + { + "name": "_views_implementation", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "commit_transfer_ownership", + "inputs": [ + { + "name": "_addr", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "accept_transfer_ownership", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_fee_receiver", + "inputs": [ + { + "name": "_pool", + "type": "address" + }, + { + "name": "_fee_receiver", + "type": "address" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_asset_type", + "inputs": [ + { + "name": "_id", + "type": "uint8" + }, + { + "name": "_name", + "type": "string" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_admin", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "asset_types", + "inputs": [ + { + "name": "arg0", + "type": "uint8" + } + ], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "pool_list", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "pool_count", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "base_pool_list", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "base_pool_count", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "base_pool_data", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "components": [ + { + "name": "lp_token", + "type": "address" + }, + { + "name": "coins", + "type": "address[]" + }, + { + "name": "decimals", + "type": "uint256" + }, + { + "name": "n_coins", + "type": "uint256" + }, + { + "name": "asset_types", + "type": "uint8[]" + } + ] + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "base_pool_assets", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "pool_implementations", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "metapool_implementations", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "math_implementation", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "gauge_implementation", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "views_implementation", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "fee_receiver", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + } +] \ No newline at end of file diff --git a/src/constants/abis/factory-stable-ng/plain-stableswap-ng.json b/src/constants/abis/factory-stable-ng/plain-stableswap-ng.json index 16cd0f15..c2d4dd16 100644 --- a/src/constants/abis/factory-stable-ng/plain-stableswap-ng.json +++ b/src/constants/abis/factory-stable-ng/plain-stableswap-ng.json @@ -1 +1,1331 @@ -[{"name":"Transfer","inputs":[{"name":"sender","type":"address","indexed":true},{"name":"receiver","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Approval","inputs":[{"name":"owner","type":"address","indexed":true},{"name":"spender","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchange","inputs":[{"name":"buyer","type":"address","indexed":true},{"name":"sold_id","type":"int128","indexed":false},{"name":"tokens_sold","type":"uint256","indexed":false},{"name":"bought_id","type":"int128","indexed":false},{"name":"tokens_bought","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchangeUnderlying","inputs":[{"name":"buyer","type":"address","indexed":true},{"name":"sold_id","type":"int128","indexed":false},{"name":"tokens_sold","type":"uint256","indexed":false},{"name":"bought_id","type":"int128","indexed":false},{"name":"tokens_bought","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[]","indexed":false},{"name":"fees","type":"uint256[]","indexed":false},{"name":"invariant","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[]","indexed":false},{"name":"fees","type":"uint256[]","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_id","type":"int128","indexed":false},{"name":"token_amount","type":"uint256","indexed":false},{"name":"coin_amount","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[]","indexed":false},{"name":"fees","type":"uint256[]","indexed":false},{"name":"invariant","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"name":"old_A","type":"uint256","indexed":false},{"name":"new_A","type":"uint256","indexed":false},{"name":"initial_time","type":"uint256","indexed":false},{"name":"future_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"name":"A","type":"uint256","indexed":false},{"name":"t","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"ApplyNewFee","inputs":[{"name":"fee","type":"uint256","indexed":false},{"name":"offpeg_fee_multiplier","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_A","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_offpeg_fee_multiplier","type":"uint256"},{"name":"_ma_exp_time","type":"uint256"},{"name":"_coins","type":"address[]"},{"name":"_rate_multipliers","type":"uint256[]"},{"name":"_asset_types","type":"uint8[]"},{"name":"_method_ids","type":"bytes4[]"},{"name":"_oracles","type":"address[]"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"exchange","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"exchange","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"exchange_received","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"exchange_received","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_min_mint_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_min_mint_amount","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"_min_received","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"_min_received","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_imbalance","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_max_burn_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_imbalance","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_max_burn_amount","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[]"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[]"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[]"},{"name":"_receiver","type":"address"},{"name":"_claim_admin_fees","type":"bool"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"nonpayable","type":"function","name":"withdraw_admin_fees","inputs":[],"outputs":[]},{"stateMutability":"view","type":"function","name":"last_price","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ema_price","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_p","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"price_oracle","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"D_oracle","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"transfer","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"transferFrom","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"approve","inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"permit","inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_deadline","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"view","type":"function","name":"DOMAIN_SEPARATOR","inputs":[],"outputs":[{"name":"","type":"bytes32"}]},{"stateMutability":"view","type":"function","name":"get_dx","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_dy","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"dx","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"calc_withdraw_one_coin","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_virtual_price","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"calc_token_amount","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_is_deposit","type":"bool"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"A","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"A_precise","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"balances","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_balances","inputs":[],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"stored_rates","inputs":[],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"dynamic_fee","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"ramp_A","inputs":[{"name":"_future_A","type":"uint256"},{"name":"_future_time","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"stop_ramp_A","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_new_fee","inputs":[{"name":"_new_fee","type":"uint256"},{"name":"_new_offpeg_fee_multiplier","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_ma_exp_time","inputs":[{"name":"_ma_exp_time","type":"uint256"},{"name":"_D_ma_time","type":"uint256"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"N_COINS","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"coins","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"fee","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"offpeg_fee_multiplier","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"admin_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"initial_A","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"future_A","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"initial_A_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"future_A_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"admin_balances","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ma_exp_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"D_ma_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ma_last_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"name","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"symbol","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"decimals","inputs":[],"outputs":[{"name":"","type":"uint8"}]},{"stateMutability":"view","type":"function","name":"version","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"balanceOf","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"allowance","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"nonces","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"salt","inputs":[],"outputs":[{"name":"","type":"bytes32"}]}] \ No newline at end of file +[ + { + "name": "Transfer", + "inputs": [ + { + "name": "sender", + "type": "address", + "indexed": true + }, + { + "name": "receiver", + "type": "address", + "indexed": true + }, + { + "name": "value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "Approval", + "inputs": [ + { + "name": "owner", + "type": "address", + "indexed": true + }, + { + "name": "spender", + "type": "address", + "indexed": true + }, + { + "name": "value", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "TokenExchange", + "inputs": [ + { + "name": "buyer", + "type": "address", + "indexed": true + }, + { + "name": "sold_id", + "type": "int128", + "indexed": false + }, + { + "name": "tokens_sold", + "type": "uint256", + "indexed": false + }, + { + "name": "bought_id", + "type": "int128", + "indexed": false + }, + { + "name": "tokens_bought", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "TokenExchangeUnderlying", + "inputs": [ + { + "name": "buyer", + "type": "address", + "indexed": true + }, + { + "name": "sold_id", + "type": "int128", + "indexed": false + }, + { + "name": "tokens_sold", + "type": "uint256", + "indexed": false + }, + { + "name": "bought_id", + "type": "int128", + "indexed": false + }, + { + "name": "tokens_bought", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "AddLiquidity", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true + }, + { + "name": "token_amounts", + "type": "uint256[]", + "indexed": false + }, + { + "name": "fees", + "type": "uint256[]", + "indexed": false + }, + { + "name": "invariant", + "type": "uint256", + "indexed": false + }, + { + "name": "token_supply", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidity", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true + }, + { + "name": "token_amounts", + "type": "uint256[]", + "indexed": false + }, + { + "name": "fees", + "type": "uint256[]", + "indexed": false + }, + { + "name": "token_supply", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityOne", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true + }, + { + "name": "token_id", + "type": "int128", + "indexed": false + }, + { + "name": "token_amount", + "type": "uint256", + "indexed": false + }, + { + "name": "coin_amount", + "type": "uint256", + "indexed": false + }, + { + "name": "token_supply", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RemoveLiquidityImbalance", + "inputs": [ + { + "name": "provider", + "type": "address", + "indexed": true + }, + { + "name": "token_amounts", + "type": "uint256[]", + "indexed": false + }, + { + "name": "fees", + "type": "uint256[]", + "indexed": false + }, + { + "name": "invariant", + "type": "uint256", + "indexed": false + }, + { + "name": "token_supply", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "RampA", + "inputs": [ + { + "name": "old_A", + "type": "uint256", + "indexed": false + }, + { + "name": "new_A", + "type": "uint256", + "indexed": false + }, + { + "name": "initial_time", + "type": "uint256", + "indexed": false + }, + { + "name": "future_time", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "StopRampA", + "inputs": [ + { + "name": "A", + "type": "uint256", + "indexed": false + }, + { + "name": "t", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "name": "ApplyNewFee", + "inputs": [ + { + "name": "fee", + "type": "uint256", + "indexed": false + }, + { + "name": "offpeg_fee_multiplier", + "type": "uint256", + "indexed": false + } + ], + "anonymous": false, + "type": "event" + }, + { + "stateMutability": "nonpayable", + "type": "constructor", + "inputs": [ + { + "name": "_name", + "type": "string" + }, + { + "name": "_symbol", + "type": "string" + }, + { + "name": "_A", + "type": "uint256" + }, + { + "name": "_fee", + "type": "uint256" + }, + { + "name": "_offpeg_fee_multiplier", + "type": "uint256" + }, + { + "name": "_ma_exp_time", + "type": "uint256" + }, + { + "name": "_coins", + "type": "address[]" + }, + { + "name": "_rate_multipliers", + "type": "uint256[]" + }, + { + "name": "_asset_types", + "type": "uint8[]" + }, + { + "name": "_method_ids", + "type": "bytes4[]" + }, + { + "name": "_oracles", + "type": "address[]" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "exchange", + "inputs": [ + { + "name": "i", + "type": "int128" + }, + { + "name": "j", + "type": "int128" + }, + { + "name": "_dx", + "type": "uint256" + }, + { + "name": "_min_dy", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "exchange", + "inputs": [ + { + "name": "i", + "type": "int128" + }, + { + "name": "j", + "type": "int128" + }, + { + "name": "_dx", + "type": "uint256" + }, + { + "name": "_min_dy", + "type": "uint256" + }, + { + "name": "_receiver", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "exchange_received", + "inputs": [ + { + "name": "i", + "type": "int128" + }, + { + "name": "j", + "type": "int128" + }, + { + "name": "_dx", + "type": "uint256" + }, + { + "name": "_min_dy", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "exchange_received", + "inputs": [ + { + "name": "i", + "type": "int128" + }, + { + "name": "j", + "type": "int128" + }, + { + "name": "_dx", + "type": "uint256" + }, + { + "name": "_min_dy", + "type": "uint256" + }, + { + "name": "_receiver", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "add_liquidity", + "inputs": [ + { + "name": "_amounts", + "type": "uint256[]" + }, + { + "name": "_min_mint_amount", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity_one_coin", + "inputs": [ + { + "name": "_burn_amount", + "type": "uint256" + }, + { + "name": "i", + "type": "int128" + }, + { + "name": "_min_received", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity_imbalance", + "inputs": [ + { + "name": "_amounts", + "type": "uint256[]" + }, + { + "name": "_max_burn_amount", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity", + "inputs": [ + { + "name": "_burn_amount", + "type": "uint256" + }, + { + "name": "_min_amounts", + "type": "uint256[]" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "remove_liquidity", + "inputs": [ + { + "name": "_burn_amount", + "type": "uint256" + }, + { + "name": "_min_amounts", + "type": "uint256[]" + }, + { + "name": "_receiver", + "type": "address" + }, + { + "name": "_claim_admin_fees", + "type": "bool" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "withdraw_admin_fees", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "last_price", + "inputs": [ + { + "name": "i", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "ema_price", + "inputs": [ + { + "name": "i", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_p", + "inputs": [ + { + "name": "i", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "price_oracle", + "inputs": [ + { + "name": "i", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "D_oracle", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "transfer", + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "transferFrom", + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "approve", + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "permit", + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + }, + { + "name": "_deadline", + "type": "uint256" + }, + { + "name": "_v", + "type": "uint8" + }, + { + "name": "_r", + "type": "bytes32" + }, + { + "name": "_s", + "type": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "bool" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "DOMAIN_SEPARATOR", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_dx", + "inputs": [ + { + "name": "i", + "type": "int128" + }, + { + "name": "j", + "type": "int128" + }, + { + "name": "dy", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_dy", + "inputs": [ + { + "name": "i", + "type": "int128" + }, + { + "name": "j", + "type": "int128" + }, + { + "name": "dx", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "calc_withdraw_one_coin", + "inputs": [ + { + "name": "_burn_amount", + "type": "uint256" + }, + { + "name": "i", + "type": "int128" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "totalSupply", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_virtual_price", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "calc_token_amount", + "inputs": [ + { + "name": "_amounts", + "type": "uint256[]" + }, + { + "name": "_is_deposit", + "type": "bool" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "A", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "A_precise", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "balances", + "inputs": [ + { + "name": "i", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "get_balances", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "stored_rates", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256[]" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "dynamic_fee", + "inputs": [ + { + "name": "i", + "type": "int128" + }, + { + "name": "j", + "type": "int128" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "ramp_A", + "inputs": [ + { + "name": "_future_A", + "type": "uint256" + }, + { + "name": "_future_time", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "stop_ramp_A", + "inputs": [], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_new_fee", + "inputs": [ + { + "name": "_new_fee", + "type": "uint256" + }, + { + "name": "_new_offpeg_fee_multiplier", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "nonpayable", + "type": "function", + "name": "set_ma_exp_time", + "inputs": [ + { + "name": "_ma_exp_time", + "type": "uint256" + }, + { + "name": "_D_ma_time", + "type": "uint256" + } + ], + "outputs": [] + }, + { + "stateMutability": "view", + "type": "function", + "name": "N_COINS", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "coins", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "address" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "fee", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "offpeg_fee_multiplier", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_fee", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "initial_A", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_A", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "initial_A_time", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "future_A_time", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "admin_balances", + "inputs": [ + { + "name": "arg0", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "ma_exp_time", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "D_ma_time", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "ma_last_time", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "name", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "symbol", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "decimals", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint8" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "version", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "string" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "balanceOf", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "allowance", + "inputs": [ + { + "name": "arg0", + "type": "address" + }, + { + "name": "arg1", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "nonces", + "inputs": [ + { + "name": "arg0", + "type": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "uint256" + } + ] + }, + { + "stateMutability": "view", + "type": "function", + "name": "salt", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ] + } +] \ No newline at end of file diff --git a/src/curve.ts b/src/curve.ts index ad2e2aba..27450351 100644 --- a/src/curve.ts +++ b/src/curve.ts @@ -787,7 +787,7 @@ class Curve implements ICurve { } else { this.constants.STABLE_NG_FACTORY_POOLS_DATA = lowerCasePoolDataAddresses(await getFactoryPoolData.call(this, 0, undefined, this.constants.ALIASES.stable_ng_factory)); } - console.log(this.constants.STABLE_NG_FACTORY_POOLS_DATA) + this.constants.STABLE_NG_FACTORY_POOLS_DATA = await this._filterHiddenPools(this.constants.STABLE_NG_FACTORY_POOLS_DATA); this._updateDecimalsAndGauges(this.constants.STABLE_NG_FACTORY_POOLS_DATA); diff --git a/src/factory/factory-api.ts b/src/factory/factory-api.ts index 64e139cb..2105d9ce 100644 --- a/src/factory/factory-api.ts +++ b/src/factory/factory-api.ts @@ -9,7 +9,7 @@ import { FACTORY_CONSTANTS } from "./constants.js"; import { CRYPTO_FACTORY_CONSTANTS } from "./constants-crypto.js"; import { setFactoryZapContracts } from "./common.js"; import { _getPoolsFromApi } from "../external-api.js"; -import { getPoolName } from "../utils.js"; +import { assetTypeNameHandler, getPoolName } from "../utils.js"; export const lowerCasePoolDataAddresses = (poolsData: IPoolDataFromApi[]): IPoolDataFromApi[] => { for (const poolData of poolsData) { @@ -185,7 +185,7 @@ export async function getFactoryPoolsDataFromApi(this: ICurve, factoryType: IFac name: getPoolName(pool.name), full_name: pool.name, symbol: pool.symbol, - reference_asset: pool.assetTypeName.toUpperCase() as REFERENCE_ASSET, + reference_asset: assetTypeNameHandler(pool.assetTypeName), swap_address: pool.address, token_address: pool.address, gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS, @@ -211,7 +211,7 @@ export async function getFactoryPoolsDataFromApi(this: ICurve, factoryType: IFac name: getPoolName(pool.name), full_name: pool.name, symbol: pool.symbol, - reference_asset: pool.assetTypeName.toUpperCase() as REFERENCE_ASSET, + reference_asset: assetTypeNameHandler(pool.assetTypeName), swap_address: pool.address, token_address: pool.address, gauge_address: pool.gaugeAddress ? pool.gaugeAddress : curve.constants.ZERO_ADDRESS, diff --git a/src/pools/PoolTemplate.ts b/src/pools/PoolTemplate.ts index a77b20af..b39854ac 100644 --- a/src/pools/PoolTemplate.ts +++ b/src/pools/PoolTemplate.ts @@ -387,9 +387,8 @@ export class PoolTemplate { const network = curve.constants.NETWORK_NAME; let poolType = this.isCrypto ? "crypto" : "main"; if (this.id.startsWith("factory")) { - poolType = "factory"; - const factoryType = this.id.split("-")[1]; - if (factoryType !== "v2") poolType += "-" + factoryType; + poolType = this.id.replace(/-\d+$/, ''); + poolType = poolType.replace(/-v2$/, ''); } const poolsData = (await _getPoolsFromApi(network, poolType as IPoolType)).poolData; diff --git a/src/utils.ts b/src/utils.ts index 036e0dfd..a0455b66 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -2,7 +2,7 @@ import axios from 'axios'; import { Contract } from 'ethers'; import { Contract as MulticallContract } from "ethcall"; import BigNumber from 'bignumber.js'; -import { IChainId, IDict, INetworkName, IRewardFromApi } from './interfaces'; +import {IChainId, IDict, INetworkName, IRewardFromApi, REFERENCE_ASSET} from './interfaces'; import { curve, NETWORK_CONSTANTS } from "./curve.js"; import { _getFactoryAPYsAndVolumes, _getLegacyAPYsAndVolumes, _getAllPoolsFromApi, _getSubgraphData } from "./external-api.js"; import ERC20Abi from './constants/abis/ERC20.json' assert { type: 'json' }; @@ -655,4 +655,12 @@ export const getPoolName = (name: string): string => { } else { return separatedName[0].trim() } +} + +export const assetTypeNameHandler = (assetTypeName: string): REFERENCE_ASSET => { + if (assetTypeName.toUpperCase() === 'UNKNOWN') { + return 'OTHER'; + } else { + return assetTypeName.toUpperCase() as REFERENCE_ASSET; + } } \ No newline at end of file diff --git a/test/stats.test.ts b/test/stats.test.ts index 8ced5fe2..37a9b776 100644 --- a/test/stats.test.ts +++ b/test/stats.test.ts @@ -29,7 +29,7 @@ const FACTORY_POOLS_COUNT_POLYGON = 263; const MAIN_POOLS_AVALANCHE = [ 'aave', 'ren', 'atricrypto']; const FACTORY_POOLS_COUNT_AVALANCHE = 81; -const MAIN_POOLS_FANTOM = ['2pool', 'fusdt', 'ren', 'tricrypto', 'ib', 'geist'];; +const MAIN_POOLS_FANTOM = ['2pool', 'fusdt', 'ren', 'tricrypto', 'ib', 'geist']; const FACTORY_POOLS_COUNT_FANTOM = 110; const CRYPTO_FACTORY_POOLS_COUNT_FANTOM = 6; From ded463d86dbd9926e5cf63db3897ba059396a03a Mon Sep 17 00:00:00 2001 From: fedorovdg Date: Mon, 13 Nov 2023 17:58:16 +0400 Subject: [PATCH 2/2] build: v2.51.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a08a2153..5aaa77c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@curvefi/api", - "version": "2.51.0", + "version": "2.51.1", "description": "JavaScript library for curve.fi", "main": "lib/index.js", "author": "Macket",