From 81d883f627a81cefb0832d0b8bd4c7b79f52cfae Mon Sep 17 00:00:00 2001 From: Chef Huan Date: Tue, 23 Apr 2024 10:56:34 +0700 Subject: [PATCH] refactor: Remove unused mappings/abi --- .../arb/abis/StableSwap3PairV2.json | 522 ------------------ .../arb/abis/StableSwapPairV2.json | 522 ------------------ .../arb/mappings/factory.ts | 19 +- ...{stableSwapPairV2.ts => stableSwapPair.ts} | 0 .../arb/mappings/stableSwapPairV3.ts | 90 --- .../arb/mappings/utils/index.ts | 3 - .../exchange-stableswap/arb/subgraph.yaml | 12 +- .../bsc/abis/StableSwap3PairV2.json | 522 ------------------ .../bsc/abis/StableSwapPairV2.json | 522 ------------------ .../bsc/mappings/stableSwapPair.ts | 97 +++- .../bsc/mappings/stableSwapPairV2.ts | 90 --- .../bsc/mappings/stableSwapPairV3.ts | 90 --- .../exchange-stableswap/bsc/subgraph.yaml | 78 +-- 13 files changed, 88 insertions(+), 2479 deletions(-) delete mode 100644 subgraphs/exchange-stableswap/arb/abis/StableSwap3PairV2.json delete mode 100644 subgraphs/exchange-stableswap/arb/abis/StableSwapPairV2.json rename subgraphs/exchange-stableswap/arb/mappings/{stableSwapPairV2.ts => stableSwapPair.ts} (100%) delete mode 100644 subgraphs/exchange-stableswap/arb/mappings/stableSwapPairV3.ts delete mode 100644 subgraphs/exchange-stableswap/bsc/abis/StableSwap3PairV2.json delete mode 100644 subgraphs/exchange-stableswap/bsc/abis/StableSwapPairV2.json delete mode 100644 subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV2.ts delete mode 100644 subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV3.ts diff --git a/subgraphs/exchange-stableswap/arb/abis/StableSwap3PairV2.json b/subgraphs/exchange-stableswap/arb/abis/StableSwap3PairV2.json deleted file mode 100644 index 155876a3..00000000 --- a/subgraphs/exchange-stableswap/arb/abis/StableSwap3PairV2.json +++ /dev/null @@ -1,522 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[3]", "name": "token_amounts", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256[3]", "name": "fees", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "AddLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "CommitNewFee", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "DonateAdminFees", "type": "event" }, - { "anonymous": false, "inputs": [], "name": "Kill", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "NewFee", - "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": "old_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "new_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "initial_time", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "future_time", "type": "uint256" } - ], - "name": "RampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[3]", "name": "token_amounts", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256[3]", "name": "fees", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[3]", "name": "token_amounts", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256[3]", "name": "fees", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidityImbalance", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "index", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_amount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "coin_amount", "type": "uint256" } - ], - "name": "RemoveLiquidityOne", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "RevertParameters", "type": "event" }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "bnb_gas", "type": "uint256" }], - "name": "SetBNBGas", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "t", "type": "uint256" } - ], - "name": "StopRampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "sold_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_sold", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "bought_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_bought", "type": "uint256" } - ], - "name": "TokenExchange", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "Unkill", "type": "event" }, - { - "inputs": [], - "name": "A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ADMIN_ACTIONS_DELAY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FEE_DENOMINATOR", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "KILL_DEADLINE_DT", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_ADMIN_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A_CHANGE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_DECIMAL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_RAMP_TIME", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "N_COINS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRECISION", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "PRECISION_MUL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "RATES", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STABLESWAP_FACTORY", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[3]", "name": "amounts", "type": "uint256[3]" }, - { "internalType": "uint256", "name": "min_mint_amount", "type": "uint256" } - ], - "name": "add_liquidity", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "admin_actions_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "i", "type": "uint256" }], - "name": "admin_balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "apply_new_fee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bnb_gas", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[3]", "name": "amounts", "type": "uint256[3]" }, - { "internalType": "bool", "name": "deposit", "type": "bool" } - ], - "name": "calc_token_amount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" } - ], - "name": "calc_withdraw_one_coin", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "coins", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "new_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "new_admin_fee", "type": "uint256" } - ], - "name": "commit_new_fee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "donate_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" }, - { "internalType": "uint256", "name": "min_dy", "type": "uint256" } - ], - "name": "exchange", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy_underlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "get_virtual_price", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address[3]", "name": "_coins", "type": "address[3]" }, - { "internalType": "uint256", "name": "_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_admin_fee", "type": "uint256" }, - { "internalType": "address", "name": "_owner", "type": "address" }, - { "internalType": "address", "name": "_LP", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "is_killed", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "kill_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "kill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_future_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_future_time", "type": "uint256" } - ], - "name": "ramp_A", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "uint256[3]", "name": "min_amounts", "type": "uint256[3]" } - ], - "name": "remove_liquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[3]", "name": "amounts", "type": "uint256[3]" }, - { "internalType": "uint256", "name": "max_burn_amount", "type": "uint256" } - ], - "name": "remove_liquidity_imbalance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "min_amount", "type": "uint256" } - ], - "name": "remove_liquidity_one_coin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "revert_new_parameters", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "_bnb_gas", "type": "uint256" }], - "name": "set_bnb_gas", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stop_rampget_A", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token", - "outputs": [{ "internalType": "contract IPancakeStableSwapLP", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "unkill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "withdraw_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/subgraphs/exchange-stableswap/arb/abis/StableSwapPairV2.json b/subgraphs/exchange-stableswap/arb/abis/StableSwapPairV2.json deleted file mode 100644 index 807639db..00000000 --- a/subgraphs/exchange-stableswap/arb/abis/StableSwapPairV2.json +++ /dev/null @@ -1,522 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[2]", "name": "token_amounts", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256[2]", "name": "fees", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "AddLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "CommitNewFee", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "DonateAdminFees", "type": "event" }, - { "anonymous": false, "inputs": [], "name": "Kill", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "NewFee", - "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": "old_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "new_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "initial_time", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "future_time", "type": "uint256" } - ], - "name": "RampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[2]", "name": "token_amounts", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256[2]", "name": "fees", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[2]", "name": "token_amounts", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256[2]", "name": "fees", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidityImbalance", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "index", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_amount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "coin_amount", "type": "uint256" } - ], - "name": "RemoveLiquidityOne", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "RevertParameters", "type": "event" }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "bnb_gas", "type": "uint256" }], - "name": "SetBNBGas", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "t", "type": "uint256" } - ], - "name": "StopRampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "sold_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_sold", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "bought_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_bought", "type": "uint256" } - ], - "name": "TokenExchange", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "Unkill", "type": "event" }, - { - "inputs": [], - "name": "A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ADMIN_ACTIONS_DELAY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FEE_DENOMINATOR", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "KILL_DEADLINE_DT", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_ADMIN_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A_CHANGE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_DECIMAL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_RAMP_TIME", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "N_COINS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRECISION", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "PRECISION_MUL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "RATES", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STABLESWAP_FACTORY", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[2]", "name": "amounts", "type": "uint256[2]" }, - { "internalType": "uint256", "name": "min_mint_amount", "type": "uint256" } - ], - "name": "add_liquidity", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "admin_actions_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "i", "type": "uint256" }], - "name": "admin_balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "apply_new_fee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bnb_gas", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[2]", "name": "amounts", "type": "uint256[2]" }, - { "internalType": "bool", "name": "deposit", "type": "bool" } - ], - "name": "calc_token_amount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" } - ], - "name": "calc_withdraw_one_coin", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "coins", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "new_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "new_admin_fee", "type": "uint256" } - ], - "name": "commit_new_fee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "donate_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" }, - { "internalType": "uint256", "name": "min_dy", "type": "uint256" } - ], - "name": "exchange", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy_underlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "get_virtual_price", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address[2]", "name": "_coins", "type": "address[2]" }, - { "internalType": "uint256", "name": "_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_admin_fee", "type": "uint256" }, - { "internalType": "address", "name": "_owner", "type": "address" }, - { "internalType": "address", "name": "_LP", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "is_killed", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "kill_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "kill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_future_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_future_time", "type": "uint256" } - ], - "name": "ramp_A", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "uint256[2]", "name": "min_amounts", "type": "uint256[2]" } - ], - "name": "remove_liquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[2]", "name": "amounts", "type": "uint256[2]" }, - { "internalType": "uint256", "name": "max_burn_amount", "type": "uint256" } - ], - "name": "remove_liquidity_imbalance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "min_amount", "type": "uint256" } - ], - "name": "remove_liquidity_one_coin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "revert_new_parameters", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "_bnb_gas", "type": "uint256" }], - "name": "set_bnb_gas", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stop_rampget_A", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token", - "outputs": [{ "internalType": "contract IPancakeStableSwapLP", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "unkill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "withdraw_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/subgraphs/exchange-stableswap/arb/mappings/factory.ts b/subgraphs/exchange-stableswap/arb/mappings/factory.ts index 4af69ea6..8ae846bb 100644 --- a/subgraphs/exchange-stableswap/arb/mappings/factory.ts +++ b/subgraphs/exchange-stableswap/arb/mappings/factory.ts @@ -1,11 +1,10 @@ /* eslint-disable prefer-const */ import { DataSourceContext, log } from "@graphprotocol/graph-ts"; -import { StableSwapPair as StableSwapPairContract } from "../generated/templates/StableSwapPair/StableSwapPair"; -import { StableSwap3PairV2 as StableSwap3PairV2Contract } from "../generated/templates/StableSwap3PairV2/StableSwap3PairV2"; import { BIG_DECIMAL_ZERO, BIG_INT_ONE, BIG_INT_ZERO, ADDRESS_ZERO } from "./utils"; import { getOrCreateFactory, getOrCreateToken } from "./utils/data"; import { NewStableSwapPair } from "../generated/StableSwapFactory/StableSwapFactory"; -import { ERC20, StableSwapPair } from "../generated/templates"; +import { AbstractStableSwap } from "../generated/StableSwapFactory/AbstractStableSwap"; +import { ERC20, StableSwapNG, StableSwapPair } from "../generated/templates"; import { Pair } from "../generated/schema"; export function handlePairCreated(event: NewStableSwapPair): void { @@ -55,13 +54,15 @@ export function handlePairCreated(event: NewStableSwapPair): void { factory.totalPairs = factory.totalPairs.plus(BIG_INT_ONE); factory.save(); - StableSwapPair.create(event.params.swapContract); + let ssToken = AbstractStableSwap.bind(event.params.swapContract).token(); + let isNGPool = ssToken.equals(event.params.swapContract); + if (isNGPool) { + StableSwapNG.create(event.params.swapContract); + } else { + StableSwapPair.create(event.params.swapContract); + } let context = new DataSourceContext(); context.setString("pairAddress", event.params.swapContract.toHex()); - if (event.params.tokenC.toHex() != ADDRESS_ZERO) { - ERC20.createWithContext(StableSwap3PairV2Contract.bind(event.params.swapContract).token(), context); - } else { - ERC20.createWithContext(StableSwapPairContract.bind(event.params.swapContract).token(), context); - } + ERC20.createWithContext(ssToken, context); } diff --git a/subgraphs/exchange-stableswap/arb/mappings/stableSwapPairV2.ts b/subgraphs/exchange-stableswap/arb/mappings/stableSwapPair.ts similarity index 100% rename from subgraphs/exchange-stableswap/arb/mappings/stableSwapPairV2.ts rename to subgraphs/exchange-stableswap/arb/mappings/stableSwapPair.ts diff --git a/subgraphs/exchange-stableswap/arb/mappings/stableSwapPairV3.ts b/subgraphs/exchange-stableswap/arb/mappings/stableSwapPairV3.ts deleted file mode 100644 index b43e46d3..00000000 --- a/subgraphs/exchange-stableswap/arb/mappings/stableSwapPairV3.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* eslint-disable prefer-const */ -import { log } from "@graphprotocol/graph-ts"; -import { BIG_INT_ONE, BIG_INT_ZERO } from "./utils"; -import { - AddLiquidity, - RemoveLiquidity, - RemoveLiquidityOne, - TokenExchange, -} from "../generated/templates/StableSwap3PairV2/StableSwap3PairV2"; -import { Pair } from "../generated/schema"; -import { BigInt } from "@graphprotocol/graph-ts"; -import { sync } from "./services/sync"; -import { swap, SwapParams } from "./services/swap"; -import { burn } from "./services/burn"; -import { mint } from "./services/mint"; - -export function handleTokenExchange(event: TokenExchange): void { - log.debug("swap for v2 pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - - let soldId = event.params.sold_id.toI32(); - let boughtId = event.params.bought_id.toI32(); - - let amount0In: BigInt; - let amount1In: BigInt; - let amount0Out: BigInt; - let amount1Out: BigInt; - if (soldId == 0) { - amount0In = event.params.tokens_sold; - amount1In = BIG_INT_ZERO; - } else { - amount0In = BIG_INT_ZERO; - amount1In = event.params.tokens_sold; - } - - if (boughtId == 0) { - amount0Out = event.params.tokens_bought; - amount1Out = BIG_INT_ZERO; - } else { - amount0Out = BIG_INT_ZERO; - amount1Out = event.params.tokens_bought; - } - - let params = { - to: event.params.buyer, - sender: event.transaction.from, - amount0In, - amount1In, - amount0Out, - amount1Out, - } as SwapParams; - swap(event, params); -} - -export function handleRemoveLiquidity(event: RemoveLiquidity): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - log.info("Removed liquidity for pair: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - let tokenAmounts: Array = event.params.token_amounts; - burn(event, tokenAmounts[0], tokenAmounts[1], null); -} - -export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - - log.info("Removed liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - if (event.params.index.equals(BIG_INT_ZERO)) { - burn(event, event.params.coin_amount, BIG_INT_ZERO, null); - } else if (event.params.index.equals(BIG_INT_ONE)) { - burn(event, BIG_INT_ZERO, event.params.coin_amount, null); - } -} - -export function handleAddLiquidity(event: AddLiquidity): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - log.info("Added liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - let tokenAmounts: Array = event.params.token_amounts; - mint(event, tokenAmounts[0], tokenAmounts[1], event.params.provider); -} diff --git a/subgraphs/exchange-stableswap/arb/mappings/utils/index.ts b/subgraphs/exchange-stableswap/arb/mappings/utils/index.ts index 02cefdca..61cc14af 100644 --- a/subgraphs/exchange-stableswap/arb/mappings/utils/index.ts +++ b/subgraphs/exchange-stableswap/arb/mappings/utils/index.ts @@ -1,8 +1,5 @@ /* eslint-disable prefer-const */ import { Address, BigDecimal, BigInt } from "@graphprotocol/graph-ts"; -// import { ERC20 } from "../../../exchange/generated/Factory/ERC20"; -// import { ERC20NameBytes } from "../../../exchange/generated/Factory/ERC20NameBytes"; -// import { ERC20SymbolBytes } from "../../../exchange/generated/Factory/ERC20SymbolBytes"; import { PriceLens0 } from "../../generated/StableSwapFactory/PriceLens0"; import { StableSwapFactory } from "../../generated/StableSwapFactory/StableSwapFactory"; import { ERC20 } from "../../generated/StableSwapFactory/ERC20"; diff --git a/subgraphs/exchange-stableswap/arb/subgraph.yaml b/subgraphs/exchange-stableswap/arb/subgraph.yaml index b8b5a164..361bf2ad 100644 --- a/subgraphs/exchange-stableswap/arb/subgraph.yaml +++ b/subgraphs/exchange-stableswap/arb/subgraph.yaml @@ -44,7 +44,7 @@ dataSources: handler: handlePairCreated templates: - kind: ethereum/contract - name: StableSwapPair #Factory + name: StableSwapPair network: arbitrum-one source: abi: StableSwapPair @@ -52,7 +52,7 @@ templates: kind: ethereum/events apiVersion: 0.0.4 language: wasm/assemblyscript - file: ./mappings/stableSwapPairV2.ts + file: ./mappings/stableSwapPair.ts entities: - Pair - Mint @@ -69,8 +69,6 @@ templates: file: ./abis/Pair.json - name: PairV3 file: ./abis/PairV3.json - - name: ERC20 - file: ./abis/ERC20.json - name: PriceLens0 file: ./abis/PriceLens0.json eventHandlers: @@ -102,6 +100,12 @@ templates: file: ./abis/StableSwapFactory.json - name: StableSwapNG file: ./abis/StableSwapNG.json + - name: Factory + file: ./abis/Factory.json + - name: Pair + file: ./abis/Pair.json + - name: PairV3 + file: ./abis/PairV3.json - name: PriceLens0 file: ./abis/PriceLens0.json eventHandlers: diff --git a/subgraphs/exchange-stableswap/bsc/abis/StableSwap3PairV2.json b/subgraphs/exchange-stableswap/bsc/abis/StableSwap3PairV2.json deleted file mode 100644 index 155876a3..00000000 --- a/subgraphs/exchange-stableswap/bsc/abis/StableSwap3PairV2.json +++ /dev/null @@ -1,522 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[3]", "name": "token_amounts", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256[3]", "name": "fees", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "AddLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "CommitNewFee", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "DonateAdminFees", "type": "event" }, - { "anonymous": false, "inputs": [], "name": "Kill", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "NewFee", - "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": "old_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "new_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "initial_time", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "future_time", "type": "uint256" } - ], - "name": "RampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[3]", "name": "token_amounts", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256[3]", "name": "fees", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[3]", "name": "token_amounts", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256[3]", "name": "fees", "type": "uint256[3]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidityImbalance", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "index", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_amount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "coin_amount", "type": "uint256" } - ], - "name": "RemoveLiquidityOne", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "RevertParameters", "type": "event" }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "bnb_gas", "type": "uint256" }], - "name": "SetBNBGas", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "t", "type": "uint256" } - ], - "name": "StopRampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "sold_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_sold", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "bought_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_bought", "type": "uint256" } - ], - "name": "TokenExchange", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "Unkill", "type": "event" }, - { - "inputs": [], - "name": "A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ADMIN_ACTIONS_DELAY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FEE_DENOMINATOR", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "KILL_DEADLINE_DT", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_ADMIN_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A_CHANGE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_DECIMAL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_RAMP_TIME", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "N_COINS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRECISION", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "PRECISION_MUL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "RATES", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STABLESWAP_FACTORY", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[3]", "name": "amounts", "type": "uint256[3]" }, - { "internalType": "uint256", "name": "min_mint_amount", "type": "uint256" } - ], - "name": "add_liquidity", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "admin_actions_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "i", "type": "uint256" }], - "name": "admin_balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "apply_new_fee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bnb_gas", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[3]", "name": "amounts", "type": "uint256[3]" }, - { "internalType": "bool", "name": "deposit", "type": "bool" } - ], - "name": "calc_token_amount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" } - ], - "name": "calc_withdraw_one_coin", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "coins", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "new_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "new_admin_fee", "type": "uint256" } - ], - "name": "commit_new_fee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "donate_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" }, - { "internalType": "uint256", "name": "min_dy", "type": "uint256" } - ], - "name": "exchange", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy_underlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "get_virtual_price", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address[3]", "name": "_coins", "type": "address[3]" }, - { "internalType": "uint256", "name": "_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_admin_fee", "type": "uint256" }, - { "internalType": "address", "name": "_owner", "type": "address" }, - { "internalType": "address", "name": "_LP", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "is_killed", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "kill_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "kill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_future_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_future_time", "type": "uint256" } - ], - "name": "ramp_A", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "uint256[3]", "name": "min_amounts", "type": "uint256[3]" } - ], - "name": "remove_liquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[3]", "name": "amounts", "type": "uint256[3]" }, - { "internalType": "uint256", "name": "max_burn_amount", "type": "uint256" } - ], - "name": "remove_liquidity_imbalance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "min_amount", "type": "uint256" } - ], - "name": "remove_liquidity_one_coin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "revert_new_parameters", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "_bnb_gas", "type": "uint256" }], - "name": "set_bnb_gas", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stop_rampget_A", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token", - "outputs": [{ "internalType": "contract IPancakeStableSwapLP", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "unkill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "withdraw_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/subgraphs/exchange-stableswap/bsc/abis/StableSwapPairV2.json b/subgraphs/exchange-stableswap/bsc/abis/StableSwapPairV2.json deleted file mode 100644 index 807639db..00000000 --- a/subgraphs/exchange-stableswap/bsc/abis/StableSwapPairV2.json +++ /dev/null @@ -1,522 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[2]", "name": "token_amounts", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256[2]", "name": "fees", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "AddLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "CommitNewFee", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "DonateAdminFees", "type": "event" }, - { "anonymous": false, "inputs": [], "name": "Kill", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "fee", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "admin_fee", "type": "uint256" } - ], - "name": "NewFee", - "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": "old_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "new_A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "initial_time", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "future_time", "type": "uint256" } - ], - "name": "RampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[2]", "name": "token_amounts", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256[2]", "name": "fees", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidity", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256[2]", "name": "token_amounts", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256[2]", "name": "fees", "type": "uint256[2]" }, - { "indexed": false, "internalType": "uint256", "name": "invariant", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_supply", "type": "uint256" } - ], - "name": "RemoveLiquidityImbalance", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "provider", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "index", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "token_amount", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "coin_amount", "type": "uint256" } - ], - "name": "RemoveLiquidityOne", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "RevertParameters", "type": "event" }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "bnb_gas", "type": "uint256" }], - "name": "SetBNBGas", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint256", "name": "A", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "t", "type": "uint256" } - ], - "name": "StopRampA", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "buyer", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "sold_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_sold", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "bought_id", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "tokens_bought", "type": "uint256" } - ], - "name": "TokenExchange", - "type": "event" - }, - { "anonymous": false, "inputs": [], "name": "Unkill", "type": "event" }, - { - "inputs": [], - "name": "A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ADMIN_ACTIONS_DELAY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "FEE_DENOMINATOR", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "KILL_DEADLINE_DT", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_ADMIN_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_A_CHANGE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_DECIMAL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MAX_FEE", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_BNB_GAS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MIN_RAMP_TIME", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "N_COINS", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PRECISION", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "PRECISION_MUL", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "RATES", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STABLESWAP_FACTORY", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[2]", "name": "amounts", "type": "uint256[2]" }, - { "internalType": "uint256", "name": "min_mint_amount", "type": "uint256" } - ], - "name": "add_liquidity", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "admin_actions_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "i", "type": "uint256" }], - "name": "admin_balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "apply_new_fee", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "balances", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "bnb_gas", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[2]", "name": "amounts", "type": "uint256[2]" }, - { "internalType": "bool", "name": "deposit", "type": "bool" } - ], - "name": "calc_token_amount", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" } - ], - "name": "calc_withdraw_one_coin", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "coins", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "new_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "new_admin_fee", "type": "uint256" } - ], - "name": "commit_new_fee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "donate_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" }, - { "internalType": "uint256", "name": "min_dy", "type": "uint256" } - ], - "name": "exchange", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_admin_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "future_fee", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "j", "type": "uint256" }, - { "internalType": "uint256", "name": "dx", "type": "uint256" } - ], - "name": "get_dy_underlying", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "get_virtual_price", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initial_A_time", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address[2]", "name": "_coins", "type": "address[2]" }, - { "internalType": "uint256", "name": "_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_admin_fee", "type": "uint256" }, - { "internalType": "address", "name": "_owner", "type": "address" }, - { "internalType": "address", "name": "_LP", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "isInitialized", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "is_killed", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "kill_deadline", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "kill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "owner", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_future_A", "type": "uint256" }, - { "internalType": "uint256", "name": "_future_time", "type": "uint256" } - ], - "name": "ramp_A", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_amount", "type": "uint256" }, - { "internalType": "uint256[2]", "name": "min_amounts", "type": "uint256[2]" } - ], - "name": "remove_liquidity", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256[2]", "name": "amounts", "type": "uint256[2]" }, - { "internalType": "uint256", "name": "max_burn_amount", "type": "uint256" } - ], - "name": "remove_liquidity_imbalance", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_token_amount", "type": "uint256" }, - { "internalType": "uint256", "name": "i", "type": "uint256" }, - { "internalType": "uint256", "name": "min_amount", "type": "uint256" } - ], - "name": "remove_liquidity_one_coin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "revert_new_parameters", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "uint256", "name": "_bnb_gas", "type": "uint256" }], - "name": "set_bnb_gas", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stop_rampget_A", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token", - "outputs": [{ "internalType": "contract IPancakeStableSwapLP", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "unkill_me", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "withdraw_admin_fees", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPair.ts b/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPair.ts index 1e441627..330dc423 100644 --- a/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPair.ts +++ b/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPair.ts @@ -1,49 +1,90 @@ /* eslint-disable prefer-const */ -import { Address, log } from "@graphprotocol/graph-ts"; -import { Pair } from "../generated/schema"; +import { log } from "@graphprotocol/graph-ts"; +import { BIG_INT_ONE, BIG_INT_ZERO } from "./utils"; import { AddLiquidity, RemoveLiquidity, RemoveLiquidityOne, - StableSwapPair, TokenExchange, } from "../generated/templates/StableSwapPair/StableSwapPair"; -import { BIG_DECIMAL_ZERO } from "./utils"; +import { Pair } from "../generated/schema"; +import { BigInt } from "@graphprotocol/graph-ts"; +import { sync } from "./services/sync"; +import { swap, SwapParams } from "./services/swap"; +import { burn } from "./services/burn"; +import { mint } from "./services/mint"; -const updateVirtualPrice = (address: Address): void => { - let pair = Pair.load(address.toHex()); - if (pair === null) { - log.error("Pair not found {}", [address.toHex()]); - return; +export function handleTokenExchange(event: TokenExchange): void { + log.debug("swap for v2 pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); + sync(event.address); + + let soldId = event.params.sold_id.toI32(); + let boughtId = event.params.bought_id.toI32(); + + let amount0In: BigInt; + let amount1In: BigInt; + let amount0Out: BigInt; + let amount1Out: BigInt; + if (soldId == 0) { + amount0In = event.params.tokens_sold; + amount1In = BIG_INT_ZERO; + } else { + amount0In = BIG_INT_ZERO; + amount1In = event.params.tokens_sold; } - let stableSwapPair = StableSwapPair.bind(address); - let virtualPriceResult = stableSwapPair.try_get_virtual_price(); - let vPrice = BIG_DECIMAL_ZERO; - if (virtualPriceResult.reverted) { - log.warning("Unable to fetch virtual price for pair {}", [pair.id]); + + if (boughtId == 0) { + amount0Out = event.params.tokens_bought; + amount1Out = BIG_INT_ZERO; } else { - vPrice = virtualPriceResult.value.toBigDecimal(); + amount0Out = BIG_INT_ZERO; + amount1Out = event.params.tokens_bought; } - pair.virtualPrice = vPrice; - pair.save(); -}; -export function handleAddLiquidity(event: AddLiquidity): void { - log.info("handleAddLiquidity. address: {}", [event.address.toHex()]); - updateVirtualPrice(event.address); + let params = { + to: event.params.buyer, + sender: event.transaction.from, + amount0In, + amount1In, + amount0Out, + amount1Out, + } as SwapParams; + swap(event, params); } export function handleRemoveLiquidity(event: RemoveLiquidity): void { - log.info("handleRemoveLiquidity. address: {}", [event.address.toHex()]); - updateVirtualPrice(event.address); + let pair = Pair.load(event.address.toHexString()); + if (!pair) { + return; + } + log.info("Removed liquidity for pair: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); + sync(event.address); + let tokenAmounts: Array = event.params.token_amounts; + burn(event, tokenAmounts[0], tokenAmounts[1], null); } export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void { - log.info("handleRemoveLiquidityOne. address: {}", [event.address.toHex()]); - updateVirtualPrice(event.address); + let pair = Pair.load(event.address.toHexString()); + if (!pair) { + return; + } + + log.info("Removed liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); + sync(event.address); + if (event.params.index.equals(BIG_INT_ZERO)) { + burn(event, event.params.coin_amount, BIG_INT_ZERO, null); + } else if (event.params.index.equals(BIG_INT_ONE)) { + burn(event, BIG_INT_ZERO, event.params.coin_amount, null); + } } -export function handleTokenExchange(event: TokenExchange): void { - log.info("handleTokenExchange. address: {}", [event.address.toHex()]); - updateVirtualPrice(event.address); +export function handleAddLiquidity(event: AddLiquidity): void { + let pair = Pair.load(event.address.toHexString()); + if (!pair) { + return; + } + log.info("Added liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); + sync(event.address); + let tokenAmounts: Array = event.params.token_amounts; + mint(event, tokenAmounts[0], tokenAmounts[1], event.params.provider); } diff --git a/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV2.ts b/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV2.ts deleted file mode 100644 index 330dc423..00000000 --- a/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV2.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* eslint-disable prefer-const */ -import { log } from "@graphprotocol/graph-ts"; -import { BIG_INT_ONE, BIG_INT_ZERO } from "./utils"; -import { - AddLiquidity, - RemoveLiquidity, - RemoveLiquidityOne, - TokenExchange, -} from "../generated/templates/StableSwapPair/StableSwapPair"; -import { Pair } from "../generated/schema"; -import { BigInt } from "@graphprotocol/graph-ts"; -import { sync } from "./services/sync"; -import { swap, SwapParams } from "./services/swap"; -import { burn } from "./services/burn"; -import { mint } from "./services/mint"; - -export function handleTokenExchange(event: TokenExchange): void { - log.debug("swap for v2 pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - - let soldId = event.params.sold_id.toI32(); - let boughtId = event.params.bought_id.toI32(); - - let amount0In: BigInt; - let amount1In: BigInt; - let amount0Out: BigInt; - let amount1Out: BigInt; - if (soldId == 0) { - amount0In = event.params.tokens_sold; - amount1In = BIG_INT_ZERO; - } else { - amount0In = BIG_INT_ZERO; - amount1In = event.params.tokens_sold; - } - - if (boughtId == 0) { - amount0Out = event.params.tokens_bought; - amount1Out = BIG_INT_ZERO; - } else { - amount0Out = BIG_INT_ZERO; - amount1Out = event.params.tokens_bought; - } - - let params = { - to: event.params.buyer, - sender: event.transaction.from, - amount0In, - amount1In, - amount0Out, - amount1Out, - } as SwapParams; - swap(event, params); -} - -export function handleRemoveLiquidity(event: RemoveLiquidity): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - log.info("Removed liquidity for pair: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - let tokenAmounts: Array = event.params.token_amounts; - burn(event, tokenAmounts[0], tokenAmounts[1], null); -} - -export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - - log.info("Removed liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - if (event.params.index.equals(BIG_INT_ZERO)) { - burn(event, event.params.coin_amount, BIG_INT_ZERO, null); - } else if (event.params.index.equals(BIG_INT_ONE)) { - burn(event, BIG_INT_ZERO, event.params.coin_amount, null); - } -} - -export function handleAddLiquidity(event: AddLiquidity): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - log.info("Added liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - let tokenAmounts: Array = event.params.token_amounts; - mint(event, tokenAmounts[0], tokenAmounts[1], event.params.provider); -} diff --git a/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV3.ts b/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV3.ts deleted file mode 100644 index a0247c7c..00000000 --- a/subgraphs/exchange-stableswap/bsc/mappings/stableSwapPairV3.ts +++ /dev/null @@ -1,90 +0,0 @@ -/* eslint-disable prefer-const */ -import { log } from "@graphprotocol/graph-ts"; -import { BIG_INT_ONE, BIG_INT_ZERO } from "./utils"; -import { - AddLiquidity, - RemoveLiquidity, - RemoveLiquidityOne, - TokenExchange, -} from "../generated/templates/StableSwapPairV2/StableSwapPairV2"; -import { Pair } from "../generated/schema"; -import { BigInt } from "@graphprotocol/graph-ts"; -import { sync } from "./services/sync"; -import { swap, SwapParams } from "./services/swap"; -import { burn } from "./services/burn"; -import { mint } from "./services/mint"; - -export function handleTokenExchange(event: TokenExchange): void { - log.debug("swap for v2 pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - - let soldId = event.params.sold_id.toI32(); - let boughtId = event.params.bought_id.toI32(); - - let amount0In: BigInt; - let amount1In: BigInt; - let amount0Out: BigInt; - let amount1Out: BigInt; - if (soldId == 0) { - amount0In = event.params.tokens_sold; - amount1In = BIG_INT_ZERO; - } else { - amount0In = BIG_INT_ZERO; - amount1In = event.params.tokens_sold; - } - - if (boughtId == 0) { - amount0Out = event.params.tokens_bought; - amount1Out = BIG_INT_ZERO; - } else { - amount0Out = BIG_INT_ZERO; - amount1Out = event.params.tokens_bought; - } - - let params = { - to: event.params.buyer, - sender: event.transaction.from, - amount0In, - amount1In, - amount0Out, - amount1Out, - } as SwapParams; - swap(event, params); -} - -export function handleRemoveLiquidity(event: RemoveLiquidity): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - log.info("Removed liquidity for pair: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - let tokenAmounts: Array = event.params.token_amounts; - burn(event, tokenAmounts[0], tokenAmounts[1], null); -} - -export function handleRemoveLiquidityOne(event: RemoveLiquidityOne): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - - log.info("Removed liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - if (event.params.index.equals(BIG_INT_ZERO)) { - burn(event, event.params.coin_amount, BIG_INT_ZERO, null); - } else if (event.params.index.equals(BIG_INT_ONE)) { - burn(event, BIG_INT_ZERO, event.params.coin_amount, null); - } -} - -export function handleAddLiquidity(event: AddLiquidity): void { - let pair = Pair.load(event.address.toHexString()); - if (!pair) { - return; - } - log.info("Added liquidity for pool: {} at {}", [event.address.toHexString(), event.transaction.hash.toHexString()]); - sync(event.address); - let tokenAmounts: Array = event.params.token_amounts; - mint(event, tokenAmounts[0], tokenAmounts[1], event.params.provider); -} diff --git a/subgraphs/exchange-stableswap/bsc/subgraph.yaml b/subgraphs/exchange-stableswap/bsc/subgraph.yaml index 83f4c8ef..a9d0760e 100644 --- a/subgraphs/exchange-stableswap/bsc/subgraph.yaml +++ b/subgraphs/exchange-stableswap/bsc/subgraph.yaml @@ -58,7 +58,7 @@ templates: kind: ethereum/events apiVersion: 0.0.4 language: wasm/assemblyscript - file: ./mappings/stableSwapPairV2.ts + file: ./mappings/stableSwapPair.ts entities: - Pair - Mint @@ -86,80 +86,6 @@ templates: handler: handleRemoveLiquidityOne - event: TokenExchange(indexed address,uint256,uint256,uint256,uint256) handler: handleTokenExchange - - kind: ethereum/contract - name: StableSwapPairV2 - network: bsc - source: - abi: StableSwapPairV2 - mapping: - kind: ethereum/events - apiVersion: 0.0.4 - language: wasm/assemblyscript - file: ./mappings/stableSwapPairV3.ts - entities: - - Pair - - Mint - - Burn - - Transaction - abis: - - name: StableSwapFactory - file: ./abis/StableSwapFactory.json - - name: StableSwapPairV2 - file: ./abis/StableSwapPairV2.json - - name: Factory - file: ./abis/Factory.json - - name: Pair - file: ./abis/Pair.json - - name: PairV3 - file: ./abis/PairV3.json - - name: PriceLens0 - file: ./abis/PriceLens0.json - eventHandlers: - - event: AddLiquidity(indexed address,uint256[2],uint256[2],uint256,uint256) - handler: handleAddLiquidity - - event: RemoveLiquidity(indexed address,uint256[2],uint256[2],uint256) - handler: handleRemoveLiquidity - - event: RemoveLiquidityOne(indexed address,uint256,uint256,uint256) - handler: handleRemoveLiquidityOne - - event: TokenExchange(indexed address,uint256,uint256,uint256,uint256) - handler: handleTokenExchange - - kind: ethereum/contract - name: StableSwap3PairV2 - network: bsc - source: - abi: StableSwap3PairV2 - mapping: - kind: ethereum/events - apiVersion: 0.0.4 - language: wasm/assemblyscript - file: ./mappings/stableSwapPairV3.ts - entities: - - Pair - - Mint - - Burn - - Transaction - abis: - - name: StableSwapFactory - file: ./abis/StableSwapFactory.json - - name: StableSwap3PairV2 - file: ./abis/StableSwap3PairV2.json - - name: Factory - file: ./abis/Factory.json - - name: Pair - file: ./abis/Pair.json - - name: PairV3 - file: ./abis/PairV3.json - - name: PriceLens0 - file: ./abis/PriceLens0.json - eventHandlers: - - event: AddLiquidity(indexed address,uint256[3],uint256[3],uint256,uint256) - handler: handleTriAddLiquidity - - event: RemoveLiquidity(indexed address,uint256[3],uint256[3],uint256) - handler: handleTriRemoveLiquidity - - event: RemoveLiquidityOne(indexed address,uint256,uint256,uint256) - handler: handleTriRemoveLiquidityOne - - event: TokenExchange(indexed address,uint256,uint256,uint256,uint256) - handler: handleTriTokenExchange - kind: ethereum/contract name: StableSwapNG network: bsc @@ -180,14 +106,12 @@ templates: file: ./abis/StableSwapFactory.json - name: StableSwapNG file: ./abis/StableSwapNG.json - - name: Factory file: ./abis/Factory.json - name: Pair file: ./abis/Pair.json - name: PairV3 file: ./abis/PairV3.json - - name: PriceLens0 file: ./abis/PriceLens0.json eventHandlers: