diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 473f6f4..45b54f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,10 +2,9 @@ name: Megagraph CI on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] - + branches: [master] jobs: build: @@ -17,7 +16,7 @@ jobs: uses: actions/cache@v2 id: cache with: - path: '**/node_modules' + path: "**/node_modules" key: npm-v2-${{ hashFiles('**/yarn.lock') }} restore-keys: npm-v2- - name: Install @@ -124,6 +123,11 @@ jobs: env: ADAPTER: Mai CONFIG: polygon + - name: Build Pangolin (Avalanche) + run: yarn build:dev + env: + ADAPTER: Pangolin + CONFIG: avalanche - name: Build QuickSwap (Polygon) run: yarn build:dev env: diff --git a/src/Pangolin/abis/ERC20.json b/src/Pangolin/abis/ERC20.json new file mode 100644 index 0000000..405d6b3 --- /dev/null +++ b/src/Pangolin/abis/ERC20.json @@ -0,0 +1,222 @@ +[ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_spender", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_from", + "type": "address" + }, + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "_to", + "type": "address" + }, + { + "name": "_value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + }, + { + "name": "_spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "payable": true, + "stateMutability": "payable", + "type": "fallback" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "from", + "type": "address" + }, + { + "indexed": true, + "name": "to", + "type": "address" + }, + { + "indexed": false, + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + } +] diff --git a/src/Pangolin/abis/Factory.json b/src/Pangolin/abis/Factory.json new file mode 100644 index 0000000..792261a --- /dev/null +++ b/src/Pangolin/abis/Factory.json @@ -0,0 +1,97 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "_feeToSetter", "type": "address" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "token0", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "token1", "type": "address" }, + { "indexed": false, "internalType": "address", "name": "pair", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "PairCreated", + "type": "event" + }, + { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allPairs", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "allPairsLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "tokenA", "type": "address" }, + { "internalType": "address", "name": "tokenB", "type": "address" } + ], + "name": "createPair", + "outputs": [{ "internalType": "address", "name": "pair", "type": "address" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeTo", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "feeToSetter", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "getPair", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "_feeTo", "type": "address" }], + "name": "setFeeTo", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "_feeToSetter", "type": "address" }], + "name": "setFeeToSetter", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/Pangolin/abis/MiniChefV2.json b/src/Pangolin/abis/MiniChefV2.json new file mode 100644 index 0000000..8cc2669 --- /dev/null +++ b/src/Pangolin/abis/MiniChefV2.json @@ -0,0 +1,489 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_rewardToken", "type": "address" }, + { "internalType": "address", "name": "_firstOwner", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" } + ], + "name": "Deposit", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" } + ], + "name": "EmergencyWithdraw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "funder", "type": "address" }], + "name": "FunderAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "funder", "type": "address" }], + "name": "FunderRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Harvest", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "rewardPerSecond", "type": "uint256" }], + "name": "LogRewardPerSecond", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "rewardsExpiration", "type": "uint256" }], + "name": "LogRewardsExpiration", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "pid", "type": "uint256" }], + "name": "Migrate", + "type": "event" + }, + { "anonymous": false, "inputs": [], "name": "MigratorDisabled", "type": "event" }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "address", "name": "migrator", "type": "address" }], + "name": "MigratorSet", + "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": true, "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, + { "indexed": true, "internalType": "contract IERC20", "name": "lpToken", "type": "address" }, + { "indexed": true, "internalType": "contract IRewarder", "name": "rewarder", "type": "address" } + ], + "name": "PoolAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, + { "indexed": true, "internalType": "contract IRewarder", "name": "rewarder", "type": "address" }, + { "indexed": false, "internalType": "bool", "name": "overwrite", "type": "bool" } + ], + "name": "PoolSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "indexed": false, "internalType": "uint64", "name": "lastRewardTime", "type": "uint64" }, + { "indexed": false, "internalType": "uint256", "name": "lpSupply", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "accRewardPerShare", "type": "uint256" } + ], + "name": "PoolUpdate", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": true, "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" } + ], + "name": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "REWARD", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_funder", "type": "address" }], + "name": "addFunder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_allocPoint", "type": "uint256" }, + { "internalType": "contract IERC20", "name": "_lpToken", "type": "address" }, + { "internalType": "contract IRewarder", "name": "_rewarder", "type": "address" } + ], + "name": "addPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256[]", "name": "_allocPoints", "type": "uint256[]" }, + { "internalType": "contract IERC20[]", "name": "_lpTokens", "type": "address[]" }, + { "internalType": "contract IRewarder[]", "name": "_rewarders", "type": "address[]" } + ], + "name": "addPools", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "addedTokens", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "depositWithPermit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "disableMigrator", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "emergencyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "extension", "type": "uint256" }, + { "internalType": "uint256", "name": "maxFunding", "type": "uint256" } + ], + "name": "extendRewardsViaDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "funding", "type": "uint256" }, + { "internalType": "uint256", "name": "minExtension", "type": "uint256" } + ], + "name": "extendRewardsViaFunding", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "funding", "type": "uint256" }, + { "internalType": "uint256", "name": "duration", "type": "uint256" } + ], + "name": "fundRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "harvest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_funder", "type": "address" }], + "name": "isFunder", + "outputs": [{ "internalType": "bool", "name": "allowed", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "lpToken", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lpTokens", + "outputs": [{ "internalType": "contract IERC20[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "massUpdateAllPools", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "uint256[]", "name": "pids", "type": "uint256[]" }], + "name": "massUpdatePools", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_pid", "type": "uint256" }], + "name": "migrate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "migrationDisabled", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "migrator", + "outputs": [{ "internalType": "contract IMigratorChef", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "address", "name": "_user", "type": "address" } + ], + "name": "pendingReward", + "outputs": [{ "internalType": "uint256", "name": "pending", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "poolInfo", + "outputs": [ + { "internalType": "uint128", "name": "accRewardPerShare", "type": "uint128" }, + { "internalType": "uint64", "name": "lastRewardTime", "type": "uint64" }, + { "internalType": "uint64", "name": "allocPoint", "type": "uint64" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolInfos", + "outputs": [ + { + "components": [ + { "internalType": "uint128", "name": "accRewardPerShare", "type": "uint128" }, + { "internalType": "uint64", "name": "lastRewardTime", "type": "uint64" }, + { "internalType": "uint64", "name": "allocPoint", "type": "uint64" } + ], + "internalType": "struct MiniChefV2.PoolInfo[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolLength", + "outputs": [{ "internalType": "uint256", "name": "pools", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "_funder", "type": "address" }], + "name": "removeFunder", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [{ "internalType": "uint256", "name": "duration", "type": "uint256" }], + "name": "resetRewardsDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerSecond", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "rewarder", + "outputs": [{ "internalType": "contract IRewarder", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsExpiration", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "contract IMigratorChef", "name": "_migrator", "type": "address" }], + "name": "setMigrator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "_pid", "type": "uint256" }, + { "internalType": "uint256", "name": "_allocPoint", "type": "uint256" }, + { "internalType": "contract IRewarder", "name": "_rewarder", "type": "address" }, + { "internalType": "bool", "name": "overwrite", "type": "bool" } + ], + "name": "setPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256[]", "name": "pids", "type": "uint256[]" }, + { "internalType": "uint256[]", "name": "allocPoints", "type": "uint256[]" }, + { "internalType": "contract IRewarder[]", "name": "rewarders", "type": "address[]" }, + { "internalType": "bool[]", "name": "overwrites", "type": "bool[]" } + ], + "name": "setPools", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalAllocPoint", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "pid", "type": "uint256" }], + "name": "updatePool", + "outputs": [ + { + "components": [ + { "internalType": "uint128", "name": "accRewardPerShare", "type": "uint128" }, + { "internalType": "uint64", "name": "lastRewardTime", "type": "uint64" }, + { "internalType": "uint64", "name": "allocPoint", "type": "uint64" } + ], + "internalType": "struct MiniChefV2.PoolInfo", + "name": "pool", + "type": "tuple" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "userInfo", + "outputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "int256", "name": "rewardDebt", "type": "int256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "pid", "type": "uint256" }, + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" } + ], + "name": "withdrawAndHarvest", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/Pangolin/abis/Pair.json b/src/Pangolin/abis/Pair.json new file mode 100644 index 0000000..809791b --- /dev/null +++ b/src/Pangolin/abis/Pair.json @@ -0,0 +1,345 @@ +[ + { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" } + ], + "name": "Burn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" } + ], + "name": "Swap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, + { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } + ], + "name": "Sync", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MINIMUM_LIQUIDITY", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "address", "name": "", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "burn", + "outputs": [ + { "internalType": "uint256", "name": "amount0", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1", "type": "uint256" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "factory", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, + { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, + { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "_token0", "type": "address" }, + { "internalType": "address", "name": "_token1", "type": "address" } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "kLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "mint", + "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price0CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "price1CumulativeLast", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], + "name": "skim", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, + { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "bytes", "name": "data", "type": "bytes" } + ], + "name": "swap", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "sync", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "from", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "value", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/Pangolin/abis/PngToken.json b/src/Pangolin/abis/PngToken.json new file mode 100644 index 0000000..b309ff2 --- /dev/null +++ b/src/Pangolin/abis/PngToken.json @@ -0,0 +1,274 @@ +[ + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "delegator", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "fromDelegate", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "toDelegate", "type": "address" } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "delegate", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "previousBalance", "type": "uint256" }, + { "indexed": false, "internalType": "uint256", "name": "newBalance", "type": "uint256" } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, + { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Transfer", + "type": "event" + }, + { + "constant": true, + "inputs": [], + "name": "DELEGATION_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "DOMAIN_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "PERMIT_TYPEHASH", + "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" } + ], + "name": "allowance", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "approve", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "", "type": "address" }, + { "internalType": "uint32", "name": "", "type": "uint32" } + ], + "name": "checkpoints", + "outputs": [ + { "internalType": "uint32", "name": "fromBlock", "type": "uint32" }, + { "internalType": "uint96", "name": "votes", "type": "uint96" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "internalType": "address", "name": "delegatee", "type": "address" }], + "name": "delegate", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "delegatee", "type": "address" }, + { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { "internalType": "uint256", "name": "expiry", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "delegateBySig", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "delegates", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "getCurrentVotes", + "outputs": [{ "internalType": "uint96", "name": "", "type": "uint96" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "internalType": "address", "name": "account", "type": "address" }, + { "internalType": "uint256", "name": "blockNumber", "type": "uint256" } + ], + "name": "getPriorVotes", + "outputs": [{ "internalType": "uint96", "name": "", "type": "uint96" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "nonces", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "numCheckpoints", + "outputs": [{ "internalType": "uint32", "name": "", "type": "uint32" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "owner", "type": "address" }, + { "internalType": "address", "name": "spender", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "permit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [{ "internalType": "string", "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "transfer", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "internalType": "address", "name": "src", "type": "address" }, + { "internalType": "address", "name": "dst", "type": "address" }, + { "internalType": "uint256", "name": "rawAmount", "type": "uint256" } + ], + "name": "transferFrom", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/Pangolin/abis/RewarderViaMultiplier.json b/src/Pangolin/abis/RewarderViaMultiplier.json new file mode 100644 index 0000000..b7c000c --- /dev/null +++ b/src/Pangolin/abis/RewarderViaMultiplier.json @@ -0,0 +1,81 @@ +[ + { + "inputs": [ + { "internalType": "contract IERC20[]", "name": "_rewardTokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "_rewardMultipliers", "type": "uint256[]" }, + { "internalType": "uint256", "name": "_baseRewardTokenDecimals", "type": "uint256" }, + { "internalType": "address", "name": "_chefV2", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "getRewardMultipliers", + "outputs": [{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRewardTokens", + "outputs": [{ "internalType": "contract IERC20[]", "name": "", "type": "address[]" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "address", "name": "to", "type": "address" }, + { "internalType": "uint256", "name": "rewardAmount", "type": "uint256" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "name": "onReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "rewardAmount", "type": "uint256" } + ], + "name": "pendingTokens", + "outputs": [ + { "internalType": "contract IERC20[]", "name": "tokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "address", "name": "user", "type": "address" }, + { "internalType": "uint256", "name": "rewardAmount", "type": "uint256" } + ], + "name": "pendingTokensDebt", + "outputs": [ + { "internalType": "contract IERC20[]", "name": "tokens", "type": "address[]" }, + { "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "rewardMultipliers", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "rewardTokens", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +] diff --git a/src/Pangolin/abis/StakingRewards.json b/src/Pangolin/abis/StakingRewards.json new file mode 100644 index 0000000..9ebb02a --- /dev/null +++ b/src/Pangolin/abis/StakingRewards.json @@ -0,0 +1,240 @@ +[ + { + "inputs": [ + { "internalType": "address", "name": "_rewardsToken", "type": "address" }, + { "internalType": "address", "name": "_stakingToken", "type": "address" } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "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": "address", "name": "token", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "reward", "type": "uint256" }], + "name": "RewardAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "reward", "type": "uint256" } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "internalType": "uint256", "name": "newDuration", "type": "uint256" }], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "internalType": "address", "name": "user", "type": "address" }, + { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "balanceOf", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], + "name": "earned", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { "inputs": [], "name": "exit", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { "inputs": [], "name": "getReward", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "getRewardForDuration", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTimeRewardApplicable", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastUpdateTime", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "reward", "type": "uint256" }], + "name": "notifyRewardAmount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "tokenAddress", "type": "address" }, + { "internalType": "uint256", "name": "tokenAmount", "type": "uint256" } + ], + "name": "recoverERC20", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { "inputs": [], "name": "renounceOwnership", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "rewardPerToken", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerTokenStored", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRate", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "rewards", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsDuration", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardsToken", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "_rewardsDuration", "type": "uint256" }], + "name": "setRewardsDuration", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "uint256", "name": "amount", "type": "uint256" }, + { "internalType": "uint256", "name": "deadline", "type": "uint256" }, + { "internalType": "uint8", "name": "v", "type": "uint8" }, + { "internalType": "bytes32", "name": "r", "type": "bytes32" }, + { "internalType": "bytes32", "name": "s", "type": "bytes32" } + ], + "name": "stakeWithPermit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "stakingToken", + "outputs": [{ "internalType": "contract IERC20", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "newOwner", "type": "address" }], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "name": "userRewardPerTokenPaid", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/Pangolin/config/avalanche.json b/src/Pangolin/config/avalanche.json new file mode 100644 index 0000000..62aa912 --- /dev/null +++ b/src/Pangolin/config/avalanche.json @@ -0,0 +1,85 @@ +{ + "network": "avalanche", + "adapter": "Pangolin", + "contracts": [ + { + "contract": "StakingRewards", + "abis": ["StakingRewards", "Pair", "PngToken"], + "entities": ["PangolinStakingData"], + "events": [ + { + "event-name": "Staked", + "event-params": "(indexed address,uint256)" + }, + { + "event-name": "Withdrawn", + "event-params": "(indexed address,uint256)" + } + ], + "instances": [ + { + "symbol": "", + "address": "0x88afdaE1a9F58Da3E68584421937E5F564A0135b", + "startBlock": 7689920 + } + ] + }, + { + "contract": "MiniChefV2", + "abis": ["MiniChefV2", "RewarderViaMultiplier"], + "entities": ["PangolinFarmData"], + "events": [ + { + "event-name": "PoolUpdate", + "event-params": "(indexed uint256,uint64,uint256,uint256)" + }, + { + "event-name": "PoolSet", + "event-params": "(indexed uint256,uint256,indexed address,bool)" + }, + { + "event-name": "PoolAdded", + "event-params": "(indexed uint256,uint256,indexed address,indexed address)" + } + ], + "instances": [ + { + "symbol": "", + "address": "0x1f806f7C8dED893fd3caE279191ad7Aa3798E928", + "startBlock": 6987996 + } + ] + }, + { + "contract": "Factory", + "abis": ["Factory", "Pair"], + "entities": ["PangolinSwapPair"], + "events": [ + { + "event-name": "PairCreated", + "event-params": "(indexed address,indexed address,address,uint256)" + } + ], + "instances": [ + { + "symbol": "", + "address": "0xefa94DE7a4656D787667C749f7E1223D71E9FD88", + "startBlock": 56877 + } + ] + } + ], + "templates": [ + { + "name": "Pair", + "abis": ["Pair", "Factory", "ERC20"], + "entities": ["PangolinSwapData"], + "events": [ + { + "event-name": "Swap", + "event-params": "(indexed address,uint256,uint256,uint256,uint256,indexed address)" + } + ] + } + ] +} diff --git a/src/Pangolin/mappings/Factory.ts b/src/Pangolin/mappings/Factory.ts new file mode 100644 index 0000000..99464ca --- /dev/null +++ b/src/Pangolin/mappings/Factory.ts @@ -0,0 +1,8 @@ +import { log } from "@graphprotocol/graph-ts"; +import { PangolinPair as PairTemplate } from "../../../generated/templates"; +import { PairCreated as PairCreatedEvent } from "../../../generated/PangolinFactory/PangolinFactory"; + +export function handlePairCreated(event: PairCreatedEvent): void { + log.info("handling create pool. pair: {}", [event.params.pair.toHex()]); + PairTemplate.create(event.params.pair); +} diff --git a/src/Pangolin/mappings/MiniChefV2.ts b/src/Pangolin/mappings/MiniChefV2.ts new file mode 100644 index 0000000..230d6d9 --- /dev/null +++ b/src/Pangolin/mappings/MiniChefV2.ts @@ -0,0 +1,33 @@ +import { + PoolAdded as PoolAddedEvent, + PoolSet as PoolSetEvent, + PoolUpdate as PoolUpdateEvent, +} from "../../../generated/PangolinMiniChefV2/PangolinMiniChefV2"; +import { handleFarmEvent } from "./handleFarmEntity"; + +export function handlePoolAdded(event: PoolAddedEvent): void { + let txnHash = event.transaction.hash; + let blockNumber = event.block.number; + let timestamp = event.block.timestamp; + let poolId = event.params.pid; + let lpToken = event.params.lpToken; + let eventType = "PoolAdded"; + handleFarmEvent(txnHash, blockNumber, timestamp, poolId, eventType, lpToken); +} +export function handlePoolSet(event: PoolSetEvent): void { + let txnHash = event.transaction.hash; + let blockNumber = event.block.number; + let timestamp = event.block.timestamp; + let poolId = event.params.pid; + let eventType = "PoolSet"; + handleFarmEvent(txnHash, blockNumber, timestamp, poolId, eventType, null); +} +export function handlePoolUpdate(event: PoolUpdateEvent): void { + let txnHash = event.transaction.hash; + let blockNumber = event.block.number; + let timestamp = event.block.timestamp; + let poolId = event.params.pid; + let eventType = "PoolUpdate"; + let lpSupply = event.params.lpSupply; + handleFarmEvent(txnHash, blockNumber, timestamp, poolId, eventType, null); +} diff --git a/src/Pangolin/mappings/Pair.ts b/src/Pangolin/mappings/Pair.ts new file mode 100644 index 0000000..d747a76 --- /dev/null +++ b/src/Pangolin/mappings/Pair.ts @@ -0,0 +1,85 @@ +import { Swap as SwapEvent } from "../../../generated/templates/PangolinPair/PangolinPair"; +import { Address, BigInt, log } from "@graphprotocol/graph-ts"; +import { PangolinSwapData, PangolinSwapPair } from "../../../generated/schema"; +import { PangolinPair as PairContract } from "../../../generated/templates/PangolinPair/PangolinPair"; +import { PangolinERC20 as ERC20Contract } from "../../../generated/templates/PangolinPair/PangolinERC20"; + +import { convertBINumToDesiredDecimals } from "../../utils/converters"; + +export function handleSwap(event: SwapEvent): void { + let entity = PangolinSwapData.load(event.transaction.hash.toHex()); + if (!entity) entity = new PangolinSwapData(event.transaction.hash.toHex()); + + entity.blockNumber = event.block.number; + entity.blockTimestamp = event.block.timestamp; + let pair = getPair(event.address); + + let token0In = convertBINumToDesiredDecimals(event.params.amount0In, pair.token0Decimals.toI32()); + let token1In = convertBINumToDesiredDecimals(event.params.amount1In, pair.token1Decimals.toI32()); + let token0Out = convertBINumToDesiredDecimals(event.params.amount0Out, pair.token0Decimals.toI32()); + let token1Out = convertBINumToDesiredDecimals(event.params.amount1Out, pair.token1Decimals.toI32()); + + // calculate volumes + entity.token0Vol = token0Out.plus(token0In); + entity.token1Vol = token1Out.plus(token1In); + + entity.pair = pair.id; + entity.save(); +} + +export function getPair(address: Address): PangolinSwapPair | null { + let pair = PangolinSwapPair.load(address.toHex()); + + if (pair === null) { + let pairContract = PairContract.bind(address); + pair = new PangolinSwapPair(address.toHex()); + + let token0AddresResult = pairContract.try_token0(); + if (token0AddresResult.reverted) { + log.warning("try_token0() reverted", []); + return null; + } else { + pair.token0Address = token0AddresResult.value; + pair = updatePairTokens(pair as PangolinSwapPair, token0AddresResult.value, null); + } + let token1AddresResult = pairContract.try_token1(); + if (token1AddresResult.reverted) { + log.warning("try_token1() reverted", []); + return null; + } else { + pair.token1Address = token1AddresResult.value; + pair = updatePairTokens(pair as PangolinSwapPair, null, token1AddresResult.value); + } + pair.name = pair.token0Symbol.concat("-").concat(pair.token1Symbol); + + pair.save(); + } + + return pair as PangolinSwapPair; +} +function updatePairTokens(pair: PangolinSwapPair, token0: Address, token1: Address): PangolinSwapPair { + let tokenAddress = token0 == null ? token1 : token0; + + let tokenContract = ERC20Contract.bind(tokenAddress); + let tokenSymbolResult = tokenContract.try_symbol(); + if (tokenSymbolResult.reverted) { + log.warning("try_symbol() {} reverted", [tokenAddress.toHex()]); + } else { + if (token0 != null) { + pair.token0Symbol = tokenSymbolResult.value; + } else { + pair.token1Symbol = tokenSymbolResult.value; + } + } + let tokenDecimalsResult = tokenContract.try_decimals(); + if (tokenDecimalsResult.reverted) { + log.warning("try_symbol() token0 reverted", []); + } else { + if (token0 != null) { + pair.token0Decimals = BigInt.fromI32(tokenDecimalsResult.value); + } else { + pair.token1Decimals = BigInt.fromI32(tokenDecimalsResult.value); + } + } + return pair; +} diff --git a/src/Pangolin/mappings/StakingRewards.ts b/src/Pangolin/mappings/StakingRewards.ts new file mode 100644 index 0000000..cf9cb4c --- /dev/null +++ b/src/Pangolin/mappings/StakingRewards.ts @@ -0,0 +1,12 @@ +import { + Staked as StakeEvent, + Withdrawn as WithdrawnEvent, +} from "../../../generated/PangolinStakingRewards/PangolinStakingRewards"; +import { handleStakingEntity } from "./handleStakingEntity"; + +export function handleStaked(event: StakeEvent): void { + handleStakingEntity(event.transaction.hash, event.block.number, event.block.timestamp, "Stake"); +} +export function handleWithdrawn(event: WithdrawnEvent): void { + handleStakingEntity(event.transaction.hash, event.block.number, event.block.timestamp, "Withdraw"); +} diff --git a/src/Pangolin/mappings/handleFarmEntity.ts b/src/Pangolin/mappings/handleFarmEntity.ts new file mode 100644 index 0000000..8b3e0bf --- /dev/null +++ b/src/Pangolin/mappings/handleFarmEntity.ts @@ -0,0 +1,109 @@ +import { Address, BigInt, Bytes, log } from "@graphprotocol/graph-ts"; +import { PangolinFarmData, PangolinFarmReward } from "../../../generated/schema"; +import { PangolinMiniChefV2 as PangolinMiniChefContract } from "../../../generated/PangolinMiniChefV2/PangolinMiniChefV2"; + +import { PangolinRewarderViaMultiplier as PangolinRewarderContract } from "../../../generated/PangolinMiniChefV2/PangolinRewarderViaMultiplier"; +import { convertBINumToDesiredDecimals } from "../../utils/converters"; +import { PANGOLIN_MINICHEFV2_ADDRESS, ZERO_ADDRESS, ZERO_BD, ZERO_BI } from "../../utils/constants"; +export function handleFarmEvent( + txnHash: Bytes, + blockNumber: BigInt, + timestamp: BigInt, + poolId: BigInt, + eventType: string, + lpToken: Address, +): void { + let entity = PangolinFarmData.load(txnHash.toHex()); + if (!entity) entity = new PangolinFarmData(txnHash.toHex()); + entity.blockNumber = blockNumber; + entity.blockTimestamp = timestamp; + entity.poolId = poolId; + entity.event = eventType; + entity.lpToken = lpToken; + + let poolAllocPoints = ZERO_BI; + let totalAllocPoints = ZERO_BI; + let totalPngPerSecond = ZERO_BD; + let rewarderAddress = ZERO_ADDRESS; + let farmContract = PangolinMiniChefContract.bind(PANGOLIN_MINICHEFV2_ADDRESS); + + let lpTokensResult = farmContract.try_lpTokens(); + if (lpTokensResult.reverted) { + log.warning("lp_tokens() reverted", []); + } else { + let lpTokens = lpTokensResult.value; + entity.lpToken = lpTokens[poolId.toI32()]; + } + + let totalPngPerSecondResult = farmContract.try_rewardPerSecond(); + if (totalPngPerSecondResult.reverted) { + log.warning("rewardPerSecond() reverted", []); + } else { + totalPngPerSecond = convertBINumToDesiredDecimals(totalPngPerSecondResult.value, 18); + } + let totalAllocPointResult = farmContract.try_totalAllocPoint(); + if (totalAllocPointResult.reverted) { + log.warning("totalAllocPoint() reverted", []); + } else { + totalAllocPoints = totalAllocPointResult.value; + } + + let poolInfoResult = farmContract.try_poolInfo(poolId); + if (poolInfoResult.reverted) { + log.warning("poolInfo() reverted", []); + } else { + let poolInfo = poolInfoResult.value; + entity.lastRewardTime = poolInfo.value1; + poolAllocPoints = poolInfo.value2; + entity.accRewardPerShare = convertBINumToDesiredDecimals(poolInfo.value0, 18); + if (totalAllocPoints > ZERO_BI) { + entity.pngPerSecond = totalPngPerSecond + .times(poolAllocPoints.toBigDecimal()) + .div(totalAllocPoints.toBigDecimal()); + } + } + let rewarderResult = farmContract.try_rewarder(poolId); + if (rewarderResult.reverted) { + log.warning("try_rewarder({}) reverted", [poolId.toString()]); + } else { + rewarderAddress = rewarderResult.value; + } + + // If there's additional rewards, query the rewarder address for the address tokens and its multipliers. + if (rewarderAddress != ZERO_ADDRESS) { + let additionalRewards: Array = new Array(); + let rewarderContract = PangolinRewarderContract.bind(rewarderAddress); + let rewardIds: Array = []; + let multipliersResult = rewarderContract.try_getRewardMultipliers(); + let rewardTokensResult = rewarderContract.try_getRewardTokens(); + + if (rewardTokensResult.reverted) { + log.warning("try_getRewardTokens() on {} reverted", [rewarderAddress.toHexString()]); + } else { + let rewardTokens = rewardTokensResult.value; + + for (let i = 0; i < rewardTokens.length; i++) { + let reward = new PangolinFarmReward(poolId.toHexString() + "-" + rewardTokens[i].toHexString()); + reward.rewardToken = rewardTokens[i]; + reward.save(); + additionalRewards.push(reward); + rewardIds.push(reward.id); + } + } + if (multipliersResult.reverted) { + log.warning("try_getRewardMultipliers() on {} reverted", [rewarderAddress.toHexString()]); + } else { + let rewardMultipliers = multipliersResult.value; + for (let i = 0; i < rewardMultipliers.length; i++) { + let multiplier = convertBINumToDesiredDecimals(rewardMultipliers[i], 18); + additionalRewards[i].rewardMultiplier = multiplier; + // the farm additional rewards are based on PNG, so the rate is affected by the multiplier. + additionalRewards[i].rewardTokenPerSecond = entity.pngPerSecond.times(multiplier); + additionalRewards[i].save(); + } + } + entity.additionalRewards = rewardIds; + } + + entity.save(); +} diff --git a/src/Pangolin/mappings/handleStakingEntity.ts b/src/Pangolin/mappings/handleStakingEntity.ts new file mode 100644 index 0000000..0598835 --- /dev/null +++ b/src/Pangolin/mappings/handleStakingEntity.ts @@ -0,0 +1,39 @@ +import { BigInt, Bytes, log } from "@graphprotocol/graph-ts"; +import { PangolinStakingData } from "../../../generated/schema"; +import { PangolinStakingRewards as StakingRewardContract } from "../../../generated/PangolinStakingRewards/PangolinStakingRewards"; +import { PangolinPngToken as PngTokenContract } from "../../../generated/PangolinStakingRewards/PangolinPngToken"; +import { convertBINumToDesiredDecimals } from "../../utils/converters"; +import { PANGOLIN_STAKING_REWARDS_ADDRESS, PANGOLIN_PNG_TOKEN_ADDRESS } from "../../utils/constants"; + +export function handleStakingEntity(txHash: Bytes, blockNumber: BigInt, timestamp: BigInt, eventType: string): void { + let entity = PangolinStakingData.load(txHash.toHex()); + if (!entity) entity = new PangolinStakingData(txHash.toHex()); + entity.blockNumber = blockNumber; + entity.blockTimestamp = timestamp; + entity.event = eventType; + + let stakingContract = StakingRewardContract.bind(PANGOLIN_STAKING_REWARDS_ADDRESS); + let pngTokenContract = PngTokenContract.bind(PANGOLIN_PNG_TOKEN_ADDRESS); + + let totalSupplyResult = stakingContract.try_totalSupply(); + if (totalSupplyResult.reverted) { + log.warning("try_totalSupply() reverted", []); + } else { + entity.totalSupply = convertBINumToDesiredDecimals(totalSupplyResult.value, 18); + } + let rewardRateResult = stakingContract.try_rewardRate(); + if (rewardRateResult.reverted) { + log.warning("try_rewardRate() reverted", []); + } else { + entity.rewardRate = convertBINumToDesiredDecimals(rewardRateResult.value, 18); + } + + let stakedPngResult = pngTokenContract.try_balanceOf(PANGOLIN_STAKING_REWARDS_ADDRESS); + if (stakedPngResult.reverted) { + log.warning("try_balanceOf() reverted", []); + } else { + entity.totalStakedPNG = convertBINumToDesiredDecimals(stakedPngResult.value, 18); + } + + entity.save(); +} diff --git a/src/Pangolin/schema.graphql b/src/Pangolin/schema.graphql new file mode 100644 index 0000000..26b4a24 --- /dev/null +++ b/src/Pangolin/schema.graphql @@ -0,0 +1,45 @@ +type PangolinFarmData @entity { + id: ID! + blockNumber: BigInt! + blockTimestamp: BigInt! + lpToken: Bytes! + poolId: BigInt! + accRewardPerShare: BigDecimal + pngPerSecond: BigDecimal + lastRewardTime: BigInt + event: String + additionalRewards: [PangolinFarmReward!] +} +type PangolinFarmReward @entity { + id: ID! # poolId - reward token address + rewardMultiplier: BigDecimal + rewardTokenPerSecond: BigDecimal + rewardToken: Bytes! +} +type PangolinStakingData @entity { + id: ID! + blockNumber: BigInt! + blockTimestamp: BigInt! + rewardRate: BigDecimal + totalStakedPNG: BigDecimal + event: String + totalSupply: BigDecimal +} +type PangolinSwapData @entity { + id: ID! + blockNumber: BigInt! + blockTimestamp: BigInt! + pair: PangolinSwapPair + token0Vol: BigDecimal + token1Vol: BigDecimal +} +type PangolinSwapPair @entity { + id: ID! # pool address + name: String! + token0Address: Bytes! + token1Address: Bytes! + token0Decimals: BigInt! + token1Decimals: BigInt! + token0Symbol: String! + token1Symbol: String! +} \ No newline at end of file diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 73b329c..f1cf5df 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -38,6 +38,11 @@ export let SushiMiniChefAddress = toAddress("0x0769fd68dFb93167989C6f7254cd0D766 export let CAM_INCENTIVES_CONTROLLER_ADDRESS: Address = toAddress("0x357D51124f59836DeD84c8a1730D72B749d8BC23"); export let CAM_LENDING_POOL_ADDRESS: Address = toAddress("0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf"); +export let PANGOLIN_FACTORY_ADDRESS: Address = toAddress("0xefa94DE7a4656D787667C749f7E1223D71E9FD88"); +export let PANGOLIN_STAKING_REWARDS_ADDRESS: Address = toAddress("0x88afdaE1a9F58Da3E68584421937E5F564A0135b"); +export let PANGOLIN_PNG_TOKEN_ADDRESS: Address = toAddress("0x60781C2586D68229fde47564546784ab3fACA982"); +export let PANGOLIN_MINICHEFV2_ADDRESS: Address = toAddress("0x1f806f7C8dED893fd3caE279191ad7Aa3798E928"); + export let TRADER_JOE_MASTER_CHEF_V2_ADDRESS: Address = toAddress("0xd6a4f121ca35509af06a0be99093d08462f53052"); export let TRADER_JOE_MASTER_CHEF_V3_ADDRESS: Address = toAddress("0x188bed1968b795d5c9022f6a0bb5931ac4c18f00"); export let TRADER_JOE_BAR_ADDRESS: Address = toAddress("0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33");