From 61dec54a708bf6d1a752d6ba85cc7a32dea00031 Mon Sep 17 00:00:00 2001 From: Ss5h Date: Mon, 18 Oct 2021 11:51:37 +0900 Subject: [PATCH 001/393] Update bifi staking --- projects/bifi/index.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/projects/bifi/index.js b/projects/bifi/index.js index 24de3fc029..28ae73b25d 100644 --- a/projects/bifi/index.js +++ b/projects/bifi/index.js @@ -1,4 +1,5 @@ const sdk = require("@defillama/sdk"); +const { staking } = require("../helper/staking"); const stakingPool = '0x488933457E89656D7eF7E69C10F2f80C7acA19b5'; const bfcAddr = '0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c'; @@ -93,14 +94,6 @@ async function eth(timestamp, block) { block: ethBlock })).output - // staking pool - let tokenStaked = await sdk.api.erc20.balanceOf({ - owner: stakingPool, - target: bfcAddr, - block: ethBlock - }); - sdk.util.sumSingleBalance(balances, bfcAddr, tokenStaked.output); - // eth tokens sdk.util.sumMultiBalanceOf(balances, await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', @@ -186,7 +179,8 @@ async function avax(timestamp, block, chainBlocks) { module.exports = { ethereum: { - tvl: eth + tvl: eth, + staking: staking(stakingPool, bfcAddr, "ethereum") }, bsc: { tvl: bsc @@ -197,5 +191,5 @@ module.exports = { avax: { tvl: avax }, - tvl: sdk.util.sumChainTvls([bsc,eth, bitcoin, avax]), + tvl: sdk.util.sumChainTvls([eth, bsc, bitcoin, avax]), } \ No newline at end of file From 041278c9a7649e6af90e5c7f07eaeb183cad1c4b Mon Sep 17 00:00:00 2001 From: razgraf Date: Tue, 19 Oct 2021 13:27:49 +0100 Subject: [PATCH 002/393] pods: track underlying post-exercise --- projects/podsfinance/queries.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/projects/podsfinance/queries.js b/projects/podsfinance/queries.js index 40390fe7db..89ab4dfc4f 100644 --- a/projects/podsfinance/queries.js +++ b/projects/podsfinance/queries.js @@ -11,11 +11,17 @@ async function getTVL (network, block) { abi: 'erc20:balanceOf', block, calls: options - .filter(option => option && option.strikeAsset && option.address) - .map(option => ({ - target: option.strikeAsset, - params: [option.address] - })), + .map(option => [ + { + target: option.strikeAsset, + params: [option.address] + }, + { + target: option.underlyingAsset, + params: [option.address] + } + ]) + .reduce((prev, curr) => prev.concat(curr), []), chain: network.name }) From 77c4f353f0a5f4c0bdc449fe7748327bfa1e0042 Mon Sep 17 00:00:00 2001 From: razgraf Date: Tue, 19 Oct 2021 13:55:59 +0100 Subject: [PATCH 003/393] pods: fix option filter --- projects/podsfinance/queries.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/podsfinance/queries.js b/projects/podsfinance/queries.js index 89ab4dfc4f..98c2dc426f 100644 --- a/projects/podsfinance/queries.js +++ b/projects/podsfinance/queries.js @@ -11,6 +11,13 @@ async function getTVL (network, block) { abi: 'erc20:balanceOf', block, calls: options + .filter( + option => + option && + option.strikeAsset && + option.underlyingAsset && + option.address + ) .map(option => [ { target: option.strikeAsset, From 4d3f51e9700e9111bdc0b06b38d98d714bca7afe Mon Sep 17 00:00:00 2001 From: Q Date: Sun, 21 Nov 2021 05:20:17 -0700 Subject: [PATCH 004/393] tvl --- .vscode/settings.json | 3 +++ projects/XDC/index.js | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 .vscode/settings.json create mode 100644 projects/XDC/index.js diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000..5c00f7ee08 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "vscode-corda.isCordaProject": false +} \ No newline at end of file diff --git a/projects/XDC/index.js b/projects/XDC/index.js new file mode 100644 index 0000000000..84482b7ea2 --- /dev/null +++ b/projects/XDC/index.js @@ -0,0 +1,24 @@ +//https://xdc.blocksscan.io/api/accounts/xdc0000000000000000000000000000000000000088 +//npm install axios@0.21.1 + +// Date/Time headers/date +// TVL data/balanceNumber +// Block + +const axios = require('axios'); + +async function tvl(price) { + try { + const response = await axios.get('https://xdc.blocksscan.io/api/accounts/xdc0000000000000000000000000000000000000088'); + var logString = ("{Total TVL: "+response.data.balanceNumber*price+ ", Timestamp: " +response.headers.date+ "}") + console.log(logString); + } catch (error) { + console.error(error); + } +} + +module.exports = { + tvl + } + +tvl(1) \ No newline at end of file From 1d2b9cc804356e011aa58e5aae7a177f9b7bb7fc Mon Sep 17 00:00:00 2001 From: Q Date: Sun, 21 Nov 2021 05:26:19 -0700 Subject: [PATCH 005/393] tlv --- projects/XDC/{index.js => index.cjs} | 0 projects/XDC/package.json | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) rename projects/XDC/{index.js => index.cjs} (100%) create mode 100644 projects/XDC/package.json diff --git a/projects/XDC/index.js b/projects/XDC/index.cjs similarity index 100% rename from projects/XDC/index.js rename to projects/XDC/index.cjs diff --git a/projects/XDC/package.json b/projects/XDC/package.json new file mode 100644 index 0000000000..5a9992b308 --- /dev/null +++ b/projects/XDC/package.json @@ -0,0 +1,17 @@ +{ + "name": "xdc", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "axios": "^0.24.0", + "node-fetch": "^3.1.0" + }, + "devDependencies": {}, + "description": "" +} From b54e2143d47ee04201c1b11b773402b7ccacb81f Mon Sep 17 00:00:00 2001 From: Q Date: Sun, 21 Nov 2021 05:30:17 -0700 Subject: [PATCH 006/393] tvl --- projects/XDC/index.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/XDC/index.cjs b/projects/XDC/index.cjs index 84482b7ea2..ad925b47b7 100644 --- a/projects/XDC/index.cjs +++ b/projects/XDC/index.cjs @@ -21,4 +21,4 @@ module.exports = { tvl } -tvl(1) \ No newline at end of file +//tvl(1) \ No newline at end of file From 914e370093dad021d1a932941b3502cf206dd5d1 Mon Sep 17 00:00:00 2001 From: Q Date: Mon, 22 Nov 2021 10:28:21 -0700 Subject: [PATCH 007/393] Update index.cjs --- projects/XDC/index.cjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/XDC/index.cjs b/projects/XDC/index.cjs index ad925b47b7..84482b7ea2 100644 --- a/projects/XDC/index.cjs +++ b/projects/XDC/index.cjs @@ -21,4 +21,4 @@ module.exports = { tvl } -//tvl(1) \ No newline at end of file +tvl(1) \ No newline at end of file From 3def5daa05b6875e3a4ddc6cdf0b2c6946fee1e9 Mon Sep 17 00:00:00 2001 From: cryptoethic Date: Tue, 30 Nov 2021 09:47:08 +0100 Subject: [PATCH 008/393] feat: starterra adapter --- projects/starterra.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/starterra.js diff --git a/projects/starterra.js b/projects/starterra.js new file mode 100644 index 0000000000..09fba2ed42 --- /dev/null +++ b/projects/starterra.js @@ -0,0 +1,14 @@ +const retry = require("./helper/retry"); +const axios = require("axios"); + +async function fetch() { + var res = await retry( + async () => await axios.get("https://api.starterra.io/cmc?q=tvl") + ); + + return parseFloat(res.data); +} + +module.exports = { + fetch, +}; From 49ed1d80b46c33cebb60ec32f10f3c917d18653d Mon Sep 17 00:00:00 2001 From: freelife2010 Date: Tue, 30 Nov 2021 02:11:24 -0800 Subject: [PATCH 009/393] updated --- projects/drops/abis/ERC20.json | 358 ++++++++++++++ projects/drops/abis/lpToken.json | 713 ++++++++++++++++++++++++++++ projects/drops/abis/masterchef.json | 569 ++++++++++++++++++++++ projects/drops/index.js | 30 ++ 4 files changed, 1670 insertions(+) create mode 100644 projects/drops/abis/ERC20.json create mode 100644 projects/drops/abis/lpToken.json create mode 100644 projects/drops/abis/masterchef.json create mode 100644 projects/drops/index.js diff --git a/projects/drops/abis/ERC20.json b/projects/drops/abis/ERC20.json new file mode 100644 index 0000000000..22793a2c9d --- /dev/null +++ b/projects/drops/abis/ERC20.json @@ -0,0 +1,358 @@ +[ + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "symbol", + "type": "string" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "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" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/projects/drops/abis/lpToken.json b/projects/drops/abis/lpToken.json new file mode 100644 index 0000000000..53582c1ed6 --- /dev/null +++ b/projects/drops/abis/lpToken.json @@ -0,0 +1,713 @@ +[ + { + "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/projects/drops/abis/masterchef.json b/projects/drops/abis/masterchef.json new file mode 100644 index 0000000000..5b98802988 --- /dev/null +++ b/projects/drops/abis/masterchef.json @@ -0,0 +1,569 @@ +[ + { + "inputs": [ + { + "internalType": "address", + "name": "_dop", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_dopPerBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_startBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_bonusEndBlock", + "type": "uint256" + } + ], + "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" + } + ], + "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" + } + ], + "name": "EmergencyWithdraw", + "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": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "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": "Withdraw", + "type": "event" + }, + { + "inputs": [], + "name": "BONUS_MULTIPLIER", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_allocPoint", + "type": "uint256" + }, + { + "internalType": "contract IERC20", + "name": "_lpToken", + "type": "address" + }, + { + "internalType": "bool", + "name": "_withUpdate", + "type": "bool" + } + ], + "name": "add", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "bonusEndBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "deposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_devaddr", + "type": "address" + } + ], + "name": "dev", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "devFundDivRate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "devaddr", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dop", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "dopPerBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + } + ], + "name": "emergencyWithdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_from", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_to", + "type": "uint256" + } + ], + "name": "getMultiplier", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "massUpdatePools", + "outputs": [], + "stateMutability": "nonpayable", + "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": "pendingDop", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accDopPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "poolLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_allocPoint", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "_withUpdate", + "type": "bool" + } + ], + "name": "set", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_bonusEndBlock", + "type": "uint256" + } + ], + "name": "setBonusEndBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_devFundDivRate", + "type": "uint256" + } + ], + "name": "setDevFundDivRate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_dopPerBlock", + "type": "uint256" + } + ], + "name": "setDopPerBlock", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "startBlock", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "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": [], + "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": "uint256", + "name": "rewardDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_pid", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/projects/drops/index.js b/projects/drops/index.js new file mode 100644 index 0000000000..87fae6f340 --- /dev/null +++ b/projects/drops/index.js @@ -0,0 +1,30 @@ +// const Web3 = require('web3'); +// const BigNumber = require('bignumber.js'); + +const utils = require("../helper/utils"); +// const { getContractInstance } = require('../config/eurxb/utils.js'); +const masterchefABI = require("./abis/masterchef.json"); +const dop_Ether = "0x00aa1c57e894c4010fe44cb840ae56432d7ea1d1"; +const NDR = "0x739763a258640919981F9bA610AE65492455bE53"; +const masterchef = "0x8A78011bf2c42df82cC05F198109Ea024B554df9"; + +// const web3 = new Web3(new Web3.providers.HttpProvider(`https://mainnet.infura.io/v3/${process.env.ETHEREUM_RPC}`)) + +const staking = async () => { + // const masterchefContract = await getContractInstance(masterchefABI, masterchef); + // const poolLength = await masterchefContract.methods.poolLength().call(); + // console.log('poolLength', poolLength) + return 0; +}; + +const fetch = async () => { + var res = await utils.fetchURL("https://drops.co/status"); + // const stakingTVL = await staking() + return res.data ? res.data.totalSupply : 0; +}; + +module.exports = { + methodology: + "TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", + fetch, +}; From cefeebdad0c2c351f34ffb15941faf2844da481c Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 30 Nov 2021 19:48:23 +0000 Subject: [PATCH 010/393] tonswap --- projects/tonswap/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/tonswap/index.js diff --git a/projects/tonswap/index.js b/projects/tonswap/index.js new file mode 100644 index 0000000000..7a34ad65e8 --- /dev/null +++ b/projects/tonswap/index.js @@ -0,0 +1,22 @@ +const retry = require("../helper/retry"); +const axios = require("axios"); +const BigNumber = require('bignumber.js') + +async function fetch() { + const tvl = (await retry(async (bail) => + await axios.post("https://ton-swap-indexer.broxus.com/v1/pairs", { + currencyAddresses: [], + limit: 1000, + offset: 0, + ordering: "tvldescending", + whiteListUri: "https://raw.githubusercontent.com/broxus/ton-assets/master/manifest.json", + }) + )).data.pairs.map(p => p.tvl).reduce( + (a, c) => new BigNumber(a).plus(c)); + + return tvl || 0; +}; + +module.exports = { + fetch +}; From e9f22fb53bac55665c29ab9b3329c8f32792b25e Mon Sep 17 00:00:00 2001 From: bananafarmlab Date: Wed, 1 Dec 2021 04:11:29 +0800 Subject: [PATCH 011/393] feat(projects): add banana adapter --- projects/banana/index.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 projects/banana/index.js diff --git a/projects/banana/index.js b/projects/banana/index.js new file mode 100644 index 0000000000..e69de29bb2 From 5208c1cf849bdd534b4d1bcb0aa000a3697341d6 Mon Sep 17 00:00:00 2001 From: bananafarmlab Date: Wed, 1 Dec 2021 04:24:27 +0800 Subject: [PATCH 012/393] feat(projects): add banana adapter --- projects/banana/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/projects/banana/index.js b/projects/banana/index.js index e69de29bb2..a96087f8f4 100644 --- a/projects/banana/index.js +++ b/projects/banana/index.js @@ -0,0 +1,19 @@ +const axios = require("axios"); + +const tvlUrl = "https://bananafarm.io/api/boba/tvl"; + +const fetch = async () => { + const { data } = await axios.get(tvlUrl) || {}; + return data?.tvl || 0; +}; + +module.exports = { + methodology: `TVL is calculated by summing up the values of all LP tokens and our project's rewards token.`, + name: "Banana", + token: "BANA", + start: 1638237600, + boba: { + fetch + }, + fetch +}; From 88cb8f6da8150c2cc987c46726dddc0c251fd58d Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 30 Nov 2021 20:44:41 +0000 Subject: [PATCH 013/393] Telos REX --- projects/telosRex.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/telosRex.js diff --git a/projects/telosRex.js b/projects/telosRex.js new file mode 100644 index 0000000000..189041cc62 --- /dev/null +++ b/projects/telosRex.js @@ -0,0 +1,16 @@ +const axios = require("axios"); +const retry = require("./helper/retry"); + +async function tvl() { + const tvlTlos = (await retry(async (bail) => axios.get( + "https://telos.caleos.io/v2/history/get_deltas?code=eosio.token&scope=eosio.rex&table=accounts", + ))).data.deltas.map(d => d.data.amount); + + return { + telos: tvlTlos[0], + }; +} + +module.exports = { + tvl, +}; From 086835a1d4f1c5a22e8871cfb8c1ab643ceaba22 Mon Sep 17 00:00:00 2001 From: 0xlyrix <0xlyrix@gmail.com> Date: Wed, 1 Dec 2021 14:56:21 +0700 Subject: [PATCH 014/393] wannaswap tracking --- projects/wannaswap/index.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 projects/wannaswap/index.js diff --git a/projects/wannaswap/index.js b/projects/wannaswap/index.js new file mode 100644 index 0000000000..a2a5c20b9f --- /dev/null +++ b/projects/wannaswap/index.js @@ -0,0 +1,29 @@ +const {calculateUsdUniTvl} = require('./helper/getUsdUniTvl') + +module.exports = { + misrepresentedTokens: true, + aurora: { + tvl:calculateUsdUniTvl( + // factory + "0x7928D4FeA7b2c90C732c10aFF59cf403f0C38246", + // chain + "aurora", + // coreAssetRaw + "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", + [ // whitelistRaw + // USDC + "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", + // USDT + "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", + // DAI + "0xe3520349F477A5F6EB06107066048508498A291b", + // wNEAR + "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", + // AURORA + "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79" + ], + // coreAssetName + "weth", + ), + }, +}; \ No newline at end of file From 491bbefc685ef0c1a7f3035181557f5cf8a6f707 Mon Sep 17 00:00:00 2001 From: Ghena <“ghena.ramascan@gmail.com”> Date: Wed, 1 Dec 2021 15:31:51 +0200 Subject: [PATCH 015/393] Created Defillama adapter --- projects/helper/getUsdUniTvl.js | 318 +++++++++++++++++--------------- projects/nearpad/index.js | 31 ++++ 2 files changed, 201 insertions(+), 148 deletions(-) create mode 100644 projects/nearpad/index.js diff --git a/projects/helper/getUsdUniTvl.js b/projects/helper/getUsdUniTvl.js index b4e9862bd1..3fa7bbe636 100644 --- a/projects/helper/getUsdUniTvl.js +++ b/projects/helper/getUsdUniTvl.js @@ -1,172 +1,194 @@ -const BigNumber = require('bignumber.js'); -const sdk = require('@defillama/sdk'); -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const getReserves = require('./abis/getReserves.json'); -const factoryAbi = require('./abis/factory.json'); -const { getBlock } = require('./getBlock'); +const BigNumber = require("bignumber.js"); +const sdk = require("@defillama/sdk"); +const token0 = require("./abis/token0.json"); +const token1 = require("./abis/token1.json"); +const getReserves = require("./abis/getReserves.json"); +const factoryAbi = require("./abis/factory.json"); +const { getBlock } = require("./getBlock"); async function requery(results, chain, block, abi) { - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } + if (results.some((r) => !r.success)) { + const failed = results.map((r, i) => [r, i]).filter((r) => !r[0].success); + const newResults = await sdk.api.abi + .multiCall({ + abi, + chain, + calls: failed.map((f) => f[0].input), + block, + }) + .then(({ output }) => output); + failed.forEach((f, i) => { + results[f[1]] = newResults[i]; + }); + } } function sum(balances, token, amount) { - if (balances[token] === undefined) { - balances[token] = 0 - } - balances[token] += Number(amount) + if (balances[token] === undefined) { + balances[token] = 0; + } + balances[token] += Number(amount); } function setPrice(prices, address, coreAmount, tokenAmount) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - if (coreAmount < currentCoreAmount) { - return - } + if (prices[address] !== undefined) { + const currentCoreAmount = prices[address][0]; + if (coreAmount < currentCoreAmount) { + return; } - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)] + } + prices[address] = [ + Number(coreAmount), + Number(coreAmount) / Number(tokenAmount), + ]; } -function calculateUsdUniTvl(FACTORY, chain, coreAssetRaw, whitelistRaw, coreAssetName, decimals = 18, allowUndefinedBlock = true) { - const whitelist = whitelistRaw.map(t => t.toLowerCase()) - const coreAsset = coreAssetRaw.toLowerCase() - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, allowUndefinedBlock) +function calculateUsdUniTvl( + FACTORY, + chain, + coreAssetRaw, + whitelistRaw, + coreAssetName, + decimals = 18, + allowUndefinedBlock = true +) { + const whitelist = whitelistRaw.map((t) => t.toLowerCase()); + const coreAsset = coreAssetRaw.toLowerCase(); + return async (timestamp, ethBlock, chainBlocks) => { + const block = await getBlock( + timestamp, + chain, + chainBlocks, + allowUndefinedBlock + ); - let pairAddresses; - const pairLength = (await sdk.api.abi.call({ + let pairAddresses; + const pairLength = ( + await sdk.api.abi.call({ + target: FACTORY, + abi: factoryAbi.allPairsLength, + chain, + block, + }) + ).output; + if (pairLength === null) { + throw new Error("allPairsLength() failed"); + } + const pairNums = Array.from(Array(Number(pairLength)).keys()); + { + const pairs = ( + await sdk.api.abi.multiCall({ + abi: factoryAbi.allPairs, + chain, + calls: pairNums.map((num) => ({ target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block - })).output - if (pairLength === null) { - throw new Error("allPairsLength() failed") - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - { - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block - })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } + params: [num], + })), + block, + }) + ).output; + await requery(pairs, chain, block, factoryAbi.allPairs); + pairAddresses = pairs.map((result) => result.output.toLowerCase()); + } - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); + const [token0Addresses, token1Addresses, reserves] = await Promise.all([ + sdk.api.abi + .multiCall({ + abi: token0, + chain, + calls: pairAddresses.map((pairAddress) => ({ + target: pairAddress, + })), + block, + }) + .then(({ output }) => output), + sdk.api.abi + .multiCall({ + abi: token1, + chain, + calls: pairAddresses.map((pairAddress) => ({ + target: pairAddress, + })), + block, + }) + .then(({ output }) => output), + sdk.api.abi + .multiCall({ + abi: getReserves, + chain, + calls: pairAddresses.map((pairAddress) => ({ + target: pairAddress, + })), + block, + }) + .then(({ output }) => output), + ]); + await requery(token0Addresses, chain, block, token0); + await requery(token1Addresses, chain, block, token1); + await requery(reserves, chain, block, getReserves); - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); + const pairs = {}; + // add token0Addresses + token0Addresses.forEach((token0Address) => { + const tokenAddress = token0Address.output.toLowerCase(); - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); + const pairAddress = token0Address.input.target.toLowerCase(); + pairs[pairAddress] = { + token0Address: tokenAddress, + }; + }); - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); + // add token1Addresses + token1Addresses.forEach((token1Address) => { + const tokenAddress = token1Address.output.toLowerCase(); + const pairAddress = token1Address.input.target.toLowerCase(); + pairs[pairAddress] = { + ...(pairs[pairAddress] || {}), + token1Address: tokenAddress, + }; + }); - const balances = {} - let coreBalance = 0 - const prices = {} - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (token0Address === coreAsset) { - coreBalance += Number(reserveAmounts[0]) * 2 - if (whitelist.includes(token1Address)) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]) - } - } else if (token1Address === coreAsset) { - coreBalance += Number(reserveAmounts[1]) * 2 - if (whitelist.includes(token0Address)) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]) - } - } else { - const whitelistedToken0 = whitelist.find(t => t === token0Address) - const whitelistedToken1 = whitelist.find(t => t === token1Address) - if (whitelistedToken0 !== undefined) { - sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2) - } else if (whitelistedToken1 !== undefined) { - sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2) - } - } + const balances = {}; + let coreBalance = 0; + const prices = {}; + for (let i = 0; i < reserves.length; i++) { + const pairAddress = reserves[i].input.target.toLowerCase(); + const pair = pairs[pairAddress]; + const token0Address = pair.token0Address.toLowerCase(); + const token1Address = pair.token1Address.toLowerCase(); + const reserveAmounts = reserves[i].output; + if (token0Address === coreAsset) { + coreBalance += Number(reserveAmounts[0]) * 2; + if (whitelist.includes(token1Address)) { + setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]); } - Object.entries(balances).forEach(([address, amount]) => { - const price = prices[address]; - if (price !== undefined) { - coreBalance += price[1] * (amount ?? 0) - } - }) - return { - [coreAssetName]: (coreBalance) / (10 ** decimals) + } else if (token1Address === coreAsset) { + coreBalance += Number(reserveAmounts[1]) * 2; + if (whitelist.includes(token0Address)) { + setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]); + } + } else { + const whitelistedToken0 = whitelist.find((t) => t === token0Address); + const whitelistedToken1 = whitelist.find((t) => t === token1Address); + if (whitelistedToken0 !== undefined) { + sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2); + } else if (whitelistedToken1 !== undefined) { + sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2); } + } } -}; + Object.entries(balances).forEach(([address, amount]) => { + const price = prices[address]; + if (price !== undefined) { + coreBalance += price[1] * (amount || 0); + } + }); + return { + [coreAssetName]: coreBalance / 10 ** decimals, + }; + }; +} module.exports = { - calculateUsdUniTvl, + calculateUsdUniTvl, }; diff --git a/projects/nearpad/index.js b/projects/nearpad/index.js new file mode 100644 index 0000000000..087a6d2bc1 --- /dev/null +++ b/projects/nearpad/index.js @@ -0,0 +1,31 @@ +const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); + +const tokens = [ + "0x885f8CF6E45bdd3fdcDc644efdcd0AC93880c781", + "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", + "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", + "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", + "0xe3520349F477A5F6EB06107066048508498A291b", + "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", + "0xF4eB217Ba2454613b15dBdea6e5f22276410e89e", + "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", + "0xFa94348467f64D5A457F75F8bc40495D33c65aBB", + "0x74974575d2f1668c63036d51ff48dbaa68e52408", + "0xdcD6D4e2B3e1D1E1E6Fa8C21C8A323DcbecfF970", + "0xDA2585430fEf327aD8ee44Af8F1f989a2A91A3d2", +]; + +module.exports = { + misrepresentedTokens: true, + aurora: { + tvl: calculateUsdUniTvl( + "0x34484b4E416f5d4B45D4Add0B6eF6Ca08FcED8f1", // factory + "aurora", // chain + "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", // coreAssetRaw + tokens, // whitelistRaw + "weth" // coreAssetName + ), + }, +}; + +// node test.js projects/nearpad/index.js From 3c6fb4219a3efd07a6b4eee0e2bce03f50acf10b Mon Sep 17 00:00:00 2001 From: Ghena <“ghena.ramascan@gmail.com”> Date: Wed, 1 Dec 2021 15:42:17 +0200 Subject: [PATCH 016/393] Reverted change in helper --- projects/helper/getUsdUniTvl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/getUsdUniTvl.js b/projects/helper/getUsdUniTvl.js index 3fa7bbe636..92a695c68a 100644 --- a/projects/helper/getUsdUniTvl.js +++ b/projects/helper/getUsdUniTvl.js @@ -180,7 +180,7 @@ function calculateUsdUniTvl( Object.entries(balances).forEach(([address, amount]) => { const price = prices[address]; if (price !== undefined) { - coreBalance += price[1] * (amount || 0); + coreBalance += price[1] * (amount ?? 0); } }); return { From 84c6976ff9de2987b0950947b8d6e1ab10464951 Mon Sep 17 00:00:00 2001 From: Peter Chung Date: Wed, 1 Dec 2021 22:24:39 +0800 Subject: [PATCH 017/393] add FlameDefi --- projects/flamedefi/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/flamedefi/index.js diff --git a/projects/flamedefi/index.js b/projects/flamedefi/index.js new file mode 100644 index 0000000000..f46f9cb4d2 --- /dev/null +++ b/projects/flamedefi/index.js @@ -0,0 +1,25 @@ +const BigNumber = require('bignumber.js') +const { request, gql } = require("graphql-request"); +const axios = require("axios"); + +const graphUrl = 'https://api2.spacefarm.xyz/api'; +const tvlQuery = gql` + { + spaceFarm { + totalStackTez + } + } +`; + +async function fetch() { + const data = (await request(graphUrl, tvlQuery)); + const totalLiquidity = new BigNumber(data.spaceFarm.totalStackTez); + const xtzUsdQuote = new BigNumber((await axios('https://api.coinbase.com/v2/prices/XTZ-USD/spot')).data.data.amount); + return totalLiquidity.multipliedBy(xtzUsdQuote).toFixed(0); +} + +module.exports = { + methodology: 'TVL counts the liquidity of FlameDefi farms. Data is pulled from:"https://api2.spacefarm.xyz/api".', + misrepresentedTokens: true, + fetch +} \ No newline at end of file From c5a160440ec3137e0baf31077a75924d385c6e09 Mon Sep 17 00:00:00 2001 From: Ghena <“ghena.ramascan@gmail.com”> Date: Wed, 1 Dec 2021 16:46:48 +0200 Subject: [PATCH 018/393] reverted changes from a helper --- projects/nearpad/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/nearpad/index.js b/projects/nearpad/index.js index 087a6d2bc1..1319ae059e 100644 --- a/projects/nearpad/index.js +++ b/projects/nearpad/index.js @@ -27,5 +27,4 @@ module.exports = { ), }, }; - // node test.js projects/nearpad/index.js From aae7b32747cf4f9cb6aca03c99fa5bd2669f5cb6 Mon Sep 17 00:00:00 2001 From: Ghena <“ghena.ramascan@gmail.com”> Date: Wed, 1 Dec 2021 17:01:19 +0200 Subject: [PATCH 019/393] Rollbacked no needed changes from helper --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fb64de0789..89b8731a97 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "description": "", "devDependencies": { - "husky": ">=6", + "husky": "^4.3.8", "lint-staged": ">=10", "prettier": "^2.4.1" }, From 542de6baba67edacb9d765360186ec73871a6a13 Mon Sep 17 00:00:00 2001 From: Ghena <“ghena.ramascan@gmail.com”> Date: Wed, 1 Dec 2021 17:19:21 +0200 Subject: [PATCH 020/393] roll back for no needed changes --- projects/helper/getUsdUniTvl.js | 318 +++++++++++++++----------------- 1 file changed, 148 insertions(+), 170 deletions(-) diff --git a/projects/helper/getUsdUniTvl.js b/projects/helper/getUsdUniTvl.js index 92a695c68a..b4e9862bd1 100644 --- a/projects/helper/getUsdUniTvl.js +++ b/projects/helper/getUsdUniTvl.js @@ -1,194 +1,172 @@ -const BigNumber = require("bignumber.js"); -const sdk = require("@defillama/sdk"); -const token0 = require("./abis/token0.json"); -const token1 = require("./abis/token1.json"); -const getReserves = require("./abis/getReserves.json"); -const factoryAbi = require("./abis/factory.json"); -const { getBlock } = require("./getBlock"); +const BigNumber = require('bignumber.js'); +const sdk = require('@defillama/sdk'); +const token0 = require('./abis/token0.json'); +const token1 = require('./abis/token1.json'); +const getReserves = require('./abis/getReserves.json'); +const factoryAbi = require('./abis/factory.json'); +const { getBlock } = require('./getBlock'); async function requery(results, chain, block, abi) { - if (results.some((r) => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter((r) => !r[0].success); - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }) - .then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i]; - }); - } + if (results.some(r => !r.success)) { + const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) + const newResults = await sdk.api.abi + .multiCall({ + abi, + chain, + calls: failed.map((f) => f[0].input), + block, + }).then(({ output }) => output); + failed.forEach((f, i) => { + results[f[1]] = newResults[i] + }) + } } function sum(balances, token, amount) { - if (balances[token] === undefined) { - balances[token] = 0; - } - balances[token] += Number(amount); + if (balances[token] === undefined) { + balances[token] = 0 + } + balances[token] += Number(amount) } function setPrice(prices, address, coreAmount, tokenAmount) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0]; - if (coreAmount < currentCoreAmount) { - return; + if (prices[address] !== undefined) { + const currentCoreAmount = prices[address][0] + if (coreAmount < currentCoreAmount) { + return + } } - } - prices[address] = [ - Number(coreAmount), - Number(coreAmount) / Number(tokenAmount), - ]; + prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)] } -function calculateUsdUniTvl( - FACTORY, - chain, - coreAssetRaw, - whitelistRaw, - coreAssetName, - decimals = 18, - allowUndefinedBlock = true -) { - const whitelist = whitelistRaw.map((t) => t.toLowerCase()); - const coreAsset = coreAssetRaw.toLowerCase(); - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock( - timestamp, - chain, - chainBlocks, - allowUndefinedBlock - ); +function calculateUsdUniTvl(FACTORY, chain, coreAssetRaw, whitelistRaw, coreAssetName, decimals = 18, allowUndefinedBlock = true) { + const whitelist = whitelistRaw.map(t => t.toLowerCase()) + const coreAsset = coreAssetRaw.toLowerCase() + return async (timestamp, ethBlock, chainBlocks) => { + const block = await getBlock(timestamp, chain, chainBlocks, allowUndefinedBlock) - let pairAddresses; - const pairLength = ( - await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block, - }) - ).output; - if (pairLength === null) { - throw new Error("allPairsLength() failed"); - } - const pairNums = Array.from(Array(Number(pairLength)).keys()); - { - const pairs = ( - await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map((num) => ({ + let pairAddresses; + const pairLength = (await sdk.api.abi.call({ target: FACTORY, - params: [num], - })), - block, - }) - ).output; - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map((result) => result.output.toLowerCase()); - } + abi: factoryAbi.allPairsLength, + chain, + block + })).output + if (pairLength === null) { + throw new Error("allPairsLength() failed") + } + const pairNums = Array.from(Array(Number(pairLength)).keys()) + { + const pairs = (await sdk.api.abi.multiCall({ + abi: factoryAbi.allPairs, + chain, + calls: pairNums.map(num => ({ + target: FACTORY, + params: [num] + })), + block + })).output + await requery(pairs, chain, block, factoryAbi.allPairs); + pairAddresses = pairs.map(result => result.output.toLowerCase()) + } - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); + const [token0Addresses, token1Addresses, reserves] = await Promise.all([ + sdk.api.abi + .multiCall({ + abi: token0, + chain, + calls: pairAddresses.map((pairAddress) => ({ + target: pairAddress, + })), + block, + }) + .then(({ output }) => output), + sdk.api.abi + .multiCall({ + abi: token1, + chain, + calls: pairAddresses.map((pairAddress) => ({ + target: pairAddress, + })), + block, + }) + .then(({ output }) => output), + sdk.api.abi + .multiCall({ + abi: getReserves, + chain, + calls: pairAddresses.map((pairAddress) => ({ + target: pairAddress, + })), + block, + }).then(({ output }) => output), + ]); + await requery(token0Addresses, chain, block, token0); + await requery(token1Addresses, chain, block, token1); + await requery(reserves, chain, block, getReserves); - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); + const pairs = {}; + // add token0Addresses + token0Addresses.forEach((token0Address) => { + const tokenAddress = token0Address.output.toLowerCase(); - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - }; - }); + const pairAddress = token0Address.input.target.toLowerCase(); + pairs[pairAddress] = { + token0Address: tokenAddress, + } + }); - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - }; - }); + // add token1Addresses + token1Addresses.forEach((token1Address) => { + const tokenAddress = token1Address.output.toLowerCase(); + const pairAddress = token1Address.input.target.toLowerCase(); + pairs[pairAddress] = { + ...(pairs[pairAddress] || {}), + token1Address: tokenAddress, + } + }); - const balances = {}; - let coreBalance = 0; - const prices = {}; - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase(); - const token1Address = pair.token1Address.toLowerCase(); - const reserveAmounts = reserves[i].output; - if (token0Address === coreAsset) { - coreBalance += Number(reserveAmounts[0]) * 2; - if (whitelist.includes(token1Address)) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]); + const balances = {} + let coreBalance = 0 + const prices = {} + for (let i = 0; i < reserves.length; i++) { + const pairAddress = reserves[i].input.target.toLowerCase(); + const pair = pairs[pairAddress]; + const token0Address = pair.token0Address.toLowerCase() + const token1Address = pair.token1Address.toLowerCase() + const reserveAmounts = reserves[i].output + if (token0Address === coreAsset) { + coreBalance += Number(reserveAmounts[0]) * 2 + if (whitelist.includes(token1Address)) { + setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]) + } + } else if (token1Address === coreAsset) { + coreBalance += Number(reserveAmounts[1]) * 2 + if (whitelist.includes(token0Address)) { + setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]) + } + } else { + const whitelistedToken0 = whitelist.find(t => t === token0Address) + const whitelistedToken1 = whitelist.find(t => t === token1Address) + if (whitelistedToken0 !== undefined) { + sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2) + } else if (whitelistedToken1 !== undefined) { + sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2) + } + } } - } else if (token1Address === coreAsset) { - coreBalance += Number(reserveAmounts[1]) * 2; - if (whitelist.includes(token0Address)) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]); - } - } else { - const whitelistedToken0 = whitelist.find((t) => t === token0Address); - const whitelistedToken1 = whitelist.find((t) => t === token1Address); - if (whitelistedToken0 !== undefined) { - sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2); - } else if (whitelistedToken1 !== undefined) { - sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2); + Object.entries(balances).forEach(([address, amount]) => { + const price = prices[address]; + if (price !== undefined) { + coreBalance += price[1] * (amount ?? 0) + } + }) + return { + [coreAssetName]: (coreBalance) / (10 ** decimals) } - } } - Object.entries(balances).forEach(([address, amount]) => { - const price = prices[address]; - if (price !== undefined) { - coreBalance += price[1] * (amount ?? 0); - } - }); - return { - [coreAssetName]: coreBalance / 10 ** decimals, - }; - }; -} +}; module.exports = { - calculateUsdUniTvl, + calculateUsdUniTvl, }; From 8a79dc3da2a71c0c5990a7528ca64e9d37eb212c Mon Sep 17 00:00:00 2001 From: Ghena <“ghena.ramascan@gmail.com”> Date: Wed, 1 Dec 2021 17:20:55 +0200 Subject: [PATCH 021/393] roll back no needed updates --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 89b8731a97..fb64de0789 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ }, "description": "", "devDependencies": { - "husky": "^4.3.8", + "husky": ">=6", "lint-staged": ">=10", "prettier": "^2.4.1" }, From da9408b1afa46faf4c4407023ee4c1a175ea58c4 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 1 Dec 2021 16:14:53 +0000 Subject: [PATCH 022/393] add new contracts for defiyieldprotocol --- projects/defiyieldprotocol/index.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/projects/defiyieldprotocol/index.js b/projects/defiyieldprotocol/index.js index 71495f50df..6a0a18a8e9 100644 --- a/projects/defiyieldprotocol/index.js +++ b/projects/defiyieldprotocol/index.js @@ -38,7 +38,21 @@ const contractFarms = { "0x7637fa253180556ba486d2fa5d2bb328eb0aa7ca", "0x2f3c4a08dad0f8a56ede3961ab654020534b8a8c", "0x417538f319afddd351f33222592b60f985475a21", - "0x350f3fe979bfad4766298713c83b387c2d2d7a7a" + "0x350f3fe979bfad4766298713c83b387c2d2d7a7a", + "0xf13aDbEb27ea9d9469D95e925e56a1CF79c06E90", + "0xaF411BF994dA1435A3150B874395B86376C5f2d5", + "0x9af074cE714FE1Eb32448052a38D274E93C5dc28", + "0xDBfb96e2899d52B469C1a1C35eD71fBBa228d2cC", + "0xc794cDb8D6aC5eB42d5ABa9c1E641ae17c239c8c", + "0x23609B1f5274160564e4afC5eB9329A8Bf81c744", + "0x264922696b9972687522b6e98Bf78A0430E2163C", + "0x9DF0A645BeB6F7aDFaDC56f3689E79405337EFE2", + "0xbd574278fEbad04b7A0694C37DeF4f2ecFa9354A", + "0x537DC4fee298Ea79A7F65676735415f1E2882F92", + "0x219717BF0bC33b2764A6c1A772F75305458BDA3d", + "0xD1151a2434931f34bcFA6c27639b67C1A23D93Af", + "0xed869Ba773c3F1A1adCC87930Ca36eE2dC73435d", + "0x415B1624710296717FA96cAD84F53454E8F02D18", ], avax: [ "0x499c588146443235357e9c630a66d6fe0250caa1", @@ -62,18 +76,19 @@ const lps = { "0x2fcf1b0d83f83135b6e5e2e231e07ae89c235f68", "0x87c546525cf48f28d73ea218c625d6f748721717", "0xc7a4d04699a9539d33e86ce746e88553149c8528", + "0x1bC61d08A300892e784eD37b2d0E63C85D1d57fb" ], avax: [ "0x497070e8b6C55fD283D8B259a6971261E2021C01" ] } -function transform(chain){ - return (addr)=>{ - if(addr === dyp){ +function transform(chain) { + return (addr) => { + if (addr === dyp) { return dyp } - return chain+':'+addr + return chain + ':' + addr } } @@ -88,7 +103,7 @@ function staking(chain) { function pool2(chain) { return async (time, ethBlock, chainBlocks) => { const balances = {} - await sumTokensAndLPsSharedOwners(balances, lps[chain].map(lp=>[lp, true]), contractFarms[chain], chainBlocks[chain], chain, transform(chain)) + await sumTokensAndLPsSharedOwners(balances, lps[chain].map(lp => [lp, true]), contractFarms[chain], chainBlocks[chain], chain, transform(chain)) return balances } } From 8a55aef1d150735ee38029c0754934ad263c28c9 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 1 Dec 2021 16:28:33 +0000 Subject: [PATCH 023/393] make flamedefi return tvl in texos --- projects/flamedefi/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/flamedefi/index.js b/projects/flamedefi/index.js index f46f9cb4d2..27e04d7cab 100644 --- a/projects/flamedefi/index.js +++ b/projects/flamedefi/index.js @@ -11,15 +11,16 @@ const tvlQuery = gql` } `; -async function fetch() { +async function tvl() { const data = (await request(graphUrl, tvlQuery)); const totalLiquidity = new BigNumber(data.spaceFarm.totalStackTez); - const xtzUsdQuote = new BigNumber((await axios('https://api.coinbase.com/v2/prices/XTZ-USD/spot')).data.data.amount); - return totalLiquidity.multipliedBy(xtzUsdQuote).toFixed(0); + return { + tezos: totalLiquidity + } } module.exports = { methodology: 'TVL counts the liquidity of FlameDefi farms. Data is pulled from:"https://api2.spacefarm.xyz/api".', misrepresentedTokens: true, - fetch + tvl } \ No newline at end of file From bfb3c1d0a7cbc282c5cf2fe7bfdd29e8dc5b8518 Mon Sep 17 00:00:00 2001 From: Jan Klimo Date: Wed, 1 Dec 2021 23:48:22 +0700 Subject: [PATCH 024/393] Update Pickle with staking --- projects/pickle/index.js | 172 ++++++++++++++++++++++----------------- 1 file changed, 97 insertions(+), 75 deletions(-) diff --git a/projects/pickle/index.js b/projects/pickle/index.js index b6e1881c14..24d45c86a7 100644 --- a/projects/pickle/index.js +++ b/projects/pickle/index.js @@ -3,90 +3,112 @@ const abi = require("./abi.json"); const utils = require("../helper/utils"); const { unwrapUniswapLPs, unwrapCrv } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); -const { chainExports } = require("../helper/exports"); const { toUSDT, usdtAddress } = require("../helper/balances"); +const { staking } = require("../helper/staking"); -const excluded = ["pbamm", "pickle-eth", "sushi-pickle-eth"] +const excluded = ["pbamm", "pickle-eth", "sushi-pickle-eth"]; const jars_url = "https://stkpowy01i.execute-api.us-west-1.amazonaws.com/prod/protocol/pools"; -function chainTvl(chain){ - return async (timestamp, _ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - const transformAddress = await getChainTransform(chain) - const balances = {}; +// Contracts +const dillAddress = "0xbBCf169eE191A1Ba7371F30A1C344bFC498b29Cf"; +const pickleAddress = "0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5"; - let jars = (await utils.fetchURL(jars_url)).data - .map(jar => { - if (jar.network === (chain==="ethereum"?'eth':chain)) - return { - ...jar, - name: jar.identifier - }; - }) - .filter(x => x && !excluded.includes(x.name)); - +function chainTvl(chain) { + return async (_timestamp, _ethBlock, chainBlocks) => { + const block = chainBlocks[chain]; + const transformAddress = await getChainTransform(chain); + const balances = {}; - const jar_balances = ( - await sdk.api.abi.multiCall({ - block, - calls: jars.map(jar => ({ - target: jar.jarAddress - })), - abi: abi.balance, - chain - }) - ).output.map(val => val.output); + let jars = (await utils.fetchURL(jars_url)).data + .map((jar) => { + if (jar.network === (chain === "ethereum" ? "eth" : chain)) + return { + ...jar, + name: jar.identifier, + }; + }) + .filter((x) => x && !excluded.includes(x.name)); - const lpPositions = []; + const jar_balances = ( + await sdk.api.abi.multiCall({ + block, + calls: jars.map((jar) => ({ + target: jar.jarAddress, + })), + abi: abi.balance, + chain, + }) + ).output.map((val) => val.output); - await Promise.all( - jars.map(async (jar, idx) => { - if((jar.name.includes("crv") || jar.name === "dodohndeth") && chain === "arbitrum" || jar.name === "rbn-eth"){ - sdk.util.sumSingleBalance( - balances, - usdtAddress, - toUSDT(jar.liquidity_locked) - ); - } else if (jar.name.toLowerCase().includes("crv") && jar.name != "yvecrv-eth") { - await unwrapCrv( - balances, - jar.tokenAddress, - jar_balances[idx], - block, - chain, - transformAddress - ); - } else if (jar.name.includes("-") || jar.name.includes("lp")) { - lpPositions.push({ - balance: jar_balances[idx], - token: jar.tokenAddress - }); - } else if(jar.name==="aleth") { - sdk.util.sumSingleBalance( // sum as weth - balances, - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - jar_balances[idx] - ); - } else { - sdk.util.sumSingleBalance( - balances, - transformAddress(jar.tokenAddress), - jar_balances[idx] - ); - } - }) - ); - await unwrapUniswapLPs( - balances, - lpPositions, - block, - chain, - transformAddress - ); + const lpPositions = []; - return balances; -} + await Promise.all( + jars.map(async (jar, idx) => { + if ( + ((jar.name.includes("crv") || jar.name === "dodohndeth") && + chain === "arbitrum") || + jar.name === "rbn-eth" + ) { + sdk.util.sumSingleBalance( + balances, + usdtAddress, + toUSDT(jar.liquidity_locked) + ); + } else if ( + jar.name.toLowerCase().includes("crv") && + jar.name != "yvecrv-eth" + ) { + await unwrapCrv( + balances, + jar.tokenAddress, + jar_balances[idx], + block, + chain, + transformAddress + ); + } else if (jar.name.includes("-") || jar.name.includes("lp")) { + lpPositions.push({ + balance: jar_balances[idx], + token: jar.tokenAddress, + }); + } else if (jar.name === "aleth") { + sdk.util.sumSingleBalance( + // sum as weth + balances, + "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + jar_balances[idx] + ); + } else { + sdk.util.sumSingleBalance( + balances, + transformAddress(jar.tokenAddress), + jar_balances[idx] + ); + } + }) + ); + await unwrapUniswapLPs( + balances, + lpPositions, + block, + chain, + transformAddress + ); + + return balances; + }; } -module.exports = chainExports(chainTvl, ["polygon", "ethereum", "arbitrum"]) +module.exports = { + arbitrum: { + tvl: chainTvl("arbitrum"), + }, + ethereum: { + tvl: chainTvl("ethereum"), + staking: staking(dillAddress, pickleAddress), + }, + polygon: { + tvl: chainTvl("polygon"), + }, +}; From f265d56c7e14b420c3c7c1f1d7beb043da57fe85 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 1 Dec 2021 17:20:58 +0000 Subject: [PATCH 025/393] add nearpad --- projects/nearpad/index.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 projects/nearpad/index.js diff --git a/projects/nearpad/index.js b/projects/nearpad/index.js new file mode 100644 index 0000000000..31c53dd5b1 --- /dev/null +++ b/projects/nearpad/index.js @@ -0,0 +1,26 @@ +const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); + +const tokens = [ + "0x885f8CF6E45bdd3fdcDc644efdcd0AC93880c781", + "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", + "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", + "0xe3520349F477A5F6EB06107066048508498A291b", + "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", + "0xF4eB217Ba2454613b15dBdea6e5f22276410e89e", + "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", + "0xFa94348467f64D5A457F75F8bc40495D33c65aBB", +]; + + +module.exports = { + misrepresentedTokens: true, + aurora: { + tvl: calculateUsdUniTvl( + "0x34484b4E416f5d4B45D4Add0B6eF6Ca08FcED8f1", // factory + "aurora", // chain + "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", // coreAssetRaw + tokens, // whitelistRaw + "weth" // coreAssetName + ), + }, +}; \ No newline at end of file From bbad00a3a4e6d4fe86b826f3aab62303287e31d9 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 1 Dec 2021 20:07:59 +0000 Subject: [PATCH 026/393] fantOHM --- projects/fantOHM.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/fantOHM.js diff --git a/projects/fantOHM.js b/projects/fantOHM.js new file mode 100644 index 0000000000..fd1c0a9ae8 --- /dev/null +++ b/projects/fantOHM.js @@ -0,0 +1,22 @@ +const { ohmTvl } = require('./helper/ohm'); + +const transforms = { + "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e": "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI + "0xbb29d2a58d880af8aa5859e30470134deaf84f2b": "0x090185f2135308bad17527004364ebcc2d37e5f6", // sSPELL => SPELL +} + +module.exports=ohmTvl("0xA3b52d5A6d2f8932a5cD921e09DA840092349D71", + [ + ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], // DAI + ["0x82f0b8b456c1a451378467398982d4834b6829c1", false], // MIM + ["0xbB29D2A58d880Af8AA5859e30470134dEAf84F2B", false], // sSPELL + ["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], // DAI/FHM + ["0x46622913cE40c54Ec14857f72968d4BAAF963947", true] // MIM/FHM + ], + "fantom", + "0x068e87aa1eabebbad65378ede4b5c16e75e5a671", + "0xfa1fbb8ef55a4855e5688c0ee13ac3f202486286", + addr => (transforms[addr.toLowerCase()] ? transforms[addr.toLowerCase()] : `fantom:${addr}`) , + undefined, + true +); \ No newline at end of file From 67a3e2fcf9ff718942f2bf8bdca09f992769b2ae Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 1 Dec 2021 20:30:17 +0000 Subject: [PATCH 027/393] retreeb --- projects/retreeb.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 projects/retreeb.js diff --git a/projects/retreeb.js b/projects/retreeb.js new file mode 100644 index 0000000000..eaba8adaad --- /dev/null +++ b/projects/retreeb.js @@ -0,0 +1,35 @@ +const BigNumber = require("bignumber.js"); +const sdk = require('@defillama/sdk'); +const { getBlock } = require('./helper/getBlock'); + +const TREEB = 'fantom:0xc60d7067dfbc6f2caf30523a064f416a5af52963'; +const contracts = [ + '0x669b6723D8cf1cE664bc1005646a26Dc8563E5C7', // QUICK + '0x39985D64b122f9089340CF1ab39D756e3cA74F0f', // MID + '0x5fA057966fB12c9e89bF603661CE3133bD3CBf8B' // DEEP +]; + +async function staking(timestamp, block, chainBlocks) { + block = await getBlock(timestamp, 'fantom', chainBlocks); + + const balance = (await sdk.api.abi.multiCall({ + calls: contracts.map((c) => ({ + target: '0xc60d7067dfbc6f2caf30523a064f416a5af52963', + params: c + })), + abi: 'erc20:balanceOf', + block, + chain: 'fantom' + })).output + .map(i => i.output) + .reduce((a, b) => new BigNumber(a).plus(b)); + + return { [TREEB]: balance }; +}; + +module.exports = { + fantom: { + staking, + tvl: async() => ({}) + } +}; \ No newline at end of file From f9e7c26be86822f486ce8e224794d345d732f050 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 1 Dec 2021 20:32:17 +0000 Subject: [PATCH 028/393] add new vaults for ondo --- projects/ondofinance/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index a38bfce312..ae47977cad 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,11 +1,11 @@ const sdk = require('@defillama/sdk') const abi = require('./abi.json') -const util = require('util') +const oldAllPairVault = "0xeF970A111dd6c281C40Eee6c40b43f24435833c2" +const newAllPairVault = "0x2bb8de958134afd7543d4063cafad0b7c6de08bc" -const allPairVault = "0xeF970A111dd6c281C40Eee6c40b43f24435833c2" - -async function tvl(timestamp, block){ +function tvlForAllPair(allPairVault){ +return async (timestamp, block) =>{ const vaults = (await sdk.api.abi.call({ target: allPairVault, block, @@ -23,8 +23,9 @@ async function tvl(timestamp, block){ } return balances } +} module.exports={ methodology: "Counts all tokens resting on upcoming vaults and the ones deposited on active vaults", - tvl + tvl: sdk.util.sumChainTvls([oldAllPairVault, newAllPairVault].map(tvlForAllPair)) } \ No newline at end of file From 8bcec0fad391ecda4c0376cd4a768d41bad5615e Mon Sep 17 00:00:00 2001 From: devagustinprado <86616429+devagustinprado@users.noreply.github.com> Date: Wed, 1 Dec 2021 18:18:35 -0300 Subject: [PATCH 029/393] Added cronos network to crystl --- projects/crystl/index.js | 136 ++++++++++++++++++++++++++------------- 1 file changed, 93 insertions(+), 43 deletions(-) diff --git a/projects/crystl/index.js b/projects/crystl/index.js index 5380a78620..623750d0f3 100644 --- a/projects/crystl/index.js +++ b/projects/crystl/index.js @@ -6,19 +6,36 @@ const apePriceGetterAbi = require("./apePriceGetter.json"); const { fetchURL } = require("../helper/utils"); const { default: BigNumber } = require("bignumber.js"); -const CRYSTL_TOKEN = "0x76bF0C28e604CC3fE9967c83b3C3F31c213cfE64"; -const MASTERHEALER = "0xeBCC84D2A73f0c9E23066089C6C24F4629Ef1e6d"; -const VAULTHEALER_V1 = "0xDB48731c021bdB3d73Abb771B4D7aF0F43C0aC16"; -const VAULTHEALER_V2 = "0xD4d696ad5A7779F4D3A0Fc1361adf46eC51C632d"; -const APEPRICE_GETTER = "0x05D6C73D7de6E02B3f57677f849843c03320681c"; - -async function getPools() { - const poolJson = ( - await fetchURL("https://www.crystl.finance/data/pools.json") - ).data; +const CHAIN_DATA = { + polygon: { + name: "polygon", + id: 137, + crystl_token: "0x76bF0C28e604CC3fE9967c83b3C3F31c213cfE64", + masterhealer: "0xeBCC84D2A73f0c9E23066089C6C24F4629Ef1e6d", + vaulthealer_v1: "0xDB48731c021bdB3d73Abb771B4D7aF0F43C0aC16", + vaulthealer_v2: "0xD4d696ad5A7779F4D3A0Fc1361adf46eC51C632d", + apeprice_getter: "0x05D6C73D7de6E02B3f57677f849843c03320681c", + pools: "https://polygon.crystl.finance/data/pools.json", + }, + cronos: { + name: "cronos", + id: 25, + crystl_token: "0xCbDE0E17d14F49e10a10302a32d17AE88a7Ecb8B", + masterhealer: "", + vaulthealer_v1: "0x4dF0dDc29cE92106eb8C8c17e21083D4e3862533", + vaulthealer_v2: "", + apeprice_getter: "0x6993fFaB6FD7c483f33A5E3EFDFEA676425C8F31", + pools: "https://cronos.crystl.finance/data/pools.json", + }, +}; + +let totalTvl = 0; + +async function getPools(chain) { + const poolJson = (await fetchURL(chain.pools)).data; const pools = Array.from(poolJson) - .filter((pool) => pool.contractAddress[137] !== MASTERHEALER) - .map((pool) => pool.contractAddress[137]); + .filter((pool) => pool.contractAddress[chain.id] !== chain.masterhealer) + .map((pool) => pool.contractAddress[chain.id]); return pools; } @@ -31,13 +48,13 @@ const getBalanceNumber = (balance, decimals = 18) => { return getBalanceAmount(balance, decimals).toNumber(); }; -async function getLPPrice(lpList, lpPrices) { +async function getLPPrice(lpList, lpPrices, chain) { let prices = ( await sdk.api.abi.call({ abi: apePriceGetterAbi.getLPPrices, - target: APEPRICE_GETTER, + target: chain.apeprice_getter, params: [lpList, 18], - chain: "polygon", + chain: chain.name, }) ).output.map((price) => getBalanceNumber(Number(price))); @@ -46,12 +63,16 @@ async function getLPPrice(lpList, lpPrices) { } } -async function getFarmBalance(lpShares, lpList) { +async function getFarmBalance(lpShares, lpList, chain) { + if (chain.masterhealer === "") { + return; + } + const farmLength = ( await sdk.api.abi.call({ abi: abi.poolLength, - target: MASTERHEALER, - chain: "polygon", + target: chain.masterhealer, + chain: chain.name, }) ).output; @@ -59,9 +80,9 @@ async function getFarmBalance(lpShares, lpList) { const lpsOrTokens = ( await sdk.api.abi.call({ abi: abi.poolInfo, - target: MASTERHEALER, + target: chain.masterhealer, params: index, - chain: "polygon", + chain: chain.name, }) ).output.lpToken; @@ -70,8 +91,8 @@ async function getFarmBalance(lpShares, lpList) { await sdk.api.abi.call({ abi: erc20.balanceOf, target: lpsOrTokens, - params: MASTERHEALER, - chain: "polygon", + params: chain.masterhealer, + chain: chain.name, }) ).output ); @@ -87,12 +108,16 @@ async function getFarmBalance(lpShares, lpList) { } } -async function getVaultBalance(lpShares, lpList, vaultHealer) { +async function getVaultBalance(lpShares, lpList, vaultHealer, chain) { + if (vaultHealer === "") { + return; + } + const vaultV1Length = ( await sdk.api.abi.call({ abi: vaultAbi.poolLength, target: vaultHealer, - chain: "polygon", + chain: chain.name, }) ).output; @@ -102,7 +127,7 @@ async function getVaultBalance(lpShares, lpList, vaultHealer) { abi: vaultAbi.poolInfo, target: vaultHealer, params: index, - chain: "polygon", + chain: chain.name, }) ).output; @@ -111,7 +136,7 @@ async function getVaultBalance(lpShares, lpList, vaultHealer) { await sdk.api.abi.call({ abi: vaultAbi.vaultSharesTotal, target: vault.strat, - chain: "polygon", + chain: chain.name, }) ).output ); @@ -127,8 +152,8 @@ async function getVaultBalance(lpShares, lpList, vaultHealer) { } } -async function poolsTvl() { - const pools = await getPools(); +async function poolsTvl(chain) { + const pools = await getPools(chain); const poolLength = pools.length; @@ -140,7 +165,7 @@ async function poolsTvl() { await sdk.api.abi.call({ abi: abi.totalStaked, target: pools[index], - chain: "polygon", + chain: chain.name, }) ).output ); @@ -151,9 +176,9 @@ async function poolsTvl() { ( await sdk.api.abi.call({ abi: apePriceGetterAbi.getPrice, - target: APEPRICE_GETTER, - params: [CRYSTL_TOKEN, 18], - chain: "polygon", + target: chain.apeprice_getter, + params: [chain.crystl_token, 18], + chain: chain.name, }) ).output ); @@ -161,7 +186,16 @@ async function poolsTvl() { return getBalanceNumber(tokenAmount) * crystlPrice; } -async function fetch() { +function calculateLpBalancePrice(lpShares, balances, lpPrices) { + for (let index = 0; index < lpShares.length; index++) { + balances += + lpShares[index].balance * + lpPrices.find((lp) => lp.token === lpShares[index].token).price; + } + return balances; +} + +async function fetchChain(chain) { let balances = 0; let lpShares = []; @@ -169,26 +203,42 @@ async function fetch() { let lpPrices = []; let [poolBalance] = await Promise.all([ - poolsTvl(), - getFarmBalance(lpShares, lpList), - getVaultBalance(lpShares, lpList, VAULTHEALER_V1), - getVaultBalance(lpShares, lpList, VAULTHEALER_V2), + poolsTvl(chain), + getFarmBalance(lpShares, lpList, chain), + getVaultBalance(lpShares, lpList, chain.vaulthealer_v1, chain), + getVaultBalance(lpShares, lpList, chain.vaulthealer_v2, chain), ]); balances += poolBalance; - await getLPPrice(lpList, lpPrices); + await getLPPrice(lpList, lpPrices, chain); - for (let index = 0; index < lpShares.length; index++) { - balances += - lpShares[index].balance * - lpPrices.find((lp) => lp.token === lpShares[index].token).price; - } + balances = calculateLpBalancePrice(lpShares, balances, lpPrices); + + totalTvl += balances; return balances; } +async function fetch() { + return (await polygon()) + (await cronos()); +} + +async function polygon() { + return fetchChain(CHAIN_DATA.polygon); +} + +async function cronos() { + return fetchChain(CHAIN_DATA.cronos); +} + module.exports = { + polygon: { + fetch: polygon, + }, + cronos: { + fetch: cronos, + }, fetch, methodology: "Our TVL is calculated from the Total Value Locked in our Vaults, Farms, and Pools.", From 72ad0a62ae5262d6e37ddd771838de777629eb6b Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 1 Dec 2021 23:07:55 +0000 Subject: [PATCH 030/393] vexchange --- package.json | 4 +- projects/vexchange/abi.json | 76 ++++++++++++++++++++++++++++++++++++ projects/vexchange/index.js | 78 +++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 projects/vexchange/abi.json create mode 100644 projects/vexchange/index.js diff --git a/package.json b/package.json index ef5f144ce5..61e86d5ae2 100644 --- a/package.json +++ b/package.json @@ -12,13 +12,15 @@ "license": "ISC", "dependencies": { "@acala-network/api": "^3.0.2", - "@defillama/sdk": "^2.3.25", + "@defillama/sdk": "^2.3.26", "@makerdao/multicall": "^0.12.0", "@polkadot/api": "^6.6.1", "@port.finance/port-sdk": "^0.1.42", "@project-serum/anchor": "^0.18.2", "@project-serum/serum": "^0.13.38", "@solana/web3.js": "^1.30.2", + "@vechain/connex-driver": "^2.0.7", + "@vechain/connex-framework": "^2.0.7", "async-retry": "^1.3.1", "atob": "^2.1.2", "axios": "^0.21.1", diff --git a/projects/vexchange/abi.json b/projects/vexchange/abi.json new file mode 100644 index 0000000000..f41d62de0a --- /dev/null +++ b/projects/vexchange/abi.json @@ -0,0 +1,76 @@ +{ + "balanceOf": { + "constant": true, + "inputs": [ + { + "name": "_owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "balance", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "allPairsLength": { + "constant": true, + "inputs": [], + "name": "allPairsLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "allPairs": { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allPairs", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "token0": { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "token1": { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getReserves": { + "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" + } +} diff --git a/projects/vexchange/index.js b/projects/vexchange/index.js new file mode 100644 index 0000000000..aebe684dd8 --- /dev/null +++ b/projects/vexchange/index.js @@ -0,0 +1,78 @@ +const abis = require('./abi.json'); +const { Framework } = require('@vechain/connex-framework'); +const { Driver, SimpleNet } = require('@vechain/connex-driver'); + +const net = new SimpleNet('https://mainnet.veblocks.net/'); +const factory = '0xb312582c023cc4938cf0faea2fd609b46d7509a2'; +let connex; + +const tokenMapping = { + '0xd8ccdd85abdbf68dfec95f06c973e87b1b5a9997': 'vechain', + '0x0000000000000000000000000000456e65726779': 'vethor-token', + '0x0CE6661b4ba86a0EA7cA2Bd86a0De87b0B860F14': 'oceanex-token', + '0xf8e1fAa0367298b55F57Ed17F7a2FF3F5F1D1628': 'eight-hours', + '0x89827F7bB951Fd8A56f8eF13C5bFEE38522F2E1F': 'plair', + '0x1b8EC6C2A45ccA481Da6F243Df0d7A5744aFc1f8': 'decentbet', + '0x5db3C8A942333f6468176a870dB36eEf120a34DC': 'safe-haven' +}; + +async function tvl() { + let balances = {}; + const driver = await Driver.connect(net); + connex = new Framework(driver); + + const allPairsLength = (await call(factory, abis.allPairsLength))[0]; + const allPairsArray = [...Array(Number(allPairsLength)).keys()]; + + const allPairsPromises = allPairsArray.map( + (id) => call(factory, abis.allPairs, [id])); + const poolAddresses = await ( + await Promise.all(allPairsPromises)).map(p => p[0]); + + const token0Promises = poolAddresses.map( + (add) => call(add, abis.token0)) + const token0Addresses = await ( + await Promise.all(token0Promises)).map(p => p[0]); + + const token1Promises = poolAddresses.map( + (add) => call(add, abis.token1)); + const token1Addresses = await ( + await Promise.all(token1Promises)).map(p => p[0]); + + const reservesPromises = poolAddresses.map( + (add) => call(add, abis.getReserves)); + const reserves = await ( + await Promise.all(reservesPromises)) + + for (let n = 0; n < poolAddresses.length; n++) { + if (Object.keys(tokenMapping).includes(token0Addresses[n])) { + let token = tokenMapping[token0Addresses[n]]; + let poolBalance = reserves[n][0] * 2 / (10 ** 18); + balances[token] = (token in balances ? + Number(balances[token]) + Number(poolBalance) : poolBalance); + } else if (Object.keys(tokenMapping).includes(token1Addresses[n])) { + let token = tokenMapping[token1Addresses[n]]; + let poolBalance = reserves[n][1] * 2 / (10 ** 18); + balances[token] = (token in balances ? + Number(balances[token]) + Number(poolBalance) : poolBalance); + }; + }; + return balances; +}; + +async function call(addressContract, abi, params = []) { + const Method = connex.thor.account(addressContract).method(abi); + switch (params.length) { + case 0: + return (await Method.call()).decoded; + case 1: + return (await Method.call(params[0])).decoded; + }; +}; + +module.exports = { + misrepresentedTokens: true, + vechain: { + tvl + } +}; \ No newline at end of file From ec30649c3c61ad1af2817f81ff8445f62215aa39 Mon Sep 17 00:00:00 2001 From: d1stsys Date: Wed, 1 Dec 2021 16:18:15 -0800 Subject: [PATCH 031/393] Update padswap subgraph to self-hosted node --- projects/padswap/index.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/projects/padswap/index.js b/projects/padswap/index.js index 090ba3d0c2..039cc135ce 100644 --- a/projects/padswap/index.js +++ b/projects/padswap/index.js @@ -15,9 +15,10 @@ const PADSWAP_MOONRIVER_FACTORY_ADDRESS = "0x760d2Bdb232027aB3b1594405077F9a1b91C04c1"; const subgraphTvls = getChainTvl({ - bsc: "https://api.thegraph.com/subgraphs/name/toadguy/padswap", - moonriver: "https://api.thegraph.com/subgraphs/name/toadguy/padswap-subgraph-moonriver" -}) + bsc: "https://subgraph.toadlytics.com:8080/subgraphs/name/padswap-subgraph", + moonriver: + "https://api.thegraph.com/subgraphs/name/toadguy/padswap-subgraph-moonriver", +}); module.exports = { methodology: `TVL accounts for the liquidity on all AMM pools (see https://info.padswap.exchange/ and https://movr-info.padswap.exchange/). Staking includes all TOAD staked in TOAD farms.`, @@ -29,14 +30,22 @@ module.exports = { "0xc0888d80ee0abf84563168b3182650c0addeb6d5", //pad ], "wbnb"), */ - staking: stakings([TOAD_FARM_ADDRESS, TOAD_PADSWAP_FARM_V1_ADDRESS, TOAD_PADSWAP_FARM_V2_ADDRESS], TOAD_ADDRESS, "bsc"), + staking: stakings( + [ + TOAD_FARM_ADDRESS, + TOAD_PADSWAP_FARM_V1_ADDRESS, + TOAD_PADSWAP_FARM_V2_ADDRESS, + ], + TOAD_ADDRESS, + "bsc" + ), }, - moonriver:{ - tvl: subgraphTvls("moonriver") + moonriver: { + tvl: subgraphTvls("moonriver"), /*calculateUsdUniTvl(PADSWAP_MOONRIVER_FACTORY_ADDRESS, "moonriver", "0x663a07a2648296f1a3c02ee86a126fe1407888e5", [ "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", //usdc "0x45488c50184ce2092756ba7cdf85731fd17e6f3d", //pad ], "moonriver"), */ - } + }, }; From 3b7d6a44719756d115b0c7d8d1e3ebbf27714673 Mon Sep 17 00:00:00 2001 From: bananafarmlab Date: Thu, 2 Dec 2021 09:24:56 +0800 Subject: [PATCH 032/393] fix(projects): add banana pool2 staking --- projects/banana/index.js | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/projects/banana/index.js b/projects/banana/index.js index a96087f8f4..e45a01a863 100644 --- a/projects/banana/index.js +++ b/projects/banana/index.js @@ -1,19 +1,46 @@ const axios = require("axios"); +const BigNumber = require("bignumber.js"); const tvlUrl = "https://bananafarm.io/api/boba/tvl"; +const stakingPid = "0"; +const poolPid = "1"; + +const share = "0xc67b9B1B0557aeAfA10AA1fFa1d7c87087a6149E"; +const pool2lp = "0x59b901160bb8eeEc517eD396Ab68e0DA81707c12"; + const fetch = async () => { - const { data } = await axios.get(tvlUrl) || {}; + const { data } = (await axios.get(tvlUrl)) || {}; return data?.tvl || 0; }; +const staking = async () => { + const { data = {} } = (await axios.get(tvlUrl)) || {}; + const tokenAddress = `boba:${share}`; + return { + [tokenAddress]: new BigNumber(data[stakingPid] * 1e18).toFixed(0), + }; +}; + +const pool2 = async () => { + const { data = {} } = (await axios.get(tvlUrl)) || {}; + const tokenAddress = `boba:${pool2lp}`; + return { + [tokenAddress]: new BigNumber(data[poolPid] * 1e18).toFixed(0), + }; +}; + module.exports = { methodology: `TVL is calculated by summing up the values of all LP tokens and our project's rewards token.`, name: "Banana", token: "BANA", start: 1638237600, boba: { - fetch + staking, + pool2, + fetch, }, - fetch + staking, + pool2, + fetch, }; From d73f518fd3684197f1529dd56fa5af1306776334 Mon Sep 17 00:00:00 2001 From: Jonathan Chemla Date: Thu, 2 Dec 2021 02:30:25 +0100 Subject: [PATCH 033/393] Get Babylon-finance TVL (gardens strategies) Get Babylon-finance TVL (gardens strategies) --- projects/babylon-finance/abi.json | 118 ++++++++++++++++++++++++++ projects/babylon-finance/index.js | 132 ++++++++++++++++++++++++++++++ 2 files changed, 250 insertions(+) create mode 100644 projects/babylon-finance/abi.json create mode 100644 projects/babylon-finance/index.js diff --git a/projects/babylon-finance/abi.json b/projects/babylon-finance/abi.json new file mode 100644 index 0000000000..589f499301 --- /dev/null +++ b/projects/babylon-finance/abi.json @@ -0,0 +1,118 @@ +{ + "getGardens": { + "name": "getGardens", + "inputs": [], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + "getGardenDetails": { + "inputs": [ + { + "internalType": "address", + "name": "_garden", + "type": "address" + } + ], + "name": "getGardenDetails", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "address[5]", + "name": "", + "type": "address[5]" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bool[4]", + "name": "", + "type": "bool[4]" + }, + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "", + "type": "address[]" + }, + { + "internalType": "uint256[10]", + "name": "", + "type": "uint256[10]" + }, + { + "internalType": "uint256[10]", + "name": "", + "type": "uint256[10]" + }, + { + "internalType": "uint256[3]", + "name": "", + "type": "uint256[3]" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getCompleteStrategy": { + "inputs": [ + { + "internalType": "address", + "name": "_strategy", + "type": "address" + } + ], + "name": "getCompleteStrategy", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "string", + "name": "", + "type": "string" + }, + { + "internalType": "uint256[16]", + "name": "", + "type": "uint256[16]" + }, + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file diff --git a/projects/babylon-finance/index.js b/projects/babylon-finance/index.js new file mode 100644 index 0000000000..3e4e526c28 --- /dev/null +++ b/projects/babylon-finance/index.js @@ -0,0 +1,132 @@ +const sdk = require("@defillama/sdk") +const BigNumber = require("bignumber.js") +const abi = require('./abi.json'); + +const babController = '0xd4a5b5fcb561daf3adf86f8477555b92fba43b5f' +const babylonViewer = '0x740913FEF40720E82498D5b73A4E8C3a5D9b9d79' + +async function tvl(timestamp, ethBlock, chainBlocks) { + const balances = {} + + // Get all gardens using babController contract + let { output: gardens } = await sdk.api.abi.call({ + abi: abi['getGardens'], + target: babController, + block: ethBlock, + chain: 'ethereum' + }) + // console.log('gardens (public and private)', gardens) + + // Get details of all gardens using babylonViewer contract + const gardensDetails = await sdk.api.abi.multiCall({ + abi: abi['getGardenDetails'], + calls: gardens.map( garden => ({ + params: garden, + target: babylonViewer, + })), + block: ethBlock, + chain: 'ethereum' + }) + + for (const gardenDetails of gardensDetails.output) { + const [gardenName, symbol, creators, reserveAsset, arr1, strategies, finalizedStrategies, voteParams, capitalArr, profits] = gardenDetails.output + // const garden_principal = capitalArr[0] + const garden_idle = capitalArr[9] + // Get strategies details + const strategiesDetails = await sdk.api.abi.multiCall({ + abi: abi['getCompleteStrategy'], + calls: strategies.map( strategy => ({ + params: strategy, + target: babylonViewer, + })), + block: ethBlock, + chain: 'ethereum' + }) + let strategy_str = '' + const strategies_tvl = strategiesDetails.output.map(strategyDetails => { + const [, strategyName, strategyProps,, ] = strategyDetails.output + const [capitalAllocated, nav] = [strategyProps[4], strategyProps[10]] + strategy_str += ` strategy ${strategyName}: nav (tvl): ${nav / 1e18} out of capitalAllocated, : ${capitalAllocated/1e18}\n` + return nav + }) + + const garden_tvl = strategies_tvl.reduce((acc, el) => acc.plus(BigNumber(el)), BigNumber(garden_idle)) + balances[reserveAsset] = balances[reserveAsset]? BigNumber(balances[reserveAsset]).plus(garden_tvl) : garden_tvl + if (garden_tvl/1e18 > 10) + console.log(`Garden with name "${gardenName}" TVL: ${garden_tvl/1e18} of reserveAsset: ${reserveAsset} locked\n${strategy_str}-----------------------------`) + } + return balances +} + +module.exports = { + methodology: "TVL of Babylon corresponds to capital locked into each garden (idle capital waiting to be deployed) as well as capital deployed to each strategy of these gardens", + ethereum: { + staking: () => ({}), + tvl, + } +} + +/* garden Details +( + gardenName, + symbol, + creators, + garden.reserveAsset(), + [true, garden.privateGarden(), garden.publicStrategists(), garden.publicStewards()], + garden.getStrategies(), + garden.getFinalizedStrategies(), + [ + garden.depositHardlock(), + garden.minVotesQuorum(), + garden.maxDepositLimit(), + garden.minVoters(), + garden.minStrategyDuration(), + garden.maxStrategyDuration(), + garden.strategyCooldownPeriod(), + garden.minContribution(), + garden.minLiquidityAsset(), + garden.totalKeeperFees().add(garden.keeperDebt()) + ], + [ + principal, + garden.reserveAssetRewardsSetAside(), + uint256(garden.absoluteReturns()), + garden.gardenInitializedAt(), + garden.totalContributors(), + garden.totalStake(), + totalSupplyValuationAndSeed[1] > 0 + ? totalSupplyValuationAndSeed[0].preciseMul(totalSupplyValuationAndSeed[1]) + : 0, + totalSupplyValuationAndSeed[0], + totalSupplyValuationAndSeed[2], + totalSupplyValuationAndSeed[3] + ], + profits +) +*/ +/* Complete Strategy +( + strategist, + strategyName, + [ + strategy.getOperationsCount(), + strategy.stake(), + strategy.totalPositiveVotes(), + strategy.totalNegativeVotes(), + strategy.capitalAllocated(), + strategy.capitalReturned(), + strategy.duration(), + strategy.expectedReturn(), + strategy.maxCapitalRequested(), + strategy.enteredAt(), + strategy.getNAV(), + rewards, + strategy.maxAllocationPercentage(), + strategy.maxGasFeePercentage(), + strategy.maxTradeSlippagePercentage(), + strategy.isStrategyActive() ? _estimateStrategyRewards(_strategy) : 0 + ], + status, + ts +) +*/ \ No newline at end of file From 2ed7186c6e587ab8a9c80c1453e7c1730e76178e Mon Sep 17 00:00:00 2001 From: donkeyfund-jijay Date: Thu, 2 Dec 2021 10:57:07 +0900 Subject: [PATCH 034/393] feat: change structure --- projects/donkey/abi/Controller.json | 1519 +++++++++++++++++++++++++++ projects/donkey/abi/DERC20.json | 1152 ++++++++++++++++++++ projects/donkey/abi/IERC20.json | 181 ++++ projects/donkey/index.js | 308 +----- 4 files changed, 2906 insertions(+), 254 deletions(-) create mode 100644 projects/donkey/abi/Controller.json create mode 100644 projects/donkey/abi/DERC20.json create mode 100644 projects/donkey/abi/IERC20.json diff --git a/projects/donkey/abi/Controller.json b/projects/donkey/abi/Controller.json new file mode 100644 index 0000000000..05da857209 --- /dev/null +++ b/projects/donkey/abi/Controller.json @@ -0,0 +1,1519 @@ +{ + "abi": [ + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isStakingContract", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isPauseGuardian", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "DONKEY_ADDRESS", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "borrowCaps", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "isController", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "allMarkets", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "donkeySpeeds", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "transferGuardianPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "name": "isListed", + "type": "bool" + }, + { + "name": "collateralFactorMantissa", + "type": "uint256" + }, + { + "name": "isDonkeyed", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isMintPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "donkeySupplierIndex", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "donkeySupplyState", + "outputs": [ + { + "name": "index", + "type": "uint224" + }, + { + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isSeizePaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "seizeGuardianPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "donkeyRate", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "isBorrowPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "protectedAssets", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "donkeyLockUpBlock", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "oracleGuardianPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "donkeyBorrowState", + "outputs": [ + { + "name": "index", + "type": "uint224" + }, + { + "name": "block", + "type": "uint32" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "donkeyInitialIndex", + "outputs": [ + { + "name": "", + "type": "uint224" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "donkeyAccrued", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "uint256" + } + ], + "name": "accountAssets", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "closeFactorMantissa", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + }, + { + "name": "", + "type": "address" + } + ], + "name": "donkeyBorrowerIndex", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "dToken", + "type": "address" + } + ], + "name": "MarketListed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "dToken", + "type": "address" + }, + { + "indexed": false, + "name": "account", + "type": "address" + } + ], + "name": "MarketEntered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "dToken", + "type": "address" + }, + { + "indexed": false, + "name": "account", + "type": "address" + } + ], + "name": "MarketExited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "dToken", + "type": "address" + }, + { + "indexed": false, + "name": "action", + "type": "string" + }, + { + "indexed": false, + "name": "pauseState", + "type": "bool" + } + ], + "name": "ActionPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "newAdmin", + "type": "address" + } + ], + "name": "NewAdmin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "dToken", + "type": "address" + }, + { + "indexed": false, + "name": "newBorrowCap", + "type": "uint256" + } + ], + "name": "NewBorrowCap", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "dToken", + "type": "address" + }, + { + "indexed": false, + "name": "oldCollateralFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCollateralFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "oldCloseFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "NewCloseFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "newPriceOracle", + "type": "address" + } + ], + "name": "NewPriceOracle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "newGuardianAddress", + "type": "address" + } + ], + "name": "NewGuardian", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "dToken", + "type": "address" + }, + { + "indexed": true, + "name": "supplier", + "type": "address" + }, + { + "indexed": false, + "name": "donkeyDelta", + "type": "uint256" + }, + { + "indexed": false, + "name": "donkeySupplyIndex", + "type": "uint256" + } + ], + "name": "DistributeSupplierDonkey", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "dToken", + "type": "address" + }, + { + "indexed": true, + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "name": "donkeyDelta", + "type": "uint256" + }, + { + "indexed": false, + "name": "donkeyBorrowIndex", + "type": "uint256" + } + ], + "name": "DistributeBorrowerDonkey", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "name": "admin_", + "type": "address" + }, + { + "name": "donkeyAddress_", + "type": "address" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newAdmin_", + "type": "address" + } + ], + "name": "setAdmin", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "exitMarket", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dTokens", + "type": "address[]" + }, + { + "name": "newBorrowCaps", + "type": "uint256[]" + } + ], + "name": "_setMarketBorrowCaps", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "redeemer", + "type": "address" + }, + { + "name": "redeemAmount", + "type": "uint256" + } + ], + "name": "redeemAllowed", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "src", + "type": "address" + }, + { + "name": "dst", + "type": "address" + }, + { + "name": "transferTokens", + "type": "uint256" + } + ], + "name": "transferAllowed", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "minter", + "type": "address" + } + ], + "name": "mintAllowed", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "state", + "type": "bool" + } + ], + "name": "setMintPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dTokens", + "type": "address[]" + }, + { + "name": "state", + "type": "bool" + } + ], + "name": "setOracleGuardianPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + } + ], + "name": "_supportMarket", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "borrower", + "type": "address" + }, + { + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrowAllowed", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "borrower", + "type": "address" + } + ], + "name": "repayBorrowAllowed", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newGuardianAddress", + "type": "address" + }, + { + "name": "state", + "type": "bool" + } + ], + "name": "setPauseGuardian", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "state", + "type": "bool" + } + ], + "name": "setBorrowPaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dTokens", + "type": "address[]" + }, + { + "name": "state", + "type": "bool" + } + ], + "name": "_setSeizePaused", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dTokenCollateral", + "type": "address" + }, + { + "name": "dTokenBorrowed", + "type": "address" + }, + { + "name": "liquidator", + "type": "address" + }, + { + "name": "borrower", + "type": "address" + } + ], + "name": "seizeAllowed", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "dTokenBorrowed", + "type": "address" + }, + { + "name": "dTokenCollateral", + "type": "address" + }, + { + "name": "actualRepayAmount", + "type": "uint256" + } + ], + "name": "liquidateCalculateSeizeTokens", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "account", + "type": "address" + }, + { + "name": "isProtectedCall", + "type": "bool" + } + ], + "name": "getAccountLiquidity", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "redeemAmount", + "type": "uint256" + }, + { + "name": "redeemTokens", + "type": "uint256" + } + ], + "name": "redeemVerify", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newCloseFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCloseFactor", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dToken", + "type": "address" + }, + { + "name": "newCollateralFactorMantissa", + "type": "uint256" + } + ], + "name": "_setCollateralFactor", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "lockupBlockNum", + "type": "uint256" + } + ], + "name": "setDonkeyLockUp", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "holders", + "type": "address[]" + }, + { + "name": "dTokens", + "type": "address[]" + }, + { + "name": "borrowers", + "type": "bool" + }, + { + "name": "suppliers", + "type": "bool" + }, + { + "name": "isMax", + "type": "bool" + } + ], + "name": "claimDonkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "holder", + "type": "address" + }, + { + "name": "dTokens", + "type": "address[]" + } + ], + "name": "claimDonkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "holder", + "type": "address" + } + ], + "name": "claimDonkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "_grantDonkey", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dTokens", + "type": "address[]" + }, + { + "name": "donkeySpeeds", + "type": "uint256[]" + } + ], + "name": "_setDonkeySpeed", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getDonkeyAddress", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getBlockNumber", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "getAccountAssets", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dTokenBorrowed", + "type": "address" + }, + { + "name": "dTokenCollateral", + "type": "address" + }, + { + "name": "borrower", + "type": "address" + }, + { + "name": "liquidator", + "type": "address" + }, + { + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "liquidateBorrowAllowed", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "dTokens", + "type": "address[]" + }, + { + "name": "newLiquidationIncentiveMantissas", + "type": "uint256[]" + } + ], + "name": "_setLiquidationIncentive", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getAllMarkets", + "outputs": [ + { + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "getCurrentMyDonkey", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "account", + "type": "address" + }, + { + "name": "isMax", + "type": "bool" + } + ], + "name": "claimDonkeyBehalfOf", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "stakingAddressList", + "type": "address[]" + }, + { + "name": "state", + "type": "bool" + } + ], + "name": "setIsStakingContract", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "dToken", + "type": "address" + } + ], + "name": "getLiquidationIncentiveOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } + ] + } \ No newline at end of file diff --git a/projects/donkey/abi/DERC20.json b/projects/donkey/abi/DERC20.json new file mode 100644 index 0000000000..215fb13ec9 --- /dev/null +++ b/projects/donkey/abi/DERC20.json @@ -0,0 +1,1152 @@ +{ + "abi": [ + { + "constant": true, + "inputs": [], + "name": "name", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "reserveFactorMantissa", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceCurrent", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "exchangeRateStored", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "redeemUnderlyingMax", + "outputs": [ + { + "name": "err", + "type": "uint256" + } + ], + "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": "isDToken", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "balanceOfUnderlying", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "getCash", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "repayBorrowMax", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "supplyPrincipal", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "rootGuardian_", + "type": "address" + } + ], + "name": "setRootGuardian", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "reduceAmount", + "type": "uint256" + } + ], + "name": "_reduceReserves", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "accrualBlockNumber", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "totalBorrowsCurrent", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "redeemUnderlyingAmount", + "type": "uint256" + } + ], + "name": "redeemUnderlying", + "outputs": [ + { + "name": "err", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalReserves", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newController", + "type": "address" + } + ], + "name": "setController", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "borrowPrincipal", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "borrowBalanceStored", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "accrueInterest", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowIndex", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "supplyRatePerBlock", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "rootGuardian", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "liquidator", + "type": "address" + }, + { + "name": "borrower", + "type": "address" + }, + { + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "seize", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "exchangeRateCurrent", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "getAccountSnapshot", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "underlyingSymbol", + "outputs": [ + { + "name": "", + "type": "bytes32" + } + ], + "payable": false, + "stateMutability": "view", + "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" + }, + { + "constant": false, + "inputs": [ + { + "name": "newInterestRateModel", + "type": "address" + } + ], + "name": "_setInterestRateModel", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "interestRateModel", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "controller", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "admin", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "borrowRatePerBlock", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "_setReserveFactor", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "error", + "type": "uint256" + }, + { + "indexed": false, + "name": "info", + "type": "uint256" + }, + { + "indexed": false, + "name": "detail", + "type": "uint256" + } + ], + "name": "Failure", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "minter", + "type": "address" + }, + { + "indexed": false, + "name": "mintAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "mintTokens", + "type": "uint256" + } + ], + "name": "Mint", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "payer", + "type": "address" + }, + { + "indexed": false, + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "accountBorrows", + "type": "uint256" + }, + { + "indexed": false, + "name": "totalBorrows", + "type": "uint256" + } + ], + "name": "RepayBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "sender", + "type": "address" + }, + { + "indexed": true, + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "name": "amount", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "name": "amount", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "liquidator", + "type": "address" + }, + { + "indexed": false, + "name": "borrower", + "type": "address" + }, + { + "indexed": false, + "name": "repayAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "dTokenCollateral", + "type": "address" + }, + { + "indexed": false, + "name": "seizeTokens", + "type": "uint256" + } + ], + "name": "LiquidateBorrow", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "oldReserveFactorMantissa", + "type": "uint256" + }, + { + "indexed": false, + "name": "newReserveFactorMantissa", + "type": "uint256" + } + ], + "name": "NewReserveFactor", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "benefactor", + "type": "address" + }, + { + "indexed": false, + "name": "addAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "admin", + "type": "address" + }, + { + "indexed": false, + "name": "reduceAmount", + "type": "uint256" + }, + { + "indexed": false, + "name": "newTotalReserves", + "type": "uint256" + } + ], + "name": "ReservesReduced", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "newController", + "type": "address" + } + ], + "name": "NewController", + "type": "event" + }, + { + "constant": false, + "inputs": [ + { + "name": "controller_", + "type": "address" + }, + { + "name": "interestRateModel_", + "type": "address" + }, + { + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "name": "underlying_", + "type": "address" + }, + { + "name": "name_", + "type": "string" + }, + { + "name": "symbol_", + "type": "string" + }, + { + "name": "underlyingSymbol_", + "type": "bytes32" + }, + { + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "controller_", + "type": "address" + }, + { + "name": "interestRateModel_", + "type": "address" + }, + { + "name": "initialExchangeRateMantissa_", + "type": "uint256" + }, + { + "name": "name_", + "type": "string" + }, + { + "name": "symbol_", + "type": "string" + }, + { + "name": "underlyingSymbol_", + "type": "bytes32" + }, + { + "name": "decimals_", + "type": "uint8" + } + ], + "name": "initialize", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "mintAmount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "name": "actualMintAmount", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "borrower", + "type": "address" + }, + { + "name": "repayAmount", + "type": "uint256" + }, + { + "name": "dTokenCollateral", + "type": "address" + } + ], + "name": "liquidateBorrow", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "borrowAmount", + "type": "uint256" + } + ], + "name": "borrow", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "repayAmount", + "type": "uint256" + } + ], + "name": "repayBorrow", + "outputs": [ + { + "name": "", + "type": "uint256" + }, + { + "name": "", + "type": "uint256" + } + ], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "addAmount", + "type": "uint256" + } + ], + "name": "_addReserves", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] + } \ No newline at end of file diff --git a/projects/donkey/abi/IERC20.json b/projects/donkey/abi/IERC20.json new file mode 100644 index 0000000000..58cdf22113 --- /dev/null +++ b/projects/donkey/abi/IERC20.json @@ -0,0 +1,181 @@ +{ + "abi": [ + { + "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" + }, + { + "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" + }, + { + "constant": true, + "inputs": [], + "name": "decimals", + "outputs": [ + { + "name": "", + "type": "uint8" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "sender", + "type": "address" + }, + { + "name": "recipient", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "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" + }, + { + "constant": false, + "inputs": [ + { + "name": "spender", + "type": "address" + }, + { + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "name": "", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ] +} diff --git a/projects/donkey/index.js b/projects/donkey/index.js index ecd96bf801..a666acb62e 100644 --- a/projects/donkey/index.js +++ b/projects/donkey/index.js @@ -7,176 +7,25 @@ const DTokenAbi = require('./abi/DToken.json').abi; const PriceOracleAbi = require('./abi/PriceOracleView.json').abi; const StakingAbi = require('./abi/Staking.json').abi; const VDONStakingAbi = require('./abi/VDONStaking.json').abi; +const ControllerAbi = require('./abi/Controller.json').abi; +const IERC20Abi = require('./abi/IERC20.json').abi; +const DERC20Abi = require('./abi/DERC20.json').abi; const PriceOracleAddress = { ethereum : '0x44EA07640609E60Ad0CFC27E9D63b68a1E240a13', klaytn : '0x2299dCFdeC881f8B5169b7033b4bd2a6b337655F' } -const ethMarkets = [ - { - symbol: 'dKNC', - underlyingSymbol: 'KNC', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xCC62B24a9fC939502feE6269402329b90C91b847', - }, - { - symbol: 'dSNT', - underlyingSymbol: 'SNT', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xeB167917A8f2Bf28d22CaBb03EC597c386E04079', - }, - { - symbol: 'dPOLY', - underlyingSymbol: 'POLY', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x30635728B43596Fd07A855af332f82cFFa95D80B', - }, - { - symbol: 'dAXS', - underlyingSymbol: 'AXS', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xBBdc8d915BF30d53df420eCb5dc2D8FB4538Ed8a', - }, - { - symbol: 'dELF', - underlyingSymbol: 'ELF', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xf732FdDb3c5cC0aD7215D3dB4875a94E67a09C26', - }, - { - symbol: 'dOMG', - underlyingSymbol: 'OMG', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x6a4FB30DcB6fc184ACF3c306081930f234d5A143', - }, - { - symbol: 'dWBTC', - underlyingSymbol: 'WBTC', - decimals: 8, - underlyingDecimals: 8, - contractAddress: '0x3a52e4863c52D15b384Be651939f8E33eE69716A', - }, - { - symbol: 'dHUNT', - underlyingSymbol: 'HUNT', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x8622f8d39cAEA7f85EE1d50aF2e4479fa2012923', - }, - { - symbol: 'dETH', - underlyingSymbol: 'ETH', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xEc0D3f28D37a3393cf09ee3aD446c485b6afDaA3', - }, - { - symbol: 'dUSDT', - underlyingSymbol: 'USDT', - decimals: 8, - underlyingDecimals: 6, - contractAddress: '0x3f5fA4Ba2e595230c3E89543f404631429D0DD26', - }, - { - symbol: 'dLINK', - underlyingSymbol: 'LINK', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x8DE66D3CBb0e660EF48165F7Ef4EA35ad9625765', - }, - { - symbol: 'dTON', - underlyingSymbol: 'TON', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x6D827EbB2d6303Ff38AeA22146B9799a846904c1', - }, - { - symbol: 'dCHZ', - underlyingSymbol: 'CHZ', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x1c07bcA0ceE9FF1b93057D8af98f18D1C1E203C5', - }, - { - symbol: 'dMANA', - underlyingSymbol: 'MANA', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x1dca9c08E493A6a2A5ef2E3cbeD0Df2380245511', - }, - { - symbol: 'dSAND', - underlyingSymbol: 'SAND', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xB2ec0d90561044aA8f09844daF417C59bE5345d1', - }, - { - symbol: 'dSTORJ', - underlyingSymbol: 'STORJ', - decimals: 8, - underlyingDecimals: 8, - contractAddress: '0xc31A07bD0792f8fE556D607776ff4F6570eFc3d5', - }, - { - symbol: 'dBORA', - underlyingSymbol: 'BORA', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x9D6DaE758d5C2E81ea4D813caD0056e0de59c5b2', - }, - { - symbol: 'dCBK', - underlyingSymbol: 'CBK', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x45f9BE645c19f07c5643599435A7b106e5D8A79c', - }, - { - symbol: 'dPLA', - underlyingSymbol: 'PLA', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x9Dc533e6c168e153F0241E36E31436387631b1da', - }, - { - symbol: 'dMTL', - underlyingSymbol: 'MTL', - decimals: 8, - liquidationIncentive: 1.1, - underlyingDecimals: 8, - contractAddress: '0x303f5b535CBC47836D4bc8bcE99992B8d7987E43', - }, - { - symbol: 'dSRM', - underlyingSymbol: 'SRM', - decimals: 8, - underlyingDecimals: 6, - contractAddress: '0x922bb502dE4F82C61E96133f92286b291056E356', - }, - { - symbol: 'dDON', - underlyingSymbol: 'DON', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xc1d7187A3ab7828443A218071b9c71b51044bF2d', - }, - { - symbol: 'dSTPT', - underlyingSymbol: 'STPT', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x76081093616e8cba6fb3822357e3Af1FDB8E5faF', - }, -] +const controllerAddress = { + ethereum : '0x55e41bc3a99aa24E194D507517b1e8b65eFdAa9e', + klaytn : '0x35dc04eE1D6E600C0d13B21FdfB5C83D022CEF25' +} + +const mainDTokenAddress = { + ethereum : '0xEc0D3f28D37a3393cf09ee3aD446c485b6afDaA3', + klaytn : '0xACC72a0cA4E85f79876eD4C5E6Ea29BE1cD26c2e' +} + const stakings = [ '0x4f2ED52bC4CbdE54e2b3547D3758474A21598D7c', @@ -187,80 +36,6 @@ const stakings = [ const VDONStakingAddress = '0x63D21dBD5A30940C605d77882D065736e8fffC94'; - -const klaytnMarkets = [ - { - symbol: 'dKLAY', - underlyingSymbol: 'KLAY', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xACC72a0cA4E85f79876eD4C5E6Ea29BE1cD26c2e', - }, - { - symbol: 'dKSP', - underlyingSymbol: 'KSP', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xC820e7b1EC1077Da8667149632A1A41a506cA690', - }, - { - symbol: 'dKETH', - underlyingSymbol: 'KETH', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x4Ca4282C39Fe621152244eA693c28Fbe2Aa78a18', - }, - { - symbol: 'dKUSDT', - underlyingSymbol: 'KUSDT', - decimals: 8, - underlyingDecimals: 6, - contractAddress: '0xC55F4F5fe1EE6C4C2f391fDc28e31445cDBf58af', - }, - { - symbol: 'dKXRP', - underlyingSymbol: 'KXRP', - decimals: 8, - underlyingDecimals: 6, - contractAddress: '0x26105e8880473bc53D591baAf0Fbf3995D1B4a3A', - }, - { - symbol: 'dKWBTC', - underlyingSymbol: 'KWBTC', - decimals: 8, - underlyingDecimals: 8, - contractAddress: '0x12b472a6250B7536183ce6eA25D4219c5d0cC3c0', - }, - { - symbol: 'dkDON', - underlyingSymbol: 'kDON', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x1E935b6A81208DBA26a8063277551886625E0bE6', - }, - { - symbol: 'dKUSDC', - underlyingSymbol: 'KUSDC', - decimals: 8, - underlyingDecimals: 6, - contractAddress: '0x4B3000BbBb19a0B009C12a8a1117B6fDF208595c', - }, - { - symbol: 'dKDAI', - underlyingSymbol: 'KDAI', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0x5B0B4772865F54C8662067D36B77A2ADC2E05929', - }, - { - symbol: 'dWEMIX', - underlyingSymbol: 'WEMIX', - decimals: 8, - underlyingDecimals: 18, - contractAddress: '0xE537a7658700537589E00EA8f772F7cC1050CfCE', - }, -] - async function getDonkeySwapRatio() { return axios .post('https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3', { @@ -269,7 +44,6 @@ async function getDonkeySwapRatio() { .then((res) => res.data.data.pool.token0Price); } - async function staking() { let totalTvlKrw = 0; const result = await axios.get('https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWUSD'); @@ -334,15 +108,29 @@ async function fetch() { let totalTvlKrw = 0; + const controllerContrat = new web3.eth.Contract(ControllerAbi, controllerAddress.ethereum) + const ethMarkets = await controllerContrat.methods.getAllMarkets().call(); + for(let i=0; i Date: Thu, 2 Dec 2021 02:22:24 +0000 Subject: [PATCH 035/393] define telos tvl in eosauthority rex --- projects/telosRex.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/projects/telosRex.js b/projects/telosRex.js index 189041cc62..ec25c68f04 100644 --- a/projects/telosRex.js +++ b/projects/telosRex.js @@ -12,5 +12,8 @@ async function tvl() { } module.exports = { - tvl, + telos: { + tvl, + } + }; From 4e736c6b1fdd60e9f4c87fd052185f0e3692ae1d Mon Sep 17 00:00:00 2001 From: Q Date: Wed, 1 Dec 2021 21:43:59 -0700 Subject: [PATCH 036/393] Debugging --- projects/XDC/index.cjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/XDC/index.cjs b/projects/XDC/index.cjs index 84482b7ea2..49d736a789 100644 --- a/projects/XDC/index.cjs +++ b/projects/XDC/index.cjs @@ -10,7 +10,7 @@ const axios = require('axios'); async function tvl(price) { try { const response = await axios.get('https://xdc.blocksscan.io/api/accounts/xdc0000000000000000000000000000000000000088'); - var logString = ("{Total TVL: "+response.data.balanceNumber*price+ ", Timestamp: " +response.headers.date+ "}") + var logString = ("{Total TVL: "+response.data.balanceNumber*price+ ", Timestamp: " +Date.parse(response.headers.date)+ "}") console.log(logString); } catch (error) { console.error(error); @@ -21,4 +21,4 @@ module.exports = { tvl } -tvl(1) \ No newline at end of file +tvl(0.08686) \ No newline at end of file From 7182c2ba303cbf5ae11c3d82ec4c854cc6ebd35d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 2 Dec 2021 05:38:58 +0000 Subject: [PATCH 037/393] add fantohm adapter WIP --- projects/fantohm/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/fantohm/index.js diff --git a/projects/fantohm/index.js b/projects/fantohm/index.js new file mode 100644 index 0000000000..84b554f8a7 --- /dev/null +++ b/projects/fantohm/index.js @@ -0,0 +1,15 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0xA3b52d5A6d2f8932a5cD921e09DA840092349D71" +module.exports = ohmTvl(treasury, [ + //DAI + ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], + //MIM + ["0x82f0b8b456c1a451378467398982d4834b6829c1", false], + //sSPELL + //["0xbB29D2A58d880Af8AA5859e30470134dEAf84F2B", false] + //spooky LP + ["0x46622913ce40c54ec14857f72968d4baaf963947", true], + //spooky LP + ["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], + ], "fantom", "0xcb9297425C889A7CbBaa5d3DB97bAb4Ea54829c2", "0xfa1FBb8Ef55A4855E5688C0eE13aC3f202486286") \ No newline at end of file From 6ffe587ea41c6a0f622e47e050ddd7ef844baeb0 Mon Sep 17 00:00:00 2001 From: Mohammed18062020 Date: Thu, 2 Dec 2021 09:04:00 +0000 Subject: [PATCH 038/393] Alpaca City && Ester finance TVL Adapters --- projects/alpacacity/index.js | 97 +++++++++++++++++++++++++++++ projects/ester/abi.json | 116 +++++++++++++++++++++++++++++++++++ projects/ester/index.js | 110 +++++++++++++++++++++++++++++++++ 3 files changed, 323 insertions(+) create mode 100644 projects/alpacacity/index.js create mode 100644 projects/ester/abi.json create mode 100644 projects/ester/index.js diff --git a/projects/alpacacity/index.js b/projects/alpacacity/index.js new file mode 100644 index 0000000000..3832e88e41 --- /dev/null +++ b/projects/alpacacity/index.js @@ -0,0 +1,97 @@ +const { staking } = require("../helper/staking"); +const { pool2, pool2s } = require("../helper/pool2"); +const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { transformBscAddress } = require("../helper/portedTokens"); + +/*** Ethereum Addresss ***/ +const stakingContracts = [ + //stakingContractAlpaFireChamber + "0x741Cee6e4Bd99Df866ab0dD0D0C0b5ED7033344A", + //stakingContract + "0x232F030747008D3bA5d51526f5966d8985218Ff0", + //StakingContractAlpacaSquadNFTFarm + "0xE23A7741A5E9500f7a1dE4B246d1F7f29F81605F" +]; +const ALPA = "0x7cA4408137eb639570F8E647d9bD7B7E8717514A"; + +const farmContract = "0x217a7D0Ac6573b0f013e12f92B6d5B250FA15D97"; +const WETH_ALPA2_UNIV2 = "0x441f9e2c89a343cefb390a8954b3b562f8f91eca"; + +const treasuryContracts = [ + "0xd93DC6B8Ef043C3ad409C6480A57b4851b3C055e", + "0xF30Ccf37c7058Db0026DE9239d373a1c8723210a" +]; + +/*** BSC Addresss ***/ +const stakingContractBSC = "0xa24FBFE379Ecb914c205BE4d9214592F64194059"; +const ALPA_BSC = "0xc5E6689C9c8B02be7C49912Ef19e79cF24977f03"; + +const farmContractsBSC = [ + //V2 + "0x25B0dc84b62D7e2bd4eBba0Dda6C25E3e7c0D717", + //V1 + "0x03625c4156A010065D135A18123a9e25FF5AEd12", +]; +const lpPairContractsBSC = [ + //WBNB_ALPA_CakeLP V2 + "0x4cC442220BE1cE560C1f2573f8CA8f460B3E4172", + //WBNB_ALPA_CakeLP V1 + "0x837cD42282801E340f1F17AAdf3166fEE99fb07c" +] + +const treasuryContractsBSC = [ + "0x3226dBce6317dF643EB68bbeF379E6B968b3E669", + "0xb9C76Db167Fa6BFd0e6d78063C63B3073C637497", + "0x6F712F28834b82B7781311b42a945a6134112B2A" +]; + +async function ethTreasury() { + const balances = {}; + + await sumTokensAndLPsSharedOwners( + balances, + [[ALPA, false]], + treasuryContracts + ); + + return balances; +} + +async function bscTreasury(chainBlocks) { + const balances = {}; + + let transform = await transformBscAddress(); + await sumTokensAndLPsSharedOwners( + balances, + [[ALPA_BSC, false]], + treasuryContractsBSC, + chainBlocks["bsc"], + "bsc", + transform + ); + + return balances; +} + +async function Staking(...params) { + for (const contract of stakingContracts) { + return staking(contract, ALPA)(...params) + } + +} + +module.exports = { + ethereum: { + treasury: ethTreasury, + staking: Staking, + pool2: pool2(farmContract, WETH_ALPA2_UNIV2), + }, + bsc: { + treasury: bscTreasury, + staking: staking(stakingContractBSC, ALPA_BSC, "bsc"), + pool2: pool2s(farmContractsBSC, lpPairContractsBSC, "bsc"), + }, + tvl: async => ({}), + methodology: + "Counts liquidity on the Farms through AlpacaFarm Contracts; and there are Staking and Pool2 parts only. We export the comunity amount as Treasury Part", +}; diff --git a/projects/ester/abi.json b/projects/ester/abi.json new file mode 100644 index 0000000000..38f9629b95 --- /dev/null +++ b/projects/ester/abi.json @@ -0,0 +1,116 @@ +{ + "poolInfoStaking": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "token", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accESTPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "poolInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "want", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accESTPerShare", + "type": "uint256" + }, + { + "internalType": "address", + "name": "strat", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "poolLength": { + "inputs": [], + "name": "poolLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "wantLockedTotal": { + "inputs": [], + "name": "wantLockedTotal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "symbol": { + "constant": true, + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file diff --git a/projects/ester/index.js b/projects/ester/index.js new file mode 100644 index 0000000000..96534ae88d --- /dev/null +++ b/projects/ester/index.js @@ -0,0 +1,110 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { staking } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); +const { addFundsInMasterChef } = require("../helper/masterchef"); +const { transformFantomAddress } = require("../helper/portedTokens"); +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); + +const esterStakingChefContract = "0x78e9D247541ff7c365b50D2eE0defdd622016498"; +const EST = "0x181f3f22c9a751e2ce673498a03e1fdfc0ebbfb6"; +const WFTM_EST_SPIRITLP = "0x0c9043cb1B994C8e4a8024e2F037Ea50b7025a82"; + +const esterVaultFarmContract = "0xA6151b608f49Feb960e951F1C87F4C766850de31"; + +const ftmTvl = async (chainBlocks) => { + const balances = {}; + + let transformAddress = await transformFantomAddress(); + + await addFundsInMasterChef( + balances, + esterStakingChefContract, + chainBlocks["fantom"], + "fantom", + transformAddress, + abi.poolInfoStaking, + [EST, WFTM_EST_SPIRITLP] + ); + + const poolLength = ( + await sdk.api.abi.call({ + abi: abi.poolLength, + target: esterVaultFarmContract, + chain: "fantom", + block: chainBlocks["fantom"], + }) + ).output; + + const lpPositions = []; + + for (let index = 0; index < poolLength; index++) { + const strat = ( + await sdk.api.abi.call({ + abi: abi.poolInfo, + target: esterVaultFarmContract, + params: index, + chain: "fantom", + block: chainBlocks["fantom"], + }) + ).output.strat; + + const want = ( + await sdk.api.abi.call({ + abi: abi.poolInfo, + target: esterVaultFarmContract, + params: index, + chain: "fantom", + block: chainBlocks["fantom"], + }) + ).output.want; + + const strat_bal = ( + await sdk.api.abi.call({ + abi: abi.wantLockedTotal, + target: strat, + chain: "fantom", + block: chainBlocks["fantom"], + }) + ).output; + + const symbol = ( + await sdk.api.abi.call({ + abi: abi.symbol, + target: want, + chain: "fantom", + block: chainBlocks["fantom"], + }) + ).output; + + if (symbol.includes("LP")) { + lpPositions.push({ + token: want, + balance: strat_bal, + }); + } else { + sdk.util.sumSingleBalance(balances, `fantom:${want}`, strat_bal); + } + } + + await unwrapUniswapLPs( + balances, + lpPositions, + chainBlocks["fantom"], + "fantom", + transformAddress + ); + + return balances; +}; + +module.exports = { + misrepresentedTokens: true, + fantom: { + staking: staking(esterStakingChefContract, EST, "fantom"), + pool2: pool2(esterStakingChefContract, WFTM_EST_SPIRITLP, "fantom"), + tvl: ftmTvl, + }, + methodology: + "We count liquidity on all the Vaults through EsterStakingChef and EsterVaultFarmt Contracts", +}; From e13cfad83eb30348330b3778db42a463cba4a16e Mon Sep 17 00:00:00 2001 From: Stefan Popov Date: Thu, 2 Dec 2021 13:06:42 +0400 Subject: [PATCH 039/393] Fix SORA adapter --- projects/sora.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/sora.js b/projects/sora.js index 34654d1dd9..b95c933246 100644 --- a/projects/sora.js +++ b/projects/sora.js @@ -5,10 +5,10 @@ const BASE_URL = 'https://api.subquery.network/sq/sora-xor/sora'; const XOR_ASSET_ID = '0x0200000000000000000000000000000000000000000000000000000000000000'; const POOL_XYK_ENTITIES = gql` query PoolXYKEntities ( - $last: Int = 1) + $first: Int = 1) { poolXYKEntities ( - last: $last + first: $first ) { nodes { From 98f51f20b237c2e14d601ac4198b19471bd47c97 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 2 Dec 2021 09:58:06 +0000 Subject: [PATCH 040/393] remove debugging on donkey --- projects/donkey/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/donkey/index.js b/projects/donkey/index.js index a666acb62e..2137010473 100644 --- a/projects/donkey/index.js +++ b/projects/donkey/index.js @@ -181,7 +181,6 @@ async function fetch() { } return totalTvlKrw / currency; } -fetch() module.exports = { fetch, From b3bc5b12e2c7c9d4894dcc9491631b9c3e3d9f59 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 2 Dec 2021 10:01:49 +0000 Subject: [PATCH 041/393] remove XDC package.json --- .vscode/settings.json | 3 --- projects/XDC/package.json | 17 ----------------- 2 files changed, 20 deletions(-) delete mode 100644 .vscode/settings.json delete mode 100644 projects/XDC/package.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 5c00f7ee08..0000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "vscode-corda.isCordaProject": false -} \ No newline at end of file diff --git a/projects/XDC/package.json b/projects/XDC/package.json deleted file mode 100644 index 5a9992b308..0000000000 --- a/projects/XDC/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "xdc", - "version": "1.0.0", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "axios": "^0.24.0", - "node-fetch": "^3.1.0" - }, - "devDependencies": {}, - "description": "" -} From e1fc6ece0a41e3bc4580f30bd52f6f30aeba3946 Mon Sep 17 00:00:00 2001 From: 1BCHDev1 <94784324+1BCHDev1@users.noreply.github.com> Date: Thu, 2 Dec 2021 11:46:05 +0100 Subject: [PATCH 042/393] Added 1bch.com DEX --- projects/1bch/index.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 projects/1bch/index.js diff --git a/projects/1bch/index.js b/projects/1bch/index.js new file mode 100644 index 0000000000..65dd8a59fb --- /dev/null +++ b/projects/1bch/index.js @@ -0,0 +1,40 @@ +const sdk = require('@defillama/sdk'); +const { getBlock } = require('../helper/getBlock'); +const { calculateUsdUniTvl } = require('../helper/getUsdUniTvl') +const { stakingPricedLP } = require('../helper/staking') + +const WBCH = "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04"; +const rBCH = "0xb4602588E5F1F9653B6F234206c91552E457fAcB"; +const FACTORY = "0x3dC4e6aC26df957a908cfE1C0E6019545D08319b"; +const MASTERBREEDER = "0xeC0A7496e66a206181034F86B261DDDC1A2c406E"; +const rBCH_WBCH_LP = "0xb9659B524447F53FF1019952A6eeDBb99776Ab4A"; +const COREASSETNAME = "bitcoin-cash"; +const CHAIN = "smartbch"; + +async function bchMasterChef(timestamp, ethBlock, chainBlocks) { + const block = await getBlock(timestamp, CHAIN, chainBlocks, true); + + const stakedBCH = (await sdk.api.erc20.balanceOf({ + target: WBCH, + owner: MASTERBREEDER, + chain: CHAIN, + block: block, + decimals: 18 + })).output; + + return { + [COREASSETNAME]: Number(stakedBCH) + } +} + +const bchDexTvl = calculateUsdUniTvl(FACTORY, CHAIN, WBCH, [rBCH], COREASSETNAME) + +module.exports = { + misrepresentedTokens: true, + methodology: "Factory address (" + FACTORY + ") is used to find the LP pairs on smartBCH. TVL is equal to AMMs liquidity plus the extra staking balance and masterchef pools.", + smartbch: { + tvl: sdk.util.sumChainTvls([bchDexTvl, bchMasterChef]), + masterchef: bchMasterChef, + staking: stakingPricedLP(MASTERBREEDER, rBCH, "smartbch", rBCH_WBCH_LP, COREASSETNAME), + }, +} From 84e0958b708554cdf3ce22de71bdb27cc9bf7e93 Mon Sep 17 00:00:00 2001 From: Parrotdefifarm Date: Thu, 2 Dec 2021 15:03:56 +0100 Subject: [PATCH 043/393] Update Parrot Egg with Harmony --- projects/parrotegg/index.js | 38 ++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/projects/parrotegg/index.js b/projects/parrotegg/index.js index 2c88bca73d..7aee77aef7 100644 --- a/projects/parrotegg/index.js +++ b/projects/parrotegg/index.js @@ -1,11 +1,11 @@ const sdk = require("@defillama/sdk"); -const { transformArbitrumAddress, transformPolygonAddress } = require("../helper/portedTokens"); +const { transformArbitrumAddress, transformPolygonAddress, transformHarmonyAddress, fixHarmonyBalances } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require('../helper/masterchef'); const IOTEX_CG_MAPPING = require("./iotex_coingecko_mapping.json") const STAKING_CONTRACT_ARBITRUM = "0x1cCf20F4eE3EFD291267c07268BEcbFDFd192311"; //MASTERCHEF ARBITRUM const STAKING_CONTRACT_IOTEX = "0x83E7e97C4e92D56c0653f92d9b0c0B70288119b8"; // MASTERCHEF IOTEX const STAKING_CONTRACT_POLYGON = "0x34E4cd20F3a4FdC5e42FdB295e5A118D4eEB0b79"; // MASTERCHEF POLYGON - +const STAKING_CONTRACT_HARMONY = "0xFb15945E38a11450AF5E3FF20355D71Da72FfE8a"; // MASTERCHEF HARMONY function compareAddresses(a, b){ return a.toLowerCase() === b.toLowerCase() @@ -53,17 +53,30 @@ const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { return balances; }; +const harmonyTvl = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + const transformAddress = await transformHarmonyAddress(); + + await addFundsInMasterChef( + balances, STAKING_CONTRACT_HARMONY, chainBlocks.harmony, 'harmony', transformAddress); + delete balances['0xC36769DFcDF05B2949F206FC34C8870707D33C89']; //TOKEN ADDRESS + delete balances['0xC36769DFcDF05B2949F206FC34C8870707D33C89']; //TOKEN ADDRESS + + fixHarmonyBalances(balances) + + return balances; +}; const iotexTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - const transformAddress = await transformIotexAddress(); - - await addFundsInMasterChef( - balances, STAKING_CONTRACT_IOTEX, chainBlocks.iotex, 'iotex', transformAddress); + const balances = {}; + const transformAddress = await transformIotexAddress(); + + await addFundsInMasterChef( + balances, STAKING_CONTRACT_IOTEX, chainBlocks.iotex, 'iotex', transformAddress); - fixIotexBalances(balances); + fixIotexBalances(balances); - return balances; + return balances; }; module.exports={ @@ -76,5 +89,8 @@ module.exports={ polygon: { tvl: polygonTvl }, - tvl: sdk.util.sumChainTvls([arbitrumTvl, iotexTvl, polygonTvl]), -} + harmony: { + tvl: harmonyTvl + }, + tvl: sdk.util.sumChainTvls([arbitrumTvl, iotexTvl, polygonTvl, harmonyTvl]), +} \ No newline at end of file From 379e20497812e5a6c242cc4a77b89b70ff8948d3 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 2 Dec 2021 14:08:20 +0000 Subject: [PATCH 044/393] fix sora --- projects/sora.js | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/projects/sora.js b/projects/sora.js index 34654d1dd9..13ce2cfa99 100644 --- a/projects/sora.js +++ b/projects/sora.js @@ -1,6 +1,9 @@ const BigNumber = require('bignumber.js'); const { request, gql } = require('graphql-request'); +const axios = require('axios'); +const {getApiTvl} = require('./helper/historicalApi'); +/* const BASE_URL = 'https://api.subquery.network/sq/sora-xor/sora'; const XOR_ASSET_ID = '0x0200000000000000000000000000000000000000000000000000000000000000'; const POOL_XYK_ENTITIES = gql` @@ -55,8 +58,46 @@ async function fetch () { throw new Error('SORA adapter: Something was happened with SORA subquery connection!'); } } +*/ + +const getData = async ()=>{ + const data = await axios.post("https://polkaview.io:8086/api/v2/query?org=PolkaCloud", { + "query": "from(bucket: \"polkaswap_platform\") |> range(start: -600d, stop: now()) |> filter(fn: (r) => r[\"_measurement\"] == \"tvl_USD\" and r[\"_field\"] == \"value\") |> aggregateWindow(every: 60m, fn: last, createEmpty: false) |> yield(name: \"last\")", + "dialect": { + "header": true, + "delimiter": ",", + "quoteChar": "\"", + "commentPrefix": "#", + "annotations": [ + "datatype", + "group", + "default" + ] + }, + "type": "flux" + }, { + headers: { + "authorization": "Token C2IS7BxyTxbxLGU75byPIy3eYn95xtcZdOEV6ap_Kp0pXMv4fKrCWIMHrFD8hg0Tlv44QJlH25asvlthauOXXA==" + } + }) + const parsed = data.data.split("\n").slice(4, -2).map(row=>{ + const els = row.split(',') + return { + date: new Date(els[5]).getTime()/1000, + totalLiquidityUSD: Number(els[6]) + } + }) + return parsed +} + +async function tvl(timestamp) { + return getApiTvl(timestamp, async()=>{ + const data = await getData() + return data[data.length-1].totalLiquidityUSD + }, getData) +} module.exports = { - methodology: "All pools from https://polkaswap.io launched on SORA network are included in TVL.", - fetch, + methodology: "All pools from https://polkaswap.io launched on SORA network are included in TVL. Data comes from https://polkaview.io", + tvl, }; From dd92ea6403f3528be5a8a8696e49eb5ded051f99 Mon Sep 17 00:00:00 2001 From: Serg Ilchuk Date: Thu, 2 Dec 2021 17:12:32 +0200 Subject: [PATCH 045/393] Add NFTb --- projects/nftb/abi.json | 38 ++++++++++++++ projects/nftb/index.js | 112 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+) create mode 100644 projects/nftb/abi.json create mode 100644 projects/nftb/index.js diff --git a/projects/nftb/abi.json b/projects/nftb/abi.json new file mode 100644 index 0000000000..8ab98d27eb --- /dev/null +++ b/projects/nftb/abi.json @@ -0,0 +1,38 @@ +{ + "getPrice": { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getTotal": { + "constant": true, + "inputs": [], + "name": "getTotalCollateral", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/nftb/index.js b/projects/nftb/index.js new file mode 100644 index 0000000000..d1bacf318d --- /dev/null +++ b/projects/nftb/index.js @@ -0,0 +1,112 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const BN = require("bignumber.js"); + +async function getTotal(pools, chain, block) { + const balances = {}; + // Need to be called separately because BUSDT rejects when multicalled on BSC + await Promise.all( + pools.map((pool) => + sdk.api.erc20 + .balanceOf({ + target: pool[1], + owner: pool[0], + chain, + block, + }) + .then((result) => + sdk.util.sumSingleBalance(balances, pool[2], result.output) + ) + ) + ); + return balances; +} + +const bscPools = [ + // pool, token, representation + + [ + "0x0158aF415642A0879802cdb2e1347f0Af1b47eF9", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //2-Month Vault + [ + "0x1240F9904c02d7e48FF03a7C71894bF2530838EB", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //4-Month Vault + [ + "0x50D888179581D540753Aa6E2B6fe5EDCa594158a", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //6-Month Vault + [ + "0xB634a7f635C6367C7F07485363750C09184Fd3F4", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //3-Month Vault + [ + "0x45994757C035892AE66b91925a4Cf561D6aa66f6", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //5-Month Vault + [ + "0x1b5A0D734786ef666abCDfD4153f3EaB9062a1F8", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //4-Month Vest Vault + [ + "0x1386FdB83a0Ce87E146E8BCF807F2B969D29A97a", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //6-Month Vest Vault + [ + "0x3a154b615447CD79D5617CD864d693e9CdD95685", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //12-Month Vest Vault + [ + "0x44D86d4DE4bAe10c85Da7C7D2CDC3333b4b515C8", + "0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + "bsc:0xde3dbbe30cfa9f437b293294d1fd64b26045c71a", + ], //Tiers + [ + "0xC5d72B45C09d2509e66F78D19BfA3B5DD7C04f5a", + "0xf81628edeb110a73c016ab7afa57d80afae07f59", + "bsc:0xf81628edeb110a73c016ab7afa57d80afae07f59", + ], //6-Month LOTT Vault + [ + "0x3213F00f2aa67BdC6eCF1502C99cCA044C87690F", + "0xf81628edeb110a73c016ab7afa57d80afae07f59", + "bsc:0xf81628edeb110a73c016ab7afa57d80afae07f59", + ], //3-Month LOTT Vault + [ + "0x3746ff9590A1ca9bC9a2067481324a75d3C528Ef", + "0xf81628edeb110a73c016ab7afa57d80afae07f59", + "bsc:0xf81628edeb110a73c016ab7afa57d80afae07f59", + ], //1-Month LOTT Vault +]; + +async function bsc(_timestamp, block, chainBlocks) { + return getTotal(bscPools, "bsc", chainBlocks["bsc"]); +} + +function mergeBalances(balances, balancesToMerge) { + Object.entries(balancesToMerge).forEach((balance) => { + sdk.util.sumSingleBalance(balances, balance[0], balance[1]); + }); +} +async function tvl(timestamp, block, chainBlocks) { + const balances = {}; + await Promise.all([bsc(timestamp, block, chainBlocks)]).then((poolBalances) => + poolBalances.forEach((pool) => mergeBalances(balances, pool)) + ); + return balances; +} + +module.exports = { + bsc: { + tvl: bsc, + }, + tvl, +}; From b6a8eb27ed3aee7d427d5a149432529ad1699866 Mon Sep 17 00:00:00 2001 From: sruthi23 Date: Thu, 2 Dec 2021 21:09:07 +0530 Subject: [PATCH 046/393] Fetch tvl for polygon and fantom network --- projects/knitfinance/index.js | 380 ++++++++++++++-------------------- 1 file changed, 158 insertions(+), 222 deletions(-) diff --git a/projects/knitfinance/index.js b/projects/knitfinance/index.js index 30bcc44986..8cf77130a5 100644 --- a/projects/knitfinance/index.js +++ b/projects/knitfinance/index.js @@ -1,231 +1,167 @@ -const retry = require('../helper/retry') -const axios = require('axios') -const BigNumber = require('bignumber.js') -const sdk = require('@defillama/sdk') +const retry = require("../helper/retry"); +const axios = require("axios"); +const BigNumber = require("bignumber.js"); +const sdk = require("@defillama/sdk"); -const _fetchKft = async () => { - let kft_response = await retry( - async bail => - await axios.get( - 'https://api.etherscan.io/api?module=stats&action=tokensupply&contractaddress=0xef53462838000184f35f7d991452e5f25110b207&apikey=UZC789UVNGW1UDUUZAQXD562CEG64JWTAE' - ) - ) - let kft_tvl = new BigNumber(kft_response.data.result).div(10 ** 18) - return { - 'knit-finance': kft_tvl - } -} - -const _fetchForBsc = async () => { - let btc_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x922a05bf1b7e07cf27d3f5fadc8133e00c75b75f&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let bsc_btc_tvl = new BigNumber(btc_bsc_response.data.result).div(10 ** 18) - - let eth_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0xb7141b1a194e9d5e32711917c68fee5db7778e65&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let bsc_eth_tvl = new BigNumber(eth_bsc_response.data.result).div(10 ** 18) - - let ltc_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0xa57963d8cb08c157d46862d77be4c0e6b5675494&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let ltc_bsc_tvl = new BigNumber(ltc_bsc_response.data.result).div(10 ** 18) - - let cardano_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x24fcff967fc28afced3c4891b86c1db56d33020e&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - - let cardano_bsc_tvl = new BigNumber(cardano_bsc_response.data.result).div( - 10 ** 18 - ) - - let polygon_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0xae35b15e58eaee102fc5c575cea17b8b6ca3dcb6&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let polygon_bsc_tvl = new BigNumber(polygon_bsc_response.data.result).div( - 10 ** 18 - ) - - let avalanche_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x54e67c935c5dc9634bcc16f86e6f5747a76b2da4&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - - let avalanche_bsc_tvl = new BigNumber(avalanche_bsc_response.data.result).div( - 10 ** 18 - ) - - let elrond_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x226be9b1840364c5883a18b354f41ae342d948f1&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - - let elrond_bsc_tvl = new BigNumber(elrond_bsc_response.data.result).div( - 10 ** 18 - ) - - let iost_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x1ad5021af1d2be561c4a086bb1e0015803c3810f&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let iost_bsc_tvl = new BigNumber(iost_bsc_response.data.result).div(10 ** 18) - - let dash_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0xb2a04c839b9f91889f333e661c9c51deaa6e642d&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let dash_bsc_tvl = new BigNumber(dash_bsc_response.data.result).div(10 ** 18) - - let ripple_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x28cf5786dbc2e9ecc1e5b8fd8a2fce005f095c06&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let ripple_bsc_tvl = new BigNumber(dash_bsc_response.data.result).div( - 10 ** 18 - ) - - let stellar_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0xf3e94c72889afba13ba53898d22717821883e1a5&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let stellar_bsc_tvl = new BigNumber(stellar_bsc_response.data.result).div( - 10 ** 18 - ) - - let doge_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x52a86ed7d5bed75c876ec9fd44d259375f623ac0&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let doge_bsc_tvl = new BigNumber(doge_bsc_response.data.result).div(10 ** 18) - - let bitcoincash_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x31ef831ff9f4e4bd88cb3c1f6c6c5d33c89cb6fd&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let bitcoincash_bsc_tvl = new BigNumber( - bitcoincash_bsc_response.data.result - ).div(10 ** 18) - - let zcash_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x941661c8066e0ef6050dcbb84891a77d9db1a20e&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let zcash_bsc_tvl = new BigNumber(zcash_bsc_response.data.result).div( - 10 ** 18 - ) - - let bitcoinsv_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x186b614883e57cd31b67b7ae417098aac732010c&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let bitcoinsv_bsc_tvl = new BigNumber(bitcoinsv_bsc_response.data.result).div( - 10 ** 18 - ) - - let frontier_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x60aa3676582a1369a79ae415122470f245fbc5a8&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let frontier_bsc_tvl = new BigNumber(frontier_bsc_response.data.result).div( - 10 ** 18 - ) - - let stacks_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0xe3312a1c2877b0f9d92e251793bfac2d1a81612e&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let stacks_bsc_tvl = new BigNumber(stacks_bsc_response.data.result).div( - 10 ** 18 - ) - - let fantom_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0x1d9f90c145df4950a50e7637a8b4066b90727159&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let fantom_bsc_tvl = new BigNumber(fantom_bsc_response.data.result).div( - 10 ** 18 - ) - - let loom_bsc_response = await retry( - async bail => - await axios.get( - 'https://api.bscscan.com/api?module=stats&action=tokensupply&contractaddress=0xd7110c535aedbe0edaedab40cbc74cc7f45fc9e7&apikey=H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG' - ) - ) - let loom_bsc_tvl = new BigNumber(loom_bsc_response.data.result).div(10 ** 18) +const apiKey = "UZC789UVNGW1UDUUZAQXD562CEG64JWTAE"; +const assets = { + bsc: { + "0x922a05bf1b7e07cf27d3f5fadc8133e00c75b75f": "bitcoin", + "0xb7141b1a194e9d5e32711917c68fee5db7778e65": "ethereum", + "0xa57963d8cb08c157d46862d77be4c0e6b5675494": "litecoin", + "0x24fcff967fc28afced3c4891b86c1db56d33020e": "cardano", + "0xae35b15e58eaee102fc5c575cea17b8b6ca3dcb6": "polygon", + "0x54e67c935c5dc9634bcc16f86e6f5747a76b2da4": "avalanche", + "0x1ad5021af1d2be561c4a086bb1e0015803c3810f": "iost", + "0xb2a04c839b9f91889f333e661c9c51deaa6e642d": "dash", + "0x28cf5786dbc2e9ecc1e5b8fd8a2fce005f095c06": "ripple", + "0xf3e94c72889afba13ba53898d22717821883e1a5": "stellar", + "0x52a86ed7d5bed75c876ec9fd44d259375f623ac0": "dogecoin", + "0x31ef831ff9f4e4bd88cb3c1f6c6c5d33c89cb6fd": "bitcoin-cash", + "0x941661c8066e0ef6050dcbb84891a77d9db1a20e": "zcash", + "0x186b614883e57cd31b67b7ae417098aac732010c": "bitcoin-sv", + "0x60aa3676582a1369a79ae415122470f245fbc5a8": "frontier", + "0x1d9f90c145df4950a50e7637a8b4066b90727159": "fantom", + "0xd7110c535aedbe0edaedab40cbc74cc7f45fc9e7": "loom-network", + "0xf3e94c72889afba13ba53898d22717821883e1a5": "knit-finance", + }, + eth: { "0xef53462838000184f35f7d991452e5f25110b207": "knit-finance" }, + matic: { + "0x94e152511588e79f6db10e7c879d4bad437107af": "ethereum", + "0xeB062AD3FE3fDa9cb20e0466E4F023b557Df116B": "bitcoin", + "0xF5529E7ff8b0587eD4d243573bC9697A4D12BfBD": "litecoin", + "0x3f44e746D31cd00BB1968Bf4e2E5E61895814E92": "cardano", + "0x9485ADfDcD26F56F9b55cE189905B27845558850": "polygon", + "0x005Ed6E17c748BDbDa3262c361A317aA3DbBC2fc": "avalanche", + "0x0ACEBF7Fcf36575aF1e93432eF0e75516e05D50E": "iost", + "0x248d0134BA0E931E48c525843a4C0029B20D2956": "dash", + "0x96729c6De16693D9C9b2013E22842e3eaDcFFE31": "ripple", + "0x03c8fB4716AB826041E6d447c0B3916FEEEFADFE": "stellar", + "0xe4b2D5b0967758DAe4677C02A7b4440d7251F86D": "dogecoin", + "0x778C9a3073fac0ED6f2b561109989E23c7AD05A6": "bitcoin-cash", + "0x0Dcd7A5DF109057332344Ef6A27C2D68031BBb3B": "zcash", + "0x85e773d0Ff19d9Bb00ed0BD0271d72c77C72a2D4": "bitcoin-sv", + "0x2dc1cc99f5E6F72197236fe1e30921EB863E38b5": "frontier", + "0x555B1774b6419dC41D917EC47B1f4fBB76e69d68": "fantom", + "0x710BC8cD80F812e1E51468f120617136EA8fc3Ca": "loom-network", + "0xC8DDB51cE5002c1984c96926022Ce20B06f11339": "knit-finance", + }, + fantom: { + "0x251f6a75192d0003d0ebc7abddc1795354df674e": "bitcoin", + "0xb06b4ab0d83b6f1a12ff5391daa8fae39a7d5ba2": "ethereum", + "0x67dbaA721dA715738011Cc193dB65f0D239004b4": "litecoin", + "0x5242F261B948f4d9aBf21b33E348D3eFaF031ae3": "cardano", + "0xEdCd6F462E8a96F596ED33f987D7DA0090E057B0": "polygon", + "0x89E96B056fb758a8a382454b0bd7ff78d59d6EC7": "avalanche", + "0x16e7B66D0Bf7400C35EDFc0CF46293cE63337C3B": "iost", + "0xa9A9616d569C38Dd0323A3aED52459D21570DBEd": "dash", + "0xAAFc50ac5C03555085F555a2B7c139B6EE058CA2": "ripple", + "0xe401744b34f44CeEfCFa2bA66eae9F1E448F0bd6": "stellar", + "0xf9AE9267C74cA2d8B50883e7D22D438Bf2878DdC": "dogecoin", + "0xe296E335643E81fDAab56652DBD3Ef5fF0c64133": "bitcoin-cash", + "0x28db80024472D67A0d7249389299dF2b14c0eFeC": "zcash", + "0x8ebF9699406986d5F28fEEa3Be3dd053Ea0F65b9": "bitcoin-sv", + "0x11B3d4F5786487d72F7814395a5455f213609bcf": "frontier", + "0x5F3b083B1571f92a67894a989f035BdBf1ee7729": "fantom", + "0x7621F2bd65624a579a9483c7d2B126c8877545b9": "loom-network", + "0xaEAB17e79C40bFccC477746CE77B661aa724CDfc": "knit-finance", + }, +}; - return { - bitcoin: bsc_btc_tvl, - ethereum: bsc_eth_tvl, - litecoin: ltc_bsc_tvl, - cardano: cardano_bsc_tvl, - polygon: polygon_bsc_tvl, - avalanche: avalanche_bsc_tvl, - elrond: elrond_bsc_tvl, - iost: iost_bsc_tvl, - dash: dash_bsc_tvl, - ripple: ripple_bsc_tvl, - stellar: stellar_bsc_tvl, - dogecoin: doge_bsc_tvl, - 'bitcoin-cash': bitcoincash_bsc_tvl, - zcash: zcash_bsc_tvl, - 'bitcoin-sv': bitcoinsv_bsc_tvl, - frontier: frontier_bsc_tvl, - stacks: stacks_bsc_tvl, - fantom: fantom_bsc_tvl, - loom: loom_bsc_tvl +const apiPath = { + bsc: { + base_url: "https://api.bscscan.com", + api_key: "H8S7Y2FBEFSP2I5D1ZSTRR5DM6BDH9Q8SG", + }, + eth: { + base_url: "https://api.etherscan.com", + api_key: "UZC789UVNGW1UDUUZAQXD562CEG64JWTAE", + }, + matic: { + base_url: "https://api.polygonscan.com", + api_key: "M2Y1KZE5BUJP8DBCCDGWVSDJYCHXCPDVYK", + }, +}; + +const getTokenSupply = (contractaddress, network) => { + return axios.get( + `${apiPath[network].base_url}/api?module=stats&action=tokensupply&contractaddress=${contractaddress}&apikey=${apiPath[network].api_key}` + ); +}; + +const _fetch = async (contractaddress, network, name) => { + return new Promise(async (resolve, reject) => { + try { + const response = await retry( + async (bail) => await getTokenSupply(contractaddress, network) + ); + let result = {}; + result[name] = new BigNumber(response.data.result).div(10 ** 18); + resolve(result); + } catch (e) { + reject(e); + } + }); +}; + +const getNetworkAssets = async (network) => { + const promises = []; + const allAddress = Object.keys(assets[network]); + allAddress.forEach((item, i) => { + promises.push( + new Promise((res) => setTimeout(res, 1000 * i)).then(() => + _fetch(item, network, assets[network][item]) + ) + ); + }); + try { + return await Promise.all(promises); + } catch (e) { + console.log(e); + } +}; + +const _ethFetch = async () => { + try { + const result = await getNetworkAssets("eth"); + const object = Object.assign({}, ...result); + return object; + } catch (e) { + console.log(e); + } +}; + +const _bscFetch = async () => { + try { + const result = await getNetworkAssets("bsc"); + const object = Object.assign({}, ...result); + return object; + } catch (e) { + console.log(e); + } +}; + +const _maticFetch = async () => { + try { + const result = await getNetworkAssets("matic"); + console.log(result); + const object = Object.assign({}, ...result); + return object; + } catch (e) { + console.log(e); } -} +}; module.exports = { methodology: - 'TVL is calculated based on the total KFT in circulation along with every k-assset minted on other chains against native assets deposited.', + "TVL is calculated based on the total KFT in circulation along with every k-assset minted on other chains against native assets deposited.", ethereum: { - tvl: _fetchKft + tvl: _ethFetch, }, bsc: { - tvl: _fetchForBsc - } -} + tvl: _bscFetch, + }, + polygon: { + tvl: _maticFetch, + }, +}; From 1d48585bcc55909fcbbc1fb08f4e7cb8d7198c21 Mon Sep 17 00:00:00 2001 From: Geek4tek Date: Thu, 2 Dec 2021 23:05:46 +0530 Subject: [PATCH 047/393] add tvl adapter for OCP --- projects/OCP/index.js | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 projects/OCP/index.js diff --git a/projects/OCP/index.js b/projects/OCP/index.js new file mode 100644 index 0000000000..99c18b8344 --- /dev/null +++ b/projects/OCP/index.js @@ -0,0 +1,48 @@ +const utils = require("../helper/utils"); + +function fetchChain(chainId) { + return async () => { + const response = await utils.fetchURL( + "https://api-omnisteaks.ocp.finance/tvl/apps?q=1666600000" + ); + + let tvl = 0; + const tradeTvl = response.data["tradeTvl"]; + const compTvl = response.data["compTvl"]; + const vaultTvl = response.data["vaultTvl"]; + const steakTvl = response.data["steakTvl"]; + const farmTvl = response.data["farmTvl"]; + + tvl = + Number(tradeTvl) + + Number(compTvl) + + Number(vaultTvl) + + Number(steakTvl) + + Number(farmTvl); + if (tvl === 0) { + throw new Error(`chain ${chainId} tvl is 0`); + } + return tvl; + }; +} + +async function fetch() { + const response = await utils.fetchURL( + "https://api-omnisteaks.ocp.finance/tvl/apps?q=1666600000" + ); + + let tvl = 0; + tvl = response.data["totalTvl"]; + if (tvl === 0) { + throw new Error("tvl is 0"); + } + + return tvl; +} + +module.exports = { + bsc: { + fetch: fetchChain(56), + }, + fetch, +}; From 3a2eadc73e5ddc474dd401d58706d58cf25abe60 Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:50:01 +0900 Subject: [PATCH 048/393] Create HoneyBee_BSC_ABI.json ABI for BSC HoneyBee --- projects/HoneyFarm/HoneyBee_BSC_ABI.json | 71 ++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 projects/HoneyFarm/HoneyBee_BSC_ABI.json diff --git a/projects/HoneyFarm/HoneyBee_BSC_ABI.json b/projects/HoneyFarm/HoneyBee_BSC_ABI.json new file mode 100644 index 0000000000..9808d15c56 --- /dev/null +++ b/projects/HoneyFarm/HoneyBee_BSC_ABI.json @@ -0,0 +1,71 @@ +{ + "poolInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IBEP20", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accSingPerShare", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "depositFeeBP", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "totalcap", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isStrat", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "stratId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earnfee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accEarnPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} From e9590f07aeb151d6fa419de350ebbf5553048eea Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:50:45 +0900 Subject: [PATCH 049/393] Create HoneyBee_Avax_ABI.json ABI for Avax HoneyBee --- projects/HoneyFarm/HoneyBee_Avax_ABI.json | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 projects/HoneyFarm/HoneyBee_Avax_ABI.json diff --git a/projects/HoneyFarm/HoneyBee_Avax_ABI.json b/projects/HoneyFarm/HoneyBee_Avax_ABI.json new file mode 100644 index 0000000000..9808d15c56 --- /dev/null +++ b/projects/HoneyFarm/HoneyBee_Avax_ABI.json @@ -0,0 +1,71 @@ +{ + "poolInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IBEP20", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accSingPerShare", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "depositFeeBP", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "totalcap", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isStrat", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "stratId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earnfee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accEarnPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} From 6d9913837b3249a9bd5a5bcb19ba1661a6f33292 Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:52:56 +0900 Subject: [PATCH 050/393] Create HoneyBee_Fantom_ABI.json --- projects/HoneyFarm/HoneyBee_Fantom_ABI.json | 76 +++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 projects/HoneyFarm/HoneyBee_Fantom_ABI.json diff --git a/projects/HoneyFarm/HoneyBee_Fantom_ABI.json b/projects/HoneyFarm/HoneyBee_Fantom_ABI.json new file mode 100644 index 0000000000..b1d8b2c421 --- /dev/null +++ b/projects/HoneyFarm/HoneyBee_Fantom_ABI.json @@ -0,0 +1,76 @@ +{ + "poolInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IBEP20", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accSingPerShare", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "depositFeeBP", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "totalcap", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isStrat", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "masterId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stratId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earnfee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accEarnPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} From 627b259bbf8bd248d5fd1f9bd884804b553fbd1b Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:53:25 +0900 Subject: [PATCH 051/393] Create HoneyBee_Poly_ABI.json --- projects/HoneyFarm/HoneyBee_Poly_ABI.json | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 projects/HoneyFarm/HoneyBee_Poly_ABI.json diff --git a/projects/HoneyFarm/HoneyBee_Poly_ABI.json b/projects/HoneyFarm/HoneyBee_Poly_ABI.json new file mode 100644 index 0000000000..d9ee14a55a --- /dev/null +++ b/projects/HoneyFarm/HoneyBee_Poly_ABI.json @@ -0,0 +1,71 @@ +{ + "poolInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IBEP20", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accSingPerShare", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "depositFeeBP", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "totalcap", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isStrat", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "stratId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stratFee", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "earned", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accEarnPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} From 0ceffe37e3bf3986568f2e57a211618be95abaa8 Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:59:44 +0900 Subject: [PATCH 052/393] Create Index.js --- projects/HoneyFarm/Index.js | 114 ++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 projects/HoneyFarm/Index.js diff --git a/projects/HoneyFarm/Index.js b/projects/HoneyFarm/Index.js new file mode 100644 index 0000000000..28aa4eb8e9 --- /dev/null +++ b/projects/HoneyFarm/Index.js @@ -0,0 +1,114 @@ +const sdk = require("@defillama/sdk"); +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); +const { addFundsInMasterChef } = require("../helper/masterchef"); +const avaxabi = require("./HoneyBee_Avax_ABI.json"); +const bscabi = require("./HoneyBee_BSC_ABI.json"); +const polyabi = require("./HoneyBee_Poly_ABI.json"); +// const ftmabi = require("./HoneyBee_Fantom_ABI.json"); +// const abiGeneral = require("../helper/abis/masterchef.json"); +const { default: BigNumber } = require("bignumber.js"); + +const BEETOKEN = { + avax: "0xB669c71431bc4372140bC35Aa1962C4B980bA507", + bsc: "0x1A8d7AC01d21991BF5249A3657C97b2B6d919222", +}; + +const masterChef = { + avax: "0x757490104fd4C80195D3C56bee4dc7B1279cCC51", + bsc: "0x88E21dedEf04cf24AFe1847B0F6927a719AA8F35", +}; +const abi = { + avax: avaxabi, + bsc: bscabi, +}; + +// const ACC_BEE_PRECISION = 1e18; + +async function getTokensInMasterChef(time, ethBlock, chainBlocks, chain) { + const block = chainBlocks[chain]; + const transformAddress = (addr) => `${chain}:${addr}`; + const ignoreAddresses = [BEETOKEN[chain]]; + + const balances = {}; + const poolLength = ( + await sdk.api.abi.call({ + abi: abiGeneral.poolLength, + target: masterChef[chain], + block, + chain, + }) + ).output; + + const poolInfo = ( + await sdk.api.abi.multiCall({ + block, + calls: Array.from(Array(Number(poolLength)).keys()).map((i) => ({ + target: masterChef[chain], + params: i, + })), + abi: abi[chain].poolInfo, + chain, + }) + ).output; + + const [symbols] = await Promise.all([ + sdk.api.abi.multiCall({ + block, + calls: poolInfo.map((p) => ({ + target: p.output[0], + })), + abi: "erc20:symbol", + chain, + }), + ]); + + const lpPositions = []; + + symbols.output.forEach((symbol, idx) => { + const pool = poolInfo[idx].output; + const balance = +pool.totalcap; + const token = symbol.input.target; + + if (symbol.output.includes("LP") || symbol.output.includes("JLP")) { + lpPositions.push({ + balance, + token, + }); + } else { + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + } + }); + + await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); + return balances; +} + +async function avaxTvl(timestamp, block, chainBlocks) { + return await getTokensInMasterChef(timestamp, block, chainBlocks, "avax"); +} +// async function fantomTvl(timestamp, block, chainBlocks) { +// return await getTokensInMasterChef(timestamp, block, chainBlocks, "fantom"); } + +async function bscTvl(timestamp, block, chainBlocks) { + return await getTokensInMasterChef(timestamp, block, chainBlocks, "bsc"); +} + +// async function polyTvl(timestamp, block, chainBlocks) { +// return await getTokensInMasterChef(timestamp, block, chainBlocks, "polygon"); } + +module.exports = { + methodology: + "Only staked LP is counted as TVL. Excluded in TVL : Locked BEE in the RoyalJelly, NFT Jelly, value of BNB & xJOE which aren't on CoinGecko yet.", + avalanche: { + tvl: avaxTvl, + }, + bsc: { + tvl: bscTvl, + }, +// polygon: { +// tvl: polyTvl, }, +// fantom: { +// tvl: fantomTvl, }, + tvl: sdk.util.sumChainTvls([avaxTvl, bscTvl]), +}; From c28e0ca41cf0679cba551749c981d3989620fa2d Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 03:03:36 +0900 Subject: [PATCH 053/393] Update HoneyBee_Avax_ABI.json --- projects/HoneyFarm/HoneyBee_Avax_ABI.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/HoneyFarm/HoneyBee_Avax_ABI.json b/projects/HoneyFarm/HoneyBee_Avax_ABI.json index 9808d15c56..15422a5414 100644 --- a/projects/HoneyFarm/HoneyBee_Avax_ABI.json +++ b/projects/HoneyFarm/HoneyBee_Avax_ABI.json @@ -26,7 +26,7 @@ }, { "internalType": "uint256", - "name": "accSingPerShare", + "name": "accBEEPerShare", "type": "uint256" }, { From 7a77558edf6265d834331b37eb26515391c6f087 Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 03:03:59 +0900 Subject: [PATCH 054/393] Update HoneyBee_BSC_ABI.json --- projects/HoneyFarm/HoneyBee_BSC_ABI.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/HoneyFarm/HoneyBee_BSC_ABI.json b/projects/HoneyFarm/HoneyBee_BSC_ABI.json index 9808d15c56..15422a5414 100644 --- a/projects/HoneyFarm/HoneyBee_BSC_ABI.json +++ b/projects/HoneyFarm/HoneyBee_BSC_ABI.json @@ -26,7 +26,7 @@ }, { "internalType": "uint256", - "name": "accSingPerShare", + "name": "accBEEPerShare", "type": "uint256" }, { From 596c99a96d2ca4a05da0dbca2ba19b88f4563961 Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 03:04:13 +0900 Subject: [PATCH 055/393] Update HoneyBee_Fantom_ABI.json --- projects/HoneyFarm/HoneyBee_Fantom_ABI.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/HoneyFarm/HoneyBee_Fantom_ABI.json b/projects/HoneyFarm/HoneyBee_Fantom_ABI.json index b1d8b2c421..843d747551 100644 --- a/projects/HoneyFarm/HoneyBee_Fantom_ABI.json +++ b/projects/HoneyFarm/HoneyBee_Fantom_ABI.json @@ -26,7 +26,7 @@ }, { "internalType": "uint256", - "name": "accSingPerShare", + "name": "accBEEPerShare", "type": "uint256" }, { From e18d9e4157dc30c1e508863de12a999812b1b7c4 Mon Sep 17 00:00:00 2001 From: HoneyFarmFi <87581535+HoneyFarmFi@users.noreply.github.com> Date: Fri, 3 Dec 2021 03:04:25 +0900 Subject: [PATCH 056/393] Update HoneyBee_Poly_ABI.json --- projects/HoneyFarm/HoneyBee_Poly_ABI.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/HoneyFarm/HoneyBee_Poly_ABI.json b/projects/HoneyFarm/HoneyBee_Poly_ABI.json index d9ee14a55a..8d02fd3f17 100644 --- a/projects/HoneyFarm/HoneyBee_Poly_ABI.json +++ b/projects/HoneyFarm/HoneyBee_Poly_ABI.json @@ -26,7 +26,7 @@ }, { "internalType": "uint256", - "name": "accSingPerShare", + "name": "accBEEPerShare", "type": "uint256" }, { From 26631f018b2bf62707db8193941d66226bb508f7 Mon Sep 17 00:00:00 2001 From: d1stsys Date: Thu, 2 Dec 2021 10:06:57 -0800 Subject: [PATCH 057/393] Buffer subgraph calls for padswap adapter --- projects/helper/getUniSubgraphTvl.js | 16 ++++++++++++++++ projects/padswap/index.js | 9 ++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/projects/helper/getUniSubgraphTvl.js b/projects/helper/getUniSubgraphTvl.js index 77622516ed..a7f81ed69c 100644 --- a/projects/helper/getUniSubgraphTvl.js +++ b/projects/helper/getUniSubgraphTvl.js @@ -29,6 +29,21 @@ query get_tvl($block: Int) { } } +function getChainTvlBuffered(graphUrls, bufferSeconds, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD") { + const chainFn = getChainTvl(graphUrls, factoriesName, tvlName) + return (chain) =>{ + const tvl = chainFn(chain) + return async (timestamp, ethBlock, chainBlocks) => { + timestamp -= bufferSeconds + for (const chainName in chainBlocks) { + chainBlocks[chainName] = await getBlock(timestamp, chainName, {}, false) + } + ethBlock = chainBlocks['ethereum'] + return await tvl(timestamp, ethBlock, chainBlocks) + } + } +} + function getAvaxUniswapTvl(graphUrl, factoriesName = "uniswapFactories", tvlName = "totalLiquidityETH") { const graphQuery = gql` query get_tvl($block: Int) { @@ -56,5 +71,6 @@ query get_tvl($block: Int) { module.exports = { getChainTvl, + getChainTvlBuffered, getAvaxUniswapTvl } \ No newline at end of file diff --git a/projects/padswap/index.js b/projects/padswap/index.js index 039cc135ce..7e448c47fb 100644 --- a/projects/padswap/index.js +++ b/projects/padswap/index.js @@ -1,6 +1,7 @@ const { stakings } = require("../helper/staking"); const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); -const { getChainTvl } = require("../helper/getUniSubgraphTvl"); +const { getChainTvlBuffered } = require("../helper/getUniSubgraphTvl"); +const { getBlock } = require("../helper/getBlock") const TOAD_ADDRESS = "0x463e737d8f740395abf44f7aac2d9531d8d539e9"; const TOAD_FARM_ADDRESS = "0xe1F1EDfBcEfB1E924e4a031Ed6B4CAbC7e570154"; @@ -14,11 +15,13 @@ const PADSWAP_BSC_FACTORY_ADDRESS = const PADSWAP_MOONRIVER_FACTORY_ADDRESS = "0x760d2Bdb232027aB3b1594405077F9a1b91C04c1"; -const subgraphTvls = getChainTvl({ +const SUBGRAPH_BUFFER_DELAY = 10*60; // 10 minutes + +const subgraphTvls = getChainTvlBuffered({ bsc: "https://subgraph.toadlytics.com:8080/subgraphs/name/padswap-subgraph", moonriver: "https://api.thegraph.com/subgraphs/name/toadguy/padswap-subgraph-moonriver", -}); +}, SUBGRAPH_BUFFER_DELAY); module.exports = { methodology: `TVL accounts for the liquidity on all AMM pools (see https://info.padswap.exchange/ and https://movr-info.padswap.exchange/). Staking includes all TOAD staked in TOAD farms.`, From 961df2269dfae03fff243201817a53ac16ad3e5d Mon Sep 17 00:00:00 2001 From: d1stsys Date: Thu, 2 Dec 2021 10:13:49 -0800 Subject: [PATCH 058/393] Fix missing space --- projects/helper/getUniSubgraphTvl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/getUniSubgraphTvl.js b/projects/helper/getUniSubgraphTvl.js index a7f81ed69c..af291df748 100644 --- a/projects/helper/getUniSubgraphTvl.js +++ b/projects/helper/getUniSubgraphTvl.js @@ -31,7 +31,7 @@ query get_tvl($block: Int) { function getChainTvlBuffered(graphUrls, bufferSeconds, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD") { const chainFn = getChainTvl(graphUrls, factoriesName, tvlName) - return (chain) =>{ + return (chain) => { const tvl = chainFn(chain) return async (timestamp, ethBlock, chainBlocks) => { timestamp -= bufferSeconds From 355ed1c871578af9c4e2d7ebde66d7b6dca9439b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 2 Dec 2021 18:15:57 +0000 Subject: [PATCH 059/393] on-chain idle + polygon --- projects/idle.js | 307 ----------------------------------------- projects/idle/abi.json | 45 ++++++ projects/idle/index.js | 74 ++++++++++ 3 files changed, 119 insertions(+), 307 deletions(-) delete mode 100644 projects/idle.js create mode 100644 projects/idle/abi.json create mode 100644 projects/idle/index.js diff --git a/projects/idle.js b/projects/idle.js deleted file mode 100644 index 03d86b43d1..0000000000 --- a/projects/idle.js +++ /dev/null @@ -1,307 +0,0 @@ -const axios = require("axios"); -const retry = require('./helper/retry'); -const web3 = require('./config/web3.js'); -const BigNumber = require('bignumber.js'); -const COMP_abi = require('./config/idle/COMP.js').abi; -const IdleCDO = require('./config/idle/IdleCDO.js').abi; -const ERC20_abi = require('./config/idle/ERC20.js').abi; -const IdleTokenV4 = require('./config/idle/IdleTokenV4.js').abi; -const IdleTokenV3 = require('./config/idle/IdleTokenV3.js').abi; -const uniswapRouter = require('./config/idle/uniswapRouter.js').abi; -const UniswapExchangeInterface = require('./config/idle/UniswapExchangeInterface.js').abi; - -async function fetch() { - - //Tranches info - const trancheContracts = { - DAI: { - abi: IdleCDO, - decimals: 18, - name: 'IdleCDO_idleDAIYield', - address: '0xd0DbcD556cA22d3f3c142e9a3220053FD7a247BC' - }, - FEI: { - abi: IdleCDO, - decimals: 18, - name: 'IdleCDO_idleFEIYield', - address: '0x77648a2661687ef3b05214d824503f6717311596' - } - }; - - // Idle tokens info - const contracts = { - idleWETHYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'WETH', - address: '0xC8E6CA6E96a326dC448307A5fDE90a0b21fd7f80', - }, - idleRAIYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'RAI', - address: '0x5C960a3DCC01BE8a0f49c02A8ceBCAcf5D07fABe', - }, - idleFEIYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'FEI', - address: '0xb2d5CB72A621493fe83C6885E4A776279be595bC', - }, - idleDAIYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'DAI', - address: '0x3fe7940616e5bc47b0775a0dccf6237893353bb4' - }, - idleDAIYieldV3: { - abi: IdleTokenV3, - underlyingToken: 'DAI', - address: '0x78751b12da02728f467a44eac40f5cbc16bd7934' - }, - idleUSDCYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'USDC', - address: '0x5274891bEC421B39D23760c04A6755eCB444797C' - }, - idleUSDCYieldV3: { - abi: IdleTokenV3, - underlyingToken: 'USDC', - address: '0x12B98C621E8754Ae70d0fDbBC73D6208bC3e3cA6' - }, - idleUSDTYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'USDT', - address: '0xF34842d05A1c888Ca02769A633DF37177415C2f8' - }, - idleUSDTYieldV3: { - abi: IdleTokenV3, - underlyingToken: 'USDT', - address: '0x63D27B3DA94A9E871222CB0A32232674B02D2f2D' - }, - idleSUSDYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'SUSD', - address: '0xf52cdcd458bf455aed77751743180ec4a595fd3f' - }, - idleSUSDYieldV3: { - abi: IdleTokenV3, - underlyingToken: 'SUSD', - address: '0xe79e177d2a5c7085027d7c64c8f271c81430fc9b' - }, - idleTUSDYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'TUSD', - address: '0xc278041fDD8249FE4c1Aad1193876857EEa3D68c' - }, - idleTUSDYieldV3: { - abi: IdleTokenV3, - underlyingToken: 'TUSD', - address: '0x51C77689A9c2e8cCBEcD4eC9770a1fA5fA83EeF1' - }, - idleWBTCYieldV4: { - abi: IdleTokenV4, - underlyingToken: 'WBTC', - address: '0x8C81121B15197fA0eEaEE1DC75533419DcfD3151' - }, - idleWBTCYieldV3: { - abi: IdleTokenV3, - underlyingToken: 'WBTC', - address: '0xD6f279B7ccBCD70F8be439d25B9Df93AEb60eC55' - }, - idleDAISafeV4: { - abi: IdleTokenV4, - underlyingToken: 'DAI', - address: '0xa14ea0e11121e6e951e87c66afe460a00bcd6a16' - }, - idleDAISafeV3: { - abi: IdleTokenV3, - underlyingToken: 'DAI', - address: '0x1846bdfDB6A0f5c473dEc610144513bd071999fB' - }, - idleUSDCSafeV4: { - abi: IdleTokenV4, - underlyingToken: 'USDC', - address: '0x3391bc034f2935ef0e1e41619445f998b2680d35' - }, - idleUSDCSafeV3: { - abi: IdleTokenV3, - underlyingToken: 'USDC', - address: '0xcDdB1Bceb7a1979C6caa0229820707429dd3Ec6C' - }, - idleUSDTSafeV4: { - abi: IdleTokenV4, - underlyingToken: 'USDT', - address: '0x28fAc5334C9f7262b3A3Fe707e250E01053e07b5' - }, - idleUSDTSafeV3: { - abi: IdleTokenV3, - underlyingToken: 'USDT', - address: '0x42740698959761baf1b06baa51efbd88cb1d862b' - } - }; - - // Underlying tokens contracts - const underlyingTokensContracts = { - DAI: new web3.eth.Contract(ERC20_abi, '0x6b175474e89094c44da98b954eedeac495271d0f'), - USDC: new web3.eth.Contract(ERC20_abi, '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'), - USDT: new web3.eth.Contract(ERC20_abi, '0xdac17f958d2ee523a2206206994597c13d831ec7'), - SUSD: new web3.eth.Contract(ERC20_abi, '0x57ab1ec28d129707052df4df418d58a2d46d5f51'), - TUSD: new web3.eth.Contract(ERC20_abi, '0x0000000000085d4780b73119b644ae5ecd22b376'), - WBTC: new web3.eth.Contract(ERC20_abi, '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599'), - WETH: new web3.eth.Contract(ERC20_abi, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'), - RAI: new web3.eth.Contract(ERC20_abi, '0x03ab458634910aad20ef5f1c8ee96f1d6ac54919'), - FEI: new web3.eth.Contract(ERC20_abi, '0x956f47f50a910163d8bf957cf5846d573e7f87ca') - }; - - // Initialize COMP - const COMPAddr = '0xc00e94cb662c3520282e6f5717214004a7f26888'; - const compContract = new web3.eth.Contract(COMP_abi, COMPAddr); - - // Initialize Uniswap Router - const uniswapRouterAddr = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'; - const UniswapRouter = new web3.eth.Contract(uniswapRouter, uniswapRouterAddr); - - // Initialize Uniswap V1 - const UNI_V1_WBTC_ETH = '0x4d2f5cFbA55AE412221182D8475bC85799A5644b'; - const UNI_V1_DAI_ETH = '0x2a1530C4C41db0B0b2bB646CB5Eb1A67b7158667'; - - const uniswapWBTC = new web3.eth.Contract(UniswapExchangeInterface, UNI_V1_WBTC_ETH); - const uniswapDAI = new web3.eth.Contract(UniswapExchangeInterface, UNI_V1_DAI_ETH); - - const BNify = n => new BigNumber(n); - - const getWBTCConversionRate = async () => { - const oneToken = BNify('1e08').times(BNify(0.0001)); - const ethSwapped = await uniswapWBTC.methods.getTokenToEthInputPrice(oneToken.toFixed()).call(); - const daiSwapped = await uniswapDAI.methods.getEthToTokenInputPrice(ethSwapped).call(); - return BNify(daiSwapped).times(BNify('10000')).div(1e18); - } - const getWETHConversionRate = async () => { - const one = BNify('1000000000000000000'); - const DAIAddr = '0x6b175474e89094c44da98b954eedeac495271d0f'; - - const path = [DAIAddr, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2']; - const unires = await UniswapRouter.methods.getAmountsIn(one.toFixed(), path).call(); - if (unires) { - - return BNify(unires[0]).div(one); - } - return null; - } - - const getUniswapConversionRate = async (tokenAddr) => { - const one = BNify('1000000000000000000'); - const DAIAddr = '0x6b175474e89094c44da98b954eedeac495271d0f'; - const path = [DAIAddr, '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', tokenAddr]; - const unires = await UniswapRouter.methods.getAmountsIn(one.toFixed(), path).call(); - if (unires) { - return BNify(unires[0]).div(one); - } - return null; - } - - // Calculate TVL - const calls = []; - - Object.keys(contracts).forEach((contractName) => { - - const call = new Promise(async (resolve, reject) => { - const contractInfo = contracts[contractName]; - const idleContract = new web3.eth.Contract(contractInfo.abi, contractInfo.address); - const underlyingTokenContract = underlyingTokensContracts[contractInfo.underlyingToken]; - - let [ - tokenPrice, - totalSupply, - tokenDecimals, - compBalance, - underlyingTokenBalance - ] = await Promise.all([ - idleContract.methods.tokenPrice().call(), - idleContract.methods.totalSupply().call(), - underlyingTokenContract.methods.decimals().call(), - compContract.methods.balanceOf(contractInfo.address).call(), - underlyingTokenContract.methods.balanceOf(contractInfo.address).call() - ]); - - let tokenTVL = BNify(totalSupply).div(1e18).times(BNify(tokenPrice).div(`1e${tokenDecimals}`)); - - // Get unlent funds - if (tokenDecimals && underlyingTokenBalance) { - underlyingTokenBalance = BNify(underlyingTokenBalance); - if (!underlyingTokenBalance.isNaN() && underlyingTokenBalance.gt(0)) { - underlyingTokenBalance = underlyingTokenBalance.div(`1e${tokenDecimals}`); - tokenTVL = tokenTVL.plus(underlyingTokenBalance); - } - } - - switch (contractInfo.underlyingToken){ - case 'WBTC': - const wbtcRate = await getWBTCConversionRate(); - if (wbtcRate) { - tokenTVL = tokenTVL.times(wbtcRate); - } - break; - case 'WETH': - const wethRate = await getWETHConversionRate(); - if (wethRate) { - tokenTVL = tokenTVL.times(wethRate); - } - break; - case 'RAI': - const raiAddr = underlyingTokenContract._address; - const raiRate = await getUniswapConversionRate(raiAddr); - if (raiRate) { - tokenTVL = tokenTVL.times(raiRate); - } - break; - default: - break; - } - - // Get COMP balance - compBalance = BNify(compBalance); - if (!compBalance.isNaN() && compBalance.gt(0)) { - const compRate = await getUniswapConversionRate(COMPAddr); - if (compRate) { - // Add COMP balance to TVL - compBalance = compBalance.div(1e18).times(compRate); - tokenTVL = tokenTVL.plus(compBalance); - } - } - - // console.log(contractName,tokenTVL.toString()); - - resolve(tokenTVL); - }); - - calls.push(call); - }); - - Object.keys(trancheContracts).forEach((contractName) => { - - const call = new Promise(async (resolve, reject) => { - const contractInfo = trancheContracts[contractName]; - const idleContract = new web3.eth.Contract(contractInfo.abi, contractInfo.address); - - const TVL = await idleContract.methods.getContractValue().call(); - const tokenTVL = new BigNumber(TVL).div(1e18); - - // console.log(contractInfo.name,contractInfo.address,tokenTVL.toString()); - - resolve(tokenTVL); - }); - - calls.push(call); - }); - - const res = await Promise.all(calls); - const totalTVL = res.reduce((totalTVL, tokenTVL) => { - return totalTVL.plus(tokenTVL); - }, BNify(0)); - - // console.log('totalTVL',parseFloat(totalTVL)); - - return parseFloat(totalTVL); -} - -module.exports = { - fetch -}; \ No newline at end of file diff --git a/projects/idle/abi.json b/projects/idle/abi.json new file mode 100644 index 0000000000..82eb9ffea9 --- /dev/null +++ b/projects/idle/abi.json @@ -0,0 +1,45 @@ +{ + "tokenPrice": { + "constant": true, + "inputs": [], + "name": "tokenPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "token": { + "constant": true, + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getContractValue": { + "inputs": [], + "name": "getContractValue", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file diff --git a/projects/idle/index.js b/projects/idle/index.js new file mode 100644 index 0000000000..fdf66d057e --- /dev/null +++ b/projects/idle/index.js @@ -0,0 +1,74 @@ +const sdk = require('@defillama/sdk') +const { default: BigNumber } = require('bignumber.js') +const abi = require('./abi.json') +const {chainExports} = require('../helper/exports') + +const contracts = { + ethereum:[ + '0xC8E6CA6E96a326dC448307A5fDE90a0b21fd7f80', + '0x5C960a3DCC01BE8a0f49c02A8ceBCAcf5D07fABe', + '0xb2d5CB72A621493fe83C6885E4A776279be595bC', + '0x3fe7940616e5bc47b0775a0dccf6237893353bb4', + '0x78751b12da02728f467a44eac40f5cbc16bd7934', + '0x5274891bEC421B39D23760c04A6755eCB444797C', + '0x12B98C621E8754Ae70d0fDbBC73D6208bC3e3cA6', + '0xF34842d05A1c888Ca02769A633DF37177415C2f8', + '0x63D27B3DA94A9E871222CB0A32232674B02D2f2D', + '0xf52cdcd458bf455aed77751743180ec4a595fd3f', + '0xe79e177d2a5c7085027d7c64c8f271c81430fc9b', + '0xc278041fDD8249FE4c1Aad1193876857EEa3D68c', + '0x51C77689A9c2e8cCBEcD4eC9770a1fA5fA83EeF1', + '0x8C81121B15197fA0eEaEE1DC75533419DcfD3151', + '0xD6f279B7ccBCD70F8be439d25B9Df93AEb60eC55', + '0xa14ea0e11121e6e951e87c66afe460a00bcd6a16', + '0x1846bdfDB6A0f5c473dEc610144513bd071999fB', + '0x3391bc034f2935ef0e1e41619445f998b2680d35', + '0xcDdB1Bceb7a1979C6caa0229820707429dd3Ec6C', + '0x28fAc5334C9f7262b3A3Fe707e250E01053e07b5', + '0x42740698959761baf1b06baa51efbd88cb1d862b' + ], + polygon:[ + "0x8a999F5A3546F8243205b2c0eCb0627cC10003ab", + "0x1ee6470CD75D5686d0b2b90C0305Fa46fb0C89A1", + "0xfdA25D931258Df948ffecb66b5518299Df6527C4" + ] +} + +const trancheContracts = ["0xd0DbcD556cA22d3f3c142e9a3220053FD7a247BC", "0x77648a2661687ef3b05214d824503f6717311596"] + +function chainTvl(chain){ + return async (time, ethBlock, chainBlocks)=>{ + const block = chainBlocks[chain] + const calls = { + chain, + block, + calls: contracts[chain].map(c=>({target:c})) + } + const [tokenPrice, token, supply] = await Promise.all([abi.tokenPrice, abi.token, "erc20:totalSupply"].map(abi=> + sdk.api.abi.multiCall({ + abi, + ...calls, + })) + ) + const balances = {} + tokenPrice.output.forEach((price, i)=>{ + sdk.util.sumSingleBalance(balances, chain+":"+ token.output[i].output, + BigNumber(price.output).times(supply.output[i].output).div(1e18).toFixed(0)) + }) + if(chain==="ethereum"){ + const [contractValue, trancheToken] = await Promise.all([abi.getContractValue, abi.token].map(abi=> + sdk.api.abi.multiCall({ + abi, + block, chain, + calls: trancheContracts.map(c=>({target:c})) + })) + ) + contractValue.output.forEach((value, i)=>{ + sdk.util.sumSingleBalance(balances, chain+":"+ trancheToken.output[i].output, value.output) + }) + } + return balances + } +} + +module.exports=chainExports(chainTvl, Object.keys(contracts)) \ No newline at end of file From 9b173b94cbd03cf15d471366e49545efd915e764 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 2 Dec 2021 18:34:40 +0000 Subject: [PATCH 060/393] delete duplicate fantohm adapter --- projects/fantohm/index.js | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 projects/fantohm/index.js diff --git a/projects/fantohm/index.js b/projects/fantohm/index.js deleted file mode 100644 index 84b554f8a7..0000000000 --- a/projects/fantohm/index.js +++ /dev/null @@ -1,15 +0,0 @@ -const { ohmTvl } = require('../helper/ohm') - -const treasury = "0xA3b52d5A6d2f8932a5cD921e09DA840092349D71" -module.exports = ohmTvl(treasury, [ - //DAI - ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], - //MIM - ["0x82f0b8b456c1a451378467398982d4834b6829c1", false], - //sSPELL - //["0xbB29D2A58d880Af8AA5859e30470134dEAf84F2B", false] - //spooky LP - ["0x46622913ce40c54ec14857f72968d4baaf963947", true], - //spooky LP - ["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], - ], "fantom", "0xcb9297425C889A7CbBaa5d3DB97bAb4Ea54829c2", "0xfa1FBb8Ef55A4855E5688C0eE13aC3f202486286") \ No newline at end of file From 2b9a6073f2ae25f43a71442b7c4b3184ed5e4b31 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 2 Dec 2021 20:04:31 +0000 Subject: [PATCH 061/393] add bsc market to ola --- projects/olafinance/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/olafinance/index.js b/projects/olafinance/index.js index 9725640cf3..3557250337 100644 --- a/projects/olafinance/index.js +++ b/projects/olafinance/index.js @@ -1,6 +1,7 @@ const {getCompoundUsdTvl} = require('../helper/compound') const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" +const unitroller_bsc = "0xAD48B2C9DC6709a560018c678e918253a65df86e" //FUSE tvl combined with fuseswap as fusefi tvl //const unitroller_fuse = "0x26a562B713648d7F3D1E1031DCc0860A4F3Fa340" @@ -9,9 +10,13 @@ const abis = { underlyingPrice: {"constant":true,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"getPriceForUnderling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, } + module.exports={ fantom:{ tvl: getCompoundUsdTvl(unitroller_fantom, "fantom", "0xed8F2C964b47D4d607a429D4eeA972B186E6f111", abis) }, + bsc:{ + tvl: getCompoundUsdTvl(unitroller_bsc, "bsc", "0x34878F6a484005AA90E7188a546Ea9E52b538F6f", abis) + } } \ No newline at end of file From b0b93eb1d78fdbcfeff2486f70b757eb40e224fb Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 2 Dec 2021 20:43:52 +0000 Subject: [PATCH 062/393] fix arbitrum transform address --- projects/helper/portedTokens.js | 2 +- projects/impermax/index.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 7de0936fd8..24a37c0cdb 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -256,7 +256,7 @@ async function transformArbitrumAddress() { const dstToken = bridge.find(token => compareAddresses(addr, token.address)) if (dstToken !== undefined) { - return dstToken.extensions.l1Address + return dstToken.extensions.bridgeInfo[1].tokenAddress } return `arbitrum:${addr}`; } diff --git a/projects/impermax/index.js b/projects/impermax/index.js index 6ab8a10f0d..c05e1abfbf 100644 --- a/projects/impermax/index.js +++ b/projects/impermax/index.js @@ -75,7 +75,4 @@ const chainTvls = { }, }; -module.exports = { - ...chainTvls, - tvl: sdk.util.sumChainTvls(Object.values(chainTvls).map(tvl=>tvl.tvl)) -}; +module.exports = chainTvls \ No newline at end of file From 2fd3585cf21878a7e159563d126c6a7399d1e852 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 2 Dec 2021 21:27:53 +0000 Subject: [PATCH 063/393] fix rome dao --- projects/rome-dao/index.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/projects/rome-dao/index.js b/projects/rome-dao/index.js index 2a4100ea16..ef44acac99 100644 --- a/projects/rome-dao/index.js +++ b/projects/rome-dao/index.js @@ -1,19 +1,14 @@ -const sdk = require('@defillama/sdk') -const { getBlock } = require('../helper/getBlock') -const {sumTokensSharedOwners} = require('../helper/unwrapLPs') +const { ohmTvl } = require('../helper/ohm') -const treasury = '0xd4a7febd52efda82d6f8ace24908ae0aa5b4f956' +const treasury = '0xfbAD41e4Dd040BC80c89FcC6E90d152A746139aF' const dai = '0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844' const frax = '0x1a93b23281cc1cde4c4741353f3064709a16197d' -async function tvl(timestamp, ethBlock, chainBlocks){ - const block = await getBlock(timestamp, "moonriver", chainBlocks, true) - const balances = {} - await sumTokensSharedOwners(balances, [dai, frax], [treasury], block, "moonriver") - return balances -} +const mim = "0x0caE51e1032e8461f4806e26332c030E34De3aDb" -module.exports = { - moonriver:{ - tvl - } -} \ No newline at end of file +// https://rome.gitbook.io/romedao/contract-addresses/all-contracts +module.exports = ohmTvl(treasury, [ + [dai, false], + [frax, false], + [mim, false], + ["0x069C2065100b4D3D982383f7Ef3EcD1b95C05894", true] +], "moonriver", "0x6f7D019502e17F1ef24AC67a260c65Dd23b759f1", "0x4a436073552044D5f2f49B176853ad3Ad473d9d6", addr=>`moonriver:${addr}`) \ No newline at end of file From 166ebc84bf3d2027df2555d92df46d2a9847d022 Mon Sep 17 00:00:00 2001 From: nemusona Date: Thu, 2 Dec 2021 16:04:55 -0600 Subject: [PATCH 064/393] fuzz finance onchain data and staking data --- projects/fuzzfinance/index.js | 98 ++++++++++++++++++++++++----------- 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/projects/fuzzfinance/index.js b/projects/fuzzfinance/index.js index e810adaafe..2dd433b59b 100644 --- a/projects/fuzzfinance/index.js +++ b/projects/fuzzfinance/index.js @@ -1,40 +1,76 @@ -const { request, gql } = require("graphql-request"); -const sdk = require('@defillama/sdk'); -const { toUSDTBalances } = require('../helper/balances'); +// const { request, gql } = require("graphql-request"); +const sdk = require("@defillama/sdk"); +// const { toUSDTBalances } = require('../helper/balances'); +const { calculateUniTvl } = require("../helper/calculateUniTvl"); +const { fixHarmonyBalances } = require("../helper/portedTokens"); -const graphUrl = 'https://graph.fuzz.fi/subgraphs/name/fuzzfinance/fuzzswap' -const graphQuery = gql` -query get_tvl($block: Int) { - uniswapFactory( - id: "0x5245d2136dc79Df222f00695C0c29d0c4d0E98A6", - block: { number: $block } - ) { - totalLiquidityUSD - }, -} -`; +const fuzz = "0x984b969a8e82f5ce1121ceb03f96ff5bb3f71fee"; +const factory = "0x5245d2136dc79Df222f00695C0c29d0c4d0E98A6"; +const masterchef = "0x847b46ed6c3df75e34a0496ef148b89bf5eb41b1"; -async function tvl(timestamp) { - const {block} = await sdk.api.util.lookupBlock(timestamp,{ - chain: 'harmony' - }) - const response = await request( - graphUrl, - graphQuery, - { - block, - } - ); +// const graphUrl = 'https://graph.fuzz.fi/subgraphs/name/fuzzfinance/fuzzswap' +// const graphQuery = gql` +// query get_tvl($block: Int) { +// uniswapFactory( +// id: "0x5245d2136dc79Df222f00695C0c29d0c4d0E98A6", +// block: { number: $block } +// ) { +// totalLiquidityUSD +// }, +// } +// `; + +async function tvl(timestamp, block, chainBlocks) { + // const {block} = await sdk.api.util.lookupBlock(timestamp,{ + // chain: 'harmony' + // }) + // const response = await request( + // graphUrl, + // graphQuery, + // { + // block, + // } + // ); - const usdTvl = Number(response.uniswapFactory.totalLiquidityUSD) + // const usdTvl = Number(response.uniswapFactory.totalLiquidityUSD) - return toUSDTBalances(usdTvl) + // return toUSDTBalances(usdTvl) + let balances = await calculateUniTvl( + (addr) => { + if (addr === "0x224e64ec1bdce3870a6a6c777edd450454068fec") { + return "0xa47c8bf37f92abed4a126bda807a7b7498661acd"; + } + return `harmony:${addr}`; + }, + chainBlocks.harmony, + "harmony", + factory, + 0, + true + ); + fixHarmonyBalances(balances); + return balances; +} + +async function staking(timestamp, block, chainBlocks) { + let balances = {}; + let balance = ( + await sdk.api.erc20.balanceOf({ + target: fuzz, + owner: masterchef, + block: chainBlocks.harmony, + chain: "harmony", + }) + ).output; + sdk.util.sumSingleBalance(balances, `harmony:${fuzz}`, balance); + return balances; } module.exports = { - methodology: `Counts the tokens locked on AMM pools, pulling the data from their subgraph "https://graph.fuzz.fi/subgraphs/name/fuzzfinance/fuzzswap".`, - harmony:{ + methodology: `Counts the tokens locked on AMM pools from the factory contract.`, + harmony: { tvl, + staking, }, - tvl -} + tvl, +}; From d4b4d6719ecde0279989b4c5e0e93b17cabef0ff Mon Sep 17 00:00:00 2001 From: Define101 Date: Thu, 2 Dec 2021 22:16:10 +0000 Subject: [PATCH 065/393] nemesis-dao adapter --- projects/nemesis-dao/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/nemesis-dao/index.js diff --git a/projects/nemesis-dao/index.js b/projects/nemesis-dao/index.js new file mode 100644 index 0000000000..3a10cb8787 --- /dev/null +++ b/projects/nemesis-dao/index.js @@ -0,0 +1,9 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0xdffb6fb92e3f54c0daa59e5af3f47fd58824562a" +module.exports = ohmTvl(treasury, [ + //BUSD + ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + //Pancake LP + ["0x6b0a3e71b69ab49ddea0ed23bef48f78bf9509aa", true], +], "bsc", "0xfd562672bf1da0f80d43f26bfc4ca19121ba661b", "0x8AC9DC3358A2dB19fDd57f433ff45d1fc357aFb3") \ No newline at end of file From 41c3cd3ded2186577284f14312b98a58d27bbb99 Mon Sep 17 00:00:00 2001 From: bananafarmlab Date: Fri, 3 Dec 2021 06:30:58 +0800 Subject: [PATCH 066/393] fixed(projects/banana): api split --- projects/banana/index.js | 43 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/projects/banana/index.js b/projects/banana/index.js index e45a01a863..f45e2ac134 100644 --- a/projects/banana/index.js +++ b/projects/banana/index.js @@ -1,33 +1,27 @@ const axios = require("axios"); -const BigNumber = require("bignumber.js"); -const tvlUrl = "https://bananafarm.io/api/boba/tvl"; +// const share = "0xc67b9b1b0557aeafa10aa1ffa1d7c87087a6149e"; +// const pool2lp = "0x59b901160bb8eeec517ed396ab68e0da81707c12"; -const stakingPid = "0"; -const poolPid = "1"; - -const share = "0xc67b9B1B0557aeAfA10AA1fFa1d7c87087a6149E"; -const pool2lp = "0x59b901160bb8eeEc517eD396Ab68e0DA81707c12"; - -const fetch = async () => { - const { data } = (await axios.get(tvlUrl)) || {}; - return data?.tvl || 0; +const tvl = async () => { + const { data = {} } = + (await axios.get("https://bananafarm.io/api/boba/tvl")) || {}; + // console.log(0, data); + return data; }; const staking = async () => { - const { data = {} } = (await axios.get(tvlUrl)) || {}; - const tokenAddress = `boba:${share}`; - return { - [tokenAddress]: new BigNumber(data[stakingPid] * 1e18).toFixed(0), - }; + const { data = {} } = + (await axios.get("https://bananafarm.io/api/boba/tvl/staking")) || {}; + // console.log(1, data); + return data; }; const pool2 = async () => { - const { data = {} } = (await axios.get(tvlUrl)) || {}; - const tokenAddress = `boba:${pool2lp}`; - return { - [tokenAddress]: new BigNumber(data[poolPid] * 1e18).toFixed(0), - }; + const { data = {} } = + (await axios.get("https://bananafarm.io/api/boba/tvl/pool2")) || {}; + // console.log(2, data); + return data; }; module.exports = { @@ -36,11 +30,8 @@ module.exports = { token: "BANA", start: 1638237600, boba: { - staking, + tvl, pool2, - fetch, + staking, }, - staking, - pool2, - fetch, }; From a8080b6e82fca15de27cbb432ed9635dedbd31ff Mon Sep 17 00:00:00 2001 From: bananafarmlab Date: Fri, 3 Dec 2021 06:52:51 +0800 Subject: [PATCH 067/393] fixed(projects/banana): api split and add total --- projects/banana/index.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/projects/banana/index.js b/projects/banana/index.js index f45e2ac134..47e9bbe532 100644 --- a/projects/banana/index.js +++ b/projects/banana/index.js @@ -3,6 +3,12 @@ const axios = require("axios"); // const share = "0xc67b9b1b0557aeafa10aa1ffa1d7c87087a6149e"; // const pool2lp = "0x59b901160bb8eeec517ed396ab68e0da81707c12"; +const fetch = async () => { + const { data = {} } = + (await axios.get("https://bananafarm.io/api/boba/tvl/total")) || {}; + return data.tvl || 0; +}; + const tvl = async () => { const { data = {} } = (await axios.get("https://bananafarm.io/api/boba/tvl")) || {}; @@ -23,6 +29,12 @@ const pool2 = async () => { // console.log(2, data); return data; }; +const totalInUsd = async () => { + const { data = {} } = + (await axios.get("https://bananafarm.io/api/boba/tvl/pool2")) || {}; + // console.log(2, data); + return data; +}; module.exports = { methodology: `TVL is calculated by summing up the values of all LP tokens and our project's rewards token.`, @@ -30,8 +42,9 @@ module.exports = { token: "BANA", start: 1638237600, boba: { - tvl, pool2, staking, + tvl, }, + fetch, }; From bc068f7c6ab7a58921cece77155b656c06afe1a6 Mon Sep 17 00:00:00 2001 From: bananafarmlab Date: Fri, 3 Dec 2021 07:14:51 +0800 Subject: [PATCH 068/393] fixed(projects/banana): use sdk --- projects/banana/index.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/projects/banana/index.js b/projects/banana/index.js index 47e9bbe532..1b2af94c3d 100644 --- a/projects/banana/index.js +++ b/projects/banana/index.js @@ -1,7 +1,10 @@ const axios = require("axios"); +const { pool2BalanceFromMasterChefExports } = require("../helper/pool2.js"); +const masterchefAbi = require("../helper/abis/masterchef.json"); -// const share = "0xc67b9b1b0557aeafa10aa1ffa1d7c87087a6149e"; +const share = "0xc67b9b1b0557aeafa10aa1ffa1d7c87087a6149e"; // const pool2lp = "0x59b901160bb8eeec517ed396ab68e0da81707c12"; +const masterChef = "0x0e69359B4783094260abFaD7dD904999fc1d6Fd0"; const fetch = async () => { const { data = {} } = @@ -29,12 +32,6 @@ const pool2 = async () => { // console.log(2, data); return data; }; -const totalInUsd = async () => { - const { data = {} } = - (await axios.get("https://bananafarm.io/api/boba/tvl/pool2")) || {}; - // console.log(2, data); - return data; -}; module.exports = { methodology: `TVL is calculated by summing up the values of all LP tokens and our project's rewards token.`, @@ -42,9 +39,14 @@ module.exports = { token: "BANA", start: 1638237600, boba: { - pool2, - staking, - tvl, + pool2: pool2BalanceFromMasterChefExports( + masterChef, + share, + "boba", + (addr) => `boba:${addr}`, + masterchefAbi.poolInfo + ), + staking: staking(masterChef, share, "boba"), }, fetch, }; From 1dd761e7f530a6e2fe481298ced00fb5af859a1f Mon Sep 17 00:00:00 2001 From: bananafarmlab Date: Fri, 3 Dec 2021 07:16:33 +0800 Subject: [PATCH 069/393] fixed(projects/banana): use sdk --- projects/banana/index.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/projects/banana/index.js b/projects/banana/index.js index 1b2af94c3d..3efcce9b0e 100644 --- a/projects/banana/index.js +++ b/projects/banana/index.js @@ -1,5 +1,6 @@ const axios = require("axios"); const { pool2BalanceFromMasterChefExports } = require("../helper/pool2.js"); +const { staking } = require("../helper/staking"); const masterchefAbi = require("../helper/abis/masterchef.json"); const share = "0xc67b9b1b0557aeafa10aa1ffa1d7c87087a6149e"; @@ -12,26 +13,26 @@ const fetch = async () => { return data.tvl || 0; }; -const tvl = async () => { - const { data = {} } = - (await axios.get("https://bananafarm.io/api/boba/tvl")) || {}; - // console.log(0, data); - return data; -}; +// const tvl = async () => { +// const { data = {} } = +// (await axios.get("https://bananafarm.io/api/boba/tvl")) || {}; +// // console.log(0, data); +// return data; +// }; -const staking = async () => { - const { data = {} } = - (await axios.get("https://bananafarm.io/api/boba/tvl/staking")) || {}; - // console.log(1, data); - return data; -}; +// const staking = async () => { +// const { data = {} } = +// (await axios.get("https://bananafarm.io/api/boba/tvl/staking")) || {}; +// // console.log(1, data); +// return data; +// }; -const pool2 = async () => { - const { data = {} } = - (await axios.get("https://bananafarm.io/api/boba/tvl/pool2")) || {}; - // console.log(2, data); - return data; -}; +// const pool2 = async () => { +// const { data = {} } = +// (await axios.get("https://bananafarm.io/api/boba/tvl/pool2")) || {}; +// // console.log(2, data); +// return data; +// }; module.exports = { methodology: `TVL is calculated by summing up the values of all LP tokens and our project's rewards token.`, From 90db8f561cb128629b1e4cfc36a957caaef5b611 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 2 Dec 2021 23:16:50 +0000 Subject: [PATCH 070/393] fix apeswap --- projects/apeswap/index.js | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/projects/apeswap/index.js b/projects/apeswap/index.js index d15a00d580..aff9ea9154 100644 --- a/projects/apeswap/index.js +++ b/projects/apeswap/index.js @@ -1,5 +1,6 @@ const sdk = require("@defillama/sdk"); -const {calculateUniTvl} = require('../helper/calculateUniTvl.js') +const {calculateUniTvl} = require('../helper/calculateUniTvl.js'); +const { staking } = require("../helper/staking.js"); const BANANA_TOKEN = '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95' const MASTER_APE = '0x5c8D727b265DBAfaba67E050f2f739cAeEB4A6F9' @@ -10,36 +11,23 @@ const SUBGRAPH_BSC = "https://graph2.apeswap.finance/subgraphs/name/ape-swap/ape const SUBGRAPH_POLYGON = "https://api.thegraph.com/subgraphs/name/apeswapfinance/dex-polygon" async function bscTvl(timestamp, block, chainBlocks) { - return calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks['bsc'], 'bsc', FACTORY_BSC, 0, true); + const balances = await calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks['bsc'], 'bsc', FACTORY_BSC, 0, true); + delete balances["bsc:0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1"] //YSL - coingecko price broken + return balances } async function polygonTvl(timestamp, block, chainBlocks) { return calculateUniTvl(addr=>`polygon:${addr}`, chainBlocks['polygon'], 'polygon', FACTORY_POLYGON, 0, true); } -async function poolsTvl(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const stakedBanana = sdk.api.erc20.balanceOf({ - target: BANANA_TOKEN, - owner: MASTER_APE, - chain: 'bsc', - block: chainBlocks.bsc - }) - sdk.util.sumSingleBalance(balances, 'bsc:' + BANANA_TOKEN, (await stakedBanana).output) - return balances -} - module.exports = { misrepresentedTokens: true, bsc:{ tvl: bscTvl, + staking: staking(MASTER_APE, BANANA_TOKEN, "bsc") }, polygon:{ tvl: polygonTvl, }, - staking:{ - tvl: poolsTvl, - }, methodology: "TVL comes from the DEX liquidity pools, staking TVL is accounted as the banana on 0x5c8D727b265DBAfaba67E050f2f739cAeEB4A6F9", - tvl: sdk.util.sumChainTvls([polygonTvl, bscTvl]) } \ No newline at end of file From 8d387594c455755b4d481b454941a5c39783f923 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 2 Dec 2021 23:31:25 +0000 Subject: [PATCH 071/393] add drift --- projects/drift.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/drift.js diff --git a/projects/drift.js b/projects/drift.js new file mode 100644 index 0000000000..83d02dbd27 --- /dev/null +++ b/projects/drift.js @@ -0,0 +1,15 @@ +const {getTokenAccountBalance} = require('./helper/solana') + +async function tvl(){ + const usdcLocked = await getTokenAccountBalance("6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S") + return { + "usd-coin": usdcLocked + } +} + +module.exports={ + methodology: "Calculate the USDC on 6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S through on-chain calls", + solana:{ + tvl + } +} \ No newline at end of file From a7b60c5f454c17bd140a63f6014b3a0ef15263f0 Mon Sep 17 00:00:00 2001 From: nemusona Date: Thu, 2 Dec 2021 18:36:04 -0600 Subject: [PATCH 072/393] qidao updates --- projects/qidao/abi.json | 9 + projects/qidao/index.js | 391 ++++++++++++++++++++++++++++++---------- 2 files changed, 308 insertions(+), 92 deletions(-) create mode 100644 projects/qidao/abi.json diff --git a/projects/qidao/abi.json b/projects/qidao/abi.json new file mode 100644 index 0000000000..e5665e6c05 --- /dev/null +++ b/projects/qidao/abi.json @@ -0,0 +1,9 @@ +{ + "getPricePerFullShare": { + "inputs": [], + "name": "getPricePerFullShare", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/qidao/index.js b/projects/qidao/index.js index 1191d4bf92..bb3aa16a51 100644 --- a/projects/qidao/index.js +++ b/projects/qidao/index.js @@ -1,103 +1,310 @@ -const {sumTokens} = require('../helper/unwrapLPs') -const sdk = require('@defillama/sdk') +const { sumTokens, unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { BigNumber } = require("bignumber.js"); + +async function handleMooTokens(balances, block, chain, tokens) { + let balance = ( + await sdk.api.abi.multiCall({ + calls: tokens.map((p) => ({ + target: p[0], + params: p[1], + })), + abi: "erc20:balanceOf", + block, + chain, + }) + ).output; + let pricePerShare = ( + await sdk.api.abi.multiCall({ + calls: tokens.map((p) => ({ + target: p[0], + })), + abi: abi.getPricePerFullShare, + block, + chain, + }) + ).output; + for (let i = 0; i < balance.length; i++) { + let addr = balance[i].input.target.toLowerCase(); + if (addr === "0xbf07093ccd6adfc3deb259c557b61e94c1f66945") { + addr = "fantom:0xd6070ae98b8069de6b494332d1a1a81b6179d960"; + } else if (addr === "0x1b156c5c75e9df4caab2a5cc5999ac58ff4f9090") { + addr = "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"; + } else { + addr = `${chain}:${addr}`; + } + sdk.util.sumSingleBalance( + balances, + addr, + BigNumber(balance[i].output) + .times(Number(pricePerShare[i].output) / 1e18) + .toFixed(0) + ); + } +} + +async function handleMooLPs(balances, block, chain, tokens) { + let lpBalances = ( + await sdk.api.abi.multiCall({ + calls: tokens.map((p) => ({ + target: p[1], + params: p[0], + })), + abi: "erc20:balanceOf", + block, + chain, + }) + ).output; + let pricePerShare = ( + await sdk.api.abi.multiCall({ + calls: tokens.map((p) => ({ + target: p[1], + })), + abi: abi.getPricePerFullShare, + block, + chain, + }) + ).output; + let lpPositions = []; + for (let i = 0; i < tokens.length; i++) { + lpPositions.push({ + balance: BigNumber(lpBalances[i].output) + .times(Number(pricePerShare[i].output) / 1e18) + .toFixed(0), + token: tokens[i][2], + }); + } + await unwrapUniswapLPs(balances, lpPositions, block, chain, (addr) => { + return `${chain}:${addr}`; + }); +} async function polygon(timestamp, block, chainBlocks) { - const balances = {} - await sumTokens(balances, [ - // vaults - ["0x1a13f4ca1d028320a707d99520abfefca3998b7f", "0x22965e296d9a0Cd0E917d6D70EF2573009F8a1bB"], //amUSDC - ["0x27f8d03b3a2196956ed754badc28d73be8830a6e", "0xE6C23289Ba5A9F0Ef31b8EB36241D5c800889b7b"], //amDAI - ["0x28424507fefb6f7f8e9d3860f56504e4e5f5f390", "0x0470CD31C8FcC42671465880BA81D631F0B76C1D"], //amWETH - ["0x60d55f02a771d515e077c9c2403a1ef324885cec", "0xB3911259f435b28EC072E4Ff6fF5A2C604fea0Fb"], //amUSDT - ["0x8df3aad3a84da6b69a4da8aec3ea40d9091b2ac4", "0x7068Ea5255cb05931EFa8026Bd04b18F3DeB8b0B"], //amMATIC - ["0x1d2a0e5ec8e5bbdca5cb219e649b565d8e5c3360", "0xeA4040B21cb68afb94889cB60834b13427CFc4EB"], //amAAVE - ["0x5c2ed810328349100a66b82b78a1791b101c9d61", "0xBa6273A78a23169e01317bd0f6338547F869E8Df"], // amWBTC - // anchor - ["0x2791bca1f2de4661ed88a30c99a7a9449aa84174", "0x947D711C25220d8301C087b25BA111FE8Cbf6672"], //USDC - ["0xc2132d05d31c914a87c6611c10748aeb04b58e8f", "0xa4742A65f24291AA421497221AaF64c70b098d98"], //USDT - ["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", "0x6062E92599a77E62e0cC9749261eb2eaC3aBD44F"], //DAI - // mai vaults - ["0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", "0x3fd939B017b31eaADF9ae50C7fF7Fa5c0661d47C"], // weth - ["0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39", "0x61167073E31b1DAd85a3E531211c7B8F1E5cAE72"], // link - ["0xd6df932a45c0f255f85145f286ea0b292b21c90b", "0x87ee36f780ae843A78D5735867bc1c13792b7b11"], // aave - ["0x172370d5cd63279efa6d502dab29171933a610af", "0x98B5F32dd9670191568b661a3e847Ed764943875"], // crv - ["0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", "0x37131aEDd3da288467B6EBe9A77C523A700E6Ca1"], // wbtc - // added - ["0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3", "0x701A1824e5574B0b6b1c8dA808B184a7AB7A2867"], //bal - ["0xf28164a485b0b2c90639e47b0f377b4a438a16b1", "0x649Aa6E6b6194250C077DF4fB37c23EE6c098513"], //dquick - ['0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7', '0xF086dEdf6a89e7B16145b03a6CB0C0a9979F1433'], - ], chainBlocks.polygon, 'polygon', addr=>`polygon:${addr}`) - balances['polygon:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270'] = (await sdk.api.eth.getBalance({ - target: "0xa3fa99a148fa48d14ed51d610c367c61876997f1", - block: chainBlocks.polygon, - chain: 'polygon' - })).output - return balances + const balances = {}; + await sumTokens( + balances, + [ + // vaults + [ + "0x1a13f4ca1d028320a707d99520abfefca3998b7f", + "0x22965e296d9a0Cd0E917d6D70EF2573009F8a1bB", + ], //amUSDC + [ + "0x27f8d03b3a2196956ed754badc28d73be8830a6e", + "0xE6C23289Ba5A9F0Ef31b8EB36241D5c800889b7b", + ], //amDAI + [ + "0x28424507fefb6f7f8e9d3860f56504e4e5f5f390", + "0x0470CD31C8FcC42671465880BA81D631F0B76C1D", + ], //amWETH + [ + "0x60d55f02a771d515e077c9c2403a1ef324885cec", + "0xB3911259f435b28EC072E4Ff6fF5A2C604fea0Fb", + ], //amUSDT + [ + "0x8df3aad3a84da6b69a4da8aec3ea40d9091b2ac4", + "0x7068Ea5255cb05931EFa8026Bd04b18F3DeB8b0B", + ], //amMATIC + [ + "0x1d2a0e5ec8e5bbdca5cb219e649b565d8e5c3360", + "0xeA4040B21cb68afb94889cB60834b13427CFc4EB", + ], //amAAVE + [ + "0x5c2ed810328349100a66b82b78a1791b101c9d61", + "0xBa6273A78a23169e01317bd0f6338547F869E8Df", + ], // amWBTC + // anchor + [ + "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "0x947D711C25220d8301C087b25BA111FE8Cbf6672", + ], //USDC + [ + "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + "0xa4742A65f24291AA421497221AaF64c70b098d98", + ], //USDT + [ + "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + "0x6062E92599a77E62e0cC9749261eb2eaC3aBD44F", + ], //DAI + // mai vaults + [ + "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + "0x3fd939B017b31eaADF9ae50C7fF7Fa5c0661d47C", + ], // weth + [ + "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39", + "0x61167073E31b1DAd85a3E531211c7B8F1E5cAE72", + ], // link + [ + "0xd6df932a45c0f255f85145f286ea0b292b21c90b", + "0x87ee36f780ae843A78D5735867bc1c13792b7b11", + ], // aave + [ + "0x172370d5cd63279efa6d502dab29171933a610af", + "0x98B5F32dd9670191568b661a3e847Ed764943875", + ], // crv + [ + "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6", + "0x37131aEDd3da288467B6EBe9A77C523A700E6Ca1", + ], // wbtc + // added + [ + "0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3", + "0x701A1824e5574B0b6b1c8dA808B184a7AB7A2867", + ], //bal + [ + "0xf28164a485b0b2c90639e47b0f377b4a438a16b1", + "0x649Aa6E6b6194250C077DF4fB37c23EE6c098513", + ], //dquick + [ + "0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7", + "0xF086dEdf6a89e7B16145b03a6CB0C0a9979F1433", + ], + ], + chainBlocks.polygon, + "polygon", + (addr) => `polygon:${addr}` + ); + balances["polygon:0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"] = ( + await sdk.api.eth.getBalance({ + target: "0xa3fa99a148fa48d14ed51d610c367c61876997f1", + block: chainBlocks.polygon, + chain: "polygon", + }) + ).output; + return balances; } async function fantom(timestamp, block, chainBlocks) { - const balances = {} - const chain = 'fantom' - await sumTokens(balances, [ - ["0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", "0x1066b8FC999c1eE94241344818486D5f944331A0"], - ["0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0", "0x7efB260662a6FA95c1CE1092c53Ca23733202798"], - ["0x637eC617c86D24E421328e6CAEa1d92114892439", "0x682E473FcA490B0adFA7EfE94083C1E63f28F034"], - ["0x74b23882a30290451A17c44f4F05243b6b58C76d", "0xD939c268C49c442F037E968F045ba02f499562D4"], - ['0x321162Cd933E2Be498Cd2267a90534A804051b11', '0xE5996a2cB60eA57F03bf332b5ADC517035d8d094'], - ['0xae75A438b2E0cB8Bb01Ec1E1e376De11D44477CC', '0x267bDD1C19C932CE03c7A62BBe5b95375F9160A6'], - ['0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8', '0xd6488d586E8Fcd53220e4804D767F19F5C846086'], - ['0x6a07A792ab2965C72a5B8088d3a069A7aC3a993B', '0xdB09908b82499CAdb9E6108444D5042f81569bD9'], - ['0x49c68edb7aebd968f197121453e41b8704acde0c', '0x3609A304c6A41d87E895b9c1fd18c02ba989Ba90'], - ['0x0a03d2c1cfca48075992d810cc69bd9fe026384a', '0xC1c7eF18ABC94013F6c58C6CdF9e829A48075b4e'], - ['0x97927abfe1abbe5429cbe79260b290222fc9fbba', '0x5563Cc1ee23c4b17C861418cFF16641D46E12436'], - ['0x6dfe2aaea9daadadf0865b661b53040e842640f8', '0x8e5e4D08485673770Ab372c05f95081BE0636Fa2'], - ['0x920786cff2a6f601975874bb24c63f0115df7dc8', '0xBf0ff8ac03f3E0DD7d8faA9b571ebA999a854146'], - ], chainBlocks[chain], chain, addr=>{ - if(addr === "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0"){ - return "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83" - } else if(addr === "0x637eC617c86D24E421328e6CAEa1d92114892439"){ - return "0x6b175474e89094c44da98b954eedeac495271d0f" - } else if (addr === "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8"){ - return "0x514910771af9ca656af840dff83e8264ecf986ca" - } else if (addr === "0x0a03d2c1cfca48075992d810cc69bd9fe026384a"){ - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - } else if (addr === "0x97927abfe1abbe5429cbe79260b290222fc9fbba"){ - return "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" - } else if (addr === "0x6dfe2aaea9daadadf0865b661b53040e842640f8"){ - return "0x514910771af9ca656af840dff83e8264ecf986ca" - } else if (addr === "0x920786cff2a6f601975874bb24c63f0115df7dc8"){ - return "0x6b175474e89094c44da98b954eedeac495271d0f" - } else if (addr === "0x49c68edb7aebd968f197121453e41b8704acde0c"){ - return "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83" - } - return `${chain}:${addr}` - }) - return balances + const balances = {}; + const chain = "fantom"; + await sumTokens( + balances, + [ + [ + "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", + "0x1066b8FC999c1eE94241344818486D5f944331A0", + ], + [ + "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0", + "0x7efB260662a6FA95c1CE1092c53Ca23733202798", + ], + [ + "0x637eC617c86D24E421328e6CAEa1d92114892439", + "0x682E473FcA490B0adFA7EfE94083C1E63f28F034", + ], + [ + "0x74b23882a30290451A17c44f4F05243b6b58C76d", + "0xD939c268C49c442F037E968F045ba02f499562D4", + ], + [ + "0x321162Cd933E2Be498Cd2267a90534A804051b11", + "0xE5996a2cB60eA57F03bf332b5ADC517035d8d094", + ], + [ + "0xae75A438b2E0cB8Bb01Ec1E1e376De11D44477CC", + "0x267bDD1C19C932CE03c7A62BBe5b95375F9160A6", + ], + [ + "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8", + "0xd6488d586E8Fcd53220e4804D767F19F5C846086", + ], + [ + "0x6a07A792ab2965C72a5B8088d3a069A7aC3a993B", + "0xdB09908b82499CAdb9E6108444D5042f81569bD9", + ], + [ + "0x49c68edb7aebd968f197121453e41b8704acde0c", + "0x3609A304c6A41d87E895b9c1fd18c02ba989Ba90", + ], + [ + "0x0a03d2c1cfca48075992d810cc69bd9fe026384a", + "0xC1c7eF18ABC94013F6c58C6CdF9e829A48075b4e", + ], + [ + "0x97927abfe1abbe5429cbe79260b290222fc9fbba", + "0x5563Cc1ee23c4b17C861418cFF16641D46E12436", + ], + [ + "0x6dfe2aaea9daadadf0865b661b53040e842640f8", + "0x8e5e4D08485673770Ab372c05f95081BE0636Fa2", + ], + [ + "0x920786cff2a6f601975874bb24c63f0115df7dc8", + "0xBf0ff8ac03f3E0DD7d8faA9b571ebA999a854146", + ], + ], + chainBlocks[chain], + chain, + (addr) => { + if (addr === "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0") { + return "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; + } else if (addr === "0x637eC617c86D24E421328e6CAEa1d92114892439") { + return "0x6b175474e89094c44da98b954eedeac495271d0f"; + } else if (addr === "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8") { + return "0x514910771af9ca656af840dff83e8264ecf986ca"; + } else if (addr === "0x0a03d2c1cfca48075992d810cc69bd9fe026384a") { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + } else if (addr === "0x97927abfe1abbe5429cbe79260b290222fc9fbba") { + return "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; + } else if (addr === "0x6dfe2aaea9daadadf0865b661b53040e842640f8") { + return "0x514910771af9ca656af840dff83e8264ecf986ca"; + } else if (addr === "0x920786cff2a6f601975874bb24c63f0115df7dc8") { + return "0x6b175474e89094c44da98b954eedeac495271d0f"; + } else if (addr === "0x49c68edb7aebd968f197121453e41b8704acde0c") { + return "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; + } + return `${chain}:${addr}`; + } + ); + const ftmMooTokens = [ + [ + "0xbf07093ccd6adfc3deb259c557b61e94c1f66945", + "0x75D4aB6843593C111Eeb02Ff07055009c836A1EF", + ], + ]; + //await handleMooTokens(balances, chainBlocks.fantom, chain, ftmMooTokens) + const ftmLPs = [ + //Vault, token, LP + [ + "0x9BA01B1279B1F7152b42aCa69fAF756029A9ABDe", + "0x2a30C5e0d577108F694d2A96179cd73611Ee069b", + "0xf0702249F4D3A25cD3DED7859a165693685Ab577", + ], + [ + "0xF34e271312e41Bbd7c451B76Af2AF8339D6f16ED", + "0xA3e3Af161943CfB3941B631676134bb048739727", + "0xFdb9Ab8B9513Ad9E419Cf19530feE49d412C3Ee3", + ], + ]; + await handleMooLPs(balances, chainBlocks.fantom, chain, ftmLPs); + return balances; } async function avax(timestamp, block, chainBlocks) { - const balances = {}; - const chain = 'avax'; - await sumTokens(balances, [ - ["0x1B156C5c75E9dF4CAAb2a5cc5999aC58ff4F9090","0xfA19c1d104F4AEfb8d5564f02B3AdCa1b515da58"] - ], chainBlocks[chain], chain, addr=>{ - if(addr === "0x1B156C5c75E9dF4CAAb2a5cc5999aC58ff4F9090") { - return "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" - } - return `${chain}:${addr}` - }) - return balances; + const balances = {}; + const chain = "avax"; + const avaxMooTokens = [ + [ + "0x1B156C5c75E9dF4CAAb2a5cc5999aC58ff4F9090", + "0xfA19c1d104F4AEfb8d5564f02B3AdCa1b515da58", + ], + ]; + await handleMooTokens(balances, chainBlocks.avax, chain, avaxMooTokens); + return balances; } module.exports = { - methodology: 'TVL counts the AAVE tokens that are deposited within the Yield Instruments section of QiDao, the Vault token deposits of CRV, LINK, AAVE and WETH, as well as USDC deposited to mint MAI.', - polygon: { - tvl: polygon - }, - fantom:{ - tvl: fantom - }, - avax: { - tvl: avax - } -} \ No newline at end of file + methodology: + "TVL counts the AAVE tokens that are deposited within the Yield Instruments section of QiDao, the Vault token deposits of CRV, LINK, AAVE and WETH, as well as USDC deposited to mint MAI.", + polygon: { + tvl: polygon, + }, + fantom: { + tvl: fantom, + }, + avax: { + tvl: avax, + }, +}; From f78361d705e6b35939a363d25d24e550fb784d14 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 00:43:46 +0000 Subject: [PATCH 073/393] add moondao correct fantohm staking --- projects/fantOHM.js | 4 ++-- projects/moondao/index.js | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 projects/moondao/index.js diff --git a/projects/fantOHM.js b/projects/fantOHM.js index fd1c0a9ae8..1082d04585 100644 --- a/projects/fantOHM.js +++ b/projects/fantOHM.js @@ -10,11 +10,11 @@ module.exports=ohmTvl("0xA3b52d5A6d2f8932a5cD921e09DA840092349D71", ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], // DAI ["0x82f0b8b456c1a451378467398982d4834b6829c1", false], // MIM ["0xbB29D2A58d880Af8AA5859e30470134dEAf84F2B", false], // sSPELL - ["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], // DAI/FHM + //["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], // DAI/FHM ["0x46622913cE40c54Ec14857f72968d4BAAF963947", true] // MIM/FHM ], "fantom", - "0x068e87aa1eabebbad65378ede4b5c16e75e5a671", + "0xcb9297425C889A7CbBaa5d3DB97bAb4Ea54829c2", "0xfa1fbb8ef55a4855e5688c0ee13ac3f202486286", addr => (transforms[addr.toLowerCase()] ? transforms[addr.toLowerCase()] : `fantom:${addr}`) , undefined, diff --git a/projects/moondao/index.js b/projects/moondao/index.js new file mode 100644 index 0000000000..28eea1e633 --- /dev/null +++ b/projects/moondao/index.js @@ -0,0 +1,11 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0xeC2aE8A3E2692E4b0836AB5cf88104d101DEBEf4" +module.exports = ohmTvl(treasury, [ + //DAI + ["0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844", false], + //USDC + ["0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", false], + //solarbeam LP + ["0xdbf638d800190271f5473e76898c6c8e741cba51", true], + ], "moonriver", "0x534F861B6BaFdF030E5b469D2d763834163f522f", "0x761cb807bFbF14A4f4bA980f29F43F009F6a18c0") \ No newline at end of file From ffba3f592cafb920fbddff15264b29f4efa2f7d9 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 00:45:26 +0000 Subject: [PATCH 074/393] re-add dai-ftm lp to fantohm --- projects/fantOHM.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/fantOHM.js b/projects/fantOHM.js index 1082d04585..57d95fdacc 100644 --- a/projects/fantOHM.js +++ b/projects/fantOHM.js @@ -10,7 +10,7 @@ module.exports=ohmTvl("0xA3b52d5A6d2f8932a5cD921e09DA840092349D71", ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], // DAI ["0x82f0b8b456c1a451378467398982d4834b6829c1", false], // MIM ["0xbB29D2A58d880Af8AA5859e30470134dEAf84F2B", false], // sSPELL - //["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], // DAI/FHM + ["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], // DAI/FHM ["0x46622913cE40c54Ec14857f72968d4BAAF963947", true] // MIM/FHM ], "fantom", From bb3d8c8cd7fdff9c8de8eeaf2979d7a7b2f0ce78 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 01:34:03 +0000 Subject: [PATCH 075/393] add cerberusdao adapter --- projects/cerberusdao/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/cerberusdao/index.js diff --git a/projects/cerberusdao/index.js b/projects/cerberusdao/index.js new file mode 100644 index 0000000000..78a25dce5e --- /dev/null +++ b/projects/cerberusdao/index.js @@ -0,0 +1,9 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0x56D595ea5591D264bc1Ef9E073aF66685F0bFD31" +module.exports = ohmTvl(treasury, [ + //SHIB + ["0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", false], + //uniswap LP shib/weth + ["0xb5b6c3816c66fa6bc5b189f49e5b088e2de5082a", true], + ], "ethereum", "0x95deaF8dd30380acd6CC5E4E90e5EEf94d258854", "0x8a14897eA5F668f36671678593fAe44Ae23B39FB") \ No newline at end of file From 258b125abdadddbfe7afab2ff28252068672fdb4 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 01:55:55 +0000 Subject: [PATCH 076/393] timetravel: true timetravel: true --- projects/maker/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/maker/index.js b/projects/maker/index.js index 399d92a225..6edc7c3785 100644 --- a/projects/maker/index.js +++ b/projects/maker/index.js @@ -110,6 +110,7 @@ async function tvl(timestamp, block) { } module.exports = { + timetravel: true, methodology: `Counts all the tokens being used as collateral of CDPs and the DAI locked in the DSR (Dai Savings Rate) contract. On the technical level, we get all the collateral tokens by fetching events, get the amounts locked by calling balanceOf() directly, unwrap any uniswap LP tokens and then get the price of each token from coingecko`, From 4a0574db6480a3676a946d5ff5aa86ab309f6e01 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 01:57:38 +0000 Subject: [PATCH 077/393] timetravel: true timetravel: true --- projects/aave/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/aave/index.js b/projects/aave/index.js index 0f951a898b..7e1d8044b3 100644 --- a/projects/aave/index.js +++ b/projects/aave/index.js @@ -307,6 +307,7 @@ const {getV2Reserves, getV2Tvl, aaveChainTvl} = require('../helper/aave') } module.exports = { + timetravel: true, methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, ethereum:{ staking, From 512a972b4a1c8871c15c3b04b31bf60a7e26bcdc Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:00:18 +0000 Subject: [PATCH 078/393] timetravel: true, timetravel: true, --- projects/convex/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/convex/index.js b/projects/convex/index.js index d026f9b34b..88dfc941bb 100644 --- a/projects/convex/index.js +++ b/projects/convex/index.js @@ -221,5 +221,6 @@ async function tvl(timestamp, block) { } module.exports = { + timetravel: true, tvl -} \ No newline at end of file +} From 24938242d766055ae34d7edf6a08cd7ef4ace9fa Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:01:22 +0000 Subject: [PATCH 079/393] timetravel: false, timetravel: false, --- projects/wbtc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wbtc.js b/projects/wbtc.js index 7592864ff4..47bbe2b4f5 100644 --- a/projects/wbtc.js +++ b/projects/wbtc.js @@ -11,6 +11,7 @@ async function fetch() { module.exports = { + timetravel: false, fetch, methodology: `TVL for WBTC consists of the BTC deposits in custody that were used to mint WBTC` } From 663bf214e01dfd4ef6ecc2c5251465daac1d4503 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:02:49 +0000 Subject: [PATCH 080/393] timetravel: true, timetravel: true, --- projects/compound-onchain/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/compound-onchain/index.js b/projects/compound-onchain/index.js index 031c832554..086ab46403 100644 --- a/projects/compound-onchain/index.js +++ b/projects/compound-onchain/index.js @@ -152,6 +152,7 @@ async function tvl(timestamp, block) { } module.exports = { + timetravel: true, ethereum: { tvl }, From 1491c457c5a9e0f07c582e4520e070819d08face Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:03:37 +0000 Subject: [PATCH 081/393] timetravel: false, timetravel: false, --- projects/instadapp.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/instadapp.js b/projects/instadapp.js index 4694b04727..4caa72b727 100644 --- a/projects/instadapp.js +++ b/projects/instadapp.js @@ -10,5 +10,6 @@ async function fetch() { } module.exports = { + timetravel: false, fetch } From a80bab27ac6ba4759fd05e7201c97b4650361ca8 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:07:05 +0000 Subject: [PATCH 082/393] timetravel: true, timetravel: true, --- projects/uniswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 9a65d27c04..c509989d68 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -18,6 +18,7 @@ const v3Graphs = getChainTvl({ }, "factories", "totalValueLockedUSD") module.exports = { + timetravel: true, misrepresentedTokens: true, methodology: `Counts the tokens locked on AMM pools, pulling the data from the 'ianlapham/uniswapv2' subgraph`, ethereum:{ From 7222b6972f4159ddf790533ee01791c343fb5cdd Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:16:56 +0000 Subject: [PATCH 083/393] timetravel: true, timetravel: true, --- projects/pancake-swap.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pancake-swap.js b/projects/pancake-swap.js index f012024fca..68fcddb81b 100644 --- a/projects/pancake-swap.js +++ b/projects/pancake-swap.js @@ -89,6 +89,7 @@ async function staking(timestamp, ethBlock, chainBlocks) { } module.exports = { + timetravel: true, misrepresentedTokens: true, methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://pancakeswap.info/ as the source. Staking accounts for the CAKE locked in MasterChef (0x73feaa1eE314F8c655E354234017bE2193C9E24E)', staking: { From 4794de3ff400c627f1463c466a5984c0d8cc04a6 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 02:22:28 +0000 Subject: [PATCH 084/393] update file xdc file name --- projects/XDC/{index.cjs => index.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename projects/XDC/{index.cjs => index.js} (100%) diff --git a/projects/XDC/index.cjs b/projects/XDC/index.js similarity index 100% rename from projects/XDC/index.cjs rename to projects/XDC/index.js From 277a64627a499d6eaaf306d4308399100831f617 Mon Sep 17 00:00:00 2001 From: lastbiter <71308682+lastbiter@users.noreply.github.com> Date: Fri, 3 Dec 2021 12:19:43 +0800 Subject: [PATCH 085/393] Update amy finance addresses --- projects/amyfinance/index.js | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/projects/amyfinance/index.js b/projects/amyfinance/index.js index 79614b24d0..fe4f00ee3f 100644 --- a/projects/amyfinance/index.js +++ b/projects/amyfinance/index.js @@ -3,22 +3,26 @@ const { transformArbitrumAddress } = require('../helper/portedTokens'); const { getBlock } = require('../helper/getBlock'); const tokens = [ - ["0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", false], //USDC - ["0x82af49447d8a07e3bd95bd0d56f35241523fbab1", false], //WETH - ["0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", false], //WBTC - ["0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9", false], //USDT - ["0xf97f4df75117a78c1a5a0dbb814af92458539fb4", false], //LINK - ["0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0", false], //UNI - ["0x82e3a8f066a6989666b031d916c43672085b1582", false], //YFI + ["0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8", false], //USDC + ["0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", false], //USDT + ["0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", false], //DAI + ["0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f", false], //WBTC + ["0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", false], //WETH + ["0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", false], //UNI + ["0xf97f4df75117a78c1A5a0DBb814Af92458539FB4", false], //LINK + ["0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A", false], //MIM + ["0xd4d42F0b6DEF4CE0383636770eF773390d85c61A", false], //SUSHI ]; const aibContracts = [ - "0x320eE3F76F81A1AEF1e0B17AB163203E341f4cEB", //aibUSDC - "0x8085fedcfd35D8346b98A2E3Beb58cFD88876BF9", //aibWETH - "0xE19e4EE5e4e203fE78066efeA990cb79bA62D8Ac", //aibWBTC - "0x31a617E3e69eE41FCF61a354f8e50fC4953053C7", //aibUSDT - "0x55A9E5cdb11E9812B40233E504380C68a3b8C901", //aibLINK - "0xa6256935758EC195E0B475756358C915c73c382A", //aibUNI - "0x9bBa222ceCdbA87601B683Ba4A50276020DFC328", //aibYFI + "0xe76a422C30B09f8d20ad5d8A9D21206835F6c692", //aibUSDC + "0xE3575B6226a7965f5289C2C6eF2f9C89b6d70941", //aibUSDT + "0xa6F7A3e16fFC0fE08C43e72C5BB5E15d98c79a05", //aibDAI + "0x2b3554d6810FA2CEc563b0bC731AbAC60A717f3B", //aibWBTC + "0x8C1b5FE3A884118569707d07049fbc56A8314CcE", //aibWETH + "0xE85B64dDA773CB18E0F2a2211Da60DaA536C0284", //aibUNI + "0x9Dd192fca6A1E7c8a3C014a35087dE3fb9Da14E5", //aibLINK + "0x381F8482ee0a12202F2A3735370859f5709B12d2", //aibMIM + "0x52444Aa321dfD7b24aA263Af6F7DCC26565f3629", //aibSUSHI ]; async function tvl(timestamp, ethBlock, chainBlocks) { From bb70b36c38b3ca961038d009c3ca007d5549d193 Mon Sep 17 00:00:00 2001 From: sruthi23 Date: Fri, 3 Dec 2021 10:26:19 +0530 Subject: [PATCH 086/393] Tvl for Knitfinance --- projects/knitfinance/index.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/projects/knitfinance/index.js b/projects/knitfinance/index.js index 8cf77130a5..3f81adb85d 100644 --- a/projects/knitfinance/index.js +++ b/projects/knitfinance/index.js @@ -81,6 +81,10 @@ const apiPath = { base_url: "https://api.polygonscan.com", api_key: "M2Y1KZE5BUJP8DBCCDGWVSDJYCHXCPDVYK", }, + fantom: { + base_url: "https://api.ftmscan.com", + api_key: "FZ6JS5HUR9RE23UKA8KT9P439BGNSZSGS1", + }, }; const getTokenSupply = (contractaddress, network) => { @@ -109,7 +113,7 @@ const getNetworkAssets = async (network) => { const allAddress = Object.keys(assets[network]); allAddress.forEach((item, i) => { promises.push( - new Promise((res) => setTimeout(res, 1000 * i)).then(() => + new Promise((res) => setTimeout(res, 500 * i)).then(() => _fetch(item, network, assets[network][item]) ) ); @@ -144,7 +148,16 @@ const _bscFetch = async () => { const _maticFetch = async () => { try { const result = await getNetworkAssets("matic"); - console.log(result); + const object = Object.assign({}, ...result); + return object; + } catch (e) { + console.log(e); + } +}; + +const _fantomFetch = async () => { + try { + const result = await getNetworkAssets("fantom"); const object = Object.assign({}, ...result); return object; } catch (e) { @@ -164,4 +177,7 @@ module.exports = { polygon: { tvl: _maticFetch, }, + fantom: { + tvl: _fantomFetch, + }, }; From c4d8af4c851c839b73b2c60531464fa4b0264ed7 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:22:55 +0000 Subject: [PATCH 087/393] timetravel: true, timetravel: true, --- projects/sushiswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/sushiswap/index.js b/projects/sushiswap/index.js index 908e5f1844..e87722b412 100644 --- a/projects/sushiswap/index.js +++ b/projects/sushiswap/index.js @@ -16,6 +16,7 @@ modulesToExport.ethereum.tvl = sdk.util.sumChainTvls([modulesToExport.ethereum.t // modulesToExport.ethereum.tvl = async (timestamp, block, chainBlocks) => getExports("sushi", ['ethereum']).ethereum.tvl() + kashiLending(timestamp, block, chainBlocks) module.exports = { + timetravel: true, misrepresentedTokens: true, ...modulesToExport, -} \ No newline at end of file +} From c9743d57d36ed445474a8b53434f732dcd4e4c6a Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:36:38 +0000 Subject: [PATCH 088/393] timetravel: true, timetravel: true, --- projects/balancer/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/balancer/index.js b/projects/balancer/index.js index 69c4905d79..bfa2e65af6 100644 --- a/projects/balancer/index.js +++ b/projects/balancer/index.js @@ -41,6 +41,7 @@ async function arbitrum(timestamp, ethBlock, chainBlocks) { } module.exports = { + timetravel: true, misrepresentedTokens: true, methodology: `Balancer TVL is pulled from the Balancer subgraph and includes deposits made to Balancer v1 and v2 liquidity pools.`, ethereum:{ From c0aa2b8732b12d5dbcd3a4f3f5597be8a133d3a8 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:38:25 +0000 Subject: [PATCH 089/393] timetravel: true, timetravel: true, --- projects/liquity/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/liquity/index.js b/projects/liquity/index.js index 5c94947475..6e4e160ec8 100644 --- a/projects/liquity/index.js +++ b/projects/liquity/index.js @@ -34,6 +34,7 @@ async function tvl(_, block) { } module.exports = { + timetravel: true, name: "Liquity", token: "LUSD", category: "minting", From 78d2268eb4045a4c5d7602666aa49677ce9783a8 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:40:18 +0000 Subject: [PATCH 090/393] timetravel: true, timetravel: true, --- projects/traderjoe/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/traderjoe/index.js b/projects/traderjoe/index.js index 97f3e2311c..0e05123e6d 100644 --- a/projects/traderjoe/index.js +++ b/projects/traderjoe/index.js @@ -32,6 +32,7 @@ async function staking(timestamp, ethBlock, chainBlocks) { } module.exports = { + timetravel: true, misrepresentedTokens: true, methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/exchange" subgraph. The staking portion of TVL includes the JoeTokens within the JoeBar contract.', avalanche:{ @@ -41,4 +42,4 @@ module.exports = { ]), staking } -} \ No newline at end of file +} From 1fae8009b6a87b478636282f59b15634148faa45 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:41:06 +0000 Subject: [PATCH 091/393] timetravel: false timetravel: false --- projects/hbtc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/hbtc.js b/projects/hbtc.js index 8cff5842b4..763d34bc82 100644 --- a/projects/hbtc.js +++ b/projects/hbtc.js @@ -12,5 +12,6 @@ async function fetch() { module.exports = { + timetravel: false, fetch } From 38e03ea559914305c802c314fa92d5b67d5095c7 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:42:46 +0000 Subject: [PATCH 092/393] timetravel: false timetravel: false --- projects/venus.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/venus.js b/projects/venus.js index 4a3c4e9071..a6a6f86961 100644 --- a/projects/venus.js +++ b/projects/venus.js @@ -15,6 +15,7 @@ async function fetch() { module.exports = { + timetravel: false, methodology: 'TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.', fetch, } From 1ef375f71433f8c84f5384636c789cde04a43362 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:44:51 +0000 Subject: [PATCH 093/393] timetravel: true timetravel: true --- projects/cream/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/cream/index.js b/projects/cream/index.js index 4944fcb91b..6a4e798144 100644 --- a/projects/cream/index.js +++ b/projects/cream/index.js @@ -312,6 +312,7 @@ const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { } module.exports = { + timetravel: true, start: 1599552000, // 09/08/2020 @ 8:00am (UTC) ethereum: { tvl: ethereumTvl, From dedd9f6e04b71d0884f76654d027c17286bed26f Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:49:15 +0000 Subject: [PATCH 094/393] timetravel: false timetravel: false --- projects/raydium.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/raydium.js b/projects/raydium.js index c9ac597d98..455fade000 100644 --- a/projects/raydium.js +++ b/projects/raydium.js @@ -14,5 +14,6 @@ async function fetch() { } module.exports = { + timetravel: false, fetch, }; From 4a4546815857d00495dd19041bfff304aaf22dc6 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:50:38 +0000 Subject: [PATCH 095/393] timetravel: true timetravel: true --- projects/justSwap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/justSwap/index.js b/projects/justSwap/index.js index 09daec9ee7..2634ae501f 100644 --- a/projects/justSwap/index.js +++ b/projects/justSwap/index.js @@ -16,7 +16,8 @@ async function tvl(timestamp){ } module.exports = { + timetravel: true, tron:{ tvl } -} \ No newline at end of file +} From 15cdb1497243c22d03987856123ff4c138546633 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:51:47 +0000 Subject: [PATCH 096/393] timetravel: true, timetravel: true, --- projects/benqi/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/benqi/index.js b/projects/benqi/index.js index ef71aea079..40ab6f60ff 100644 --- a/projects/benqi/index.js +++ b/projects/benqi/index.js @@ -9,6 +9,7 @@ async function tvl(...params) { } module.exports={ + timetravel: true, methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", tvl } From d8c9a50dfb810f0c9b7aac8547129f1bd861b622 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:54:22 +0000 Subject: [PATCH 097/393] timetravel: true, timetravel: true, --- projects/synthetix/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/synthetix/index.js b/projects/synthetix/index.js index 295480cc40..54df8693e2 100644 --- a/projects/synthetix/index.js +++ b/projects/synthetix/index.js @@ -2,5 +2,6 @@ const {getExports} = require('../helper/heroku-api') const chains = ['ethereum', 'optimism'] module.exports = { + timetravel: true, ...getExports("synthetix", chains) -} \ No newline at end of file +} From abb91dfe4ae14a6b67c2ed6aaea55c2591f2ff82 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:55:24 +0000 Subject: [PATCH 098/393] timetravel: true timetravel: true --- projects/juststable/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/juststable/index.js b/projects/juststable/index.js index 18755b93e4..a7d6175d43 100644 --- a/projects/juststable/index.js +++ b/projects/juststable/index.js @@ -20,7 +20,8 @@ async function tvl(timestamp){ } module.exports = { + timetravel: true, tron:{ tvl } -} \ No newline at end of file +} From 902a9ece8dfb1842b828003bb6d41636c7dcec29 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 3 Dec 2021 05:56:47 +0000 Subject: [PATCH 099/393] timetravel: false timetravel: false --- projects/marinade.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/marinade.js b/projects/marinade.js index afdf94f4ee..a2021f1f33 100644 --- a/projects/marinade.js +++ b/projects/marinade.js @@ -10,6 +10,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: `To obtain the Marinade Finance TVL we make a dedicated API endpoint in our REST server. It is using values from the database with a separate update process. The *_sol fields of returned JSON object contains a number of SOL tokens held in our contract for us to then use Coingecko to get the price of SOL token in USD and export it. We are counting only SOL tokens because all other tokens used in our contract are mintable by us and represents a value of locked SOL tokens to our customers`, -} \ No newline at end of file +} From 5d3d160bef6a57f84314bdf25da48e33750aa4eb Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 3 Dec 2021 14:14:01 +0800 Subject: [PATCH 100/393] add mobiusfinance adapter --- projects/mobiusfinance/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/mobiusfinance/index.js diff --git a/projects/mobiusfinance/index.js b/projects/mobiusfinance/index.js new file mode 100644 index 0000000000..077eda9f93 --- /dev/null +++ b/projects/mobiusfinance/index.js @@ -0,0 +1,16 @@ +const utils = require('../helper/utils'); + +async function polygon() { + const tvl = await utils.fetchURL('https://api.mobius.finance/tvl/') + return tvl.data +} + +async function fetch() { + return await polygon() +} +module.exports = { + polygon:{ + fetch:polygon + }, + fetch +} \ No newline at end of file From c75687f5ea10637a6d28be1f3b2706bc3788641d Mon Sep 17 00:00:00 2001 From: donkeyfund-jijay Date: Fri, 3 Dec 2021 17:17:27 +0900 Subject: [PATCH 101/393] update: split-network - split network to ethereum, klaytn --- projects/donkey/index.js | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/projects/donkey/index.js b/projects/donkey/index.js index a666acb62e..c4c8d99d47 100644 --- a/projects/donkey/index.js +++ b/projects/donkey/index.js @@ -83,11 +83,10 @@ async function staking() { return totalTvlKrw / currency; } -async function fetch() { +async function ethereum() { + let totalTvlKrw = 0; const result = await axios.get('https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWUSD'); const currency = result.data[0].basePrice; - - const web3 = new Web3(process.env.ETHEREUM_RPC); const priceOracleContract = new web3.eth.Contract(PriceOracleAbi, PriceOracleAddress.ethereum); const { 0 : symbols, 1 : prices} = await priceOracleContract.methods.getPrices().call(); @@ -104,9 +103,6 @@ async function fetch() { const donkeyPrice = Math.ceil(ethPrice / Math.floor(donRatio)); priceObj['DON'] = donkeyPrice; - priceObj['kDON'] = donkeyPrice; - - let totalTvlKrw = 0; const controllerContrat = new web3.eth.Contract(ControllerAbi, controllerAddress.ethereum) const ethMarkets = await controllerContrat.methods.getAllMarkets().call(); @@ -130,6 +126,13 @@ async function fetch() { totalTvlKrw += tvlKrw; } } + return totalTvlKrw / currency; +} + +async function klaytn() { + const result = await axios.get('https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWUSD'); + const currency = result.data[0].basePrice; + let totalTvlKrw = 0; const KLAYTN_ACCESS_KEY_ID = "KASK19AHMII2AZN1MAJDRFOU" const KLAYTN_SECRET_ACCESS_KEY = "I1Iwgwt1C6z_jA79eh6JBJKOHTGLIK-tAozkz-bl" @@ -157,6 +160,12 @@ async function fetch() { } }, {}) + const donRatio = await getDonkeySwapRatio(); + const ethPrice = klaytnPriceObj['KETH']; + const donkeyPrice = Math.ceil(ethPrice / Math.floor(donRatio)); + + klaytnPriceObj['kDON'] = donkeyPrice; + const controllerContract = new caver.klay.Contract(ControllerAbi, controllerAddress.klaytn); const klaytnMarkets = await controllerContract.methods.getAllMarkets().call(); @@ -181,9 +190,15 @@ async function fetch() { } return totalTvlKrw / currency; } -fetch() - module.exports = { - fetch, - staking + ethereum : { + staking, + tvl: ethereum + }, + klaytn: { + tvl: klaytn + }, + staking : { + tvl: staking + }, } From 93d5949951cfbca7bcc96a3c99469630beba838d Mon Sep 17 00:00:00 2001 From: Olivier Riccini Date: Fri, 3 Dec 2021 12:23:58 +0100 Subject: [PATCH 102/393] add arbirise adapter --- .../abis/arbiStakerERC20.json | 53 +++++++ projects/arbirise-finance/abis/getPair.json | 26 ++++ .../arbirise-finance/abis/getReserves.json | 25 ++++ projects/arbirise-finance/abis/token0.json | 15 ++ projects/arbirise-finance/contracts.json | 9 ++ projects/arbirise-finance/getPrice.js | 136 ++++++++++++++++++ projects/arbirise-finance/index.js | 72 ++++++++++ 7 files changed, 336 insertions(+) create mode 100644 projects/arbirise-finance/abis/arbiStakerERC20.json create mode 100644 projects/arbirise-finance/abis/getPair.json create mode 100644 projects/arbirise-finance/abis/getReserves.json create mode 100644 projects/arbirise-finance/abis/token0.json create mode 100644 projects/arbirise-finance/contracts.json create mode 100644 projects/arbirise-finance/getPrice.js create mode 100644 projects/arbirise-finance/index.js diff --git a/projects/arbirise-finance/abis/arbiStakerERC20.json b/projects/arbirise-finance/abis/arbiStakerERC20.json new file mode 100644 index 0000000000..ff40a1c902 --- /dev/null +++ b/projects/arbirise-finance/abis/arbiStakerERC20.json @@ -0,0 +1,53 @@ +{ + "stakedTokenTotal": { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakedTokenTotal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getNumTokensStaked": { + "inputs": [], + "name": "getNumTokensStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "num", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getTokenStakedAt": { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getTokenStakedAt", + "outputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/arbirise-finance/abis/getPair.json b/projects/arbirise-finance/abis/getPair.json new file mode 100644 index 0000000000..f7f469683a --- /dev/null +++ b/projects/arbirise-finance/abis/getPair.json @@ -0,0 +1,26 @@ +{ + "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" +} diff --git a/projects/arbirise-finance/abis/getReserves.json b/projects/arbirise-finance/abis/getReserves.json new file mode 100644 index 0000000000..e3f6fcc11d --- /dev/null +++ b/projects/arbirise-finance/abis/getReserves.json @@ -0,0 +1,25 @@ +{ + "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" +} diff --git a/projects/arbirise-finance/abis/token0.json b/projects/arbirise-finance/abis/token0.json new file mode 100644 index 0000000000..eefbeb998a --- /dev/null +++ b/projects/arbirise-finance/abis/token0.json @@ -0,0 +1,15 @@ +{ + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" +} diff --git a/projects/arbirise-finance/contracts.json b/projects/arbirise-finance/contracts.json new file mode 100644 index 0000000000..d6a036ad19 --- /dev/null +++ b/projects/arbirise-finance/contracts.json @@ -0,0 +1,9 @@ +{ + "arbiStaker": "0x6a894bd1A5476Bdc52B709623B8751e244E6e975", + "sushiFactoryAddress": "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", + "weth": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", + "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", + "lp": "0xf2537009e97e409C16f7608885459a62F9eccC48", + "arf": "0xeb6F8eEBC83D85120F9299B84DA558825685570e", + "usdcWethPair": "0x905dfCD5649217c42684f23958568e533C711Aa3" +} diff --git a/projects/arbirise-finance/getPrice.js b/projects/arbirise-finance/getPrice.js new file mode 100644 index 0000000000..271ba93064 --- /dev/null +++ b/projects/arbirise-finance/getPrice.js @@ -0,0 +1,136 @@ +const sdk = require("@defillama/sdk"); +const getPair = require("./abis/getPair.json"); +const getReserves = require("./abis/getReserves.json"); +const token0 = require("./abis/token0.json"); +const contracts = require("./contracts.json"); +const { default: BigNumber } = require("bignumber.js"); + +const getETHPrice = async (block) => { + const reserves = ( + await sdk.api.abi.call({ + target: contracts["usdcWethPair"], + abi: getReserves, + block: block, + chain: "arbitrum", + }) + ).output; + + const _token0 = ( + await sdk.api.abi.call({ + target: contracts["usdcWethPair"], + abi: token0, + block: block, + chain: "arbitrum", + }) + ).output; + + const WETHReserve = new BigNumber( + _token0.toLowerCase() === contracts["weth"].toLowerCase() + ? reserves._reserve0 + : reserves._reserve1 + ).div(1e18); + const USDCReserve = new BigNumber( + _token0.toLowerCase() === contracts["usdc"].toLowerCase() + ? reserves._reserve0 + : reserves._reserve1 + ).div(1e6); + + return new BigNumber(USDCReserve).div(new BigNumber(WETHReserve)); +}; + +const getPrice = async (tokenAddress, block) => { + try { + const ETHPrice = await getETHPrice(block); + + if (tokenAddress.toLowerCase() === contracts["weth"].toLowerCase()) { + return { price: ETHPrice, decimals: 18 }; + } + + const pairAddress = + tokenAddress.toLowerCase() === contracts["lp"].toLowerCase() || + tokenAddress.toLowerCase() === contracts["arf"].toLowerCase() + ? contracts["lp"] + : ( + await sdk.api.abi.call({ + target: contracts["sushiFactoryAddress"], + abi: getPair, + params: [tokenAddress, contracts["weth"]], + block: block, + chain: "arbitrum", + }) + ).output; + + const reserves = ( + await sdk.api.abi.call({ + target: pairAddress, + abi: getReserves, + block: block, + chain: "arbitrum", + }) + ).output; + + const _token0 = ( + await sdk.api.abi.call({ + target: pairAddress, + abi: token0, + block: block, + chain: "arbitrum", + }) + ).output; + + const decimals = ( + await sdk.api.abi.call({ + target: tokenAddress, + abi: "erc20:decimals", + chain: "arbitrum", + }) + ).output; + + const WETHReserve = new BigNumber( + _token0.toLowerCase() === contracts["weth"].toLowerCase() + ? reserves._reserve0 + : reserves._reserve1 + ).div(1e18); + const tokenReserve = new BigNumber( + _token0.toLowerCase() === tokenAddress.toLowerCase() + ? reserves._reserve0 + : reserves._reserve1 + ).div(`1e${decimals}`); + + if (tokenAddress.toLowerCase() === contracts["lp"].toLowerCase()) { + const totalSupply = ( + await sdk.api.abi.call({ + target: tokenAddress, + abi: "erc20:totalSupply", + chain: "arbitrum", + }) + ).output; + + return { + price: new BigNumber(WETHReserve) + .times(ETHPrice) + .times(2) + .div(new BigNumber(totalSupply).div(`1e${decimals}`)), + decimals, + }; + } + + const priceInETH = new BigNumber(tokenReserve).div( + new BigNumber(WETHReserve) + ); + + return { + price: ETHPrice.div(priceInETH), + decimals, + }; + } catch (e) { + return { + price: new BigNumber(0), + decimals: 0, + }; + } +}; + +module.exports = { + getPrice, +}; diff --git a/projects/arbirise-finance/index.js b/projects/arbirise-finance/index.js new file mode 100644 index 0000000000..2a81890a3d --- /dev/null +++ b/projects/arbirise-finance/index.js @@ -0,0 +1,72 @@ +const sdk = require("@defillama/sdk"); +const { getBlock } = require("../helper/getBlock"); +const arbiStakerERC20 = require("./abis/arbiStakerERC20.json"); +const contracts = require("./contracts.json"); +const { default: BigNumber } = require("bignumber.js"); +const { getPrice } = require("./getPrice"); + +async function tvl(time, _ethBlock, chainBlocks) { + const block = await getBlock(time, "arbitrum", chainBlocks); + + const nbOfPrograms = ( + await sdk.api.abi.call({ + block, + target: contracts["arbiStaker"], + abi: arbiStakerERC20["getNumTokensStaked"], + chain: "arbitrum", + }) + ).output; + + const stakingTokens = ( + await sdk.api.abi.multiCall({ + block, + abi: arbiStakerERC20["getTokenStakedAt"], + calls: [...Array(+nbOfPrograms).keys()].map((index) => ({ + target: contracts["arbiStaker"], + params: index, + })), + chain: "arbitrum", + }) + ).output.map((o) => o.output); + + const stakedByProgram = ( + await sdk.api.abi.multiCall({ + block, + abi: arbiStakerERC20["stakedTokenTotal"], + calls: stakingTokens.map((token) => ({ + target: contracts["arbiStaker"], + params: token, + })), + chain: "arbitrum", + }) + ).output; + + let balances = {}; + + for (let i = 0; i < stakedByProgram.length; i++) { + const { price, decimals } = await getPrice( + stakedByProgram[i].input.params[0], + block + ); + const staked = new BigNumber(stakedByProgram[i].output).div( + `1e${decimals}` + ); + // Adding USDC decimals (6)again here `price.times(staked).times(1e6)` because `sumSingleBalance` will remove them + const rewardProgramTVL = price.times(staked).times(1e6).toFixed(0); + sdk.util.sumSingleBalance( + balances, + `arbitrum:${contracts["usdc"]}`, + rewardProgramTVL + ); + } + + return balances; +} + +module.exports = { + methodology: + "TVL is calculated by summing up all reward program total staked values.", + arbitrum: { + tvl, + }, +}; From 46324211b5b077773298357601433805f4b1edca Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 3 Dec 2021 11:41:13 +0000 Subject: [PATCH 103/393] delete XDC --- projects/XDC/index.js | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 projects/XDC/index.js diff --git a/projects/XDC/index.js b/projects/XDC/index.js deleted file mode 100644 index 49d736a789..0000000000 --- a/projects/XDC/index.js +++ /dev/null @@ -1,24 +0,0 @@ -//https://xdc.blocksscan.io/api/accounts/xdc0000000000000000000000000000000000000088 -//npm install axios@0.21.1 - -// Date/Time headers/date -// TVL data/balanceNumber -// Block - -const axios = require('axios'); - -async function tvl(price) { - try { - const response = await axios.get('https://xdc.blocksscan.io/api/accounts/xdc0000000000000000000000000000000000000088'); - var logString = ("{Total TVL: "+response.data.balanceNumber*price+ ", Timestamp: " +Date.parse(response.headers.date)+ "}") - console.log(logString); - } catch (error) { - console.error(error); - } -} - -module.exports = { - tvl - } - -tvl(0.08686) \ No newline at end of file From ad85d836b47dae4bd3b879522d3c91af02afe7b3 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 3 Dec 2021 12:06:29 +0000 Subject: [PATCH 104/393] rivrkitty --- projects/rivrkitty.js | 63 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 projects/rivrkitty.js diff --git a/projects/rivrkitty.js b/projects/rivrkitty.js new file mode 100644 index 0000000000..ab5cc5eacd --- /dev/null +++ b/projects/rivrkitty.js @@ -0,0 +1,63 @@ + +const sdk = require('@defillama/sdk'); +const { getBlock } = require('./helper/getBlock'); +const { transformMoonriverAddress } = require('./helper/portedTokens'); +const { unwrapUniswapLPs } = require('./helper/unwrapLPs'); + +const contract = '0x995ef3a5D14b66Ac5C7Fa1a967F8D9Cd727452bA'; +const tokens = [ + { + address: '0x9a92b5ebf1f6f6f7d93696fcd44e5cf75035a756', // FINN + isLP: false + },{ + address: '0x8e643094fb9941e273c2190563d7c514d56c841b', // HBLP + isLP: true + },{ + address: '0x6714cd1e19363dc613154ebe440172e41575c469', // PAWS + isLP: false + } +]; + +async function staking(timestamp, block, chainBlocks) { + const balances = {}; + block = await getBlock(timestamp, 'moonriver', chainBlocks); + const transform = await transformMoonriverAddress(); + + const balanceOfs = (await sdk.api.abi.multiCall({ + calls: tokens.map(c => ({ + target: c.address, + params: [contract]})), + abi: 'erc20:balanceOf', + block, + chain: 'moonriver' + })).output; + + for (let i = 0; i < tokens.length; i++) { + if (tokens[i].isLP) { + await unwrapUniswapLPs( + balances, + [{ + balance: balanceOfs[i].output, + token: tokens[i].address + }], + block, + 'moonriver', + transform + ); + } else { + await sdk.util.sumSingleBalance( + balances, + transform(tokens[i].address), + balanceOfs[i].output + ); + }; + }; + return balances; +}; + +module.exports = { + moonriver: { + staking, + tvl: async()=>({}) + } +}; \ No newline at end of file From b4e8570e99dd8ca9ba7dd71d92e40f164825a2d8 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 3 Dec 2021 11:56:47 +0000 Subject: [PATCH 105/393] whitelist more tokens for vvs --- projects/vvs-finance/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/vvs-finance/index.js b/projects/vvs-finance/index.js index acf630cca5..6fc425cc87 100644 --- a/projects/vvs-finance/index.js +++ b/projects/vvs-finance/index.js @@ -4,6 +4,13 @@ module.exports={ misrepresentedTokens: true, methodology: "Factory address (0x3b44b2a187a7b3824131f8db5a74194d0a42fc15) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", cronos: { - tvl:calculateUsdUniTvl("0x3b44b2a187a7b3824131f8db5a74194d0a42fc15", "cronos", "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", ["0x2D03bECE6747ADC00E1a131BBA1469C15fD11e03"], "crypto-com-chain") + tvl:calculateUsdUniTvl("0x3b44b2a187a7b3824131f8db5a74194d0a42fc15", "cronos", "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", + [ + "0x2D03bECE6747ADC00E1a131BBA1469C15fD11e03", //vvs + "0xc21223249ca28397b4b6541dffaecc539bff0c59", //usdc + "0xe44fd7fcb2b1581822d0c862b68222998a0c299a", //weth + "0x66e428c3f67a68878562e79a0234c1f83c208770", //usdt + ] + , "crypto-com-chain") } } \ No newline at end of file From b208d9f4240c9c75fe9e1b116326425cf81ce24a Mon Sep 17 00:00:00 2001 From: nemusona Date: Fri, 3 Dec 2021 07:10:23 -0600 Subject: [PATCH 106/393] qidao moonriver --- projects/qidao/index.js | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/projects/qidao/index.js b/projects/qidao/index.js index bb3aa16a51..1038050d21 100644 --- a/projects/qidao/index.js +++ b/projects/qidao/index.js @@ -264,7 +264,7 @@ async function fantom(timestamp, block, chainBlocks) { "0x75D4aB6843593C111Eeb02Ff07055009c836A1EF", ], ]; - //await handleMooTokens(balances, chainBlocks.fantom, chain, ftmMooTokens) + await handleMooTokens(balances, chainBlocks.fantom, chain, ftmMooTokens); const ftmLPs = [ //Vault, token, LP [ @@ -295,6 +295,34 @@ async function avax(timestamp, block, chainBlocks) { return balances; } +async function moonriver(timestamp, block, chainBlocks) { + const balances = {}; + const chain = "moonriver"; + const moonriverMooLPs = [ + [ + "0x97D811A7eb99Ef4Cb027ad59800cE27E68Ee1109", + "0x932009984bd2a7da8c6396694e811da5c0952d05", + "0xA0D8DFB2CC9dFe6905eDd5B71c56BA92AD09A3dC", + ], + ]; + await sumTokens( + balances, + [ + [ + "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c", + "0x4a0474E3262d4DB3306Cea4F207B5d66eC8E0AA9", + ], + ], + chainBlocks.moonriver, + chain, + (addr) => { + return `moonriver:${addr}`; + } + ); + await handleMooLPs(balances, chainBlocks.moonriver, chain, moonriverMooLPs); + return balances; +} + module.exports = { methodology: "TVL counts the AAVE tokens that are deposited within the Yield Instruments section of QiDao, the Vault token deposits of CRV, LINK, AAVE and WETH, as well as USDC deposited to mint MAI.", @@ -307,4 +335,7 @@ module.exports = { avax: { tvl: avax, }, + moonriver: { + tvl: moonriver, + }, }; From 2232da07c225c24f9671d22b6e8582fe8f5fca84 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 3 Dec 2021 13:59:22 +0000 Subject: [PATCH 107/393] vesper fail hard --- projects/vesper/index.js | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/projects/vesper/index.js b/projects/vesper/index.js index ee1ce0b416..67c762fd33 100644 --- a/projects/vesper/index.js +++ b/projects/vesper/index.js @@ -1,10 +1,5 @@ -/*================================================== - Modules - ==================================================*/ - const sdk = require("@defillama/sdk"); const abi = require('./abi.json') -const BigNumber = require("bignumber.js"); const _ = require("underscore"); async function tvl(timestamp, block) { @@ -71,21 +66,12 @@ async function tvl(timestamp, block) { _.each(totalValueResponse.output, (response) => { const totalValue = response.output; const poolAddress = response.input.target; - const existingBalance = new BigNumber(balances[collateralToken[poolAddress]] || "0"); - balances[collateralToken[poolAddress]] = existingBalance.plus(new BigNumber(totalValue)).toFixed(); + sdk.util.sumSingleBalance(balances, collateralToken[poolAddress], totalValue) }); return balances; } -/*================================================== - Exports - ==================================================*/ - module.exports = { - name: "Vesper", - website: "https://vesper.finance", - token: "VSP", - category: "assets", start: 1608667205, // December 22 2020 at 8:00 PM UTC tvl, }; From 786c07c725410267b5cb20b5410675543a97253d Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 3 Dec 2021 14:13:17 +0000 Subject: [PATCH 108/393] idledao --- projects/idleDao.js | 61 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 projects/idleDao.js diff --git a/projects/idleDao.js b/projects/idleDao.js new file mode 100644 index 0000000000..ca9e28281b --- /dev/null +++ b/projects/idleDao.js @@ -0,0 +1,61 @@ + +const sdk = require('@defillama/sdk'); +const { getBlock } = require('./helper/getBlock'); +const { transformPolygonAddress } = require('./helper/portedTokens'); + +const vaults = [ + { + address: '0x8a999F5A3546F8243205b2c0eCb0627cC10003ab', // IdleDAI + tokens: [ + '0x27f8d03b3a2196956ed754badc28d73be8830a6e', // amDAI + '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', // DAI + '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // wMATIC + ] + }, { + address: '0x1ee6470CD75D5686d0b2b90C0305Fa46fb0C89A1', // IdleUSDC + tokens: [ + '0x1a13f4ca1d028320a707d99520abfefca3998b7f', // amUSDC + '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', // USDC + '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // wMATIC + ] + }, { + address: '0xfdA25D931258Df948ffecb66b5518299Df6527C4', // IdleWETH + tokens: [ + '0x28424507fefb6f7f8e9d3860f56504e4e5f5f390', // amWETH + '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH + '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // wMATIC + ] + } +]; + +async function tvl(timestamp, block, chainBlocks) { + const balances = {}; + block = await getBlock(timestamp, 'polygon', chainBlocks); + const transform = await transformPolygonAddress(); + + for (let vault of vaults) { + const balanceOfs = (await sdk.api.abi.multiCall({ + calls: vault.tokens.map(c => ({ + target: c, + params: [vault.address]})), + abi: 'erc20:balanceOf', + block, + chain: 'polygon' + })).output; + + for (let i = 0; i < vault.tokens.length; i++) { + await sdk.util.sumSingleBalance( + balances, + transform(vault.tokens[i]), + balanceOfs[i].output + ); + }; + }; + return balances; +}; + +module.exports = { + polygon: { + tvl + } +}; \ No newline at end of file From a90cc0140f1dbc277382f9c3dd1599ed7b00d1e8 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 3 Dec 2021 14:31:13 +0000 Subject: [PATCH 109/393] Rivrkitty masterchef deposits --- projects/rivrkitty.js | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/projects/rivrkitty.js b/projects/rivrkitty.js index ab5cc5eacd..25a72895ab 100644 --- a/projects/rivrkitty.js +++ b/projects/rivrkitty.js @@ -3,8 +3,10 @@ const sdk = require('@defillama/sdk'); const { getBlock } = require('./helper/getBlock'); const { transformMoonriverAddress } = require('./helper/portedTokens'); const { unwrapUniswapLPs } = require('./helper/unwrapLPs'); +const abi = require("./pendle/abi.json"); -const contract = '0x995ef3a5D14b66Ac5C7Fa1a967F8D9Cd727452bA'; +const masterchefContract = '0x1f4b7660b6AdC3943b5038e3426B33c1c0e343E6' +const stakingContract = '0x995ef3a5D14b66Ac5C7Fa1a967F8D9Cd727452bA'; const tokens = [ { address: '0x9a92b5ebf1f6f6f7d93696fcd44e5cf75035a756', // FINN @@ -15,24 +17,46 @@ const tokens = [ },{ address: '0x6714cd1e19363dc613154ebe440172e41575c469', // PAWS isLP: false + }, { + address: '0xDCd92eb568157D3c1a6b3AE53ADF18a230bc304A', // HBLP + isLP: true } ]; - -async function staking(timestamp, block, chainBlocks) { +// node test.js projects/rivrkitty.js +async function pool2(timestamp, block, chainBlocks) { const balances = {}; block = await getBlock(timestamp, 'moonriver', chainBlocks); const transform = await transformMoonriverAddress(); + + const masterChefDeposits = await sdk.api.abi.call({ + target: masterchefContract, + abi, + params: [19, stakingContract], + block, + chain: 'moonriver' + }); + await unwrapUniswapLPs( + balances, + [{ + balance: masterChefDeposits.output.amount, + token: tokens[3].address + }], + block, + 'moonriver', + transform + ); + const balanceOfs = (await sdk.api.abi.multiCall({ calls: tokens.map(c => ({ target: c.address, - params: [contract]})), + params: [stakingContract]})), abi: 'erc20:balanceOf', block, chain: 'moonriver' })).output; - for (let i = 0; i < tokens.length; i++) { + for (let i = 0; i < tokens.length - 1; i++) { if (tokens[i].isLP) { await unwrapUniswapLPs( balances, @@ -52,12 +76,13 @@ async function staking(timestamp, block, chainBlocks) { ); }; }; + return balances; }; module.exports = { moonriver: { - staking, + pool2, tvl: async()=>({}) } }; \ No newline at end of file From 4ed92715f2404583482c9f63d7e8b45a2c4fe313 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 3 Dec 2021 15:32:03 +0000 Subject: [PATCH 110/393] apply #1053 --- package.json | 2 + projects/connext/index.js | 249 +++++------- projects/helper/portedTokens.js | 682 +++++++++++++++++++------------- 3 files changed, 508 insertions(+), 425 deletions(-) diff --git a/package.json b/package.json index 61e86d5ae2..254fb7a336 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ "license": "ISC", "dependencies": { "@acala-network/api": "^3.0.2", + "@connext/nxtp-contracts": "0.0.93", + "@connext/nxtp-utils": "0.0.93", "@defillama/sdk": "^2.3.26", "@makerdao/multicall": "^0.12.0", "@polkadot/api": "^6.6.1", diff --git a/projects/connext/index.js b/projects/connext/index.js index 8d14d008ae..854832bd95 100644 --- a/projects/connext/index.js +++ b/projects/connext/index.js @@ -1,155 +1,112 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); -const BigNumber = require('bignumber.js') -const {getBlock} = require('../helper/getBlock') +const { getBlock } = require("../helper/getBlock"); +const { chainExports } = require("../helper/exports"); +const sdk = require("@defillama/sdk"); +const { getChainData } = require("@connext/nxtp-utils"); +const { getChainTransform } = require("../helper/portedTokens"); +const contractDeployments = require("@connext/nxtp-contracts/deployments.json"); -// V1 -const hubAddress = '0xdfa6edAe2EC0cF1d4A60542422724A48195A5071'; -const tokenDenominationAddress = '0x6b175474e89094c44da98b954eedeac495271d0f'; -//V3 -const routers = ['0xe3cF69b86F274a14B87946bf641f11Ac837f4492', '0xe6887c0cc3c37cb2ee34Bc58AB258f36825CA910', '0xE540998865aFEB054021dc849Cc6191b8E09dC08', '0xC6C68811E75EfD86d012587849F1A1D30427361d'] -const ethereumTokens = ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', '0x6b175474e89094c44da98b954eedeac495271d0f'] -const bscTokens = ['0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', '0x55d398326f99059fF775485246999027B3197955', '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d'] -const polygonSettings = { - nativeCoin: 'matic-network', - tokens: [ - { - address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', - coingeckoId: 'dai', - }, - { - address: '0xA1c57f48F0Deb89f569dFbE6E2B7f46D33606fD4', - coingeckoId: 'decentraland' - }, - { - address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - coingeckoId: 'tether' - }, - { - address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', - coingeckoId: 'usd-coin' - } - ] -} -const xdaiSettings = { - nativeCoin: 'dai', - tokens: [ - { - address: '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83', - coingeckoId: 'usd-coin' - }, - { - address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6', - coingeckoId: 'tether' - }, - ] -} +// Includes some chains that are not yet live +const chainNameToChainId = { + ethereum: 1, + bsc: 56, + polygon: 137, + xdai: 100, + fantom: 250, + arbitrum: 42161, + avax: 43114, + optimism: 10, + fuse: 122, + moonbeam: 1284, + moonriver: 1285, + celo: 42220, + aurora: 1313161554, + harmony: 1666600000, +}; -function constructBalanceOfCalls(tokens, useAddressProp){ - const calls = [] - for(const router of routers){ - for(const token of tokens){ - const address = useAddressProp?token.address:token - calls.push({ - target: address, - params: [router] - }) - } +async function getDeployedContractAddress(chainId) { + const record = contractDeployments[String(chainId)] + ? contractDeployments[String(chainId)] + : {}; + const name = Object.keys(record)[0]; + if (!name) { + return undefined; } - return calls -} - -async function getRouterBalances(timestamp, chain, settings, block){ - const routerBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - block, - calls: constructBalanceOfCalls(settings.tokens, true), - chain - }) - const tokenDecimals = await sdk.api.abi.multiCall({ - abi: 'erc20:decimals', - block, - calls: settings.tokens.map(token => ({ - target: token.address, - })), - chain - }) - const nativeBalances = await sdk.api.eth.getBalances({ - targets: routers, - block, - chain, - }) - const totalNativeBalance = nativeBalances.output.reduce((acc, output)=>acc.plus(output.balance), BigNumber(0)) - const balances = {} - balances[settings.nativeCoin] = totalNativeBalance.div(1e18).toFixed(0) - routerBalances.output.forEach((result)=>{ - const tokenIndex = settings.tokens.findIndex(token=>result.input.target.toLowerCase()===token.address.toLowerCase()) - const coingeckoId = settings.tokens[tokenIndex].coingeckoId - const decimals = Number(tokenDecimals.output[tokenIndex].output) - sdk.util.sumSingleBalance(balances, coingeckoId, BigNumber(result.output).div(10**decimals).toFixed(0)) - }) - return balances; + const contract = record[name]?.contracts?.TransactionManager; + return contract ? contract.address : undefined; } -async function ethereum(timestamp, block) { - // V1 - const totalChannelToken = (await sdk.api.abi.call({ - block, - target: hubAddress, - abi: abi['totalChannelToken'], - })).output; - - const balances = { [tokenDenominationAddress]: totalChannelToken }; - - // V2 - const routerBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - block, - calls: constructBalanceOfCalls(ethereumTokens, false) - }) - sdk.util.sumMultiBalanceOf(balances, routerBalances); - - return balances -} - -async function bsc(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks.bsc - const balances={} - const routerBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - block, - chain:'bsc', - calls: constructBalanceOfCalls(bscTokens, false) - }) - routerBalances.output.forEach(result=>{ - sdk.util.sumSingleBalance(balances, `bsc:${result.input.target}`, result.output) - }) - return balances -} +function chainTvl(chain) { + return async (time, ethBlock, chainBlocks) => { + const block = await getBlock(time, chain, chainBlocks, true); + const balances = {}; + const contractAddress = await getDeployedContractAddress( + chainNameToChainId[chain] + ); + if (!contractAddress) { + return balances; + } + const chainData = await getChainData(); + const _chain = chainData.get(chainNameToChainId[chain].toString()); + await Promise.all( + Object.keys(_chain.assetId).map(async (assetId) => { + let balance; + if (assetId === "0x0000000000000000000000000000000000000000") { + balance = await sdk.api.eth.getBalance({ + chain, + block, + target: contractAddress, + }); + } else { + balance = await sdk.api.erc20.balanceOf({ + chain, + block, + target: assetId, + owner: contractAddress, + }); + } + const chainTransform = await getChainTransform(chain); + let transformedAssetId; + if (chain == "arbitrum") { + transformedAssetId = + assetId == "0x0000000000000000000000000000000000000000" + ? "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + : `arbitrum:${assetId}`; + } else if (chain == "polygon") { + transformedAssetId = + assetId == "0x0000000000000000000000000000000000000000" + ? "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0" + : `polygon:${assetId}`; + } else { + transformedAssetId = await chainTransform(assetId); + } -async function polygon(timestamp, ethBlock, chainBlocks) { - const block = await getBlock(timestamp, 'polygon', chainBlocks) - return getRouterBalances(timestamp, 'polygon', polygonSettings, block) + sdk.util.sumSingleBalance(balances, transformedAssetId, balance.output); + }) + ); + return balances; + }; } -async function xdai(timestamp, ethBlock, chainBlocks) { - const block = await getBlock(timestamp, 'xdai', chainBlocks) - return getRouterBalances(timestamp, 'xdai', xdaiSettings, block) -} +const chains = [ + "ethereum", + "bsc", + "polygon", + "moonriver", + "fantom", + "xdai", + "avax", + "optimism", + "arbitrum", + /* + "okexchain", + "metis", + "harmony", + "fuse", + "cronos", + "heco", + "aurora", + "boba", + */ +]; -module.exports = { - start: 1552065900, // 03/08/2019 @ 5:25pm (UTC) - tvl:sdk.util.sumChainTvls([ethereum, polygon, xdai, bsc]), - ethereum: { - tvl: ethereum - }, - polygon: { - tvl: polygon - }, - xdai: { - tvl: xdai - }, - bsc:{ - tvl: bsc - } -}; +module.exports = chainExports(chainTvl, Array.from(chains)); \ No newline at end of file diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 24a37c0cdb..42a899ed34 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -1,357 +1,481 @@ -const utils = require('../helper/utils'); -const sdk = require('@defillama/sdk') +const utils = require("../helper/utils"); +const sdk = require("@defillama/sdk"); async function transformFantomAddress() { - const multichainTokens = (await utils.fetchURL('https://netapi.anyswap.net/bridge/v2/info')).data.bridgeList + const multichainTokens = ( + await utils.fetchURL("https://netapi.anyswap.net/bridge/v2/info") + ).data.bridgeList; - return (addr) => { - // WFTM - if (addr.toLowerCase() === "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83") { - return "0x4e15361fd6b4bb609fa63c81a2be19d873717870" - } - if (addr.toLowerCase() === "0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad") { // fETH - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - } - if (addr.toLowerCase() === "0x82f0b8b456c1a451378467398982d4834b6829c1") { // MIM - return "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3" - } - if(compareAddresses(addr, "0x260b3e40c714ce8196465ec824cd8bb915081812")){ - return "polygon:0x4a81f8796e0c6ad4877a51c86693b0de8093f2ef" // IRON ICE - } - const srcToken = multichainTokens.find(token => token.chainId === "250" && token.token === addr.toLowerCase()) - if (srcToken !== undefined) { - if (srcToken.srcChainId === '1') { - return srcToken.srcToken; - } else if (srcToken.srcChainId === '56') { - if(srcToken.srcToken === ''){ - return 'bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c' - } - return `bsc:${srcToken.srcToken}`; - } - } - return `fantom:${addr}` + return (addr) => { + // WFTM && FTM + if ( + compareAddresses(addr, "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83") || + compareAddresses(addr, "0x0000000000000000000000000000000000000000") + ) { + return "0x4e15361fd6b4bb609fa63c81a2be19d873717870"; + } + if (compareAddresses(addr, "0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad")) { + // fETH + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + } + if (compareAddresses(addr, "0x82f0b8b456c1a451378467398982d4834b6829c1")) { + // MIM + return "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3"; } + if (compareAddresses(addr, "0x260b3e40c714ce8196465ec824cd8bb915081812")) { + return "polygon:0x4a81f8796e0c6ad4877a51c86693b0de8093f2ef"; // IRON ICE + } + const srcToken = multichainTokens.find( + (token) => token.chainId === "250" && token.token === addr.toLowerCase() + ); + if (srcToken !== undefined) { + if (srcToken.srcChainId === "1") { + return srcToken.srcToken; + } else if (srcToken.srcChainId === "56") { + if (srcToken.srcToken === "") { + return "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; + } + return `bsc:${srcToken.srcToken}`; + } + } + return `fantom:${addr}`; + }; } -function compareAddresses(a, b){ - return a.toLowerCase() === b.toLowerCase() +function compareAddresses(a, b) { + return a.toLowerCase() === b.toLowerCase(); } async function transformAvaxAddress() { - const [bridgeTokensOld, bridgeTokensNew, bridgeTokenDetails] = await Promise.all([ - utils.fetchURL("https://raw.githubusercontent.com/0xngmi/bridge-tokens/main/data/penultimate.json"), - utils.fetchURL("https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/avalanche_contract_address.json").then(r=>Object.entries(r.data)), - utils.fetchURL("https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.json") + const [bridgeTokensOld, bridgeTokensNew, bridgeTokenDetails] = + await Promise.all([ + utils.fetchURL( + "https://raw.githubusercontent.com/0xngmi/bridge-tokens/main/data/penultimate.json" + ), + utils + .fetchURL( + "https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/avalanche_contract_address.json" + ) + .then((r) => Object.entries(r.data)), + utils.fetchURL( + "https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.json" + ), ]); - return (addr) => { - if(compareAddresses(addr, "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7")){ //WAVAX - return `avax:${addr}` - } - if(compareAddresses(addr, "0xaf2c034c764d53005cc6cbc092518112cbd652bb")){ //qiAVAX - return `avax:0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7` - } - if(compareAddresses(addr, "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33")){ //xJOE - return `avax:0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd` - } - const srcToken = bridgeTokensOld.data.find(token => compareAddresses(token["Avalanche Token Address"], addr)) - if (srcToken !== undefined && srcToken["Ethereum Token Decimals"] === srcToken["Avalanche Token Decimals"]) { - return srcToken["Ethereum Token Address"] - } - const newBridgeToken = bridgeTokensNew.find(token=>compareAddresses(addr, token[1])) - if(newBridgeToken !== undefined){ - const tokenName = newBridgeToken[0].split('.')[0] - const tokenData = bridgeTokenDetails.data[tokenName]; - if(tokenData !== undefined){ - return tokenData.nativeContractAddress - } - } - return `avax:${addr}` + return (addr) => { + if (compareAddresses(addr, "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7")) { + //WAVAX + return `avax:${addr}`; + } + if (compareAddresses(addr, "0xaf2c034c764d53005cc6cbc092518112cbd652bb")) { + //qiAVAX + return `avax:0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7`; + } + if (compareAddresses(addr, "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33")) { + //xJOE + return `avax:0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd`; + } + if (compareAddresses(addr, "0x0000000000000000000000000000000000000000")) { + //AVAX + return "avax:0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; } + const srcToken = bridgeTokensOld.data.find((token) => + compareAddresses(token["Avalanche Token Address"], addr) + ); + if ( + srcToken !== undefined && + srcToken["Ethereum Token Decimals"] === + srcToken["Avalanche Token Decimals"] + ) { + return srcToken["Ethereum Token Address"]; + } + const newBridgeToken = bridgeTokensNew.find((token) => + compareAddresses(addr, token[1]) + ); + if (newBridgeToken !== undefined) { + const tokenName = newBridgeToken[0].split(".")[0]; + const tokenData = bridgeTokenDetails.data[tokenName]; + if (tokenData !== undefined) { + return tokenData.nativeContractAddress; + } + } + return `avax:${addr}`; + }; } async function transformBscAddress() { - const binanceBridge = (await utils.fetchURL("https://api.binance.org/bridge/api/v2/tokens?walletNetwork=")).data.data.tokens + const binanceBridge = ( + await utils.fetchURL( + "https://api.binance.org/bridge/api/v2/tokens?walletNetwork=" + ) + ).data.data.tokens; - return (addr) => { - const srcToken = binanceBridge.find(token => token.ethContractAddress !== "" && token.bscContractAddress.toLowerCase() === addr.toLowerCase()) - if (srcToken !== undefined && srcToken.bscContractDecimal === srcToken.ethContractDecimal) { - return srcToken.ethContractAddress - } - if (addr.toLowerCase() == "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c") { - return 'avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c' - } - if (addr.toLowerCase() == "0x2170ed0880ac9a755fd29b2688956bd959f933f8") { - return '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' - } - return `bsc:${addr}` + return (addr) => { + const srcToken = binanceBridge.find( + (token) => + token.ethContractAddress !== "" && + token.bscContractAddress.toLowerCase() === addr.toLowerCase() + ); + if ( + srcToken !== undefined && + srcToken.bscContractDecimal === srcToken.ethContractDecimal + ) { + return srcToken.ethContractAddress; + } + // BNB + if (addr.toLowerCase() == "0x0000000000000000000000000000000000000000") { + return "bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; } + if (addr.toLowerCase() == "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c") { + return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; + } + if (addr.toLowerCase() == "0x2170ed0880ac9a755fd29b2688956bd959f933f8") { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + } + return `bsc:${addr}`; + }; } -const PoSMappedTokenList = 'https://api.bridge.matic.network/api/tokens/pos/erc20' -const PlasmaMappedTokenList = 'https://api.bridge.matic.network/api/tokens/plasma/erc20' +const PoSMappedTokenList = + "https://api.bridge.matic.network/api/tokens/pos/erc20"; +const PlasmaMappedTokenList = + "https://api.bridge.matic.network/api/tokens/plasma/erc20"; + async function transformPolygonAddress() { - const posTokens = await utils.fetchURL(PoSMappedTokenList) - const plasmaTokens = await utils.fetchURL(PlasmaMappedTokenList) - const tokens = posTokens.data.tokens.concat(plasmaTokens.data.tokens).reduce((tokenMap, token) => { - tokenMap[token.childToken.toLowerCase()] = token.rootToken.toLowerCase(); - return tokenMap; - }, {}) + const posTokens = await utils.fetchURL(PoSMappedTokenList); + const plasmaTokens = await utils.fetchURL(PlasmaMappedTokenList); + const tokens = posTokens.data.tokens + .concat(plasmaTokens.data.tokens) + .reduce((tokenMap, token) => { + tokenMap[token.childToken.toLowerCase()] = token.rootToken.toLowerCase(); + return tokenMap; + }, {}); - return (addr) => { - if (addr.toLowerCase() === '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619') { - return '0x0000000000000000000000000000000000000000' - } - return tokens[addr.toLowerCase()] || `polygon:${addr}` + return (addr) => { + if (addr.toLowerCase() === "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619") { + return "0x0000000000000000000000000000000000000000"; } + if (addr.toLowerCase() === "0x0000000000000000000000000000000000000000") { + return "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"; + } + return tokens[addr.toLowerCase()] || `polygon:${addr}`; + }; } -const bridgeAdd = '0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d' +const bridgeAdd = "0xf6A78083ca3e2a662D6dd1703c939c8aCE2e268d"; const abiXdaiBridgeAbi = { - "type": "function", - "stateMutability": "view", - "payable": false, - "outputs": [{ - "type": "address", - "name": "" - }], - "name": "foreignTokenAddress", - "inputs": [{ - "internalType": "address", - "type": "address", - "name": "_homeToken" - }], - "constant": true - } + type: "function", + stateMutability: "view", + payable: false, + outputs: [ + { + type: "address", + name: "", + }, + ], + name: "foreignTokenAddress", + inputs: [ + { + internalType: "address", + type: "address", + name: "_homeToken", + }, + ], + constant: true, +}; async function transformXdaiAddress() { - return async (address) => { - const result = await sdk.api.abi.call({ - target: bridgeAdd, - abi: abiXdaiBridgeAbi, - params: [address], - chain: 'xdai' - }); - if(result.output === "0x0000000000000000000000000000000000000000"){ - return `xdai:${address}` - } - return result.output + return async (address) => { + const result = await sdk.api.abi.call({ + target: bridgeAdd, + abi: abiXdaiBridgeAbi, + params: [address], + chain: "xdai", + }); + // XDAI -> DAI + if (address === "0x0000000000000000000000000000000000000000") { + return `0x6b175474e89094c44da98b954eedeac495271d0f`; + } + if (result.output === "0x0000000000000000000000000000000000000000") { + return `xdai:${address}`; } + return result.output; + }; } async function transformOkexAddress() { - const okexBridge = (await utils.fetchURL("https://www.okex.com/v2/asset/cross-chain/currencyAddress")).data.data.tokens - // TODO - return (addr) => { - if(compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")){ - return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c" - } - return `okexchain:${addr}`; - }; + const okexBridge = ( + await utils.fetchURL( + "https://www.okex.com/v2/asset/cross-chain/currencyAddress" + ) + ).data.data.tokens; + // TODO + return (addr) => { + if (compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")) { + return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; + } + // Native token -> OKB + if (compareAddresses(addr, "0x0000000000000000000000000000000000000000")) { + return "0x75231f58b43240c9718dd58b4967c5114342a86c"; + } + return `okexchain:${addr}`; + }; } async function transformHecoAddress() { return (addr) => { - if (addr.toLowerCase() == '0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c') { - return 'avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c'; - } else { - return `heco:${addr}`; + if (addr.toLowerCase() == "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c") { + return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; } + if (addr.toLowerCase() == "0x0000000000000000000000000000000000000000") { + return "0x6f259637dcd74c767781e37bc6133cd6a68aa161"; + } + return `heco:${addr}`; }; } async function transformCeloAddress() { - return (addr) => { - if (addr.toLowerCase() === "0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73") { - //return "0xd71ecff9342a5ced620049e616c5035f1db98620" //sEUR - return "celo-euro" - } - if (addr.toLowerCase() === "0x765de816845861e75a25fca122bb6898b8b1282a") { - //return "0x8e870d67f660d95d5be530380d0ec0bd388289e1" //USDP - return "celo-dollar" - } - if (addr.toLowerCase() === "0x471ece3750da237f93b8e339c536989b8978a438") { - return "celo" //CELO - } - return `celo:${addr}`; - }; + return (addr) => { + if (addr.toLowerCase() === "0xd8763cba276a3738e6de85b4b3bf5fded6d6ca73") { + //return "0xd71ecff9342a5ced620049e616c5035f1db98620" //sEUR + return "celo-euro"; + } + if (addr.toLowerCase() === "0x765de816845861e75a25fca122bb6898b8b1282a") { + //return "0x8e870d67f660d95d5be530380d0ec0bd388289e1" //USDP + return "celo-dollar"; + } + if (addr.toLowerCase() === "0x471ece3750da237f93b8e339c536989b8978a438") { + return "celo"; //CELO + } + return `celo:${addr}`; + }; } async function transformHarmonyAddress() { - const bridge = (await utils.fetchURL("https://be4.bridge.hmny.io/tokens/?page=0&size=1000")).data.content + const bridge = ( + await utils.fetchURL("https://be4.bridge.hmny.io/tokens/?page=0&size=1000") + ).data.content; - return (addr) => { - if(compareAddresses(addr, "0x6983D1E6DEf3690C4d616b13597A09e6193EA013")){ - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - } - if(compareAddresses(addr, "0x224e64ec1bdce3870a6a6c777edd450454068fec")){ - return "0xa47c8bf37f92abed4a126bda807a7b7498661acd" - } - if(compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")){ - return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c" - } - const srcToken = bridge.find(token => compareAddresses(addr, token.hrc20Address)) - if (srcToken !== undefined) { - const prefix = srcToken.network === "BINANCE"?"bsc:":"" - return prefix+srcToken.erc20Address - } - return `harmony:${addr}` + return (addr) => { + if (compareAddresses(addr, "0x6983D1E6DEf3690C4d616b13597A09e6193EA013")) { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + } + if (compareAddresses(addr, "0x224e64ec1bdce3870a6a6c777edd450454068fec")) { + return "0xa47c8bf37f92abed4a126bda807a7b7498661acd"; + } + if (compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")) { + return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; + } + const srcToken = bridge.find((token) => + compareAddresses(addr, token.hrc20Address) + ); + if (srcToken !== undefined) { + const prefix = srcToken.network === "BINANCE" ? "bsc:" : ""; + return prefix + srcToken.erc20Address; } + return `harmony:${addr}`; + }; } const optimismSynths = { - "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9": "0x57ab1ec28d129707052df4df418d58a2d46d5f51", - "0xc5db22719a06418028a40a9b5e9a7c02959d0d08": "0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6", - "0xe405de8f52ba7559f9df3c368500b6e6ae6cee49": "0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb", - "0x298b9b95708152ff6968aafd889c6586e9169f1d": "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", -} + "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9": + "0x57ab1ec28d129707052df4df418d58a2d46d5f51", + "0xc5db22719a06418028a40a9b5e9a7c02959d0d08": + "0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6", + "0xe405de8f52ba7559f9df3c368500b6e6ae6cee49": + "0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb", + "0x298b9b95708152ff6968aafd889c6586e9169f1d": + "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", +}; async function transformOptimismAddress() { - const bridge = (await utils.fetchURL("https://static.optimism.io/optimism.tokenlist.json")).data.tokens + const bridge = ( + await utils.fetchURL("https://static.optimism.io/optimism.tokenlist.json") + ).data.tokens; - return (addr) => { - if(compareAddresses(addr, "0x4200000000000000000000000000000000000006")){ - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - } - if(compareAddresses(addr, "0x5029c236320b8f15ef0a657054b84d90bfbeded3")){ - return "0x15ee120fd69bec86c1d38502299af7366a41d1a6" - } - const possibleSynth = optimismSynths[addr.toLowerCase()] - if(possibleSynth !== undefined){ - return possibleSynth - } - const dstToken = bridge.find(token => compareAddresses(addr, token.address) && token.chainId === 10) - if (dstToken !== undefined) { - const srcToken = bridge.find(token => dstToken.logoURI === token.logoURI && token.chainId === 1) - if(srcToken !== undefined){ - return srcToken.address - } - } - return addr //`optimism:${addr}` // TODO: Fix + return (addr) => { + if (compareAddresses(addr, "0x4200000000000000000000000000000000000006")) { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; } + if (compareAddresses(addr, "0x5029c236320b8f15ef0a657054b84d90bfbeded3")) { + return "0x15ee120fd69bec86c1d38502299af7366a41d1a6"; + } + // OETH -> WETH + if (compareAddresses(addr, "0x0000000000000000000000000000000000000000")) { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + } + const possibleSynth = optimismSynths[addr.toLowerCase()]; + if (possibleSynth !== undefined) { + return possibleSynth; + } + const dstToken = bridge.find( + (token) => compareAddresses(addr, token.address) && token.chainId === 10 + ); + if (dstToken !== undefined) { + const srcToken = bridge.find( + (token) => dstToken.logoURI === token.logoURI && token.chainId === 1 + ); + if (srcToken !== undefined) { + return srcToken.address; + } + } + return addr; //`optimism:${addr}` // TODO: Fix + }; } async function transformMoonriverAddress() { - - return (addr) => { - if(compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")){ - return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c" - } - return `moonriver:${addr}` //`optimism:${addr}` // TODO: Fix + return (addr) => { + if (compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")) { + return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; } + if (compareAddresses(addr, "0x0000000000000000000000000000000000000000")) { + return "moonriver:0x98878B06940aE243284CA214f92Bb71a2b032B8A"; + } + return `moonriver:${addr}`; //`optimism:${addr}` // TODO: Fix + }; } async function transformArbitrumAddress() { - const bridge = (await utils.fetchURL("https://bridge.arbitrum.io/token-list-42161.json")).data.tokens - - return (addr) => { - if(compareAddresses(addr, "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A")){ - return "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3" // MIM - } - if(compareAddresses(addr, "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501")){ - return "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d" // renBTC - } - if(compareAddresses(addr, "0x9ef758ac000a354479e538b8b2f01b917b8e89e7")){ - return "polygon:0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea" // XDO - } + const bridge = ( + await utils.fetchURL("https://bridge.arbitrum.io/token-list-42161.json") + ).data.tokens; - const dstToken = bridge.find(token => compareAddresses(addr, token.address)) - if (dstToken !== undefined) { - return dstToken.extensions.bridgeInfo[1].tokenAddress - } - return `arbitrum:${addr}`; + return (addr) => { + if (compareAddresses(addr, "0x0000000000000000000000000000000000000000")) { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; // WETH } + if (compareAddresses(addr, "0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A")) { + return "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3"; // MIM + } + if (compareAddresses(addr, "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501")) { + return "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d"; // renBTC + } + if (compareAddresses(addr, "0x9ef758ac000a354479e538b8b2f01b917b8e89e7")) { + return "polygon:0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea"; // XDO + } + const dstToken = bridge.find((token) => + compareAddresses(addr, token.address) + ); + if (dstToken !== undefined) { + return dstToken.extensions.l1Address; + } + return `arbitrum:${addr}`; + }; } -function fixAvaxBalances(balances){ - for(const representation of ["avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", '0x9dEbca6eA3af87Bf422Cea9ac955618ceb56EfB4']){ - if(balances[representation] !== undefined){ - balances['avalanche-2'] = Number(balances[representation])/1e18 - delete balances[representation] - } +function fixAvaxBalances(balances) { + for (const representation of [ + "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", + "0x9dEbca6eA3af87Bf422Cea9ac955618ceb56EfB4", + ]) { + if (balances[representation] !== undefined) { + balances["avalanche-2"] = Number(balances[representation]) / 1e18; + delete balances[representation]; } + } } -function fixHarmonyBalances(balances){ - for(const representation of ["harmony:0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", '0xcf664087a5bb0237a0bad6742852ec6c8d69a27a', 'harmony:0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a', '0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a', 'bsc:0xdE976f3344cd9F06E451aF3A94a324afC3E154F4', 'bsc:0xde976f3344cd9f06e451af3a94a324afc3e154f4']){ - if(balances[representation] !== undefined){ - balances['harmony'] = Number(balances[representation])/1e18 - delete balances[representation] - } +function fixHarmonyBalances(balances) { + for (const representation of [ + "harmony:0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", + "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", + "harmony:0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a", + "0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a", + "bsc:0xdE976f3344cd9F06E451aF3A94a324afC3E154F4", + "bsc:0xde976f3344cd9f06e451af3a94a324afc3e154f4", + ]) { + if (balances[representation] !== undefined) { + balances["harmony"] = Number(balances[representation]) / 1e18; + delete balances[representation]; } + } } async function transformIotexAddress() { - return (addr) => { - return `iotex:${addr}`; - }; + return (addr) => { + return `iotex:${addr}`; + }; } async function transformKccAddress() { - return (addr) => { - if(compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")){ - return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c" - } - if(compareAddresses(addr.toLowerCase(), "0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48")){ - return "0xdac17f958d2ee523a2206206994597c13d831ec7" - } - if(compareAddresses(addr, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48")){ - return "okexchain:0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85" - } - if(compareAddresses(addr, "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c")){ - return "bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" - } - if(compareAddresses(addr, "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d")){ - return "0x4fabb145d64652a948d72533023f6e7a623c7c53" - } - if(compareAddresses(addr, "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055")){ - return "0x6b175474e89094c44da98b954eedeac495271d0f" - } - if(compareAddresses(addr, "0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0")){ - return "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" - } - if(compareAddresses(addr, "0xf55af137a98607f7ed2efefa4cd2dfe70e4253b1")){ - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - } - if(compareAddresses(addr, "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430")){ - return "okexchain:0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85" - } - return `kcc:${addr}`; - }; + return (addr) => { + if (compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")) { + return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; + } + if ( + compareAddresses( + addr.toLowerCase(), + "0x0039f574ee5cc39bdd162e9a88e3eb1f111baf48" + ) + ) { + return "0xdac17f958d2ee523a2206206994597c13d831ec7"; + } + if (compareAddresses(addr, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48")) { + return "okexchain:0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85"; + } + if (compareAddresses(addr, "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c")) { + return "bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; + } + if (compareAddresses(addr, "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d")) { + return "0x4fabb145d64652a948d72533023f6e7a623c7c53"; + } + if (compareAddresses(addr, "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055")) { + return "0x6b175474e89094c44da98b954eedeac495271d0f"; + } + if (compareAddresses(addr, "0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0")) { + return "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; + } + if (compareAddresses(addr, "0xf55af137a98607f7ed2efefa4cd2dfe70e4253b1")) { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + } + if (compareAddresses(addr, "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430")) { + return "okexchain:0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85"; + } + return `kcc:${addr}`; + }; } const chainTransforms = { - celo: transformCeloAddress, - fantom: transformFantomAddress, - optimism: transformOptimismAddress, - harmony: transformHarmonyAddress, - arbitrum: transformArbitrumAddress, -} -async function getChainTransform(chain){ - if(chain === 'ethereum'){ - return id=>id - } - if(chainTransforms[chain]!== undefined){ - return chainTransforms[chain]() - } - return addr=>`${chain}:${addr}` + celo: transformCeloAddress, + fantom: transformFantomAddress, + bsc: transformBscAddress, + polygon: transformPolygonAddress, + xdai: transformXdaiAddress, + avax: transformAvaxAddress, + heco: transformHecoAddress, + harmony: transformHarmonyAddress, + optimism: transformOptimismAddress, + moonriver: transformMoonriverAddress, + okex: transformOkexAddress, + kcc: transformKccAddress, + arbitrum: transformArbitrumAddress, + iotex: transformIotexAddress, +}; +async function getChainTransform(chain) { + if (chain === "ethereum") { + return (id) => id; + } + if (chainTransforms[chain] !== undefined) { + return chainTransforms[chain](); + } + return (addr) => `${chain}:${addr}`; } module.exports = { - getChainTransform, - transformCeloAddress, - transformFantomAddress, - transformBscAddress, - transformPolygonAddress, - transformXdaiAddress, - transformAvaxAddress, - transformHecoAddress, - transformHarmonyAddress, - transformOptimismAddress, - transformMoonriverAddress, - fixAvaxBalances, - transformOkexAddress, - transformKccAddress, - transformArbitrumAddress, - fixHarmonyBalances, - transformIotexAddress -}; + getChainTransform, + transformCeloAddress, + transformFantomAddress, + transformBscAddress, + transformPolygonAddress, + transformXdaiAddress, + transformAvaxAddress, + transformHecoAddress, + transformHarmonyAddress, + transformOptimismAddress, + transformMoonriverAddress, + fixAvaxBalances, + transformOkexAddress, + transformKccAddress, + transformArbitrumAddress, + fixHarmonyBalances, + transformIotexAddress, +}; \ No newline at end of file From 42549e554640de74a3cde7fb53cf1cb1d57c9956 Mon Sep 17 00:00:00 2001 From: Olivier Riccini Date: Fri, 3 Dec 2021 16:38:14 +0100 Subject: [PATCH 111/393] handle properly lp tokens --- projects/arbirise-finance/contracts.json | 2 -- projects/arbirise-finance/getPrice.js | 36 +++++++++++++++--------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/projects/arbirise-finance/contracts.json b/projects/arbirise-finance/contracts.json index d6a036ad19..b402c911dd 100644 --- a/projects/arbirise-finance/contracts.json +++ b/projects/arbirise-finance/contracts.json @@ -3,7 +3,5 @@ "sushiFactoryAddress": "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", "weth": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "lp": "0xf2537009e97e409C16f7608885459a62F9eccC48", - "arf": "0xeb6F8eEBC83D85120F9299B84DA558825685570e", "usdcWethPair": "0x905dfCD5649217c42684f23958568e533C711Aa3" } diff --git a/projects/arbirise-finance/getPrice.js b/projects/arbirise-finance/getPrice.js index 271ba93064..49f1d7996a 100644 --- a/projects/arbirise-finance/getPrice.js +++ b/projects/arbirise-finance/getPrice.js @@ -42,23 +42,31 @@ const getPrice = async (tokenAddress, block) => { try { const ETHPrice = await getETHPrice(block); + const symbol = ( + await sdk.api.abi.call({ + target: tokenAddress, + abi: "erc20:symbol", + chain: "arbitrum", + }) + ).output; + + const isLp = symbol === "SLP"; + if (tokenAddress.toLowerCase() === contracts["weth"].toLowerCase()) { return { price: ETHPrice, decimals: 18 }; } - const pairAddress = - tokenAddress.toLowerCase() === contracts["lp"].toLowerCase() || - tokenAddress.toLowerCase() === contracts["arf"].toLowerCase() - ? contracts["lp"] - : ( - await sdk.api.abi.call({ - target: contracts["sushiFactoryAddress"], - abi: getPair, - params: [tokenAddress, contracts["weth"]], - block: block, - chain: "arbitrum", - }) - ).output; + const pairAddress = isLp + ? tokenAddress + : ( + await sdk.api.abi.call({ + target: contracts["sushiFactoryAddress"], + abi: getPair, + params: [tokenAddress, contracts["weth"]], + block: block, + chain: "arbitrum", + }) + ).output; const reserves = ( await sdk.api.abi.call({ @@ -97,7 +105,7 @@ const getPrice = async (tokenAddress, block) => { : reserves._reserve1 ).div(`1e${decimals}`); - if (tokenAddress.toLowerCase() === contracts["lp"].toLowerCase()) { + if (isLp) { const totalSupply = ( await sdk.api.abi.call({ target: tokenAddress, From 9e2725caa0daa0cd601a0806172b657b5ab6aa73 Mon Sep 17 00:00:00 2001 From: nemusona Date: Fri, 3 Dec 2021 10:16:15 -0600 Subject: [PATCH 112/393] makiswap changes --- projects/makiswap/abi.json | 52 ++++-------- projects/makiswap/index.js | 161 ++++++++++++++++++++++++++++++------- 2 files changed, 147 insertions(+), 66 deletions(-) diff --git a/projects/makiswap/abi.json b/projects/makiswap/abi.json index 9637c6fee0..ed099b779a 100644 --- a/projects/makiswap/abi.json +++ b/projects/makiswap/abi.json @@ -1,38 +1,20 @@ { - "allPairs": { - "constant": true, - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "allPairs", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" + "totalPairs": { + "constant": true, + "inputs": [], + "name": "totalPairs", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" }, - "allPairsLength": { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" + "allPairs": { + "constant": true, + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allPairs", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" } -} \ No newline at end of file +} diff --git a/projects/makiswap/index.js b/projects/makiswap/index.js index 167a094a86..4bcc5fd591 100644 --- a/projects/makiswap/index.js +++ b/projects/makiswap/index.js @@ -1,42 +1,141 @@ -const { request, gql } = require("graphql-request"); const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const abi = require("./abi.json"); -// We use USDT for TVL for all farm pairs -const usdtToken = "0xdac17f958d2ee523a2206206994597c13d831ec7"; +const factory = "0x11cdC9Bd86fF68b6A6152037342bAe0c3a717f56"; +const maki = "0x5FaD6fBBA4BbA686bA9B8052Cf0bd51699f38B93"; +const makiChef = "0x4cb4c9C8cC67B171Ce86eB947cf558AFDBcAB17E"; -const tvl = async (timestamp, ethBlock, chainBlocks) => { - let block = chainBlocks["heco"]; +const ignoreLPs = [ + "0x329bae377d60df25e58a17b3d0b1d46cf2f4fd8b", + "0x4db7c033137c2843481a686cc0cb415ad09fa764", + "0x5e9cdc40d1acf45fef65313142e40c72059bcb98", +]; - if (block === undefined) { - block = (await sdk.api.util.lookupBlock(timestamp, { chain: "heco" })) - .block; - } - - const gqlEndpoint = 'https://q.hg.network/subgraphs/name/maki-exchanges/heco'; - const gqlQuery = ` - query tvl($block: Int){ - uniswapFactories ( - block:{ number: $block } - ) { - totalLiquidityUSD - } +async function tvl(timestamp, block, chainBlocks) { + let balances = {}; + let poolLength = ( + await sdk.api.abi.call({ + target: factory, + abi: abi.totalPairs, + block: chainBlocks.heco, + chain: "heco", + }) + ).output; + let allPools = ( + await sdk.api.abi.multiCall({ + calls: Array.from({ length: Number(poolLength) }, (_, k) => ({ + target: factory, + params: k, + })), + abi: abi.allPairs, + block: chainBlocks.heco, + chain: "heco", + }) + ).output; + let supply = ( + await sdk.api.abi.multiCall({ + calls: allPools.map((p) => ({ + target: p.output, + })), + abi: "erc20:totalSupply", + block: chainBlocks.heco, + chain: "heco", + }) + ).output; + let ignoreLPSupply = ( + await sdk.api.abi.multiCall({ + calls: ignoreLPs.map((p) => ({ + target: p, + })), + abi: "erc20:totalSupply", + block: chainBlocks.heco, + chain: "heco", + }) + ).output; + let lpPositions = []; + supply.forEach((p) => { + let addr = p.output.toLowerCase(); + if (addr === "0") { + return; } - `; - const result = await request(gqlEndpoint, gqlQuery, { block }) - .then((data) => data.uniswapFactories[0].totalLiquidityUSD); + lpPositions.push({ + balance: p.output, + token: p.input.target, + }); + }); + ignoreLPSupply.forEach((p) => { + lpPositions.push({ + balance: p.output, + token: p.input.target, + }); + }); + await unwrapUniswapLPs( + balances, + lpPositions, + chainBlocks.heco, + "heco", + (addr) => { + if (addr === "0x5ee41ab6edd38cdfb9f6b4e6cf7f75c87e170d98") { + return "0x0000000000085d4780b73119b644ae5ecd22b376"; + } else if (addr === "0x343ca8e4e6bbb400251525c3c12a7274e49056fc") { + return "0x5fa2e9ba5757504b3d6e8f6da03cc40d4ce19499"; + } else if (addr === "0x40280e26a572745b1152a54d1d44f365daa51618") { + return "bsc:0xba2ae424d960c26247dd6c32edc70b295c744c43"; + } else if (addr === "0x4a31d1ad7430586752a1888fe947e3e7d52affb8") { + return "0xed04915c23f00a313a544955524eb7dbd823143d"; + } else if (addr === "0x461d52769884ca6235b685ef2040f47d30c94eb5") { + return "bsc:0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3"; + } else if (addr === "0x27d4dfdb3fdf58e198ba4dbc23b2f82c0b8e3405") { + return "bsc:0x154a9f9cbd3449ad22fdae23044319d6ef2a1fab"; + } else if (addr === "0x843af718ef25708765a8e0942f89edeae1d88df0") { + return "bsc:0x3ee2200efb3400fabb9aacf31297cbdd1d435d47"; + } else if (addr === "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c") { + return "0x0ff6ffcfda92c53f615a4a75d982f399c989366b"; + } else if (addr === "0xdb11743fe8b129b49b11236e8a715004bdabe7e5") { + return "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0"; + } else if (addr === "0xdd86dd2dc0aca2a8f41a680fc1f88ec1b7fc9b09") { + return "0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce"; + } else if (addr === "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c") { + return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; + } else if (addr === "0xce0a5ca134fb59402b723412994b30e02f083842") { + return "0xc00e94cb662c3520282e6f5717214004a7f26888"; + } else if (addr === "0x3d760a45d0887dfd89a2f5385a236b29cb46ed2a") { + return "0x6b175474e89094c44da98b954eedeac495271d0f"; + } else if (addr === "0x9362bbef4b8313a8aa9f0c9808b80577aa26b73b") { + return "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; + } else if (addr === "0x62c10412d69823a98db5c09cf6e82810e0df5ad7") { + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; + } else if (addr === "0xc8f62c36e2b92fe60e68c14eb783293dc5bf2ae0") { + return "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; + } + return `heco:${addr}`; + }, + ignoreLPs + ); + return balances; +} - return { - // --- Arrange to account the decimals as it was usdt (decimals = 6) --- - [usdtToken]: BigNumber(result) - .multipliedBy(10 ** 6) - .toFixed(0), - }; -}; +async function staking(timestamp, block, chainBlocks) { + let balances = {}; + let balance = ( + await sdk.api.erc20.balanceOf({ + target: maki, + owner: makiChef, + block: chainBlocks.heco, + chain: "heco", + }) + ).output; + sdk.util.sumSingleBalance(balances, `heco:${maki}`, balance); + return balances; +} module.exports = { - misrepresentedTokens: true, - tvl + methodology: "TVL consists of LPs created by the factory contract", + heco: { + tvl, + staking, + }, + tvl, }; From 99c2fe966eab0f746dad4d6c9650faf26ed576dc Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 4 Dec 2021 00:37:16 +0800 Subject: [PATCH 113/393] Add powerbomb project --- projects/powerbomb/abi.json | 15 +++++++++ projects/powerbomb/index.js | 63 +++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 projects/powerbomb/abi.json create mode 100644 projects/powerbomb/index.js diff --git a/projects/powerbomb/abi.json b/projects/powerbomb/abi.json new file mode 100644 index 0000000000..4b34e5d8f6 --- /dev/null +++ b/projects/powerbomb/abi.json @@ -0,0 +1,15 @@ +{ + "getAllPoolInUSD": { + "inputs": [], + "name": "getAllPoolInUSD", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/powerbomb/index.js b/projects/powerbomb/index.js new file mode 100644 index 0000000000..56f42b6fab --- /dev/null +++ b/projects/powerbomb/index.js @@ -0,0 +1,63 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); + +const powerbombAvaxCurveBTCAddr = "0x2510E5054eeEbED40C3C580ae3241F5457b630D9"; +const powerbombAvaxCurveETHAddr = "0xFAcB839BF8f09f2e7B4b6C83349B5bbFD62fd659"; +const powerbombAvaxCurveWsOHMAddr = + "0x4d3e58DAa8233Cc6a46b9c6e23df5A202B178550"; +const powerbombAvaxCurveMEMOAddr = "0xB523b02556cFeEE0417222f696d9aee0deAd49bf"; + +async function fetch() { + const btcTVL = + Number( + ( + await sdk.api.abi.call({ + chain: "avax", + target: powerbombAvaxCurveBTCAddr, + abi: abi["getAllPoolInUSD"], + }) + ).output + ) / 1000000; + + const ethTVL = + Number( + ( + await sdk.api.abi.call({ + chain: "avax", + target: powerbombAvaxCurveETHAddr, + abi: abi["getAllPoolInUSD"], + }) + ).output + ) / 1000000; + + const wsohmTVL = + Number( + ( + await sdk.api.abi.call({ + chain: "avax", + target: powerbombAvaxCurveWsOHMAddr, + abi: abi["getAllPoolInUSD"], + }) + ).output + ) / 1000000; + + const memoTVL = + Number( + ( + await sdk.api.abi.call({ + chain: "avax", + target: powerbombAvaxCurveMEMOAddr, + abi: abi["getAllPoolInUSD"], + }) + ).output + ) / 1000000; + + return btcTVL + ethTVL + wsohmTVL + memoTVL; +} + +module.exports = { + avalanche: { + fetch, + }, + fetch, +}; From 091a8d460f6ca33594804c0ea0070b3a09782688 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Fri, 3 Dec 2021 21:12:59 +0000 Subject: [PATCH 114/393] old connext code --- projects/connext/old.js | 155 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 projects/connext/old.js diff --git a/projects/connext/old.js b/projects/connext/old.js new file mode 100644 index 0000000000..8d14d008ae --- /dev/null +++ b/projects/connext/old.js @@ -0,0 +1,155 @@ +const sdk = require('@defillama/sdk'); +const abi = require('./abi.json'); +const BigNumber = require('bignumber.js') +const {getBlock} = require('../helper/getBlock') + +// V1 +const hubAddress = '0xdfa6edAe2EC0cF1d4A60542422724A48195A5071'; +const tokenDenominationAddress = '0x6b175474e89094c44da98b954eedeac495271d0f'; +//V3 +const routers = ['0xe3cF69b86F274a14B87946bf641f11Ac837f4492', '0xe6887c0cc3c37cb2ee34Bc58AB258f36825CA910', '0xE540998865aFEB054021dc849Cc6191b8E09dC08', '0xC6C68811E75EfD86d012587849F1A1D30427361d'] +const ethereumTokens = ['0xdAC17F958D2ee523a2206206994597C13D831ec7', '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', '0x0f5d2fb29fb7d3cfee444a200298f468908cc942', '0x6b175474e89094c44da98b954eedeac495271d0f'] +const bscTokens = ['0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', '0x55d398326f99059fF775485246999027B3197955', '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d'] +const polygonSettings = { + nativeCoin: 'matic-network', + tokens: [ + { + address: '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', + coingeckoId: 'dai', + }, + { + address: '0xA1c57f48F0Deb89f569dFbE6E2B7f46D33606fD4', + coingeckoId: 'decentraland' + }, + { + address: '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', + coingeckoId: 'tether' + }, + { + address: '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174', + coingeckoId: 'usd-coin' + } + ] +} +const xdaiSettings = { + nativeCoin: 'dai', + tokens: [ + { + address: '0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83', + coingeckoId: 'usd-coin' + }, + { + address: '0x4ECaBa5870353805a9F068101A40E0f32ed605C6', + coingeckoId: 'tether' + }, + ] +} + +function constructBalanceOfCalls(tokens, useAddressProp){ + const calls = [] + for(const router of routers){ + for(const token of tokens){ + const address = useAddressProp?token.address:token + calls.push({ + target: address, + params: [router] + }) + } + } + return calls +} + +async function getRouterBalances(timestamp, chain, settings, block){ + const routerBalances = await sdk.api.abi.multiCall({ + abi: 'erc20:balanceOf', + block, + calls: constructBalanceOfCalls(settings.tokens, true), + chain + }) + const tokenDecimals = await sdk.api.abi.multiCall({ + abi: 'erc20:decimals', + block, + calls: settings.tokens.map(token => ({ + target: token.address, + })), + chain + }) + const nativeBalances = await sdk.api.eth.getBalances({ + targets: routers, + block, + chain, + }) + const totalNativeBalance = nativeBalances.output.reduce((acc, output)=>acc.plus(output.balance), BigNumber(0)) + const balances = {} + balances[settings.nativeCoin] = totalNativeBalance.div(1e18).toFixed(0) + routerBalances.output.forEach((result)=>{ + const tokenIndex = settings.tokens.findIndex(token=>result.input.target.toLowerCase()===token.address.toLowerCase()) + const coingeckoId = settings.tokens[tokenIndex].coingeckoId + const decimals = Number(tokenDecimals.output[tokenIndex].output) + sdk.util.sumSingleBalance(balances, coingeckoId, BigNumber(result.output).div(10**decimals).toFixed(0)) + }) + return balances; +} + +async function ethereum(timestamp, block) { + // V1 + const totalChannelToken = (await sdk.api.abi.call({ + block, + target: hubAddress, + abi: abi['totalChannelToken'], + })).output; + + const balances = { [tokenDenominationAddress]: totalChannelToken }; + + // V2 + const routerBalances = await sdk.api.abi.multiCall({ + abi: 'erc20:balanceOf', + block, + calls: constructBalanceOfCalls(ethereumTokens, false) + }) + sdk.util.sumMultiBalanceOf(balances, routerBalances); + + return balances +} + +async function bsc(timestamp, ethBlock, chainBlocks) { + const block = chainBlocks.bsc + const balances={} + const routerBalances = await sdk.api.abi.multiCall({ + abi: 'erc20:balanceOf', + block, + chain:'bsc', + calls: constructBalanceOfCalls(bscTokens, false) + }) + routerBalances.output.forEach(result=>{ + sdk.util.sumSingleBalance(balances, `bsc:${result.input.target}`, result.output) + }) + return balances +} + +async function polygon(timestamp, ethBlock, chainBlocks) { + const block = await getBlock(timestamp, 'polygon', chainBlocks) + return getRouterBalances(timestamp, 'polygon', polygonSettings, block) +} + +async function xdai(timestamp, ethBlock, chainBlocks) { + const block = await getBlock(timestamp, 'xdai', chainBlocks) + return getRouterBalances(timestamp, 'xdai', xdaiSettings, block) +} + +module.exports = { + start: 1552065900, // 03/08/2019 @ 5:25pm (UTC) + tvl:sdk.util.sumChainTvls([ethereum, polygon, xdai, bsc]), + ethereum: { + tvl: ethereum + }, + polygon: { + tvl: polygon + }, + xdai: { + tvl: xdai + }, + bsc:{ + tvl: bsc + } +}; From 160f90acee0acd882975fc3abc33ab3421f92534 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 00:54:08 +0000 Subject: [PATCH 115/393] add adapter for stellarx --- projects/stellarx/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/stellarx/index.js diff --git a/projects/stellarx/index.js b/projects/stellarx/index.js new file mode 100644 index 0000000000..687c7deda6 --- /dev/null +++ b/projects/stellarx/index.js @@ -0,0 +1,11 @@ +const utils = require('./helper/utils'); + +async function fetch() { + var totalTvl = await utils.fetchURL('https://amm-api.stellarx.com/api/pools/30d-statistic/?pool_string='); + return totalTvl.data[totalTvl.data.length-1].liquidity; +} + +module.exports = { + fetch, + +} \ No newline at end of file From e561c36f6f9711aa7a35c3c87d94bf48143171c4 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 05:21:40 +0000 Subject: [PATCH 116/393] add xeus adapter --- projects/xeus/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/xeus/index.js diff --git a/projects/xeus/index.js b/projects/xeus/index.js new file mode 100644 index 0000000000..2449252fbc --- /dev/null +++ b/projects/xeus/index.js @@ -0,0 +1,11 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0xF1081555011689cCCfa29CCA6a9E6AFcB907B0bC" +module.exports = ohmTvl(treasury, [ + //BUSD + ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + //DAI + ["0xE50c40B0B84946D7491337613059F181700ddBEa", false], + //pancakeswap LP + ["0x76129f6e590f7aaac39b9804048a18060297a79b", true], + ], "bsc", "0x4669A93D251633C9983103529783eD1E4E36F20c", "0x4E141769366634D9c4e498257Fa7EC204d22b634") \ No newline at end of file From 1a70411fd3819648498927c820a5d4d67a86fdb0 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 06:17:01 +0000 Subject: [PATCH 117/393] add taichi adapter --- projects/taichi/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/taichi/index.js diff --git a/projects/taichi/index.js b/projects/taichi/index.js new file mode 100644 index 0000000000..985599bb38 --- /dev/null +++ b/projects/taichi/index.js @@ -0,0 +1,11 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0xD4b0DC48AB6BD7907E3698A62CCD1DBE2d46d310" +module.exports = ohmTvl(treasury, [ + //BUSD + ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], + //WBNB + ["0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", false], + //pancakeswap LP + ["0x5ef473d91e89c613b3e5138fa8279884bf5b7adf", true], + ], "bsc", "0xb12Ef3033D5CE0F3f80f3A15dE7E90Cd87a5973e", "0xe49bfc53a195a62d78a941a1967d7b0f83a47c14") \ No newline at end of file From 27f57d87434db75cc6c8fd362128e85abda4175c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 06:39:30 +0000 Subject: [PATCH 118/393] add omicron adapter --- projects/omicron/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/omicron/index.js diff --git a/projects/omicron/index.js b/projects/omicron/index.js new file mode 100644 index 0000000000..eca79c7fd2 --- /dev/null +++ b/projects/omicron/index.js @@ -0,0 +1,13 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0x9EF8600b0f107c083F9df557e0Ddf12E071E75fe" +module.exports = ohmTvl(treasury, [ + //USDC + ["0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", false], + //MIM + ["0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a", false], + //sushi LP + ["0xe4ad045abb586dbdae6b11a4d2c6ff5434b93ed1", true], + // + ["0xcf4f4f341b60587513b8fc01482237996c7e3fd3", true], + ], "arbitrum", "0x51568924623E66110ffFAc620e948caD8555Ea98", "0x86b3353387f560295a8fa7902679735e5f076bd5") \ No newline at end of file From 59500d9cf09c1066fd6019341d8ddc4a40f980f1 Mon Sep 17 00:00:00 2001 From: UniverseFinance <87629076+UniverseFinance@users.noreply.github.com> Date: Sat, 4 Dec 2021 14:56:09 +0800 Subject: [PATCH 119/393] Update index.js Dynamically fetch the vault address and ABI --- projects/universe-finance/index.js | 115 +++++++++++++++-------------- 1 file changed, 60 insertions(+), 55 deletions(-) diff --git a/projects/universe-finance/index.js b/projects/universe-finance/index.js index 962558481f..8c7fe265a3 100644 --- a/projects/universe-finance/index.js +++ b/projects/universe-finance/index.js @@ -1,73 +1,78 @@ const sdk = require("@defillama/sdk"); +const utils = require("../helper/utils"); + +const vaultsUrl = "https://raw.githubusercontent.com/UniverseFinance/UniverseFinanceProtocol/main/doc/vaultAddress.json"; -const vaults = [ - "0xe6505575a49d904Aea01bB8452c94eB393EE74E0", // Team Vault - "0x39A88389Ae0A307b9E4041d8778c8bf1ebCd54D6", // Early Bird Vault -]; -const getTotalAmounts = { - inputs: [], - name: "getTotalAmounts", - outputs: [ - { internalType: "uint128", name: "", type: "uint128" }, - { internalType: "uint256", name: "", type: "uint256" }, - { internalType: "uint256", name: "", type: "uint256" }, - ], - stateMutability: "view", - type: "function", -}; const token0Abi = require("../helper/abis/token0.json"); const token1Abi = require("../helper/abis/token1.json"); async function tvl(timestamp, block) { let balances = {}; - let { output: totalAmount } = await sdk.api.abi.multiCall({ - calls: vaults.map((address) => ({ - target: address, - })), - abi: getTotalAmounts, - block, - }); + let resp = await utils.fetchURL(vaultsUrl); - let { output: token0 } = await sdk.api.abi.multiCall({ - calls: vaults.map((address) => ({ - target: address, - })), - abi: token0Abi, - block, - }); + let allVaults = resp.data.filter(vault => vault.type > 0).map((vault) => ({ + address: vault.address, + name: vault.name, + getTotalAmounts: vault.getTotalAmounts, + type: vault.type, + amountIndex: vault.amountIndex + })); - let { output: token1 } = await sdk.api.abi.multiCall({ - calls: vaults.map((address) => ({ - target: address, - })), - abi: token1Abi, - block, - }); + const abiMap = {}; + const addressMap = {}; - for (let i = 0; i < vaults.length; i++) { - - // Gets balance in vault contracts - let { output: token0Balance } = await sdk.api.erc20.balanceOf({ - target: token0[i].output, - owner: vaults[i], - block, - }); - let { output: token1Balance } = await sdk.api.erc20.balanceOf({ - target: token1[i].output, - owner: vaults[i], - block, - }); + for (let i = 0; i < allVaults.length; i++) { + if(abiMap[allVaults[i].type] == undefined){ + abiMap[allVaults[i].type] = allVaults[i].getTotalAmounts; + } + if(addressMap[allVaults[i].type] == undefined){ + addressMap[allVaults[i].type] = [{ + "address":allVaults[i].address, + "index":allVaults[i].amountIndex + }]; + }else{ + addressMap[allVaults[i].type].push({ + "address":allVaults[i].address, + "index":allVaults[i].amountIndex + }); + } + } + const types = Object.keys(abiMap); + const typeNumber = types.length; + for (let i = 0; i < typeNumber; i++) { + const addressList = addressMap[types[i]]; + const abi = abiMap[types[i]]; + let { output: totalAmount } = await sdk.api.abi.multiCall({ + calls: addressList.map((address) => ({ + target: address.address, + })), + abi: abi, + block, + }); - // Sums value in vault contracts - sdk.util.sumSingleBalance(balances, token0[i].output, token0Balance); - sdk.util.sumSingleBalance(balances, token1[i].output, token1Balance); + let { output: token0 } = await sdk.api.abi.multiCall({ + calls: addressList.map((address) => ({ + target: address.address, + })), + abi: token0Abi, + block, + }); - // Sums value in UNI pools - sdk.util.sumSingleBalance(balances, token0[i].output, totalAmount[i].output[1]); - sdk.util.sumSingleBalance(balances, token1[i].output, totalAmount[i].output[2]); + let { output: token1 } = await sdk.api.abi.multiCall({ + calls: addressList.map((address) => ({ + target: address.address, + })), + abi: token1Abi, + block, + }); + for (let i = 0; i < addressList.length; i++) { + // Sums value in UNI pools + sdk.util.sumSingleBalance(balances, token0[i].output, totalAmount[i].output[addressList[i].index]); + sdk.util.sumSingleBalance(balances, token1[i].output, totalAmount[i].output[addressList[i].index + 1]); + } } return balances; From 4b0d0c1763a1167963920475c35cfb54c2a8f486 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 07:00:04 +0000 Subject: [PATCH 120/393] update adapter --- projects/stellarx/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/stellarx/index.js b/projects/stellarx/index.js index 687c7deda6..e7c837c341 100644 --- a/projects/stellarx/index.js +++ b/projects/stellarx/index.js @@ -1,4 +1,4 @@ -const utils = require('./helper/utils'); +const utils = require('../helper/utils'); async function fetch() { var totalTvl = await utils.fetchURL('https://amm-api.stellarx.com/api/pools/30d-statistic/?pool_string='); From e09781cbaee1a4f151bd08e330707c930179194a Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:02:33 +0000 Subject: [PATCH 121/393] add adapter for wingswap --- projects/wingswap/index.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 projects/wingswap/index.js diff --git a/projects/wingswap/index.js b/projects/wingswap/index.js new file mode 100644 index 0000000000..2d293b855f --- /dev/null +++ b/projects/wingswap/index.js @@ -0,0 +1,25 @@ +const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); +const { stakingPricedLP } = require('../helper/staking') + + +module.exports = { + timetravel: true, + misrepresentedTokens: true, + methodology: + "Factory address (0xc0719a9A35a2D9eBBFdf1C6d383a5E8E7b2ef7a8) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + fantom: { + tvl: calculateUsdUniTvl( + "0xc0719a9A35a2D9eBBFdf1C6d383a5E8E7b2ef7a8", + "fantom", + "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", + [ + //USDC + "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + //WIS + "0xF24be6c063Bee7c7844dD90a21fdf7d783d41a94", + ], + "wrapped-fantom" + ), + staking: stakingPricedLP("0x546dA2105c52dc2dBA3a4320b43bc2cfDA9cB311", "0xF24be6c063Bee7c7844dD90a21fdf7d783d41a94", "fantom", "0x194C3973Eb43Ba98941C5e9D8e3D06EF9e6aa399", "wrapped-fantom") + }, +}; // node test.js projects/wingswap/index.js \ No newline at end of file From e5e64907aa47aa369ed5c1d509544b71332acc46 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:20:19 +0000 Subject: [PATCH 122/393] timetravel: false timetravel: false --- projects/quarry/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/quarry/index.js b/projects/quarry/index.js index c155626072..78d1d3ab93 100644 --- a/projects/quarry/index.js +++ b/projects/quarry/index.js @@ -134,6 +134,7 @@ async function tvl() { } module.exports = { + timetravel: false, methodology: "TVL counts deposits made to Quarry Protocol. CoinGecko is used to find the price of tokens in USD.", tvl, From 83a077930bb31e78aefa56537e1ce12fe4f0b229 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:21:02 +0000 Subject: [PATCH 123/393] timetravel: false timetravel: false --- projects/orca/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/orca/index.js b/projects/orca/index.js index b25b425b10..f612f08470 100644 --- a/projects/orca/index.js +++ b/projects/orca/index.js @@ -10,6 +10,7 @@ async function fetch(){ } module.exports = { + timetravel: false, fetch, hallmarks:[ [1628565707, "Token+LM launch"] From dc5623efe7b7f882a5157b87f992f2564fc3be5b Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:21:33 +0000 Subject: [PATCH 124/393] timetravel: false timetravel: false --- projects/solfarm.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/solfarm.js b/projects/solfarm.js index 9e638c4d18..07fd19c329 100644 --- a/projects/solfarm.js +++ b/projects/solfarm.js @@ -8,5 +8,6 @@ async function fetch() { } module.exports = { + timetravel: false, fetch } From 039bec72617d4cd2cdd4569fee6d6d6402f6b025 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:22:10 +0000 Subject: [PATCH 125/393] timetravel: false timetravel: false --- projects/saber.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/saber.js b/projects/saber.js index feab78e40e..4c068386be 100644 --- a/projects/saber.js +++ b/projects/saber.js @@ -47,6 +47,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: 'To obtain the TVL of Saber we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the tokens are found. TVL is calculated using the list of pool addresses found under the "Pools" button of the Saber App. These pools addresses are hard-coded. Making these calls returns the amount of tokens held in each contract. We then use Coingecko to get the price of each token in USD and export the sum of all tokens. "USDP" is used to price the stablecoin "PAI" since it has not been listed on Coingecko.', From bee4fe5c959166a5afff2a160759062b518866d5 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:22:47 +0000 Subject: [PATCH 126/393] timetravel: false timetravel: false --- projects/atrix.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/atrix.js b/projects/atrix.js index fb6bad0d50..4814012e64 100644 --- a/projects/atrix.js +++ b/projects/atrix.js @@ -14,6 +14,7 @@ async function fetch() { } module.exports = { + timetravel: false, methodology: "The Atrix API endpoint fetches on-chain data from the Serum orderbook and token accounts for each liquidity pool, then uses prices from Coingecko to aggregate total TVL.", fetch, }; From d36dd2f0542483a557f532408993f6c9cf90667d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:23:19 +0000 Subject: [PATCH 127/393] timetravel: false timetravel: false --- projects/sunny.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sunny.js b/projects/sunny.js index e9d2ea3d34..26536d53a1 100644 --- a/projects/sunny.js +++ b/projects/sunny.js @@ -72,6 +72,7 @@ async function tvl() { } module.exports = { + timetravel: false, methodology: 'TVL counts LP token deposits made to Sunny Aggregator. CoinGecko is used to find the price of tokens in USD, only the original "SOL" token price is used for all existing variations of the token.', tvl, From 601e84b88938f2d03d9e0bddb6597217712be85a Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:23:51 +0000 Subject: [PATCH 128/393] timetravel: false timetravel: false --- projects/solend/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/solend/index.js b/projects/solend/index.js index 34a04ed6ad..d5e8d412fc 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -44,6 +44,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.', hallmarks: [ From ef60aaae23084ddf4fd9b4996140fa0b4c8b9d7d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:24:23 +0000 Subject: [PATCH 129/393] timetravel: false timetravel: false --- projects/almond.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/almond.js b/projects/almond.js index 9598104992..83f15e84b6 100644 --- a/projects/almond.js +++ b/projects/almond.js @@ -14,6 +14,7 @@ async function fetch() { } module.exports = { + timetravel: false, methodology: "The pools on https://almond.so/ are included in TVL. Standard tokens (SOL, BTC, ETH, USDC, etc..), no pool 2. The API fetches the balances of the Solana accounts holding the staked tokens, then uses Coingecko prices to determine dollar values.", fetch, }; From 35e9f18544c8285d21976590e1ce2518f5042a88 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:24:51 +0000 Subject: [PATCH 130/393] timetravel: false timetravel: false --- projects/francium.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/francium.js b/projects/francium.js index 82e53db541..6e9017c3ed 100644 --- a/projects/francium.js +++ b/projects/francium.js @@ -14,6 +14,7 @@ async function fetch() { } module.exports = { + timetravel: false, methodology: 'Value of total LP tokens locked + deposits that are not borrowed.', fetch, }; From 17050de61592dafce3bae5cac63a77a7ac33589d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:25:29 +0000 Subject: [PATCH 131/393] timetravel: false, timetravel: false, --- projects/apricot.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/apricot.js b/projects/apricot.js index a003834e3a..fa7ebda7bf 100644 --- a/projects/apricot.js +++ b/projects/apricot.js @@ -66,6 +66,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.', -} \ No newline at end of file +} From 03849d284c4eaf2378678fa31c464c47731813c9 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:26:19 +0000 Subject: [PATCH 132/393] timetravel: false, timetravel: false, --- projects/portfinance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/portfinance/index.js b/projects/portfinance/index.js index bd33d27fce..84a7aa2b4f 100644 --- a/projects/portfinance/index.js +++ b/projects/portfinance/index.js @@ -32,5 +32,6 @@ async function tvl() { } module.exports = { + timetravel: false, tvl }; From a8b5f9aa9d14c18e3876f2e2bc2f23e8bfc6e4d0 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:26:57 +0000 Subject: [PATCH 133/393] timetravel: false, timetravel: false, --- projects/parrot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/parrot.js b/projects/parrot.js index 4afbb3f38b..89abaa788c 100644 --- a/projects/parrot.js +++ b/projects/parrot.js @@ -128,6 +128,7 @@ async function tvl() { } } module.exports = { + timetravel: false, tvl, methodology: `To obtain the Parrot TVL we make on-chain calls using the function getTokenBalance() that uses the token addresses and the vault addresses where deposits are made to mint PAI, pBTC or pSOL. Hence, the addresses used are the addresses that hold the collateral for the protocol and these addresses are hard-coded. The calls made return the number of tokens held in each contract for us to then use Coingecko to get the price of each token in USD and export the sum of all tokens. Since the Mercurial and Saber LP tokens that are used as collateral have a virtual price of $1, these are counted as Tether. We also include SOL staked on prtSOL that is used for the liquidity staking program.`, } From e324742ffaf4a4542c8f310cbcd32ae9bd11710a Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:27:31 +0000 Subject: [PATCH 134/393] timetravel: false, timetravel: false, --- projects/mango-markets/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mango-markets/index.js b/projects/mango-markets/index.js index c6b495aa94..c194436d71 100644 --- a/projects/mango-markets/index.js +++ b/projects/mango-markets/index.js @@ -55,6 +55,7 @@ async function test() { // test(); module.exports = { + timetravel: false, solana: { tvl, }, From ff2534c8b8d6baa98f7637b61ea9f1325f452754 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:27:57 +0000 Subject: [PATCH 135/393] timetravel: false, timetravel: false, --- projects/socean/socean.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/socean/socean.js b/projects/socean/socean.js index 37aba95e9b..68043f0106 100644 --- a/projects/socean/socean.js +++ b/projects/socean/socean.js @@ -17,6 +17,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: 'We call our API endpoint to get total SOL TVL. An alternative is to check our total supply for a lower bound on TVL, as each SOCN token is guaranteed to be backed by (at least) 1 SOL.', } From c43583e2f1830b439c60c9befa0c0fd2d5dde26d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:29:08 +0000 Subject: [PATCH 136/393] timetravel: false, timetravel: false, --- projects/aldrin/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/aldrin/index.js b/projects/aldrin/index.js index c642e311dc..c4619c8666 100644 --- a/projects/aldrin/index.js +++ b/projects/aldrin/index.js @@ -30,6 +30,7 @@ async function tvl(timestamp) { } module.exports = { + timetravel: false, misrepresentedTokens: true, tvl } From 36f6f2d7aa595d3bad0ae6665685d085ee10337f Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:29:42 +0000 Subject: [PATCH 137/393] timetravel: false, timetravel: false, --- projects/mercurial.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mercurial.js b/projects/mercurial.js index c41071cb08..8ae2696c7f 100644 --- a/projects/mercurial.js +++ b/projects/mercurial.js @@ -111,6 +111,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: "To obtain the Mercurial TVL we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the token is located. The addresses used are the 3pool addresses and the SOL 2pool address where the corresponding tokens were deposited and these addresses are hard-coded. This returns the number of tokens held in each contract. We then use Coingecko to get the price of each token in USD to export the sum of all tokens.", From 3e560f14ef6862cd287c85c64ed577cba775a5a1 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:30:06 +0000 Subject: [PATCH 138/393] timetravel: false, timetravel: false, --- projects/invictus/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/invictus/index.js b/projects/invictus/index.js index bd3113ff0a..ea17c3117d 100644 --- a/projects/invictus/index.js +++ b/projects/invictus/index.js @@ -17,9 +17,10 @@ async function tvl(){ module.exports={ + timetravel: false, misrepresentedTokens: true, solana:{ tvl, staking } -} \ No newline at end of file +} From 4d778c693a0dcd96e8edd89c5f55417a17f44fe2 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:30:29 +0000 Subject: [PATCH 139/393] timetravel: false, timetravel: false, --- projects/synthetify/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/synthetify/index.js b/projects/synthetify/index.js index 5f3a8d4daa..261686d532 100644 --- a/projects/synthetify/index.js +++ b/projects/synthetify/index.js @@ -10,7 +10,8 @@ async function fetch() { } module.exports = { + timetravel: false, fetch, methodology: 'To obtain TVL of Synthetify we must add all colaterals which was deposited.' - } \ No newline at end of file + } From e0162b7b84dc16d16110a4c3ce0cc9e98c04034d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:31:01 +0000 Subject: [PATCH 140/393] timetravel: false, timetravel: false, --- projects/jetprotocol.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/jetprotocol.js b/projects/jetprotocol.js index d1dffdcfa2..88c1f25015 100644 --- a/projects/jetprotocol.js +++ b/projects/jetprotocol.js @@ -23,6 +23,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.', -} \ No newline at end of file +} From 8932fa04d770f4a1bfe98e4909be713a58da3d2f Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:31:27 +0000 Subject: [PATCH 141/393] timetravel: false, timetravel: false, --- projects/arrow/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/arrow/index.js b/projects/arrow/index.js index 1c54d8f332..3dae0cf6ac 100644 --- a/projects/arrow/index.js +++ b/projects/arrow/index.js @@ -105,6 +105,7 @@ async function tvl() { } module.exports = { + timetravel: false, methodology: 'TVL counts LP token deposits made to Arrow Protocol. CoinGecko is used to find the price of tokens in USD, only the original "SOL" token price is used for all existing variations of the token.', tvl, From 30b2add9c301e83606f6f23380ec2030b8f9e16d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:32:04 +0000 Subject: [PATCH 142/393] timetravel: false, timetravel: false, --- projects/cashio/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/cashio/index.js b/projects/cashio/index.js index 2a6de48148..60df449ce6 100644 --- a/projects/cashio/index.js +++ b/projects/cashio/index.js @@ -138,6 +138,7 @@ async function tvl() { } module.exports = { + timetravel: false, methodology: "TVL counts LP token deposits made to Cashio and accrued reward tokens to its bank. CoinGecko is used to find the price of tokens in USD.", tvl, From 9db4f73da9ff91c0d7f0b3ebe07f1dc400210c77 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:32:28 +0000 Subject: [PATCH 143/393] timetravel: false, timetravel: false, --- projects/soda-protocol/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/soda-protocol/index.js b/projects/soda-protocol/index.js index ec3feb31d7..0e2f704bd4 100644 --- a/projects/soda-protocol/index.js +++ b/projects/soda-protocol/index.js @@ -32,6 +32,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: 'TVL consists of deposits made to the protocol and borrowed tokens are not counted.' } From bcc1cf3fa24feaf5612fa40915e8f1044cd7dfaa Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:32:55 +0000 Subject: [PATCH 144/393] timetravel: false, timetravel: false, --- projects/oxygen/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/oxygen/index.js b/projects/oxygen/index.js index 562a52f13e..4d7e366cf9 100644 --- a/projects/oxygen/index.js +++ b/projects/oxygen/index.js @@ -13,10 +13,11 @@ async function tvl() { } module.exports = { + timetravel: false, misrepresentedTokens: true, solana: { tvl, }, timeTravelUnsupported: true, tvl -} \ No newline at end of file +} From ed3b399c515f5ec0a33d41dd63d91f3d73dda411 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:33:20 +0000 Subject: [PATCH 145/393] timetravel: false, timetravel: false, --- projects/pole/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pole/index.js b/projects/pole/index.js index 6e2dc1b05b..1c1bafb636 100644 --- a/projects/pole/index.js +++ b/projects/pole/index.js @@ -19,5 +19,6 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, }; From b0a3fa54f68c2bc75b6cc77a9e519713c1013dd9 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:33:47 +0000 Subject: [PATCH 146/393] timetravel: false, timetravel: false, --- projects/asol/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/asol/index.js b/projects/asol/index.js index 38f71a3f69..373cf7ef12 100644 --- a/projects/asol/index.js +++ b/projects/asol/index.js @@ -8,6 +8,7 @@ async function tvl() { } module.exports = { + timetravel: false, methodology: "aSOL TVL is computed by looking at the token balances of the accounts holding the stake pool tokens backing the aSOL Crate. The token accounts come from https://asol.so/#/admin.", tvl, From 4d95095d2fdb1867941e6efbdaa1fa6a70872508 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:34:20 +0000 Subject: [PATCH 147/393] timetravel: false, timetravel: false, --- projects/fabric/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/fabric/index.js b/projects/fabric/index.js index b622cc9d37..04bd3774ee 100644 --- a/projects/fabric/index.js +++ b/projects/fabric/index.js @@ -18,6 +18,7 @@ async function solonaTvl() { } module.exports = { + timetravel: false, solana: { tvl: solonaTvl, }, From 191098e131929e7f582a15cf444a125df087f396 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:34:44 +0000 Subject: [PATCH 148/393] timetravel: false, timetravel: false, --- projects/drift.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/drift.js b/projects/drift.js index 83d02dbd27..d527b322e9 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -8,8 +8,9 @@ async function tvl(){ } module.exports={ + timetravel: false, methodology: "Calculate the USDC on 6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S through on-chain calls", solana:{ tvl } -} \ No newline at end of file +} From 5dcb55549aac49d34ce2cdf536b384f77c3c5aba Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:35:14 +0000 Subject: [PATCH 149/393] timetravel: false, timetravel: false, --- projects/solyard.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/solyard.js b/projects/solyard.js index 0ce75bdf37..00ebf7019b 100644 --- a/projects/solyard.js +++ b/projects/solyard.js @@ -20,6 +20,7 @@ async function pool2() { } module.exports = { + timetravel: false, staking:{ fetch:staking }, From 4094ea8120999184873cfb47391440010e69e90c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:36:12 +0000 Subject: [PATCH 150/393] timetravel: false, timetravel: false, --- projects/sencha/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/sencha/index.js b/projects/sencha/index.js index c3dae736bc..4447ecd098 100644 --- a/projects/sencha/index.js +++ b/projects/sencha/index.js @@ -23,6 +23,7 @@ async function tvl() { } module.exports = { + timetravel: false, methodology: "Sencha TVL is computed by iterating each known Sencha pool, then taking the value of each of the underlying tokens. Assets not listed on Coingecko are not counted.", tvl, From fe07a85ecd2c7219dee6677ca97f5f4d51901add Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:36:54 +0000 Subject: [PATCH 151/393] timetravel: false, timetravel: false, --- projects/acumen/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/acumen/index.js b/projects/acumen/index.js index b229b2b422..d27abc6a5f 100644 --- a/projects/acumen/index.js +++ b/projects/acumen/index.js @@ -40,6 +40,7 @@ async function tvl() { } module.exports = { + timetravel: false, tvl, methodology: `To obtain the Acumen TVL we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the token is located. The addresses used are the pool address where the corresponding tokens were deposited as collateral to borrow and or earn, borrowed tokens are not counted and these addresses are hard-coded. These calls return the number of tokens held in each pool contract. We then use Coingecko to get the price of each token in USD to export the sum of all tokens.`, -} \ No newline at end of file +} From a7db7fd4b988831895277a62841beaa7e582fd2d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 10:37:19 +0000 Subject: [PATCH 152/393] timetravel: false, timetravel: false, --- projects/only1.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/only1.js b/projects/only1.js index 9410c649c5..3538240f9f 100644 --- a/projects/only1.js +++ b/projects/only1.js @@ -10,6 +10,7 @@ async function staking() { } module.exports = { + timetravel: false, methodology: "TVL is the sum of all tokens in the staking pools", solana: { staking, From cb51e73adac5d004cee4b42075fb61fdd01a9d85 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sat, 4 Dec 2021 16:11:08 +0000 Subject: [PATCH 153/393] fix arbitrum again --- projects/helper/portedTokens.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 42a899ed34..e0705f0ea2 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -356,7 +356,7 @@ async function transformArbitrumAddress() { compareAddresses(addr, token.address) ); if (dstToken !== undefined) { - return dstToken.extensions.l1Address; + return dstToken.extensions.bridgeInfo[1].tokenAddress; } return `arbitrum:${addr}`; }; From cd4512844f6f89e1954a53ca6851e368cbd89e99 Mon Sep 17 00:00:00 2001 From: Mohammed18062020 Date: Sat, 4 Dec 2021 17:29:44 +0000 Subject: [PATCH 154/393] YVS Finance && ChickenSwap TVL Adapters --- projects/chickenswap/abi.json | 62 +++++++++++++++ projects/chickenswap/index.js | 74 ++++++++++++++++++ projects/yvs/abi.json | 28 +++++++ projects/yvs/index.js | 141 ++++++++++++++++++++++++++++++++++ 4 files changed, 305 insertions(+) create mode 100644 projects/chickenswap/abi.json create mode 100644 projects/chickenswap/index.js create mode 100644 projects/yvs/abi.json create mode 100644 projects/yvs/index.js diff --git a/projects/chickenswap/abi.json b/projects/chickenswap/abi.json new file mode 100644 index 0000000000..6f18d7e109 --- /dev/null +++ b/projects/chickenswap/abi.json @@ -0,0 +1,62 @@ +{ + "poolInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accChickenPerShare", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "token": { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "balance": { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file diff --git a/projects/chickenswap/index.js b/projects/chickenswap/index.js new file mode 100644 index 0000000000..5b973fd846 --- /dev/null +++ b/projects/chickenswap/index.js @@ -0,0 +1,74 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { staking } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); +const { addFundsInMasterChef } = require("../helper/masterchef"); +const { getChainTvl } = require('../helper/getUniSubgraphTvl'); + +const chickenChefContract = "0x87AE4928f6582376a0489E9f70750334BBC2eb35"; +const KFC = "0xE63684BcF2987892CEfB4caA79BD21b34e98A291"; +const WETH_KFC_UNIV2 = "0x90544c3f88d0a9e374ed35490028f45642a8b3f2"; + +const kfcVaults = [ + //kfcUSDT + "0x408eC098bAB8457499EcE4BF17f197637e338D3a", + //kfcUSDC + "0x13DfDa244e281Ced094796e0E0d2A1Cf91A1BD13" +]; + +/*** Pools(pairs) TVL Portion ***/ +const ethChainTvl = getChainTvl({ + ethereum: 'https://api.thegraph.com/subgraphs/name/chickenswap/graph', +}); + +/*** Vaults TVL Portion ***/ +const ethTvl = async (chainBlocks) => { + const balances = {}; + + await addFundsInMasterChef( + balances, + chickenChefContract, + chainBlocks["ethereum"], + "ethereum", + addr => addr, + abi.poolInfo, + [KFC, WETH_KFC_UNIV2, kfcVaults[0], kfcVaults[1]] + ); + + const kfcTokens = ( + await sdk.api.abi.multiCall({ + abi: abi.token, + calls: kfcVaults.map(vault => ({ + target: vault, + })) + }) + ).output.map(tokens => tokens.output); + + const tokensBalance = ( + await sdk.api.abi.multiCall({ + abi: abi.balance, + calls: kfcVaults.map(vault => ({ + target: vault, + })) + }) + ).output.map(bals => bals.output); + + kfcTokens.forEach((token, idx) => { + sdk.util.sumSingleBalance(balances, token, tokensBalance[idx]); + }); + + return balances; +}; + +module.exports = { + misrepresentedTokens: true, + ethereum: { + staking: staking(chickenChefContract, KFC), + pool2: pool2(chickenChefContract, WETH_KFC_UNIV2), + tvl: ethTvl, + }, + tvl: sdk.util.sumChainTvls([ethTvl, ethChainTvl('ethereum')]), + methodology: + `We count liquidity on the Vaults (only single tokens) through ChickenChef Contract and the liquuidity on the AMM Pools (only pairs) + pulling data from the subgraph at https://api.thegraph.com/subgraphs/name/chickenswap/graph`, +}; \ No newline at end of file diff --git a/projects/yvs/abi.json b/projects/yvs/abi.json new file mode 100644 index 0000000000..f4f1d023b7 --- /dev/null +++ b/projects/yvs/abi.json @@ -0,0 +1,28 @@ +{ + "underlying": { + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "balance": { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file diff --git a/projects/yvs/index.js b/projects/yvs/index.js new file mode 100644 index 0000000000..9977d7a664 --- /dev/null +++ b/projects/yvs/index.js @@ -0,0 +1,141 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { staking } = require("../helper/staking"); +const { pool2, pool2s } = require("../helper/pool2"); + +/*** Ethereum Addresses ***/ +// Pools Part +const poolStakingContract = "0x5a055f79981C8338230E5199BA7e477cFE35D14f"; +const YVS = "0xec681f28f4561c2a9534799aa38e0d36a83cf478"; + +const poolLiquidityContract = "0x613f654C7BBB948219f3952173518DEBCD963718"; +const YVS_WETH_UNIV2 = "0x182885Fa47B63C02D06A8D65db3Bf3871BE9F998"; + +// Vaults Part +const vaultContracts = [ + "0x981cc277841f06401B750a3c7dd42492ff962B9C", + "0x0B1b5C66B519BF7B586FFf0A7bacE89227aC5EAF" +]; + +/*** BSC Addresses ***/ +// Pools Part +const poolStakingContractBSC = "0xf44672da873f662AB8e1Fc904f8d053DAd9353DF"; +const YVS_BSC = "0x47c1c7b9d7941a7265d123dcfb100d8fb5348213"; +const poolLiquidityContractBSC = [ + //BUSD-YVS SLP closed + "0xfbdf2bEdE50948754295F33FA4704Fd69E6d4C43", + //BUSD-YVS PanCake Closed + "0xBcbd2a48B6279C2a2d4609282aA80d8e856bFeBB", + //WBNB-YVS PanCake Closed + "0x7f644abFb4dD8d39c781411Bc3e7D70479E3a546", + //WBNB-YVS PanCake V2 + "0x08559533a0671Ae685048C3B28980226Fb185209", + //WBNB-YVS SLP + "0x371CCe38B26f6a06Dd61Fabd50bA9D74eA2D58cC", + //WBNB-YVS SLP + "0x2f002F05bd3609E1151360476d5142bCdb11307B", + //vaultWBNB_YVS + "0x2d94d8b9301cDe1fDeCdF8B30EBdDD81e2E632bb" +]; +const lpPoolsBSC = [ + //BUSD_YVS_SLP + "0xeDaF3C776AbAef600a63585232855800b354578a", + //BUSD_YVS_CakeLP + "0x99338d3cc1300ddfA6D0621d27e8387eAE2aE858", + //WBNB-YVS_CakeLP + "0xA12C87881fECCC2CA1F8e1E7ECbDa8Af3A89Ab3c", + //WBNB-YVS_CakeLPV2 + "0x226E28020fD59F1bE367cF4b20e76856e6d2D1DF", + //WBNB-YVS_SLP + "0x5E12A25A09b74313F0679D96aACB12886d2e02e4", + //WBNB-YVS_SLP + "0x5E12A25A09b74313F0679D96aACB12886d2e02e4", + //lpVaultWBNB_YVS_SLP + "0x5E12A25A09b74313F0679D96aACB12886d2e02e4" +]; + +// Vaults Part +const vaultContractsBSC = [ + //yvsBUSD + "0x3eB8BC3017ba663332CE9f8BdD89D9503EA978B0", + //yvsWBNB + "0x561819d509F94EBb08e75299A41Dc356af403F7B", + //yvs4Belt + "0x92d3f515AFAA05c8297Dd243Bae50b934A827f74", + //yvsbeltBNB + "0xA6B093259F39C8f9B55Ee2206a6b470Cf9D78C3B" +]; + +/*** Polygon Addresses ***/ +//Pools Part +const poolStakingContractPolygon = "0x21E2822d912343251554812785f7AE9b9c52F420"; +const YVS_polygon = "0xb565cf70613ca464d68427106af80c67a8e4b801"; +const poolLiquidityContractPolygon = "0x5b19B98d9A9357fa9E05E6b0b1eCdFC84eF10529" +const YVS_WETH_UNIV2Polygon = "0x6951eb8E9bd734290590C8e7770aEBFf19e4F043"; + +async function calcTvl(balances, underlying, balance, vaultContracts, chain = "ethereum") { + let chainBlocks = {}; + + const vaultUnderlying = ( + await sdk.api.abi.multiCall({ + abi: underlying, + calls: vaultContracts.map(vault => ({ + target: vault, + })), + chain: chain, + block: chainBlocks[chain], + }) + ).output.map(under => under.output); + + const vaultBalances = ( + await sdk.api.abi.multiCall({ + abi: balance, + calls: vaultContracts.map(vault => ({ + target: vault, + })), + chain: chain, + block: chainBlocks[chain], + }) + ).output.map(bal => bal.output); + + vaultUnderlying.forEach((Underlying, idx) => { + sdk.util.sumSingleBalance(balances, `${chain}:${Underlying}`, vaultBalances[idx]); + }); + + return balances; +} + +async function ethTvl() { + const balances = {}; + + await calcTvl(balances, abi.underlying, abi.balance, vaultContracts); + + return balances; +} + +async function bscTvl() { + const balances = {}; + + await calcTvl(balances, abi.underlying, abi.balance, vaultContractsBSC, "bsc"); + + return balances; +} + +module.exports = { + ethereum: { + staking: staking(poolStakingContract, YVS), + pool2: pool2(poolLiquidityContract, YVS_WETH_UNIV2), + tvl: ethTvl, + }, + bsc: { + staking: staking(poolStakingContractBSC, YVS_BSC, "bsc"), + pool2: pool2s(poolLiquidityContractBSC, lpPoolsBSC, "bsc"), + tvl: bscTvl, + }, + polygon: { + staking: staking(poolStakingContractPolygon, YVS_polygon, "polygon"), + pool2: pool2(poolLiquidityContractPolygon, YVS_WETH_UNIV2Polygon, "polygon"), + }, + methodology: + "Counts tvl of all Pools and Vaults through their Contracts, also there are pool2 and staking parts", +}; From 7dae3021b44849181447636a82d96287886ebe17 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:21:27 +0000 Subject: [PATCH 155/393] timetravel: false, timetravel: false, --- projects/serum.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/serum.js b/projects/serum.js index 7feb055e5f..d8099923ef 100644 --- a/projects/serum.js +++ b/projects/serum.js @@ -14,5 +14,6 @@ async function fetch() { } module.exports = { + timetravel: false, fetch, }; From c086d3f8b8a5158cea35daeb8b4eab5a1db33ded Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:25:06 +0000 Subject: [PATCH 156/393] timetravel: true, timetravel: true, --- projects/ren/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/ren/index.js b/projects/ren/index.js index cd567b0e1b..e5393e56d1 100644 --- a/projects/ren/index.js +++ b/projects/ren/index.js @@ -138,6 +138,7 @@ async function solana(){ } module.exports = { + timetravel: true, solana:{ tvl: solana }, From c9038b835ccde73adf193367d0c6d21ee07d87e8 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:25:56 +0000 Subject: [PATCH 157/393] timetravel: true, timetravel: true, --- projects/stafi/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/stafi/index.js b/projects/stafi/index.js index a571741193..93acc199d8 100644 --- a/projects/stafi/index.js +++ b/projects/stafi/index.js @@ -51,9 +51,10 @@ function chainTvl(chain){ } module.exports = { + timetravel: true, ethereum: { tvl: ethereum, staking: getTvlFunction("RFIS", "stafi") }, ...chainExports(chainTvl, Object.keys(chainToParams)) -} \ No newline at end of file +} From 4cfa67c590b4dbd099813cb8a2e64d68afc16b57 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sat, 4 Dec 2021 18:41:02 +0000 Subject: [PATCH 158/393] update export for telosrex --- projects/telosRex.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/telosRex.js b/projects/telosRex.js index ec25c68f04..95078c699d 100644 --- a/projects/telosRex.js +++ b/projects/telosRex.js @@ -14,6 +14,6 @@ async function tvl() { module.exports = { telos: { tvl, - } - + }, + tvl, }; From c513be224630203bf0bf43c9edd2e49733450ed8 Mon Sep 17 00:00:00 2001 From: BlazeWasHere Date: Sat, 4 Dec 2021 21:49:28 +0000 Subject: [PATCH 159/393] add tokens locked in the bridge --- projects/synapse/index.js | 133 +++++++++++++++++++++++++++++++++++++- 1 file changed, 132 insertions(+), 1 deletion(-) diff --git a/projects/synapse/index.js b/projects/synapse/index.js index 4b1919075b..1df934dc07 100644 --- a/projects/synapse/index.js +++ b/projects/synapse/index.js @@ -1,11 +1,34 @@ const { chainExports } = require("../helper/exports"); const { sumTokens } = require("../helper/unwrapLPs"); const { getBlock } = require("../helper/getBlock"); +const BigNumber = require("bignumber.js"); +const sdk = require("@defillama/sdk"); // Used to represent nUSD. const TUSD = "0x0000000000085d4780b73119b644ae5ecd22b376"; // Used to represent nETH. const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const NFD = "0xdfdb7f72c1f195c5951a234e8db9806eb0635346"; + +const abi = { + inputs: [ + { + internalType: "address", + name: "tokenAddress", + type: "address", + }, + ], + name: "getFeeBalance", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", +}; const DATA = { bsc: { @@ -20,6 +43,14 @@ const DATA = { metapool: "0x930d001b7efb225613aC7F35911c52Ac9E111Fa9", basepool: "0x938aFAFB36E8B1AB3347427eb44537f543475cF9", }, + bridge: "0xd123f70ae324d34a9e76b67a27bf77593ba8749f", + bridgeAssets: [ + "0x5f4bde007dc06b867f86ebfe4802e34a1ffeed63", // HIGH + "0x0fe9778c005a5a6115cbe12b0568a2d50b765a51", // NFD + "0x130025ee738a66e691e6a7a62381cb33c6d9ae83", // JUMP + "0x23b891e5c62e0955ae2bd185990103928ab817b3", // nUSD + "0xaa88c603d142c371ea0eac8756123c5805edee03", // DOG + ], }, harmony: { stables: [ @@ -33,6 +64,10 @@ const DATA = { metapool: "0x555982d2E211745b96736665e19D9308B615F78e", basepool: "0x080f6aed32fc474dd5717105dba5ea57268f46eb", }, + bridge: "0xaf41a65f786339e7911f4acdad6bd49426f2dc6b", + bridgeAssets: [ + "0xED2a7edd7413021d440b09D654f3b87712abAB66", // nUSD + ], }, ethereum: { stables: [ @@ -41,6 +76,16 @@ const DATA = { "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT ], pool: "0x1116898DdA4015eD8dDefb84b6e8Bc24528Af2d8", + bridge: "0x2796317b0ff8538f253012862c06787adfb8ceb6", + nusd: "0x1b84765de8b7566e4ceaf4d0fd3c5af52d3dde4f", + bridgeAssets: [ + "0x71ab77b7dbb4fa7e017bc15090b2163221420282", // HIGH + WETH, + "0x853d955acef822db058eb8505911ed77f175b99e", // FRAX + "0xbaac2b4491727d78d2b78815144570b9f2fe8899", // DOG + "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f", // gOHM + "0x1b84765de8b7566e4ceaf4d0fd3c5af52d3dde4f", // nUSD + ], }, polygon: { stables: [ @@ -54,6 +99,12 @@ const DATA = { basepool: "0x3f52E42783064bEba9C1CFcD2E130D156264ca77", metapool: "0x96cf323e477ec1e17a4197bdcc6f72bb2502756a", }, + bridge: "0x8f5bbb2bb8c2ee94639e55d5f41de9b4839c1280", + bridgeAssets: [ + "0x0a5926027d407222f8fe20f24cb16e103f617046", // NFD + "0xd8ca34fd379d9ca3c6ee3b3905678320f5b45195", // gOHM + "0xb6c473756050de474286bed418b77aeac39b02af", // nUSD + ], }, avax: { stables: [ @@ -63,10 +114,18 @@ const DATA = { ], nusd: "0xCFc37A6AB183dd4aED08C204D1c2773c0b1BDf46", pool: "0xED2a7edd7413021d440b09D654f3b87712abAB66", + neth: "0x19e1ae0ee35c0404f835521146206595d37981ae", legacy: { basepool: "0xE55e19Fb4F2D85af758950957714292DAC1e25B2", metapool: "0xf44938b0125a6662f9536281ad2cd6c499f22004", }, + bridge: "0xc05e61d0e7a63d27546389b7ad62fdff5a91aace", + bridgeAssets: [ + "0xf1293574ee43950e7a8c9f1005ff097a9a713959", // NFD + "0x321e7092a180bb43555132ec53aaa65a5bf84251", // gOHM + "0x19e1ae0ee35c0404f835521146206595d37981ae", // nETH + "0xCFc37A6AB183dd4aED08C204D1c2773c0b1BDf46", // nUSD + ], }, fantom: { stables: [ @@ -80,6 +139,12 @@ const DATA = { basepool: "0x080F6AEd32Fc474DD5717105Dba5ea57268F46eb", metapool: "0x1f6a0656ff5061930076bf0386b02091e0839f9f", }, + bridge: "0xaf41a65f786339e7911f4acdad6bd49426f2dc6b", + bridgeAssets: [ + "0x91fa20244fb509e8289ca630e5db3e9166233fdc", // gOHM + "0x78de9326792ce1d6eca0c978753c6953cdeedd73", // JUMP + "0xED2a7edd7413021d440b09D654f3b87712abAB66", // nUSD + ], }, arbitrum: { stables: [ @@ -96,6 +161,12 @@ const DATA = { basepool: "0xbafc462d00993ffcd3417abbc2eb15a342123fda", metapool: "0x84cd82204c07c67df1c2c372d8fd11b3266f76a3", }, + bridge: "0x6f4e8eba4d337f874ab57478acc2cb5bacdc19c9", + bridgeAssets: [ + "0x8d9ba570d6cb60c7e3e0f31343efe75ab8e65fb1", // gOHM + "0x3ea9b0ab55f34fb188824ee288ceaefc63cf908e", // nETH + "0x2913e812cf0dcca30fb28e6cac3d2dcff4497688", // nUSD + ], }, boba: { stables: [ @@ -108,11 +179,27 @@ const DATA = { weth: "0xd203De32170130082896b4111eDF825a4774c18E", pool: "0x75FF037256b36F15919369AC58695550bE72fead", ethPool: "0x753bb855c8fe814233d26Bb23aF61cb3d2022bE5", + bridge: "0x432036208d2717394d2614d6697c46df3ed69540", + bridgeAssets: [ + "0x6B4712AE9797C199edd44F897cA09BC57628a1CF", // nUSD + "0x96419929d7949D6A801A6909c145C8EEf6A40431", // nETH + ], }, optimism: { neth: "0x809DC529f07651bD43A172e8dB6f4a7a0d771036", weth: "0x121ab82b49B2BC4c7901CA46B8277962b4350204", ethPool: "0xE27BFf97CE92C3e1Ff7AA9f86781FDd6D48F5eE9", + bridge: "0xaf41a65f786339e7911f4acdad6bd49426f2dc6b", + bridgeAssets: [ + "0x809DC529f07651bD43A172e8dB6f4a7a0d771036", // nETH + ], + }, + moonriver: { + bridge: "0xaed5b25be1c3163c907a471082640450f928ddfe", + bridgeAssets: [ + "0xe96ac70907fff3efee79f502c985a7a21bce407d", // synFRAX + "0x3bf21ce864e58731b6f28d68d5928bcbeb0ad172", // gOHM + ], }, }; @@ -136,6 +223,20 @@ const misrepresentedTokensMap = { "0xd203De32170130082896b4111eDF825a4774c18E": WETH, // WETH (OPTIMISM) -> WETH (ETH) "0x121ab82b49B2BC4c7901CA46B8277962b4350204": WETH, + // NFD (BSC) -> NFD (ETH) + "0x0fe9778c005a5a6115cbe12b0568a2d50b765a51": NFD, + // NFD (POLYGON) -> NFD (ETH) + "0x0a5926027d407222f8fe20f24cb16e103f617046": NFD, + // NFD (AVAX) -> NFD (ETH) + "0xf1293574ee43950e7a8c9f1005ff097a9a713959": NFD, + // WONE (ONE) + "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a": "wrapped-one", + // synFRAX (MOVR) -> FRAX (ETH) + "0xe96ac70907fff3efee79f502c985a7a21bce407d": + "0x853d955acef822db058eb8505911ed77f175b99e", + // gOHM (MOVR) -> gOHM (ETH) + "0x3bf21ce864e58731b6f28d68d5928bcbeb0ad172": + "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f", }; const sumLegacyPools = async (balances, block, chain, transform) => { @@ -164,6 +265,34 @@ const mapStables = (data) => { return stables; }; +const bridgeTVL = async (balances, data, block, chain, transform) => { + await sumTokens( + balances, + data.bridgeAssets.map((x) => [x, data.bridge]), + block, + chain, + transform + ); + + const { output } = await sdk.api.abi.multiCall({ + calls: data.bridgeAssets.map((x) => ({ + target: data.bridge, + params: [x], + })), + abi, + block, + chain, + }); + + // Take away unwithdrawn admin fees from bridge contract's balance. + output.forEach((x) => { + const token = x.input.params[0]; + balances[transform(token)] = BigNumber(balances[transform(token)]) + .minus(x.output) + .toFixed(0); + }); +}; + const chainTVL = (chain) => { const transform = (token) => { if (token === DATA[chain].nusd) return TUSD; @@ -181,6 +310,7 @@ const chainTVL = (chain) => { const data = DATA[chain]; await sumTokens(balances, mapStables(data), block, chain, transform); + await bridgeTVL(balances, data, block, chain, transform); if (chain !== "ethereum") await sumLegacyPools(balances, block, chain, transform); @@ -199,6 +329,7 @@ module.exports = chainExports(chainTVL, [ "harmony", "boba", "optimism", + "moonriver", ]); -module.exports.methodology = "Synapse AMM pools are counted as TVL"; +module.exports.methodology = `Synapse AMM pools and tokens locked on the Synapse bridge are counted as TVL`; module.exports.misrepresentedTokens = true; From c7beeca71ea7a91a0d36e7b7238a2ff108f5fcc1 Mon Sep 17 00:00:00 2001 From: BlazeWasHere Date: Sat, 4 Dec 2021 22:10:48 +0000 Subject: [PATCH 160/393] add pool2 --- projects/helper/unwrapLPs.js | 1171 ++++++++++++++++++++-------------- projects/synapse/abi.json | 19 + projects/synapse/index.js | 19 +- 3 files changed, 714 insertions(+), 495 deletions(-) create mode 100644 projects/synapse/abi.json diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 1ca0f97ee2..3ade9585b3 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -1,404 +1,550 @@ const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const token0 = require('./abis/token0.json') -const {getPoolTokens, getPoolId} = require('./abis/balancer.json') -const getPricePerShare = require('./abis/getPricePerShare.json') -const {requery} = require('./requery') -const creamAbi = require('./abis/cream.json') +const token0 = require("./abis/token0.json"); +const { getPoolTokens, getPoolId } = require("./abis/balancer.json"); +const getPricePerShare = require("./abis/getPricePerShare.json"); +const { requery } = require("./requery"); +const creamAbi = require("./abis/cream.json"); const crvPools = { - '0x6c3f90f043a72fa612cbac8115ee7e52bde6e490': { - swapContract: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', - underlyingTokens: ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f'], - }, - '0x194ebd173f6cdace046c53eacce9b953f28411d1': { - swapContract: '0x0Ce6a5fF5217e38315f87032CF90686C96627CAA', - underlyingTokens: ['0xdb25f211ab05b1c97d595516f45794528a807ad8', '0xd71ecff9342a5ced620049e616c5035f1db98620'], - }, - '0x075b1bb99792c9e1041ba13afef80c91a1e70fb3': { - swapContract: '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', - underlyingTokens: ['0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6'], - }, - // Nerve - '0xf2511b5e4fb0e5e2d123004b672ba14850478c14': { - swapContract: '0x1B3771a66ee31180906972580adE9b81AFc5fCDc', - underlyingTokens: ['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0x55d398326f99059ff775485246999027b3197955', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d'], - }, - // DOP-LP BSC - '0x9116f04092828390799514bac9986529d70c3791': { - swapContract: '0x5162f992EDF7101637446ecCcD5943A9dcC63A8A', - underlyingTokens: [ - '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' - ], - }, - // DOP-2P-LP BSC - '0x124166103814e5a033869c88e0f40c61700fca17': { - swapContract: '0x449256e20ac3ed7F9AE81c2583068f7508d15c02', - underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955' - ], - }, - // DOP-UST-LP BSC - '0x7edcdc8cd062948ce9a9bc38c477e6aa244dd545': { - swapContract: '0x830e287ac5947B1C0DA865dfB3Afd7CdF7900464', - underlyingTokens: [ - '0x23396cF899Ca06c4472205fC903bDB4de249D6fC', - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955' - ], - }, - // DOP-3P-LP BSC - '0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c': { - swapContract: '0x61f864a7dFE66Cc818a4Fd0baabe845323D70454', - underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0xfF54da7CAF3BC3D34664891fC8f3c9B6DeA6c7A5' - ], - }, - // 3P-QLP BSC - '0xb0f0983b32352a1cfaec143731ddd8a5f6e78b1f': { - swapContract: '0x3ED4b2070E3DB5eF5092F504145FB8150CfFE5Ea', - underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' - ], - }, - // IS3USD Polygon - "0xb4d09ff3dA7f9e9A2BA029cb0A81A989fd7B8f17": { - swapContract: "0x837503e8A8753ae17fB8C8151B8e6f586defCb57", - underlyingTokens: [ - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" - ] - }, - // am3CRV Polygon - "0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171": { - swapContract: "0x445FE580eF8d70FF569aB36e80c647af338db351", - underlyingTokens: [ - "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", - "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", - "0x60D55F02A771d515e077c9C2403a1ef324885CeC" - ] - }, - // sCRV Eth - "0xc25a3a3b969415c80451098fa907ec722572917f": { - swapContract: "0xA5407eAE9Ba41422680e2e00537571bcC53efBfD", - underlyingTokens: [ - "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x6b175474e89094c44da98b954eedeac495271d0f", - "0x57ab1ec28d129707052df4df418d58a2d46d5f51" - ] - }, - // renBTC Eth - "0x49849c98ae39fff122806c06791fa73784fb3675": { - swapContract: "0x93054188d876f558f4a66B2EF1d97d16eDf0895B", - underlyingTokens: [ - "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" - ] - }, - // lusd Eth - "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca": { - swapContract: "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca", - underlyingTokens: [ - "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490" - ] - }, - // steCRV Eth - "0x06325440d014e39736583c165c2963ba99faf14e": { - swapContract: "0xdc24316b9ae028f1497c275eb9192a3ea0f67022", - underlyingTokens: ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"] - }, - // fraxCRV Eth - "0xd632f22692fac7611d2aa1c0d552930d43caed3b": { - swapContract: "0xd632f22692fac7611d2aa1c0d552930d43caed3b", - underlyingTokens: [ - "0x853d955acef822db058eb8505911ed77f175b99e", - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490" - ] - }, - // seCRV Eth - "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c": { - swapContract: "0xc5424B857f758E906013F3555Dad202e4bdB4567", - underlyingTokens: ["0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb"] - }, - // btcCRV Polygon - "0xf8a57c1d3b9629b77b6726a042ca48990a84fb49": { - swapContract: "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", - underlyingTokens: [ - "0x5c2ed810328349100A66B82b78a1791B101C9D61", - "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501" - ] - }, - // gondolaDAIeUSDTe Avax - "0xd7d4a4c67e9c1f5a913bc38e87e228f4b8820e8a": { - swapContract: "0xCF97190fAAfea63523055eBd139c008cdb4468eB", - underlyingTokens: [ - "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", - "0xc7198437980c041c805a1edcba50c1ce5db95118" - ] - }, - // gondolaYAKPool Avax - "0x7f1e6a8730fec77f27daeecd82e1941518383a62": { - swapContract: "0xd72Dc856868f964D37D01CeA7A7a3c1F4da4F98f", - underlyingTokens: [ - "0xddaaad7366b455aff8e7c82940c43ceb5829b604", - "0x59414b3089ce2af0010e7523dea7e2b35d776ec7" - ] - }, - // gondolaUSDCe Avax - "0x4dc5a6308338e540aa97faab7fd2e03876075413": { - swapContract: "0x4b941276eb39d114c89514791d073a085acba3c0", - underlyingTokens: [ - "0xc7198437980c041c805a1edcba50c1ce5db95118", - "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664" - ] - }, - // av3CRV Avax - "0x1337bedc9d22ecbe766df105c9623922a27963ec": { - swapContract: "0x7f90122BF0700F9E7e1F688fe926940E8839F353", - underlyingTokens: [ - "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", - "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", - "0x532E6537FEA298397212F09A61e03311686f548e" - ] - }, - // MIM-fUSDT-USDC Fantom - "0x2dd7C9371965472E5A5fD28fbE165007c61439E1": { - swapContract: "0x3a1659Ddcf2339Be3aeA159cA010979FB49155FF", - underlyingTokens: [ - "0x82f0B8B456c1A451378467398982d4834b6829c1", - "0x049d68029688eAbF473097a2fC38ef61633A3C7A", - "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75" - ] - }, -} + "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490": { + swapContract: "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7", + underlyingTokens: [ + "0xdac17f958d2ee523a2206206994597c13d831ec7", + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "0x6b175474e89094c44da98b954eedeac495271d0f", + ], + }, + "0x194ebd173f6cdace046c53eacce9b953f28411d1": { + swapContract: "0x0Ce6a5fF5217e38315f87032CF90686C96627CAA", + underlyingTokens: [ + "0xdb25f211ab05b1c97d595516f45794528a807ad8", + "0xd71ecff9342a5ced620049e616c5035f1db98620", + ], + }, + "0x075b1bb99792c9e1041ba13afef80c91a1e70fb3": { + swapContract: "0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714", + underlyingTokens: [ + "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", + ], + }, + // Nerve + "0xf2511b5e4fb0e5e2d123004b672ba14850478c14": { + swapContract: "0x1B3771a66ee31180906972580adE9b81AFc5fCDc", + underlyingTokens: [ + "0xe9e7cea3dedca5984780bafc599bd69add087d56", + "0x55d398326f99059ff775485246999027b3197955", + "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", + ], + }, + // DOP-LP BSC + "0x9116f04092828390799514bac9986529d70c3791": { + swapContract: "0x5162f992EDF7101637446ecCcD5943A9dcC63A8A", + underlyingTokens: [ + "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + "0x55d398326f99059fF775485246999027B3197955", + "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + ], + }, + // DOP-2P-LP BSC + "0x124166103814e5a033869c88e0f40c61700fca17": { + swapContract: "0x449256e20ac3ed7F9AE81c2583068f7508d15c02", + underlyingTokens: [ + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + "0x55d398326f99059fF775485246999027B3197955", + ], + }, + // DOP-UST-LP BSC + "0x7edcdc8cd062948ce9a9bc38c477e6aa244dd545": { + swapContract: "0x830e287ac5947B1C0DA865dfB3Afd7CdF7900464", + underlyingTokens: [ + "0x23396cF899Ca06c4472205fC903bDB4de249D6fC", + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + "0x55d398326f99059fF775485246999027B3197955", + ], + }, + // DOP-3P-LP BSC + "0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c": { + swapContract: "0x61f864a7dFE66Cc818a4Fd0baabe845323D70454", + underlyingTokens: [ + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + "0x55d398326f99059fF775485246999027B3197955", + "0xfF54da7CAF3BC3D34664891fC8f3c9B6DeA6c7A5", + ], + }, + // 3P-QLP BSC + "0xb0f0983b32352a1cfaec143731ddd8a5f6e78b1f": { + swapContract: "0x3ED4b2070E3DB5eF5092F504145FB8150CfFE5Ea", + underlyingTokens: [ + "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", + "0x55d398326f99059fF775485246999027B3197955", + "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", + ], + }, + // IS3USD Polygon + "0xb4d09ff3dA7f9e9A2BA029cb0A81A989fd7B8f17": { + swapContract: "0x837503e8A8753ae17fB8C8151B8e6f586defCb57", + underlyingTokens: [ + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + ], + }, + // am3CRV Polygon + "0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171": { + swapContract: "0x445FE580eF8d70FF569aB36e80c647af338db351", + underlyingTokens: [ + "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", + "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", + "0x60D55F02A771d515e077c9C2403a1ef324885CeC", + ], + }, + // sCRV Eth + "0xc25a3a3b969415c80451098fa907ec722572917f": { + swapContract: "0xA5407eAE9Ba41422680e2e00537571bcC53efBfD", + underlyingTokens: [ + "0xdac17f958d2ee523a2206206994597c13d831ec7", + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "0x6b175474e89094c44da98b954eedeac495271d0f", + "0x57ab1ec28d129707052df4df418d58a2d46d5f51", + ], + }, + // renBTC Eth + "0x49849c98ae39fff122806c06791fa73784fb3675": { + swapContract: "0x93054188d876f558f4a66B2EF1d97d16eDf0895B", + underlyingTokens: [ + "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", + ], + }, + // lusd Eth + "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca": { + swapContract: "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca", + underlyingTokens: [ + "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", + ], + }, + // steCRV Eth + "0x06325440d014e39736583c165c2963ba99faf14e": { + swapContract: "0xdc24316b9ae028f1497c275eb9192a3ea0f67022", + underlyingTokens: ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"], + }, + // fraxCRV Eth + "0xd632f22692fac7611d2aa1c0d552930d43caed3b": { + swapContract: "0xd632f22692fac7611d2aa1c0d552930d43caed3b", + underlyingTokens: [ + "0x853d955acef822db058eb8505911ed77f175b99e", + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", + ], + }, + // seCRV Eth + "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c": { + swapContract: "0xc5424B857f758E906013F3555Dad202e4bdB4567", + underlyingTokens: ["0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb"], + }, + // btcCRV Polygon + "0xf8a57c1d3b9629b77b6726a042ca48990a84fb49": { + swapContract: "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", + underlyingTokens: [ + "0x5c2ed810328349100A66B82b78a1791B101C9D61", + "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501", + ], + }, + // gondolaDAIeUSDTe Avax + "0xd7d4a4c67e9c1f5a913bc38e87e228f4b8820e8a": { + swapContract: "0xCF97190fAAfea63523055eBd139c008cdb4468eB", + underlyingTokens: [ + "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "0xc7198437980c041c805a1edcba50c1ce5db95118", + ], + }, + // gondolaYAKPool Avax + "0x7f1e6a8730fec77f27daeecd82e1941518383a62": { + swapContract: "0xd72Dc856868f964D37D01CeA7A7a3c1F4da4F98f", + underlyingTokens: [ + "0xddaaad7366b455aff8e7c82940c43ceb5829b604", + "0x59414b3089ce2af0010e7523dea7e2b35d776ec7", + ], + }, + // gondolaUSDCe Avax + "0x4dc5a6308338e540aa97faab7fd2e03876075413": { + swapContract: "0x4b941276eb39d114c89514791d073a085acba3c0", + underlyingTokens: [ + "0xc7198437980c041c805a1edcba50c1ce5db95118", + "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", + ], + }, + // av3CRV Avax + "0x1337bedc9d22ecbe766df105c9623922a27963ec": { + swapContract: "0x7f90122BF0700F9E7e1F688fe926940E8839F353", + underlyingTokens: [ + "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", + "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", + "0x532E6537FEA298397212F09A61e03311686f548e", + ], + }, + // MIM-fUSDT-USDC Fantom + "0x2dd7C9371965472E5A5fD28fbE165007c61439E1": { + swapContract: "0x3a1659Ddcf2339Be3aeA159cA010979FB49155FF", + underlyingTokens: [ + "0x82f0B8B456c1A451378467398982d4834b6829c1", + "0x049d68029688eAbF473097a2fC38ef61633A3C7A", + "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", + ], + }, +}; const yearnVaults = { - // yvToken: underlying, eg yvYFI:YFI - // yvYFI v2 - "0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", - // yvWETH v2 - "0xa258c4606ca8206d8aa700ce2143d7db854d168c": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvWETH v1 - "0xa9fe4601811213c340e850ea305481aff02f5b28": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvUSDT v2 - "0x7da96a3891add058ada2e826306d812c638d87a7": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yvUSDC v2 - "0x5f18c75abdae578b483e5f43f12a39cf75b973a9": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yvcrvSTETH - "0xdcd90c7f6324cfa40d7169ef80b12031770b4325": "0x06325440d014e39736583c165c2963ba99faf14e", - // yvcrvIB - "0x27b7b1ad7288079a66d12350c828d3c00a6f07d7": "0x5282a4ef67d9c33135340fb3289cc1711c13638c", -} -async function unwrapYearn(balances, yToken, block, chain = "ethereum", transformAddress=(addr)=>addr) { - //if (yearnVaults[yToken.toLowerCase()] == undefined) { return; }; - const underlying = yearnVaults[yToken.toLowerCase()]; + // yvToken: underlying, eg yvYFI:YFI + // yvYFI v2 + "0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1": + "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", + // yvWETH v2 + "0xa258c4606ca8206d8aa700ce2143d7db854d168c": + "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + // yvWETH v1 + "0xa9fe4601811213c340e850ea305481aff02f5b28": + "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + // yvUSDT v2 + "0x7da96a3891add058ada2e826306d812c638d87a7": + "0xdac17f958d2ee523a2206206994597c13d831ec7", + // yvUSDC v2 + "0x5f18c75abdae578b483e5f43f12a39cf75b973a9": + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + // yvcrvSTETH + "0xdcd90c7f6324cfa40d7169ef80b12031770b4325": + "0x06325440d014e39736583c165c2963ba99faf14e", + // yvcrvIB + "0x27b7b1ad7288079a66d12350c828d3c00a6f07d7": + "0x5282a4ef67d9c33135340fb3289cc1711c13638c", +}; +async function unwrapYearn( + balances, + yToken, + block, + chain = "ethereum", + transformAddress = (addr) => addr +) { + //if (yearnVaults[yToken.toLowerCase()] == undefined) { return; }; + const underlying = yearnVaults[yToken.toLowerCase()]; - let pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[1], - block: block, - chain: chain + let pricePerShare = await sdk.api.abi.call({ + target: yToken, + abi: getPricePerShare[1], + block: block, + chain: chain, + }); + if (pricePerShare == undefined) { + pricePerShare = await sdk.api.abi.call({ + target: yToken, + abi: getPricePerShare[0], + block: block, + chain: chain, }); - if (pricePerShare == undefined) { - pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[0], - block: block, - chain: chain - }); - }; - - sdk.util.sumSingleBalance(balances, transformAddress(underlying), - balances[yToken] * pricePerShare.output / 10 ** - (await sdk.api.erc20.decimals(underlying, chain)).output); - delete balances[yToken]; -}; -async function unwrapCrv(balances, crvToken, balance3Crv, block, chain = "ethereum", transformAddress=(addr)=>addr) { - if(crvPools[crvToken.toLowerCase()] === undefined){ - return - } - const crvSwapContract = crvPools[crvToken.toLowerCase()].swapContract - const underlyingTokens = crvPools[crvToken.toLowerCase()].underlyingTokens - const crvTotalSupply = sdk.api.erc20.totalSupply({ - target: crvToken, - block, - chain - }) - const underlyingSwapTokens = (await sdk.api.abi.multiCall({ - calls: underlyingTokens.map(token => ({ - target: token, - params: [crvSwapContract] - })), - block, - chain, - abi: 'erc20:balanceOf' - })).output + } - // steth and seth case where balanceOf not applicable on ETH balance - if (crvToken.toLowerCase() === "0x06325440d014e39736583c165c2963ba99faf14e" || crvToken.toLowerCase() === "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c") { - underlyingSwapTokens[0].output = underlyingSwapTokens[0].output * 2; - } - const resolvedCrvTotalSupply = (await crvTotalSupply).output - underlyingSwapTokens.forEach(call => { - const underlyingBalance = BigNumber(call.output).times(balance3Crv).div(resolvedCrvTotalSupply); - sdk.util.sumSingleBalance(balances, transformAddress(call.input.target), underlyingBalance.toFixed(0)) + sdk.util.sumSingleBalance( + balances, + transformAddress(underlying), + (balances[yToken] * pricePerShare.output) / + 10 ** (await sdk.api.erc20.decimals(underlying, chain)).output + ); + delete balances[yToken]; +} +async function unwrapCrv( + balances, + crvToken, + balance3Crv, + block, + chain = "ethereum", + transformAddress = (addr) => addr +) { + if (crvPools[crvToken.toLowerCase()] === undefined) { + return; + } + const crvSwapContract = crvPools[crvToken.toLowerCase()].swapContract; + const underlyingTokens = crvPools[crvToken.toLowerCase()].underlyingTokens; + const crvTotalSupply = sdk.api.erc20.totalSupply({ + target: crvToken, + block, + chain, + }); + const underlyingSwapTokens = ( + await sdk.api.abi.multiCall({ + calls: underlyingTokens.map((token) => ({ + target: token, + params: [crvSwapContract], + })), + block, + chain, + abi: "erc20:balanceOf", }) + ).output; + + // steth and seth case where balanceOf not applicable on ETH balance + if ( + crvToken.toLowerCase() === "0x06325440d014e39736583c165c2963ba99faf14e" || + crvToken.toLowerCase() === "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c" + ) { + underlyingSwapTokens[0].output = underlyingSwapTokens[0].output * 2; + } + const resolvedCrvTotalSupply = (await crvTotalSupply).output; + underlyingSwapTokens.forEach((call) => { + const underlyingBalance = BigNumber(call.output) + .times(balance3Crv) + .div(resolvedCrvTotalSupply); + sdk.util.sumSingleBalance( + balances, + transformAddress(call.input.target), + underlyingBalance.toFixed(0) + ); + }); } -const lpReservesAbi = { "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" } -const lpSuppliesAbi = {"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"} -const token0Abi = {"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"} -const token1Abi = {"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"} +const lpReservesAbi = { + 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", +}; +const lpSuppliesAbi = { + constant: true, + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", +}; +const token0Abi = { + constant: true, + inputs: [], + name: "token0", + outputs: [{ internalType: "address", name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", +}; +const token1Abi = { + constant: true, + inputs: [], + name: "token1", + outputs: [{ internalType: "address", name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", +}; /* lpPositions:{ balance, token }[] */ -async function unwrapUniswapLPs(balances, lpPositions, block, chain='ethereum', transformAddress=(addr)=>addr, excludeTokensRaw = [], retry = false) { - const excludeTokens = excludeTokensRaw.map(addr=>addr.toLowerCase()) - const lpTokenCalls = lpPositions.map(lpPosition=>({ - target: lpPosition.token - })) - const lpReserves = sdk.api.abi.multiCall({ - block, - abi: lpReservesAbi, - calls: lpTokenCalls, - chain - }) - const lpSupplies = sdk.api.abi.multiCall({ - block, - abi: lpSuppliesAbi, - calls: lpTokenCalls, - chain +async function unwrapUniswapLPs( + balances, + lpPositions, + block, + chain = "ethereum", + transformAddress = (addr) => addr, + excludeTokensRaw = [], + retry = false +) { + const excludeTokens = excludeTokensRaw.map((addr) => addr.toLowerCase()); + const lpTokenCalls = lpPositions.map((lpPosition) => ({ + target: lpPosition.token, + })); + const lpReserves = sdk.api.abi.multiCall({ + block, + abi: lpReservesAbi, + calls: lpTokenCalls, + chain, + }); + const lpSupplies = sdk.api.abi.multiCall({ + block, + abi: lpSuppliesAbi, + calls: lpTokenCalls, + chain, + }); + const tokens0 = sdk.api.abi.multiCall({ + block, + abi: token0Abi, + calls: lpTokenCalls, + chain, + }); + const tokens1 = sdk.api.abi.multiCall({ + block, + abi: token1Abi, + calls: lpTokenCalls, + chain, + }); + if (retry) { + await Promise.all( + [ + [lpReserves, lpReservesAbi], + [lpSupplies, lpSuppliesAbi], + [tokens0, token0Abi], + [tokens1, token1Abi], + ].map(async (call) => { + await requery(await call[0], chain, block, call[1]); }) - const tokens0 = sdk.api.abi.multiCall({ - block, - abi:token0Abi, - calls: lpTokenCalls, - chain - }) - const tokens1 = sdk.api.abi.multiCall({ - block, - abi:token1Abi, - calls: lpTokenCalls, - chain - }) - if(retry){ - await Promise.all([ - [lpReserves, lpReservesAbi], - [lpSupplies, lpSuppliesAbi], - [tokens0, token0Abi], - [tokens1, token1Abi] - ].map(async call=>{ - await requery(await call[0], chain, block, call[1]) - })) + ); + } + await Promise.all( + lpPositions.map(async (lpPosition) => { + try { + const lpToken = lpPosition.token; + const token0 = (await tokens0).output + .find((call) => call.input.target === lpToken) + .output.toLowerCase(); + const token1 = (await tokens1).output + .find((call) => call.input.target === lpToken) + .output.toLowerCase(); + if (excludeTokens.includes(token0) || excludeTokens.includes(token1)) { + return; + } + const supply = (await lpSupplies).output.find( + (call) => call.input.target === lpToken + ).output; + const { _reserve0, _reserve1 } = (await lpReserves).output.find( + (call) => call.input.target === lpToken + ).output; + const token0Balance = BigNumber(lpPosition.balance) + .times(BigNumber(_reserve0)) + .div(BigNumber(supply)); + sdk.util.sumSingleBalance( + balances, + await transformAddress(token0), + token0Balance.toFixed(0) + ); + const token1Balance = BigNumber(lpPosition.balance) + .times(BigNumber(_reserve1)) + .div(BigNumber(supply)); + sdk.util.sumSingleBalance( + balances, + await transformAddress(token1), + token1Balance.toFixed(0) + ); + } catch (e) { + console.log( + `Failed to get data for LP token at ${lpPosition.token} on chain ${chain}` + ); + throw e; } - await Promise.all(lpPositions.map(async lpPosition => { - try{ - const lpToken = lpPosition.token - const token0 = (await tokens0).output.find(call=>call.input.target === lpToken).output.toLowerCase() - const token1 = (await tokens1).output.find(call=>call.input.target === lpToken).output.toLowerCase() - if(excludeTokens.includes(token0) || excludeTokens.includes(token1)){ - return - } - const supply = (await lpSupplies).output.find(call=>call.input.target === lpToken).output - const {_reserve0, _reserve1} = (await lpReserves).output.find(call=>call.input.target === lpToken).output - const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token0), token0Balance.toFixed(0)) - const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token1), token1Balance.toFixed(0)) - } catch(e){ - console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) - throw e - } - })) + }) + ); } -async function addBalanceOfTokensAndLPs(balances, balanceResult, block){ - await addTokensAndLPs(balances, { - output: balanceResult.output.map(t=>({output:t.input.target})) +async function addBalanceOfTokensAndLPs(balances, balanceResult, block) { + await addTokensAndLPs( + balances, + { + output: balanceResult.output.map((t) => ({ output: t.input.target })), }, balanceResult, - block) + block + ); } // Unwrap the tokens that are LPs and directly add the others // To be used when you don't know which tokens are LPs and which are not -async function addTokensAndLPs(balances, tokens, amounts, block, chain = "ethereum", transformAddress=id=>id){ - const tokens0 = await sdk.api.abi.multiCall({ - calls:tokens.output.map(t=>({ - target: t.output - })), - abi: token0, - block, - chain - }) - const lpBalances = [] - tokens0.output.forEach((result, idx)=>{ - const token = tokens.output[idx].output - const balance = amounts.output[idx].output - if(result.success){ - lpBalances.push({ - token, - balance - }) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }) - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) +async function addTokensAndLPs( + balances, + tokens, + amounts, + block, + chain = "ethereum", + transformAddress = (id) => id +) { + const tokens0 = await sdk.api.abi.multiCall({ + calls: tokens.output.map((t) => ({ + target: t.output, + })), + abi: token0, + block, + chain, + }); + const lpBalances = []; + tokens0.output.forEach((result, idx) => { + const token = tokens.output[idx].output; + const balance = amounts.output[idx].output; + if (result.success) { + lpBalances.push({ + token, + balance, + }); + } else { + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + } + }); + await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress); } -function addressesEqual(a,b){ - return a.toLowerCase() === b.toLowerCase() +function addressesEqual(a, b) { + return a.toLowerCase() === b.toLowerCase(); } /* tokens [ [token, isLP] - eg ["0xaaa", true] ] */ -async function sumTokensAndLPsSharedOwners(balances, tokens, owners, block, chain = "ethereum", transformAddress=id=>id){ - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokens.map(t=>owners.map(o=>({ - target: t[0], - params: o - }))).flat(), - abi: 'erc20:balanceOf', - block, - chain - }) - await requery(balanceOfTokens, chain, block, 'erc20:balanceOf') - const isLP = {} - tokens.forEach(token=>{ - isLP[token[0].toLowerCase()]=token[1] - }) - const lpBalances = [] - balanceOfTokens.output.forEach((result, idx)=>{ - const token = result.input.target.toLowerCase() - const balance = result.output - if(isLP[token] === true){ - lpBalances.push({ - token, - balance - }) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }) - if(lpBalances.length > 0){ - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) +async function sumTokensAndLPsSharedOwners( + balances, + tokens, + owners, + block, + chain = "ethereum", + transformAddress = (id) => id +) { + const balanceOfTokens = await sdk.api.abi.multiCall({ + calls: tokens + .map((t) => + owners.map((o) => ({ + target: t[0], + params: o, + })) + ) + .flat(), + abi: "erc20:balanceOf", + block, + chain, + }); + await requery(balanceOfTokens, chain, block, "erc20:balanceOf"); + const isLP = {}; + tokens.forEach((token) => { + isLP[token[0].toLowerCase()] = token[1]; + }); + const lpBalances = []; + balanceOfTokens.output.forEach((result, idx) => { + const token = result.input.target.toLowerCase(); + const balance = result.output; + if (isLP[token] === true) { + lpBalances.push({ + token, + balance, + }); + } else { + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); } + }); + if (lpBalances.length > 0) { + await unwrapUniswapLPs( + balances, + lpBalances, + block, + chain, + transformAddress + ); + } } /* @@ -406,79 +552,101 @@ tokens [ [token, owner, isLP] - eg ["0xaaa", "0xbbb", true] ] */ -async function sumTokensAndLPs(balances, tokens, block, chain = "ethereum", transformAddress=id=>id){ - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokens.map(t=>({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }) - const lpBalances = [] - balanceOfTokens.output.forEach((result, idx)=>{ - const token = result.input.target - const balance = result.output - if(tokens[idx][2]){ - lpBalances.push({ - token, - balance - }) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }) - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) +async function sumTokensAndLPs( + balances, + tokens, + block, + chain = "ethereum", + transformAddress = (id) => id +) { + const balanceOfTokens = await sdk.api.abi.multiCall({ + calls: tokens.map((t) => ({ + target: t[0], + params: t[1], + })), + abi: "erc20:balanceOf", + block, + chain, + }); + const lpBalances = []; + balanceOfTokens.output.forEach((result, idx) => { + const token = result.input.target; + const balance = result.output; + if (tokens[idx][2]) { + lpBalances.push({ + token, + balance, + }); + } else { + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + } + }); + await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress); } -const balancerVault = "0xBA12222222228d8Ba445958a75a0704d566BF2C8" -async function sumBalancerLps(balances, tokensAndOwners, block, chain, transformAddress){ - const poolIds = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0] - })), - abi: getPoolId, - block, - chain - }) - const balancerPoolSupplies = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0] - })), - abi: 'erc20:totalSupply', - block, - chain - }) - const balanceOfTokens = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain +const balancerVault = "0xBA12222222228d8Ba445958a75a0704d566BF2C8"; +async function sumBalancerLps( + balances, + tokensAndOwners, + block, + chain, + transformAddress +) { + const poolIds = sdk.api.abi.multiCall({ + calls: tokensAndOwners.map((t) => ({ + target: t[0], + })), + abi: getPoolId, + block, + chain, + }); + const balancerPoolSupplies = sdk.api.abi.multiCall({ + calls: tokensAndOwners.map((t) => ({ + target: t[0], + })), + abi: "erc20:totalSupply", + block, + chain, + }); + const balanceOfTokens = sdk.api.abi.multiCall({ + calls: tokensAndOwners.map((t) => ({ + target: t[0], + params: t[1], + })), + abi: "erc20:balanceOf", + block, + chain, + }); + const balancerPoolsPromise = sdk.api.abi.multiCall({ + calls: (await poolIds).output.map((o) => ({ + target: balancerVault, + params: o.output, + })), + abi: getPoolTokens, + block, + chain, + }); + const [poolSupplies, tokenBalances, balancerPools] = await Promise.all([ + balancerPoolSupplies, + balanceOfTokens, + balancerPoolsPromise, + ]); + tokenBalances.output.forEach((result, idx) => { + const lpBalance = result.output; + const balancerPool = balancerPools.output[idx].output; + const supply = poolSupplies.output[idx].output; + balancerPool.tokens.forEach((token, tokenIndex) => { + const tokensInPool = balancerPool.balances[tokenIndex]; + const underlyingBalance = BigNumber(tokensInPool) + .times(lpBalance) + .div(supply); + sdk.util.sumSingleBalance( + balances, + transformAddress(token), + underlyingBalance.toFixed(0) + ); }); - const balancerPoolsPromise = sdk.api.abi.multiCall({ - calls: (await poolIds).output.map(o => ({ - target: balancerVault, - params: o.output - })), - abi: getPoolTokens, - block, - chain - }) - const [poolSupplies, tokenBalances, balancerPools] = await Promise.all([balancerPoolSupplies, balanceOfTokens, balancerPoolsPromise]) - tokenBalances.output.forEach((result, idx)=>{ - const lpBalance = result.output - const balancerPool = balancerPools.output[idx].output - const supply = poolSupplies.output[idx].output - balancerPool.tokens.forEach((token, tokenIndex)=>{ - const tokensInPool = balancerPool.balances[tokenIndex] - const underlyingBalance = BigNumber(tokensInPool).times(lpBalance).div(supply) - sdk.util.sumSingleBalance(balances, transformAddress(token), underlyingBalance.toFixed(0)); - }) - }) + }); } /* @@ -486,67 +654,82 @@ tokensAndOwners [ [token, owner] - eg ["0xaaa", "0xbbb"] ] */ -async function sumTokens(balances, tokensAndOwners, block, chain = "ethereum", transformAddress=id=>id){ - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t=>({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }) - balanceOfTokens.output.forEach((result, idx)=>{ - const token = result.input.target - const balance = result.output - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - }) +async function sumTokens( + balances, + tokensAndOwners, + block, + chain = "ethereum", + transformAddress = (id) => id +) { + const balanceOfTokens = await sdk.api.abi.multiCall({ + calls: tokensAndOwners.map((t) => ({ + target: t[0], + params: t[1], + })), + abi: "erc20:balanceOf", + block, + chain, + }); + balanceOfTokens.output.forEach((result, idx) => { + const token = result.input.target; + const balance = result.output; + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + }); } -async function unwrapCreamTokens(balances, tokensAndOwners, block, chain = "ethereum", transformAddress=id=>id){ - const [balanceOfTokens, exchangeRates, underlyingTokens] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - })), - abi: creamAbi.exchangeRateStored, - block, - chain - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - })), - abi: creamAbi.underlying, - block, - chain - }) - ]) - balanceOfTokens.output.forEach((balanceCall, i)=>{ - const underlying = underlyingTokens.output[i].output - const balance = BigNumber(balanceCall.output).times(exchangeRates.output[i].output).div(1e18).toFixed(0) - sdk.util.sumSingleBalance(balances, transformAddress(underlying), balance) - }) +async function unwrapCreamTokens( + balances, + tokensAndOwners, + block, + chain = "ethereum", + transformAddress = (id) => id +) { + const [balanceOfTokens, exchangeRates, underlyingTokens] = await Promise.all([ + sdk.api.abi.multiCall({ + calls: tokensAndOwners.map((t) => ({ + target: t[0], + params: t[1], + })), + abi: "erc20:balanceOf", + block, + chain, + }), + sdk.api.abi.multiCall({ + calls: tokensAndOwners.map((t) => ({ + target: t[0], + })), + abi: creamAbi.exchangeRateStored, + block, + chain, + }), + sdk.api.abi.multiCall({ + calls: tokensAndOwners.map((t) => ({ + target: t[0], + })), + abi: creamAbi.underlying, + block, + chain, + }), + ]); + balanceOfTokens.output.forEach((balanceCall, i) => { + const underlying = underlyingTokens.output[i].output; + const balance = BigNumber(balanceCall.output) + .times(exchangeRates.output[i].output) + .div(1e18) + .toFixed(0); + sdk.util.sumSingleBalance(balances, transformAddress(underlying), balance); + }); } module.exports = { - unwrapYearn, - unwrapCrv, - unwrapUniswapLPs, - addTokensAndLPs, - sumTokensAndLPsSharedOwners, - addBalanceOfTokensAndLPs, - sumTokensAndLPs, - sumTokens, - sumBalancerLps, - unwrapCreamTokens -} + unwrapYearn, + unwrapCrv, + unwrapUniswapLPs, + addTokensAndLPs, + sumTokensAndLPsSharedOwners, + addBalanceOfTokensAndLPs, + sumTokensAndLPs, + sumTokens, + sumBalancerLps, + unwrapCreamTokens, +}; diff --git a/projects/synapse/abi.json b/projects/synapse/abi.json new file mode 100644 index 0000000000..304bdfb9f4 --- /dev/null +++ b/projects/synapse/abi.json @@ -0,0 +1,19 @@ +{ + "inputs": [ + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } + ], + "name": "getFeeBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" +} diff --git a/projects/synapse/index.js b/projects/synapse/index.js index 1df934dc07..f6385cf583 100644 --- a/projects/synapse/index.js +++ b/projects/synapse/index.js @@ -1,5 +1,8 @@ const { chainExports } = require("../helper/exports"); -const { sumTokens } = require("../helper/unwrapLPs"); +const { + sumTokensAndLPsSharedOwners, + sumTokens, +} = require("../helper/unwrapLPs"); const { getBlock } = require("../helper/getBlock"); const BigNumber = require("bignumber.js"); const sdk = require("@defillama/sdk"); @@ -293,6 +296,19 @@ const bridgeTVL = async (balances, data, block, chain, transform) => { }); }; +const ethPool2 = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + + await sumTokensAndLPsSharedOwners( + balances, + [["0x4a86c01d67965f8cb3d0aaa2c655705e64097c31", true]], // SYN/ETH SLP + ["0xd10eF2A513cEE0Db54E959eF16cAc711470B62cF"], // MiniChefV2 + ethBlock + ); + + return balances; +}; + const chainTVL = (chain) => { const transform = (token) => { if (token === DATA[chain].nusd) return TUSD; @@ -333,3 +349,4 @@ module.exports = chainExports(chainTVL, [ ]); module.exports.methodology = `Synapse AMM pools and tokens locked on the Synapse bridge are counted as TVL`; module.exports.misrepresentedTokens = true; +module.exports.ethereum.pool2 = ethPool2; From 67201d61a742132d546189b92469bebd0c89610c Mon Sep 17 00:00:00 2001 From: BlazeWasHere Date: Sat, 4 Dec 2021 22:13:48 +0000 Subject: [PATCH 161/393] add pool2 --- projects/synapse/index.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/projects/synapse/index.js b/projects/synapse/index.js index 1df934dc07..f6385cf583 100644 --- a/projects/synapse/index.js +++ b/projects/synapse/index.js @@ -1,5 +1,8 @@ const { chainExports } = require("../helper/exports"); -const { sumTokens } = require("../helper/unwrapLPs"); +const { + sumTokensAndLPsSharedOwners, + sumTokens, +} = require("../helper/unwrapLPs"); const { getBlock } = require("../helper/getBlock"); const BigNumber = require("bignumber.js"); const sdk = require("@defillama/sdk"); @@ -293,6 +296,19 @@ const bridgeTVL = async (balances, data, block, chain, transform) => { }); }; +const ethPool2 = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + + await sumTokensAndLPsSharedOwners( + balances, + [["0x4a86c01d67965f8cb3d0aaa2c655705e64097c31", true]], // SYN/ETH SLP + ["0xd10eF2A513cEE0Db54E959eF16cAc711470B62cF"], // MiniChefV2 + ethBlock + ); + + return balances; +}; + const chainTVL = (chain) => { const transform = (token) => { if (token === DATA[chain].nusd) return TUSD; @@ -333,3 +349,4 @@ module.exports = chainExports(chainTVL, [ ]); module.exports.methodology = `Synapse AMM pools and tokens locked on the Synapse bridge are counted as TVL`; module.exports.misrepresentedTokens = true; +module.exports.ethereum.pool2 = ethPool2; From 1da6166b89002a8bd8260970cd495b41b686c62d Mon Sep 17 00:00:00 2001 From: BlazeWasHere Date: Sat, 4 Dec 2021 22:16:58 +0000 Subject: [PATCH 162/393] revert --- projects/helper/unwrapLPs.js | 1171 ++++++++++++++-------------------- 1 file changed, 494 insertions(+), 677 deletions(-) diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 3ade9585b3..1ca0f97ee2 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -1,550 +1,404 @@ const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); -const token0 = require("./abis/token0.json"); -const { getPoolTokens, getPoolId } = require("./abis/balancer.json"); -const getPricePerShare = require("./abis/getPricePerShare.json"); -const { requery } = require("./requery"); -const creamAbi = require("./abis/cream.json"); +const token0 = require('./abis/token0.json') +const {getPoolTokens, getPoolId} = require('./abis/balancer.json') +const getPricePerShare = require('./abis/getPricePerShare.json') +const {requery} = require('./requery') +const creamAbi = require('./abis/cream.json') const crvPools = { - "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490": { - swapContract: "0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7", - underlyingTokens: [ - "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x6b175474e89094c44da98b954eedeac495271d0f", - ], - }, - "0x194ebd173f6cdace046c53eacce9b953f28411d1": { - swapContract: "0x0Ce6a5fF5217e38315f87032CF90686C96627CAA", - underlyingTokens: [ - "0xdb25f211ab05b1c97d595516f45794528a807ad8", - "0xd71ecff9342a5ced620049e616c5035f1db98620", - ], - }, - "0x075b1bb99792c9e1041ba13afef80c91a1e70fb3": { - swapContract: "0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714", - underlyingTokens: [ - "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", - ], - }, - // Nerve - "0xf2511b5e4fb0e5e2d123004b672ba14850478c14": { - swapContract: "0x1B3771a66ee31180906972580adE9b81AFc5fCDc", - underlyingTokens: [ - "0xe9e7cea3dedca5984780bafc599bd69add087d56", - "0x55d398326f99059ff775485246999027b3197955", - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", - ], - }, - // DOP-LP BSC - "0x9116f04092828390799514bac9986529d70c3791": { - swapContract: "0x5162f992EDF7101637446ecCcD5943A9dcC63A8A", - underlyingTokens: [ - "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "0x55d398326f99059fF775485246999027B3197955", - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", - ], - }, - // DOP-2P-LP BSC - "0x124166103814e5a033869c88e0f40c61700fca17": { - swapContract: "0x449256e20ac3ed7F9AE81c2583068f7508d15c02", - underlyingTokens: [ - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "0x55d398326f99059fF775485246999027B3197955", - ], - }, - // DOP-UST-LP BSC - "0x7edcdc8cd062948ce9a9bc38c477e6aa244dd545": { - swapContract: "0x830e287ac5947B1C0DA865dfB3Afd7CdF7900464", - underlyingTokens: [ - "0x23396cF899Ca06c4472205fC903bDB4de249D6fC", - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "0x55d398326f99059fF775485246999027B3197955", - ], - }, - // DOP-3P-LP BSC - "0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c": { - swapContract: "0x61f864a7dFE66Cc818a4Fd0baabe845323D70454", - underlyingTokens: [ - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "0x55d398326f99059fF775485246999027B3197955", - "0xfF54da7CAF3BC3D34664891fC8f3c9B6DeA6c7A5", - ], - }, - // 3P-QLP BSC - "0xb0f0983b32352a1cfaec143731ddd8a5f6e78b1f": { - swapContract: "0x3ED4b2070E3DB5eF5092F504145FB8150CfFE5Ea", - underlyingTokens: [ - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", - "0x55d398326f99059fF775485246999027B3197955", - "0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d", - ], - }, - // IS3USD Polygon - "0xb4d09ff3dA7f9e9A2BA029cb0A81A989fd7B8f17": { - swapContract: "0x837503e8A8753ae17fB8C8151B8e6f586defCb57", - underlyingTokens: [ - "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", - "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", - "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", - ], - }, - // am3CRV Polygon - "0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171": { - swapContract: "0x445FE580eF8d70FF569aB36e80c647af338db351", - underlyingTokens: [ - "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", - "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", - "0x60D55F02A771d515e077c9C2403a1ef324885CeC", - ], - }, - // sCRV Eth - "0xc25a3a3b969415c80451098fa907ec722572917f": { - swapContract: "0xA5407eAE9Ba41422680e2e00537571bcC53efBfD", - underlyingTokens: [ - "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x6b175474e89094c44da98b954eedeac495271d0f", - "0x57ab1ec28d129707052df4df418d58a2d46d5f51", - ], - }, - // renBTC Eth - "0x49849c98ae39fff122806c06791fa73784fb3675": { - swapContract: "0x93054188d876f558f4a66B2EF1d97d16eDf0895B", - underlyingTokens: [ - "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", - "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - ], - }, - // lusd Eth - "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca": { - swapContract: "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca", - underlyingTokens: [ - "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", - ], - }, - // steCRV Eth - "0x06325440d014e39736583c165c2963ba99faf14e": { - swapContract: "0xdc24316b9ae028f1497c275eb9192a3ea0f67022", - underlyingTokens: ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"], - }, - // fraxCRV Eth - "0xd632f22692fac7611d2aa1c0d552930d43caed3b": { - swapContract: "0xd632f22692fac7611d2aa1c0d552930d43caed3b", - underlyingTokens: [ - "0x853d955acef822db058eb8505911ed77f175b99e", - "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", - ], - }, - // seCRV Eth - "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c": { - swapContract: "0xc5424B857f758E906013F3555Dad202e4bdB4567", - underlyingTokens: ["0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb"], - }, - // btcCRV Polygon - "0xf8a57c1d3b9629b77b6726a042ca48990a84fb49": { - swapContract: "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", - underlyingTokens: [ - "0x5c2ed810328349100A66B82b78a1791B101C9D61", - "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501", - ], - }, - // gondolaDAIeUSDTe Avax - "0xd7d4a4c67e9c1f5a913bc38e87e228f4b8820e8a": { - swapContract: "0xCF97190fAAfea63523055eBd139c008cdb4468eB", - underlyingTokens: [ - "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", - "0xc7198437980c041c805a1edcba50c1ce5db95118", - ], - }, - // gondolaYAKPool Avax - "0x7f1e6a8730fec77f27daeecd82e1941518383a62": { - swapContract: "0xd72Dc856868f964D37D01CeA7A7a3c1F4da4F98f", - underlyingTokens: [ - "0xddaaad7366b455aff8e7c82940c43ceb5829b604", - "0x59414b3089ce2af0010e7523dea7e2b35d776ec7", - ], - }, - // gondolaUSDCe Avax - "0x4dc5a6308338e540aa97faab7fd2e03876075413": { - swapContract: "0x4b941276eb39d114c89514791d073a085acba3c0", - underlyingTokens: [ - "0xc7198437980c041c805a1edcba50c1ce5db95118", - "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664", - ], - }, - // av3CRV Avax - "0x1337bedc9d22ecbe766df105c9623922a27963ec": { - swapContract: "0x7f90122BF0700F9E7e1F688fe926940E8839F353", - underlyingTokens: [ - "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", - "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", - "0x532E6537FEA298397212F09A61e03311686f548e", - ], - }, - // MIM-fUSDT-USDC Fantom - "0x2dd7C9371965472E5A5fD28fbE165007c61439E1": { - swapContract: "0x3a1659Ddcf2339Be3aeA159cA010979FB49155FF", - underlyingTokens: [ - "0x82f0B8B456c1A451378467398982d4834b6829c1", - "0x049d68029688eAbF473097a2fC38ef61633A3C7A", - "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", - ], - }, -}; + '0x6c3f90f043a72fa612cbac8115ee7e52bde6e490': { + swapContract: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', + underlyingTokens: ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f'], + }, + '0x194ebd173f6cdace046c53eacce9b953f28411d1': { + swapContract: '0x0Ce6a5fF5217e38315f87032CF90686C96627CAA', + underlyingTokens: ['0xdb25f211ab05b1c97d595516f45794528a807ad8', '0xd71ecff9342a5ced620049e616c5035f1db98620'], + }, + '0x075b1bb99792c9e1041ba13afef80c91a1e70fb3': { + swapContract: '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', + underlyingTokens: ['0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6'], + }, + // Nerve + '0xf2511b5e4fb0e5e2d123004b672ba14850478c14': { + swapContract: '0x1B3771a66ee31180906972580adE9b81AFc5fCDc', + underlyingTokens: ['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0x55d398326f99059ff775485246999027b3197955', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d'], + }, + // DOP-LP BSC + '0x9116f04092828390799514bac9986529d70c3791': { + swapContract: '0x5162f992EDF7101637446ecCcD5943A9dcC63A8A', + underlyingTokens: [ + '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', + '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + '0x55d398326f99059fF775485246999027B3197955', + '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' + ], + }, + // DOP-2P-LP BSC + '0x124166103814e5a033869c88e0f40c61700fca17': { + swapContract: '0x449256e20ac3ed7F9AE81c2583068f7508d15c02', + underlyingTokens: [ + '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + '0x55d398326f99059fF775485246999027B3197955' + ], + }, + // DOP-UST-LP BSC + '0x7edcdc8cd062948ce9a9bc38c477e6aa244dd545': { + swapContract: '0x830e287ac5947B1C0DA865dfB3Afd7CdF7900464', + underlyingTokens: [ + '0x23396cF899Ca06c4472205fC903bDB4de249D6fC', + '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + '0x55d398326f99059fF775485246999027B3197955' + ], + }, + // DOP-3P-LP BSC + '0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c': { + swapContract: '0x61f864a7dFE66Cc818a4Fd0baabe845323D70454', + underlyingTokens: [ + '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + '0x55d398326f99059fF775485246999027B3197955', + '0xfF54da7CAF3BC3D34664891fC8f3c9B6DeA6c7A5' + ], + }, + // 3P-QLP BSC + '0xb0f0983b32352a1cfaec143731ddd8a5f6e78b1f': { + swapContract: '0x3ED4b2070E3DB5eF5092F504145FB8150CfFE5Ea', + underlyingTokens: [ + '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', + '0x55d398326f99059fF775485246999027B3197955', + '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' + ], + }, + // IS3USD Polygon + "0xb4d09ff3dA7f9e9A2BA029cb0A81A989fd7B8f17": { + swapContract: "0x837503e8A8753ae17fB8C8151B8e6f586defCb57", + underlyingTokens: [ + "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174" + ] + }, + // am3CRV Polygon + "0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171": { + swapContract: "0x445FE580eF8d70FF569aB36e80c647af338db351", + underlyingTokens: [ + "0x27F8D03b3a2196956ED754baDc28D73be8830A6e", + "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", + "0x60D55F02A771d515e077c9C2403a1ef324885CeC" + ] + }, + // sCRV Eth + "0xc25a3a3b969415c80451098fa907ec722572917f": { + swapContract: "0xA5407eAE9Ba41422680e2e00537571bcC53efBfD", + underlyingTokens: [ + "0xdac17f958d2ee523a2206206994597c13d831ec7", + "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + "0x6b175474e89094c44da98b954eedeac495271d0f", + "0x57ab1ec28d129707052df4df418d58a2d46d5f51" + ] + }, + // renBTC Eth + "0x49849c98ae39fff122806c06791fa73784fb3675": { + swapContract: "0x93054188d876f558f4a66B2EF1d97d16eDf0895B", + underlyingTokens: [ + "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", + "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599" + ] + }, + // lusd Eth + "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca": { + swapContract: "0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca", + underlyingTokens: [ + "0x5f98805A4E8be255a32880FDeC7F6728C6568bA0", + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490" + ] + }, + // steCRV Eth + "0x06325440d014e39736583c165c2963ba99faf14e": { + swapContract: "0xdc24316b9ae028f1497c275eb9192a3ea0f67022", + underlyingTokens: ["0xae7ab96520de3a18e5e111b5eaab095312d7fe84"] + }, + // fraxCRV Eth + "0xd632f22692fac7611d2aa1c0d552930d43caed3b": { + swapContract: "0xd632f22692fac7611d2aa1c0d552930d43caed3b", + underlyingTokens: [ + "0x853d955acef822db058eb8505911ed77f175b99e", + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490" + ] + }, + // seCRV Eth + "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c": { + swapContract: "0xc5424B857f758E906013F3555Dad202e4bdB4567", + underlyingTokens: ["0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb"] + }, + // btcCRV Polygon + "0xf8a57c1d3b9629b77b6726a042ca48990a84fb49": { + swapContract: "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", + underlyingTokens: [ + "0x5c2ed810328349100A66B82b78a1791B101C9D61", + "0xDBf31dF14B66535aF65AaC99C32e9eA844e14501" + ] + }, + // gondolaDAIeUSDTe Avax + "0xd7d4a4c67e9c1f5a913bc38e87e228f4b8820e8a": { + swapContract: "0xCF97190fAAfea63523055eBd139c008cdb4468eB", + underlyingTokens: [ + "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + "0xc7198437980c041c805a1edcba50c1ce5db95118" + ] + }, + // gondolaYAKPool Avax + "0x7f1e6a8730fec77f27daeecd82e1941518383a62": { + swapContract: "0xd72Dc856868f964D37D01CeA7A7a3c1F4da4F98f", + underlyingTokens: [ + "0xddaaad7366b455aff8e7c82940c43ceb5829b604", + "0x59414b3089ce2af0010e7523dea7e2b35d776ec7" + ] + }, + // gondolaUSDCe Avax + "0x4dc5a6308338e540aa97faab7fd2e03876075413": { + swapContract: "0x4b941276eb39d114c89514791d073a085acba3c0", + underlyingTokens: [ + "0xc7198437980c041c805a1edcba50c1ce5db95118", + "0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664" + ] + }, + // av3CRV Avax + "0x1337bedc9d22ecbe766df105c9623922a27963ec": { + swapContract: "0x7f90122BF0700F9E7e1F688fe926940E8839F353", + underlyingTokens: [ + "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a", + "0x46A51127C3ce23fb7AB1DE06226147F446e4a857", + "0x532E6537FEA298397212F09A61e03311686f548e" + ] + }, + // MIM-fUSDT-USDC Fantom + "0x2dd7C9371965472E5A5fD28fbE165007c61439E1": { + swapContract: "0x3a1659Ddcf2339Be3aeA159cA010979FB49155FF", + underlyingTokens: [ + "0x82f0B8B456c1A451378467398982d4834b6829c1", + "0x049d68029688eAbF473097a2fC38ef61633A3C7A", + "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75" + ] + }, +} const yearnVaults = { - // yvToken: underlying, eg yvYFI:YFI - // yvYFI v2 - "0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1": - "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", - // yvWETH v2 - "0xa258c4606ca8206d8aa700ce2143d7db854d168c": - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvWETH v1 - "0xa9fe4601811213c340e850ea305481aff02f5b28": - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvUSDT v2 - "0x7da96a3891add058ada2e826306d812c638d87a7": - "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yvUSDC v2 - "0x5f18c75abdae578b483e5f43f12a39cf75b973a9": - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yvcrvSTETH - "0xdcd90c7f6324cfa40d7169ef80b12031770b4325": - "0x06325440d014e39736583c165c2963ba99faf14e", - // yvcrvIB - "0x27b7b1ad7288079a66d12350c828d3c00a6f07d7": - "0x5282a4ef67d9c33135340fb3289cc1711c13638c", -}; -async function unwrapYearn( - balances, - yToken, - block, - chain = "ethereum", - transformAddress = (addr) => addr -) { - //if (yearnVaults[yToken.toLowerCase()] == undefined) { return; }; - const underlying = yearnVaults[yToken.toLowerCase()]; + // yvToken: underlying, eg yvYFI:YFI + // yvYFI v2 + "0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", + // yvWETH v2 + "0xa258c4606ca8206d8aa700ce2143d7db854d168c": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + // yvWETH v1 + "0xa9fe4601811213c340e850ea305481aff02f5b28": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + // yvUSDT v2 + "0x7da96a3891add058ada2e826306d812c638d87a7": "0xdac17f958d2ee523a2206206994597c13d831ec7", + // yvUSDC v2 + "0x5f18c75abdae578b483e5f43f12a39cf75b973a9": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + // yvcrvSTETH + "0xdcd90c7f6324cfa40d7169ef80b12031770b4325": "0x06325440d014e39736583c165c2963ba99faf14e", + // yvcrvIB + "0x27b7b1ad7288079a66d12350c828d3c00a6f07d7": "0x5282a4ef67d9c33135340fb3289cc1711c13638c", +} +async function unwrapYearn(balances, yToken, block, chain = "ethereum", transformAddress=(addr)=>addr) { + //if (yearnVaults[yToken.toLowerCase()] == undefined) { return; }; + const underlying = yearnVaults[yToken.toLowerCase()]; - let pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[1], - block: block, - chain: chain, - }); - if (pricePerShare == undefined) { - pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[0], - block: block, - chain: chain, + let pricePerShare = await sdk.api.abi.call({ + target: yToken, + abi: getPricePerShare[1], + block: block, + chain: chain }); - } - - sdk.util.sumSingleBalance( - balances, - transformAddress(underlying), - (balances[yToken] * pricePerShare.output) / - 10 ** (await sdk.api.erc20.decimals(underlying, chain)).output - ); - delete balances[yToken]; -} -async function unwrapCrv( - balances, - crvToken, - balance3Crv, - block, - chain = "ethereum", - transformAddress = (addr) => addr -) { - if (crvPools[crvToken.toLowerCase()] === undefined) { - return; - } - const crvSwapContract = crvPools[crvToken.toLowerCase()].swapContract; - const underlyingTokens = crvPools[crvToken.toLowerCase()].underlyingTokens; - const crvTotalSupply = sdk.api.erc20.totalSupply({ - target: crvToken, - block, - chain, - }); - const underlyingSwapTokens = ( - await sdk.api.abi.multiCall({ - calls: underlyingTokens.map((token) => ({ - target: token, - params: [crvSwapContract], - })), - block, - chain, - abi: "erc20:balanceOf", + if (pricePerShare == undefined) { + pricePerShare = await sdk.api.abi.call({ + target: yToken, + abi: getPricePerShare[0], + block: block, + chain: chain + }); + }; + + sdk.util.sumSingleBalance(balances, transformAddress(underlying), + balances[yToken] * pricePerShare.output / 10 ** + (await sdk.api.erc20.decimals(underlying, chain)).output); + delete balances[yToken]; +}; +async function unwrapCrv(balances, crvToken, balance3Crv, block, chain = "ethereum", transformAddress=(addr)=>addr) { + if(crvPools[crvToken.toLowerCase()] === undefined){ + return + } + const crvSwapContract = crvPools[crvToken.toLowerCase()].swapContract + const underlyingTokens = crvPools[crvToken.toLowerCase()].underlyingTokens + const crvTotalSupply = sdk.api.erc20.totalSupply({ + target: crvToken, + block, + chain }) - ).output; + const underlyingSwapTokens = (await sdk.api.abi.multiCall({ + calls: underlyingTokens.map(token => ({ + target: token, + params: [crvSwapContract] + })), + block, + chain, + abi: 'erc20:balanceOf' + })).output - // steth and seth case where balanceOf not applicable on ETH balance - if ( - crvToken.toLowerCase() === "0x06325440d014e39736583c165c2963ba99faf14e" || - crvToken.toLowerCase() === "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c" - ) { - underlyingSwapTokens[0].output = underlyingSwapTokens[0].output * 2; - } - const resolvedCrvTotalSupply = (await crvTotalSupply).output; - underlyingSwapTokens.forEach((call) => { - const underlyingBalance = BigNumber(call.output) - .times(balance3Crv) - .div(resolvedCrvTotalSupply); - sdk.util.sumSingleBalance( - balances, - transformAddress(call.input.target), - underlyingBalance.toFixed(0) - ); - }); + // steth and seth case where balanceOf not applicable on ETH balance + if (crvToken.toLowerCase() === "0x06325440d014e39736583c165c2963ba99faf14e" || crvToken.toLowerCase() === "0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c") { + underlyingSwapTokens[0].output = underlyingSwapTokens[0].output * 2; + } + const resolvedCrvTotalSupply = (await crvTotalSupply).output + underlyingSwapTokens.forEach(call => { + const underlyingBalance = BigNumber(call.output).times(balance3Crv).div(resolvedCrvTotalSupply); + sdk.util.sumSingleBalance(balances, transformAddress(call.input.target), underlyingBalance.toFixed(0)) + }) } -const lpReservesAbi = { - 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", -}; -const lpSuppliesAbi = { - constant: true, - inputs: [], - name: "totalSupply", - outputs: [{ internalType: "uint256", name: "", type: "uint256" }], - payable: false, - stateMutability: "view", - type: "function", -}; -const token0Abi = { - constant: true, - inputs: [], - name: "token0", - outputs: [{ internalType: "address", name: "", type: "address" }], - payable: false, - stateMutability: "view", - type: "function", -}; -const token1Abi = { - constant: true, - inputs: [], - name: "token1", - outputs: [{ internalType: "address", name: "", type: "address" }], - payable: false, - stateMutability: "view", - type: "function", -}; +const lpReservesAbi = { "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" } +const lpSuppliesAbi = {"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"} +const token0Abi = {"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"} +const token1Abi = {"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"} /* lpPositions:{ balance, token }[] */ -async function unwrapUniswapLPs( - balances, - lpPositions, - block, - chain = "ethereum", - transformAddress = (addr) => addr, - excludeTokensRaw = [], - retry = false -) { - const excludeTokens = excludeTokensRaw.map((addr) => addr.toLowerCase()); - const lpTokenCalls = lpPositions.map((lpPosition) => ({ - target: lpPosition.token, - })); - const lpReserves = sdk.api.abi.multiCall({ - block, - abi: lpReservesAbi, - calls: lpTokenCalls, - chain, - }); - const lpSupplies = sdk.api.abi.multiCall({ - block, - abi: lpSuppliesAbi, - calls: lpTokenCalls, - chain, - }); - const tokens0 = sdk.api.abi.multiCall({ - block, - abi: token0Abi, - calls: lpTokenCalls, - chain, - }); - const tokens1 = sdk.api.abi.multiCall({ - block, - abi: token1Abi, - calls: lpTokenCalls, - chain, - }); - if (retry) { - await Promise.all( - [ - [lpReserves, lpReservesAbi], - [lpSupplies, lpSuppliesAbi], - [tokens0, token0Abi], - [tokens1, token1Abi], - ].map(async (call) => { - await requery(await call[0], chain, block, call[1]); +async function unwrapUniswapLPs(balances, lpPositions, block, chain='ethereum', transformAddress=(addr)=>addr, excludeTokensRaw = [], retry = false) { + const excludeTokens = excludeTokensRaw.map(addr=>addr.toLowerCase()) + const lpTokenCalls = lpPositions.map(lpPosition=>({ + target: lpPosition.token + })) + const lpReserves = sdk.api.abi.multiCall({ + block, + abi: lpReservesAbi, + calls: lpTokenCalls, + chain + }) + const lpSupplies = sdk.api.abi.multiCall({ + block, + abi: lpSuppliesAbi, + calls: lpTokenCalls, + chain }) - ); - } - await Promise.all( - lpPositions.map(async (lpPosition) => { - try { - const lpToken = lpPosition.token; - const token0 = (await tokens0).output - .find((call) => call.input.target === lpToken) - .output.toLowerCase(); - const token1 = (await tokens1).output - .find((call) => call.input.target === lpToken) - .output.toLowerCase(); - if (excludeTokens.includes(token0) || excludeTokens.includes(token1)) { - return; - } - const supply = (await lpSupplies).output.find( - (call) => call.input.target === lpToken - ).output; - const { _reserve0, _reserve1 } = (await lpReserves).output.find( - (call) => call.input.target === lpToken - ).output; - const token0Balance = BigNumber(lpPosition.balance) - .times(BigNumber(_reserve0)) - .div(BigNumber(supply)); - sdk.util.sumSingleBalance( - balances, - await transformAddress(token0), - token0Balance.toFixed(0) - ); - const token1Balance = BigNumber(lpPosition.balance) - .times(BigNumber(_reserve1)) - .div(BigNumber(supply)); - sdk.util.sumSingleBalance( - balances, - await transformAddress(token1), - token1Balance.toFixed(0) - ); - } catch (e) { - console.log( - `Failed to get data for LP token at ${lpPosition.token} on chain ${chain}` - ); - throw e; + const tokens0 = sdk.api.abi.multiCall({ + block, + abi:token0Abi, + calls: lpTokenCalls, + chain + }) + const tokens1 = sdk.api.abi.multiCall({ + block, + abi:token1Abi, + calls: lpTokenCalls, + chain + }) + if(retry){ + await Promise.all([ + [lpReserves, lpReservesAbi], + [lpSupplies, lpSuppliesAbi], + [tokens0, token0Abi], + [tokens1, token1Abi] + ].map(async call=>{ + await requery(await call[0], chain, block, call[1]) + })) } - }) - ); + await Promise.all(lpPositions.map(async lpPosition => { + try{ + const lpToken = lpPosition.token + const token0 = (await tokens0).output.find(call=>call.input.target === lpToken).output.toLowerCase() + const token1 = (await tokens1).output.find(call=>call.input.target === lpToken).output.toLowerCase() + if(excludeTokens.includes(token0) || excludeTokens.includes(token1)){ + return + } + const supply = (await lpSupplies).output.find(call=>call.input.target === lpToken).output + const {_reserve0, _reserve1} = (await lpReserves).output.find(call=>call.input.target === lpToken).output + const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)) + sdk.util.sumSingleBalance(balances, await transformAddress(token0), token0Balance.toFixed(0)) + const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)) + sdk.util.sumSingleBalance(balances, await transformAddress(token1), token1Balance.toFixed(0)) + } catch(e){ + console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) + throw e + } + })) } -async function addBalanceOfTokensAndLPs(balances, balanceResult, block) { - await addTokensAndLPs( - balances, - { - output: balanceResult.output.map((t) => ({ output: t.input.target })), +async function addBalanceOfTokensAndLPs(balances, balanceResult, block){ + await addTokensAndLPs(balances, { + output: balanceResult.output.map(t=>({output:t.input.target})) }, balanceResult, - block - ); + block) } // Unwrap the tokens that are LPs and directly add the others // To be used when you don't know which tokens are LPs and which are not -async function addTokensAndLPs( - balances, - tokens, - amounts, - block, - chain = "ethereum", - transformAddress = (id) => id -) { - const tokens0 = await sdk.api.abi.multiCall({ - calls: tokens.output.map((t) => ({ - target: t.output, - })), - abi: token0, - block, - chain, - }); - const lpBalances = []; - tokens0.output.forEach((result, idx) => { - const token = tokens.output[idx].output; - const balance = amounts.output[idx].output; - if (result.success) { - lpBalances.push({ - token, - balance, - }); - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }); - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress); +async function addTokensAndLPs(balances, tokens, amounts, block, chain = "ethereum", transformAddress=id=>id){ + const tokens0 = await sdk.api.abi.multiCall({ + calls:tokens.output.map(t=>({ + target: t.output + })), + abi: token0, + block, + chain + }) + const lpBalances = [] + tokens0.output.forEach((result, idx)=>{ + const token = tokens.output[idx].output + const balance = amounts.output[idx].output + if(result.success){ + lpBalances.push({ + token, + balance + }) + } else { + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + } + }) + await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) } -function addressesEqual(a, b) { - return a.toLowerCase() === b.toLowerCase(); +function addressesEqual(a,b){ + return a.toLowerCase() === b.toLowerCase() } /* tokens [ [token, isLP] - eg ["0xaaa", true] ] */ -async function sumTokensAndLPsSharedOwners( - balances, - tokens, - owners, - block, - chain = "ethereum", - transformAddress = (id) => id -) { - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokens - .map((t) => - owners.map((o) => ({ - target: t[0], - params: o, - })) - ) - .flat(), - abi: "erc20:balanceOf", - block, - chain, - }); - await requery(balanceOfTokens, chain, block, "erc20:balanceOf"); - const isLP = {}; - tokens.forEach((token) => { - isLP[token[0].toLowerCase()] = token[1]; - }); - const lpBalances = []; - balanceOfTokens.output.forEach((result, idx) => { - const token = result.input.target.toLowerCase(); - const balance = result.output; - if (isLP[token] === true) { - lpBalances.push({ - token, - balance, - }); - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); +async function sumTokensAndLPsSharedOwners(balances, tokens, owners, block, chain = "ethereum", transformAddress=id=>id){ + const balanceOfTokens = await sdk.api.abi.multiCall({ + calls: tokens.map(t=>owners.map(o=>({ + target: t[0], + params: o + }))).flat(), + abi: 'erc20:balanceOf', + block, + chain + }) + await requery(balanceOfTokens, chain, block, 'erc20:balanceOf') + const isLP = {} + tokens.forEach(token=>{ + isLP[token[0].toLowerCase()]=token[1] + }) + const lpBalances = [] + balanceOfTokens.output.forEach((result, idx)=>{ + const token = result.input.target.toLowerCase() + const balance = result.output + if(isLP[token] === true){ + lpBalances.push({ + token, + balance + }) + } else { + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + } + }) + if(lpBalances.length > 0){ + await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) } - }); - if (lpBalances.length > 0) { - await unwrapUniswapLPs( - balances, - lpBalances, - block, - chain, - transformAddress - ); - } } /* @@ -552,101 +406,79 @@ tokens [ [token, owner, isLP] - eg ["0xaaa", "0xbbb", true] ] */ -async function sumTokensAndLPs( - balances, - tokens, - block, - chain = "ethereum", - transformAddress = (id) => id -) { - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokens.map((t) => ({ - target: t[0], - params: t[1], - })), - abi: "erc20:balanceOf", - block, - chain, - }); - const lpBalances = []; - balanceOfTokens.output.forEach((result, idx) => { - const token = result.input.target; - const balance = result.output; - if (tokens[idx][2]) { - lpBalances.push({ - token, - balance, - }); - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }); - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress); +async function sumTokensAndLPs(balances, tokens, block, chain = "ethereum", transformAddress=id=>id){ + const balanceOfTokens = await sdk.api.abi.multiCall({ + calls: tokens.map(t=>({ + target: t[0], + params: t[1] + })), + abi: 'erc20:balanceOf', + block, + chain + }) + const lpBalances = [] + balanceOfTokens.output.forEach((result, idx)=>{ + const token = result.input.target + const balance = result.output + if(tokens[idx][2]){ + lpBalances.push({ + token, + balance + }) + } else { + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + } + }) + await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) } -const balancerVault = "0xBA12222222228d8Ba445958a75a0704d566BF2C8"; -async function sumBalancerLps( - balances, - tokensAndOwners, - block, - chain, - transformAddress -) { - const poolIds = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map((t) => ({ - target: t[0], - })), - abi: getPoolId, - block, - chain, - }); - const balancerPoolSupplies = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map((t) => ({ - target: t[0], - })), - abi: "erc20:totalSupply", - block, - chain, - }); - const balanceOfTokens = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map((t) => ({ - target: t[0], - params: t[1], - })), - abi: "erc20:balanceOf", - block, - chain, - }); - const balancerPoolsPromise = sdk.api.abi.multiCall({ - calls: (await poolIds).output.map((o) => ({ - target: balancerVault, - params: o.output, - })), - abi: getPoolTokens, - block, - chain, - }); - const [poolSupplies, tokenBalances, balancerPools] = await Promise.all([ - balancerPoolSupplies, - balanceOfTokens, - balancerPoolsPromise, - ]); - tokenBalances.output.forEach((result, idx) => { - const lpBalance = result.output; - const balancerPool = balancerPools.output[idx].output; - const supply = poolSupplies.output[idx].output; - balancerPool.tokens.forEach((token, tokenIndex) => { - const tokensInPool = balancerPool.balances[tokenIndex]; - const underlyingBalance = BigNumber(tokensInPool) - .times(lpBalance) - .div(supply); - sdk.util.sumSingleBalance( - balances, - transformAddress(token), - underlyingBalance.toFixed(0) - ); +const balancerVault = "0xBA12222222228d8Ba445958a75a0704d566BF2C8" +async function sumBalancerLps(balances, tokensAndOwners, block, chain, transformAddress){ + const poolIds = sdk.api.abi.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0] + })), + abi: getPoolId, + block, + chain + }) + const balancerPoolSupplies = sdk.api.abi.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0] + })), + abi: 'erc20:totalSupply', + block, + chain + }) + const balanceOfTokens = sdk.api.abi.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0], + params: t[1] + })), + abi: 'erc20:balanceOf', + block, + chain }); - }); + const balancerPoolsPromise = sdk.api.abi.multiCall({ + calls: (await poolIds).output.map(o => ({ + target: balancerVault, + params: o.output + })), + abi: getPoolTokens, + block, + chain + }) + const [poolSupplies, tokenBalances, balancerPools] = await Promise.all([balancerPoolSupplies, balanceOfTokens, balancerPoolsPromise]) + tokenBalances.output.forEach((result, idx)=>{ + const lpBalance = result.output + const balancerPool = balancerPools.output[idx].output + const supply = poolSupplies.output[idx].output + balancerPool.tokens.forEach((token, tokenIndex)=>{ + const tokensInPool = balancerPool.balances[tokenIndex] + const underlyingBalance = BigNumber(tokensInPool).times(lpBalance).div(supply) + sdk.util.sumSingleBalance(balances, transformAddress(token), underlyingBalance.toFixed(0)); + }) + }) } /* @@ -654,82 +486,67 @@ tokensAndOwners [ [token, owner] - eg ["0xaaa", "0xbbb"] ] */ -async function sumTokens( - balances, - tokensAndOwners, - block, - chain = "ethereum", - transformAddress = (id) => id -) { - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokensAndOwners.map((t) => ({ - target: t[0], - params: t[1], - })), - abi: "erc20:balanceOf", - block, - chain, - }); - balanceOfTokens.output.forEach((result, idx) => { - const token = result.input.target; - const balance = result.output; - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - }); +async function sumTokens(balances, tokensAndOwners, block, chain = "ethereum", transformAddress=id=>id){ + const balanceOfTokens = await sdk.api.abi.multiCall({ + calls: tokensAndOwners.map(t=>({ + target: t[0], + params: t[1] + })), + abi: 'erc20:balanceOf', + block, + chain + }) + balanceOfTokens.output.forEach((result, idx)=>{ + const token = result.input.target + const balance = result.output + sdk.util.sumSingleBalance(balances, transformAddress(token), balance); + }) } -async function unwrapCreamTokens( - balances, - tokensAndOwners, - block, - chain = "ethereum", - transformAddress = (id) => id -) { - const [balanceOfTokens, exchangeRates, underlyingTokens] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map((t) => ({ - target: t[0], - params: t[1], - })), - abi: "erc20:balanceOf", - block, - chain, - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map((t) => ({ - target: t[0], - })), - abi: creamAbi.exchangeRateStored, - block, - chain, - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map((t) => ({ - target: t[0], - })), - abi: creamAbi.underlying, - block, - chain, - }), - ]); - balanceOfTokens.output.forEach((balanceCall, i) => { - const underlying = underlyingTokens.output[i].output; - const balance = BigNumber(balanceCall.output) - .times(exchangeRates.output[i].output) - .div(1e18) - .toFixed(0); - sdk.util.sumSingleBalance(balances, transformAddress(underlying), balance); - }); +async function unwrapCreamTokens(balances, tokensAndOwners, block, chain = "ethereum", transformAddress=id=>id){ + const [balanceOfTokens, exchangeRates, underlyingTokens] = await Promise.all([ + sdk.api.abi.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0], + params: t[1] + })), + abi: 'erc20:balanceOf', + block, + chain + }), + sdk.api.abi.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0], + })), + abi: creamAbi.exchangeRateStored, + block, + chain + }), + sdk.api.abi.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0], + })), + abi: creamAbi.underlying, + block, + chain + }) + ]) + balanceOfTokens.output.forEach((balanceCall, i)=>{ + const underlying = underlyingTokens.output[i].output + const balance = BigNumber(balanceCall.output).times(exchangeRates.output[i].output).div(1e18).toFixed(0) + sdk.util.sumSingleBalance(balances, transformAddress(underlying), balance) + }) } module.exports = { - unwrapYearn, - unwrapCrv, - unwrapUniswapLPs, - addTokensAndLPs, - sumTokensAndLPsSharedOwners, - addBalanceOfTokensAndLPs, - sumTokensAndLPs, - sumTokens, - sumBalancerLps, - unwrapCreamTokens, -}; + unwrapYearn, + unwrapCrv, + unwrapUniswapLPs, + addTokensAndLPs, + sumTokensAndLPsSharedOwners, + addBalanceOfTokensAndLPs, + sumTokensAndLPs, + sumTokens, + sumBalancerLps, + unwrapCreamTokens +} From 980ddd231f712d145bc138350c790987200f75e6 Mon Sep 17 00:00:00 2001 From: BlazeWasHere Date: Sat, 4 Dec 2021 22:17:40 +0000 Subject: [PATCH 163/393] revert --- projects/synapse/abi.json | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 projects/synapse/abi.json diff --git a/projects/synapse/abi.json b/projects/synapse/abi.json deleted file mode 100644 index 304bdfb9f4..0000000000 --- a/projects/synapse/abi.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "inputs": [ - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "name": "getFeeBalance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} From 422c34d9c829118cf6d23e3a34afc61437acad4c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 5 Dec 2021 00:16:59 +0000 Subject: [PATCH 164/393] add wavax to treasury --- projects/wonderland/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/wonderland/index.js b/projects/wonderland/index.js index 5cb226ee40..7b9ad71c17 100644 --- a/projects/wonderland/index.js +++ b/projects/wonderland/index.js @@ -30,7 +30,11 @@ async function tvl(timestamp, block, chainBlocks) { balances, [ [mim, false], + //wAVAX + ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], + //joe LP ["0x113f413371fC4CC4C9d6416cf1DE9dFd7BF747Df", true], + //joe LP ["0xf64e1c5B6E17031f5504481Ac8145F4c3eab4917", true], ], [treasury], From b6f09ea5ad93748ae7b5fa3a89456fce1c0984e4 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 5 Dec 2021 01:27:04 +0000 Subject: [PATCH 165/393] merge --- projects/wonderland/index.js | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/projects/wonderland/index.js b/projects/wonderland/index.js index 7b9ad71c17..c6afacd557 100644 --- a/projects/wonderland/index.js +++ b/projects/wonderland/index.js @@ -1,27 +1,14 @@ const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const sdk = require('@defillama/sdk'); +const { staking } = require("../helper/staking"); const TimeStaking = "0x4456B87Af11e87E329AB7d7C7A246ed1aC2168B9" const time = "0xb54f16fB19478766A268F172C9480f8da1a7c9C3" -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stakingBalance = await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: time, - params: TimeStaking, - block: chainBlocks.avax, - chain: 'avax' - }); - - sdk.util.sumSingleBalance(balances, 'avax:'+time, stakingBalance.output); - - return balances; -}; // https://app.wonderland.money/#/bonds const treasury = "0x1c46450211CB2646cc1DA3c5242422967eD9e04c" +const dao = "0x78a9e536EBdA08b5b9EDbE5785C9D1D50fA3278C" const mim = "0x130966628846BFd36ff31a822705796e8cb8C18D" +const wavax = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" async function tvl(timestamp, block, chainBlocks) { const balances = {}; @@ -30,14 +17,13 @@ async function tvl(timestamp, block, chainBlocks) { balances, [ [mim, false], - //wAVAX - ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], - //joe LP - ["0x113f413371fC4CC4C9d6416cf1DE9dFd7BF747Df", true], - //joe LP - ["0xf64e1c5B6E17031f5504481Ac8145F4c3eab4917", true], + [wavax, false], + ["0x113f413371fC4CC4C9d6416cf1DE9dFd7BF747Df", true], // mim-time + ["0x781655d802670bba3c89aebaaea59d3182fd755d", true], // wavax-mim + ["0x8ea6dd9482a49791e8c3d0f7c515bbd3be702f74", true], // MIM-WETH + ["0xf64e1c5B6E17031f5504481Ac8145F4c3eab4917", true], // wavax-time ], - [treasury], + [treasury, dao], chainBlocks.avax, 'avax', addr=>addr.toLowerCase()==="0x130966628846bfd36ff31a822705796e8cb8c18d"?"0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3":`avax:${addr}` @@ -49,7 +35,7 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { avalanche: { tvl, - staking + staking: staking(TimeStaking, time, "avax") }, methodology: "Counts tokens on the treasury for tvl and staked TIME for staking", From b05e2475f512b24fc3a98b94ff08ce87e42cac27 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 5 Dec 2021 04:47:18 +0000 Subject: [PATCH 166/393] add adapter for tornadao --- projects/tornadao/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/tornadao/index.js diff --git a/projects/tornadao/index.js b/projects/tornadao/index.js new file mode 100644 index 0000000000..9b0a594279 --- /dev/null +++ b/projects/tornadao/index.js @@ -0,0 +1,9 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0x68bb6883B44F4Ab37596b6189FAe354E937D4990" +module.exports = ohmTvl(treasury, [ + ["0x130966628846bfd36ff31a822705796e8cb8c18d", false],//mim + ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false],//avax + ["0xaef85b5b06b13b79b17fd684b1f04035570a9ae0", true],//joeLP + ["0xe750f3b821d4bc696f977756cd3b1b5e0ae00647", true],//joeLP + ], "avax", "0x39Af1EB019750aDc3Ea89D80080079F64D5432dB", "0xb80323c7aa915cb960b19b5cca1d88a2132f7bd1") \ No newline at end of file From defd2280e317721bf844537f032fbad4306b5054 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 5 Dec 2021 05:03:44 +0000 Subject: [PATCH 167/393] update telosrex export --- projects/telosRex.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/projects/telosRex.js b/projects/telosRex.js index 95078c699d..184d8ba38d 100644 --- a/projects/telosRex.js +++ b/projects/telosRex.js @@ -12,8 +12,6 @@ async function tvl() { } module.exports = { - telos: { - tvl, - }, + tvl, }; From fdff6dfe6a4a89fe372ca2a8259ccfc667b06de8 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 5 Dec 2021 05:14:46 +0000 Subject: [PATCH 168/393] update exports for additional clarity --- projects/chickenswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/chickenswap/index.js b/projects/chickenswap/index.js index 5b973fd846..2a7ab0cb42 100644 --- a/projects/chickenswap/index.js +++ b/projects/chickenswap/index.js @@ -65,7 +65,7 @@ module.exports = { ethereum: { staking: staking(chickenChefContract, KFC), pool2: pool2(chickenChefContract, WETH_KFC_UNIV2), - tvl: ethTvl, + masterchef: ethTvl, }, tvl: sdk.util.sumChainTvls([ethTvl, ethChainTvl('ethereum')]), methodology: From 381e67b76da669c1b3b7ba24f091eb47fcf4dbd4 Mon Sep 17 00:00:00 2001 From: 0xlyrix <0xlyrix@gmail.com> Date: Sun, 5 Dec 2021 12:54:48 +0700 Subject: [PATCH 169/393] wannaswap tracking --- projects/wannaswap/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/projects/wannaswap/index.js b/projects/wannaswap/index.js index a2a5c20b9f..cc26faf944 100644 --- a/projects/wannaswap/index.js +++ b/projects/wannaswap/index.js @@ -1,8 +1,10 @@ -const {calculateUsdUniTvl} = require('./helper/getUsdUniTvl') +const {calculateUsdUniTvl} = require('./helper/getUsdUniTvl'); +const { staking } = require('../helper/staking.js'); module.exports = { misrepresentedTokens: true, aurora: { + staking: staking("0x5205c30bf2E37494F8cF77D2c19C6BA4d2778B9B", "0x7faA64Faf54750a2E3eE621166635fEAF406Ab22", "aurora"), tvl:calculateUsdUniTvl( // factory "0x7928D4FeA7b2c90C732c10aFF59cf403f0C38246", @@ -20,7 +22,9 @@ module.exports = { // wNEAR "0xC42C30aC6Cc15faC9bD938618BcaA1a1FaE8501d", // AURORA - "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79" + "0x8BEc47865aDe3B172A928df8f990Bc7f2A3b9f79", + // WANNA + "0x7faA64Faf54750a2E3eE621166635fEAF406Ab22" ], // coreAssetName "weth", From f2d659a2d4915eba0b82caad38e68d14e3bb6e1e Mon Sep 17 00:00:00 2001 From: 0xMadxi <0xMadxi> Date: Sun, 5 Dec 2021 15:35:11 +0900 Subject: [PATCH 170/393] Add calculation for WAVAX --- projects/maximizer/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/projects/maximizer/index.js b/projects/maximizer/index.js index b5a3edf63f..dd59b9780a 100644 --- a/projects/maximizer/index.js +++ b/projects/maximizer/index.js @@ -6,6 +6,7 @@ const MaximizerStaking = "0x6d7AD602Ec2EFdF4B7d34A9A53f92F06d27b82B1"; const Treasury = "0x22cF6c46b4E321913ec30127C2076b7b12aC6d15"; const MAXI = "0x7C08413cbf02202a1c13643dB173f2694e0F73f0"; const DAI = "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70"; +const WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; const MAXI_DAI_JLP = "0xfBDC4aa69114AA11Fae65E858e92DC5D013b2EA9"; const staking = async (timestamp, ethBlock, chainBlocks) => { @@ -31,6 +32,7 @@ async function tvl(timestamp, block, chainBlocks) { balances, [ [DAI, false], + [WAVAX, false], [MAXI_DAI_JLP, true], ], [Treasury], @@ -47,5 +49,5 @@ module.exports = { tvl, staking, }, - methodology: "Counts DAI, DAI JLP (MAXI-DAI) on the treasury", + methodology: "Counts DAI, DAI JLP (MAXI-DAI), WAVAX on the treasury", }; From b904deb16a8f1a1116d1e54e2f1c68547924828e Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 5 Dec 2021 07:36:48 +0000 Subject: [PATCH 171/393] add adapter for partyswap --- projects/partyswap/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 projects/partyswap/index.js diff --git a/projects/partyswap/index.js b/projects/partyswap/index.js new file mode 100644 index 0000000000..af95a3ca5e --- /dev/null +++ b/projects/partyswap/index.js @@ -0,0 +1,14 @@ +const { getAvaxUniswapTvl} = require('../helper/getUniSubgraphTvl') +const { stakingPricedLP } = require('../helper/staking') + +const PARTY_WAVAX_LP = "0x379842a6cd96a70ebce66004275ce0c68069df62"; +const COREASSETNAME = "avalanche-2"; + + +module.exports={ + avax:{ + tvl: getAvaxUniswapTvl( "https://api.thegraph.com/subgraphs/name/josema03/partyswap-dex", "partyswapFactories", "totalLiquidityETH"), + staking: stakingPricedLP("0xA07d1932775f22DaeDA671812c16F859b4257363","0x25afd99fcb474d7c336a2971f26966da652a92bc","avax", PARTY_WAVAX_LP, COREASSETNAME), + + } +} \ No newline at end of file From a0429d539519915e268cc10e192bf73fd102d833 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 5 Dec 2021 08:19:14 +0000 Subject: [PATCH 172/393] updated sdk --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 254fb7a336..364583f74f 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@acala-network/api": "^3.0.2", "@connext/nxtp-contracts": "0.0.93", "@connext/nxtp-utils": "0.0.93", - "@defillama/sdk": "^2.3.26", + "@defillama/sdk": "^2.3.27", "@makerdao/multicall": "^0.12.0", "@polkadot/api": "^6.6.1", "@port.finance/port-sdk": "^0.1.42", From 887e19e1661e7db93f78a757656859bd80f9d99d Mon Sep 17 00:00:00 2001 From: kukafe <87063285+kukafe@users.noreply.github.com> Date: Sun, 5 Dec 2021 20:01:00 +0800 Subject: [PATCH 173/393] kafe --- projects/kafefinance/index.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 projects/kafefinance/index.js diff --git a/projects/kafefinance/index.js b/projects/kafefinance/index.js new file mode 100644 index 0000000000..42b9495fbc --- /dev/null +++ b/projects/kafefinance/index.js @@ -0,0 +1,27 @@ +const utils = require('../helper/utils'); +// Please refer to Github(https://github.com/kukafe/kafe-defillama/tree/main/kafe-defillama) for the codes to calculate the TVL via on-chain calls +const apiUrl = 'https://kafe-defillama.herokuapp.com/getTvl'; + +function fetchChain(chainId) { + return async()=>{ + let response = await utils.fetchURL(apiUrl); + let tvl = parseFloat(response.data.tvlinfo[chainId]); + return Math.round(tvl); + } +} + +async function fetch() { + let response = await utils.fetchURL(apiUrl); + let tvl = parseFloat(response.data.totalValueLocked); + return Math.round(tvl); +} + +module.exports = { + moonriver: { + fetch: fetchChain('moonriver'), + }, + cronos: { + fetch: fetchChain('cronos'), + }, + fetch + } \ No newline at end of file From 5b9ecaa4113fe86dd7047a59c01e34350abe4f1f Mon Sep 17 00:00:00 2001 From: kukafe <87063285+kukafe@users.noreply.github.com> Date: Sun, 5 Dec 2021 20:40:57 +0800 Subject: [PATCH 174/393] update url --- projects/kafefinance/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/kafefinance/index.js b/projects/kafefinance/index.js index 42b9495fbc..4f33312d11 100644 --- a/projects/kafefinance/index.js +++ b/projects/kafefinance/index.js @@ -1,6 +1,6 @@ const utils = require('../helper/utils'); // Please refer to Github(https://github.com/kukafe/kafe-defillama/tree/main/kafe-defillama) for the codes to calculate the TVL via on-chain calls -const apiUrl = 'https://kafe-defillama.herokuapp.com/getTvl'; +const apiUrl = 'http://142.93.53.244:5001/getTvl'; function fetchChain(chainId) { return async()=>{ @@ -24,4 +24,4 @@ module.exports = { fetch: fetchChain('cronos'), }, fetch - } \ No newline at end of file + } From a6d46ff4eee5fbf048f67afb234151a8b7d0cf2d Mon Sep 17 00:00:00 2001 From: Morazzela Date: Sun, 5 Dec 2021 13:44:03 +0100 Subject: [PATCH 175/393] add vikings adapters --- projects/vikings/index.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 projects/vikings/index.js diff --git a/projects/vikings/index.js b/projects/vikings/index.js new file mode 100644 index 0000000000..0498ab181c --- /dev/null +++ b/projects/vikings/index.js @@ -0,0 +1,7 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0x04b611A65A5cfEFC1C449F725b1948eeaadEB231"; +module.exports = ohmTvl(treasuryAddress, [ + ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], + ["0x1E2D68196AcF7EB9e345c531e476E726D60a5C4b", true], +], "avax", "0x743DE042c7be8C415effa75b960A2A7bB5fc0704", "0x91D680545a1ff4411C1ff4C927f86CD34ADB932a", undefined, undefined, true) From fd6846482b3b2dc4b28857d055d779ffd96a998c Mon Sep 17 00:00:00 2001 From: Morazzela Date: Sun, 5 Dec 2021 13:54:53 +0100 Subject: [PATCH 176/393] token not on gecko yet --- projects/vikings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vikings/index.js b/projects/vikings/index.js index 0498ab181c..d09bc803e4 100644 --- a/projects/vikings/index.js +++ b/projects/vikings/index.js @@ -4,4 +4,4 @@ const treasuryAddress = "0x04b611A65A5cfEFC1C449F725b1948eeaadEB231"; module.exports = ohmTvl(treasuryAddress, [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], ["0x1E2D68196AcF7EB9e345c531e476E726D60a5C4b", true], -], "avax", "0x743DE042c7be8C415effa75b960A2A7bB5fc0704", "0x91D680545a1ff4411C1ff4C927f86CD34ADB932a", undefined, undefined, true) +], "avax", "0x743DE042c7be8C415effa75b960A2A7bB5fc0704", "0x91D680545a1ff4411C1ff4C927f86CD34ADB932a", undefined, undefined, false) From 669da028713a494c482a5c67877049419bd59f4a Mon Sep 17 00:00:00 2001 From: nemusona Date: Sun, 5 Dec 2021 09:55:50 -0600 Subject: [PATCH 177/393] kafe finance change --- projects/kafefinance/index.js | 68 +++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 18 deletions(-) diff --git a/projects/kafefinance/index.js b/projects/kafefinance/index.js index 4f33312d11..ed7e3d296a 100644 --- a/projects/kafefinance/index.js +++ b/projects/kafefinance/index.js @@ -1,27 +1,59 @@ -const utils = require('../helper/utils'); +const utils = require("../helper/utils"); // Please refer to Github(https://github.com/kukafe/kafe-defillama/tree/main/kafe-defillama) for the codes to calculate the TVL via on-chain calls -const apiUrl = 'http://142.93.53.244:5001/getTvl'; +const apiUrl = "http://142.93.53.244:5001/getTvl"; -function fetchChain(chainId) { - return async()=>{ - let response = await utils.fetchURL(apiUrl); - let tvl = parseFloat(response.data.tvlinfo[chainId]); - return Math.round(tvl); +async function fetchChain(chain, includePool2) { + let totalTvl = 0; + let response = (await utils.fetchURL(apiUrl)).data; + Object.keys(response).forEach((key) => { + let entry = response[key]; + if (entry.chain !== chain) return; + if (includePool2 == false) { + if (key.startsWith("KAFE")) return; + } else { + if (!key.startsWith("KAFE")) return; + if (key.startsWith("KAFE") && key.endsWith("KAFE")) return; } + totalTvl = totalTvl + Number(entry.TVL); + }); + return Math.round(totalTvl); +} + +async function fetchCronos() { + return fetchChain("cronos", false); +} + +async function fetchMoonriver() { + return fetchChain("moonriver", false); +} + +async function fetchMoonRiverPool2() { + return fetchChain("moonriver", true); +} + +async function fetchMoonriverStaking() { + let response = (await utils.fetchURL(apiUrl)).data; + return Math.round(Number(response["KAFE"].TVL)); } async function fetch() { - let response = await utils.fetchURL(apiUrl); - let tvl = parseFloat(response.data.totalValueLocked); - return Math.round(tvl); + let cronosTvl = await fetchChain("cronos", false); + let moonriverTvl = await fetchChain("moonriver", false); + return cronosTvl + moonriverTvl; } module.exports = { - moonriver: { - fetch: fetchChain('moonriver'), - }, - cronos: { - fetch: fetchChain('cronos'), - }, - fetch - } + cronos: { + fetch: fetchCronos, + }, + moonriver: { + fetch: fetchMoonriver, + }, + pool2: { + fetch: fetchMoonRiverPool2, + }, + staking: { + fetch: fetchMoonriverStaking, + }, + fetch, +}; From 0046bfd223df558e3753b231abfa3f6898176b2f Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 5 Dec 2021 16:37:04 +0000 Subject: [PATCH 178/393] add borrowed and pool2 to benqi --- projects/benqi/index.js | 8 ++++++-- projects/helper/compound.js | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/projects/benqi/index.js b/projects/benqi/index.js index 40ab6f60ff..f885344847 100644 --- a/projects/benqi/index.js +++ b/projects/benqi/index.js @@ -1,15 +1,19 @@ const {getCompoundV2Tvl} = require('../helper/compound') const {transformAvaxAddress, fixAvaxBalances} = require('../helper/portedTokens') +const {pool2} = require('../helper/pool2') async function tvl(...params) { const transformAdress= await transformAvaxAddress() const balances = await getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", transformAdress)(...params) - fixAvaxBalances(balances) return balances } module.exports={ timetravel: true, methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", - tvl + avalanche:{ + tvl: getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", addr=>`avax:${addr}`, undefined, undefined), + borrowed: getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", addr=>`avax:${addr}`, undefined, undefined, true), + pool2: pool2("0x784da19e61cf348a8c54547531795ecfee2affd1", "0xe530dc2095ef5653205cf5ea79f8979a7028065c", "avax") + } } diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 602ecf02c2..07e61c1d67 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -51,7 +51,7 @@ async function getMarkets(comptroller, block, chain, cether, cetheEquivalent) { return markets; } -function getCompoundV2Tvl(comptroller, chain="ethereum", transformAdress = addr=>addr, cether="0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2") { +function getCompoundV2Tvl(comptroller, chain="ethereum", transformAdress = addr=>addr, cether="0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", borrowed=false) { return async (timestamp, ethBlock, chainBlocks) => { const block = chainBlocks[chain] let balances = {}; @@ -64,7 +64,7 @@ function getCompoundV2Tvl(comptroller, chain="ethereum", transformAdress = addr= calls: _.map(markets, (market) => ({ target: market.cToken, })), - abi: abi['getCash'], + abi: borrowed? abi.totalBorrows: abi['getCash'], }); _.each(markets, (market) => { From 2d466ad4833f6a131db19046b601143380f8005d Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 5 Dec 2021 19:30:43 +0000 Subject: [PATCH 179/393] add borrowed to all compound forks --- projects/atlantisloans/index.js | 8 +- projects/benqi/index.js | 13 +-- projects/cashcow/index.js | 12 ++- projects/cozy/index.js | 19 +++-- projects/cream/index.js | 75 ++++++----------- projects/helper/compound.js | 35 ++++++++ projects/hundredfinance/index.js | 21 +---- projects/klend/index.js | 10 ++- projects/mantradao/index.js | 30 +++---- projects/rari/onchain.js | 126 ++++++++++++++++------------- projects/sashimiswap/index.js | 93 ++++++--------------- projects/scream/index.js | 39 +++++---- projects/strike/index.js | 7 +- projects/traderjoe/index.js | 21 ++--- projects/unfederalreserve/index.js | 11 +-- 15 files changed, 231 insertions(+), 289 deletions(-) diff --git a/projects/atlantisloans/index.js b/projects/atlantisloans/index.js index 6702ad4cad..2920ad380a 100644 --- a/projects/atlantisloans/index.js +++ b/projects/atlantisloans/index.js @@ -1,6 +1,6 @@ const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const { getCompoundV2Tvl } = require("../helper/compound"); +const { compoundExports } = require("../helper/compound"); const comptroller = "0xE7E304F136c054Ee71199Efa6E26E8b0DAe242F3"; @@ -12,13 +12,13 @@ const ALT_BUSD_CakeLP = "0xaa40dc3ec6ad76db3254b54443c4531e3dfe6bdb"; module.exports = { misrepresentedTokens: true, + timetravel: true, + doublecounted: false, bsc: { pool2: pool2(lpVaultStakingContract, ALT_BUSD_CakeLP, "bsc"), staking: staking(vaultStakingContract, ATL, "bsc"), - tvl: getCompoundV2Tvl( - comptroller, + ...compoundExports( comptroller, "bsc", - addr=>`bsc:${addr}`, "0x5A9A90983A369b6bB8F062f0AFe6219Ac01caF63", "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" ), diff --git a/projects/benqi/index.js b/projects/benqi/index.js index f885344847..572d2cdca5 100644 --- a/projects/benqi/index.js +++ b/projects/benqi/index.js @@ -1,19 +1,12 @@ -const {getCompoundV2Tvl} = require('../helper/compound') -const {transformAvaxAddress, fixAvaxBalances} = require('../helper/portedTokens') +const {compoundExports} = require('../helper/compound') const {pool2} = require('../helper/pool2') -async function tvl(...params) { - const transformAdress= await transformAvaxAddress() - const balances = await getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", transformAdress)(...params) - return balances -} - module.exports={ timetravel: true, + doublecounted: false, methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", avalanche:{ - tvl: getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", addr=>`avax:${addr}`, undefined, undefined), - borrowed: getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", addr=>`avax:${addr}`, undefined, undefined, true), + ...compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax"), pool2: pool2("0x784da19e61cf348a8c54547531795ecfee2affd1", "0xe530dc2095ef5653205cf5ea79f8979a7028065c", "avax") } } diff --git a/projects/cashcow/index.js b/projects/cashcow/index.js index 9cecd23660..a3cdee69f0 100644 --- a/projects/cashcow/index.js +++ b/projects/cashcow/index.js @@ -1,5 +1,5 @@ const abi = require("./abi.json"); -const { getCompoundV2Tvl } = require("../helper/compound"); +const { getCompoundV2Tvl, compoundExports } = require("../helper/compound"); const { transformBscAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); @@ -26,16 +26,14 @@ const stakingPools = async (timestamp, ethBlock, chainBlocks) => { }; module.exports = { - misrepresentedTokens: true, + timetravel: true, + doublecounted: false, bsc: { staking: stakingPools, - tvl: getCompoundV2Tvl( - comptroller, + ...compoundExports(comptroller, "bsc", - (addr) => `bsc:${addr}`, cBNB, - WBNBEquivalent - ), + WBNBEquivalent) }, methodology: "We count liquidity on the lending markets same as compound; and the Pools (LP Piars) through Chef Contract", diff --git a/projects/cozy/index.js b/projects/cozy/index.js index 7dccf937fd..ea995626fe 100644 --- a/projects/cozy/index.js +++ b/projects/cozy/index.js @@ -1,10 +1,15 @@ -const {getCompoundV2Tvl} = require('../helper/compound') +const {compoundExports} = require('../helper/compound') + +const transform = addr=>{ + if(addr==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"){ + return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" + } + return addr +} module.exports={ - tvl: getCompoundV2Tvl('0x895879b2c1fbb6ccfcd101f2d3f3c76363664f92', 'ethereum', addr=>{ - if(addr==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"){ - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - } - return addr - }) + timetravel: true, + doublecounted: false, + methodology: "Count tokens the same way we count for compound", + ethereum: compoundExports('0x895879b2c1fbb6ccfcd101f2d3f3c76363664f92', "ethereum", undefined, undefined, transform) } \ No newline at end of file diff --git a/projects/cream/index.js b/projects/cream/index.js index 6a4e798144..03dd8e5973 100644 --- a/projects/cream/index.js +++ b/projects/cream/index.js @@ -1,7 +1,7 @@ const sdk = require("@defillama/sdk"); const utils = require("../helper/utils"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { getCompoundV2Tvl } = require("../helper/compound"); +const { getCompoundV2Tvl, compoundExports } = require("../helper/compound"); const { transformFantomAddress, transformBscAddress } = require('../helper/portedTokens') const { GraphQLClient, gql } = require('graphql-request') @@ -136,13 +136,12 @@ async function ethereumTvl(timestamp, block) { return balances; } -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks["bsc"]; // req for the block type +async function lending(block, chain, borrowed){ let balances = {}; let tokens_bsc = ( await utils.fetchURL( - "https://api.cream.finance/api/v1/crtoken?comptroller=bsc" + `https://api.cream.finance/api/v1/crtoken?comptroller=${chain}` ) ).data; @@ -150,8 +149,8 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { await sdk.api.abi.multiCall({ block, calls: tokens_bsc.map((token) => ({ target: token.token_address })), - abi: abiCerc20["getCash"], - chain: "bsc", + abi: borrowed? abiCerc20.totalBorrows: abiCerc20["getCash"], + chain, }) ).output; @@ -160,7 +159,7 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { block, calls: tokens_bsc.map((token) => ({ target: token.token_address })), abi: abiCerc20["underlying"], - chain: "bsc", + chain, }) ).output; @@ -172,7 +171,7 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { token: underlyings[idx].output, balance: cashVal.output, }); - } else if (underlyings[idx].output == undefined) { + } else if (tokens_bsc[idx].symbol==="crBNB") { sdk.util.sumSingleBalance( balances, "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", @@ -184,6 +183,12 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { } }); await unwrapUniswapLPs(balances, lpPositions, block, 'bsc', transformAdress); + return balances +} + +const bscTvl = async (timestamp, ethBlock, chainBlocks) => { + const block = chainBlocks["bsc"]; // req for the block type + const balances = await lending(block, "bsc", false) // --- Staking bsc service --- const bsc_staking_service = await utils.fetchURL( @@ -201,6 +206,11 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { return balances; }; +const bscBorrowed = async (timestamp, ethBlock, chainBlocks) => { + const block = chainBlocks["bsc"]; // req for the block type + return lending(block, "bsc", true) +} + const fantomToken = "0x4e15361fd6b4bb609fa63c81a2be19d873717870"; const fantomTvl = async (timestamp, ethBlock, chainBlocks) => { const block = chainBlocks["fantom"]; // req for the block type @@ -275,58 +285,21 @@ const fantomTvl = async (timestamp, ethBlock, chainBlocks) => { return balances; }; -const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks["polygon"]; - const chain = 'polygon' - let balances = {}; - - let tokens = ( - await utils.fetchURL( - "https://api.cream.finance/api/v1/crtoken?comptroller=polygon" - ) - ).data; - - let cashValues = ( - await sdk.api.abi.multiCall({ - block, - calls: tokens.map((token) => ({ target: token.token_address })), - abi: abiCerc20["getCash"], - chain - }) - ).output; - - let underlyings = ( - await sdk.api.abi.multiCall({ - block, - calls: tokens.map((token) => ({ target: token.token_address })), - abi: abiCerc20["underlying"], - chain - }) - ).output; - - cashValues.map((cashVal, idx) => { - const tokenAddr = 'polygon:'+ underlyings[idx].output - sdk.util.sumSingleBalance(balances, tokenAddr, cashVal.output); - }); - return balances -} - module.exports = { - timetravel: true, + timetravel: false, // bsc and fantom api's for staked coins can't be queried at historical points start: 1599552000, // 09/08/2020 @ 8:00am (UTC) ethereum: { tvl: ethereumTvl, }, bsc: { tvl: bscTvl, + borrowed: bscBorrowed + //getCompoundV2Tvl("0x589de0f0ccf905477646599bb3e5c622c84cc0ba", "bsc", addr=>`bsc:${addr}`, "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", true), }, fantom: { tvl: fantomTvl, + borrowed: getCompoundV2Tvl("0x4250a6d3bd57455d7c6821eecb6206f507576cd2", "fantom", addr=>`fantom:${addr}`, undefined, undefined, true) }, - polygon:{ - tvl: polygonTvl - }, - avalanche:{ - tvl: getCompoundV2Tvl("0x2eE80614Ccbc5e28654324a66A396458Fa5cD7Cc", "avax", addr=>`avax:${addr}`) - } + polygon:compoundExports("0x20ca53e2395fa571798623f1cfbd11fe2c114c24", "polygon"), + avalanche:compoundExports("0x2eE80614Ccbc5e28654324a66A396458Fa5cD7Cc", "avax") }; diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 07e61c1d67..5a464f80fd 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -173,7 +173,42 @@ function getCompoundUsdTvl(comptroller, chain, cether, abis={ } } +function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw){ + const transformAddress = transformAdressRaw === undefined? addr=>`${chain}:${addr}`:transformAdressRaw + if(cether !== undefined && cetheEquivalent === undefined){ + throw new Error("You need to define the underlying for native cAsset") + } + return { + tvl: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent), + borrowed: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true) + } +} + +function compoundExportsWithAsyncTransform(comptroller, chain, cether, cetheEquivalent, transformAdressConstructor){ + return { + tvl: async (...args)=>{ + const transformAddress = await transformAdressConstructor() + return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent)(...args) + }, + borrowed: async (...args)=>{ + const transformAddress = await transformAdressConstructor() + return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true)(...args) + }, + } +} + +function fullCoumpoundExports(comptroller, chain, cether, cetheEquivalent){ + return { + timetravel: true, + doublecounted: false, + [chain]:compoundExports(comptroller, chain, cether, cetheEquivalent) + } +} + module.exports = { getCompoundV2Tvl, getCompoundUsdTvl, + compoundExports, + compoundExportsWithAsyncTransform, + fullCoumpoundExports }; diff --git a/projects/hundredfinance/index.js b/projects/hundredfinance/index.js index 6e16f31157..fb2c68ea1a 100644 --- a/projects/hundredfinance/index.js +++ b/projects/hundredfinance/index.js @@ -1,23 +1,10 @@ -const {getCompoundV2Tvl} = require('../helper/compound') +const {compoundExports, compoundExportsWithAsyncTransform} = require('../helper/compound') const {transformArbitrumAddress, transformFantomAddress} = require('../helper/portedTokens') -const sdk = require('@defillama/sdk') const comptroller = "0x0f390559f258eb8591c8e31cf0905e97cf36ace2" -async function arb(time, block, chainBlocks){ - const transform = await transformArbitrumAddress() - return getCompoundV2Tvl(comptroller, "arbitrum", transform, "0x8e15a22853A0A60a0FBB0d875055A8E66cff0235", "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1")(time, block, chainBlocks) -} -async function fantom(time, block, chainBlocks){ - const transform = await transformFantomAddress() - return getCompoundV2Tvl(comptroller, "fantom", transform, "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83")(time, block, chainBlocks) -} - - -const eth = getCompoundV2Tvl(comptroller, "ethereum", id=>id, "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D") - module.exports={ - ethereum:{tvl:eth}, - arbitrum:{tvl:arb}, - fantom:{tvl:fantom}, + ethereum:compoundExports(comptroller, "ethereum", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"), + arbitrum:compoundExportsWithAsyncTransform(comptroller, "arbitrum", "0x8e15a22853A0A60a0FBB0d875055A8E66cff0235", "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", transformArbitrumAddress), + fantom:compoundExportsWithAsyncTransform(comptroller, "fantom", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", transformFantomAddress), } \ No newline at end of file diff --git a/projects/klend/index.js b/projects/klend/index.js index fe2c0678ea..10f9cc4346 100644 --- a/projects/klend/index.js +++ b/projects/klend/index.js @@ -1,10 +1,11 @@ const sdk = require('@defillama/sdk'); -const {getCompoundV2Tvl} = require('../helper/compound'); +const {compoundExports} = require('../helper/compound'); const {unwrapUniswapLPs} = require('../helper/unwrapLPs'); // BSC const unitroller = "0xA6bEd5B7320941eA185A315D1292492F7Fdd1e5c"; const kBnb = "0x2C334c6cBC0547e759084bD8D469f933B17Ff481"; +const wbnb = "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c" const bscPools = [ "0xf1D447656692d51d4DB7057104Ac6E97029A7790", "0x95D4D2D88C96cE96c97A912Aa7122715716013D4" @@ -18,6 +19,7 @@ const lpAbi = {"constant":true,"inputs":[],"name":"lp","outputs":[{"internalType // OKEX const okexUnitroller = "0x9589c9c9b7A484F57d69aC09c14EcE4b6d785710"; const kOkt = "0x4923abEe988f7bB7A9ae136BEBE4A8455e8dE229"; +const wokt = "0x8f8526dbfd6e38e3d8307702ca8469bae6c56c15" async function pool2Tvl(balances, chainBlocks, chain, pools) { @@ -69,12 +71,14 @@ async function okexPool2(timestamp, block, chainBlocks) { } module.exports = { + timetravel: true, + doublecounted: false, bsc: { - tvl: getCompoundV2Tvl(unitroller, "bsc", addr=>`bsc:${addr}`, kBnb), + ...compoundExports(unitroller, "bsc", kBnb, wbnb), pool2: bscPool2 }, okexchain: { - tvl: getCompoundV2Tvl(okexUnitroller, "okexchain", addr=>`okexchain:${addr}`, kOkt), + ...compoundExports(okexUnitroller, "okexchain", kOkt, wokt), pool2: okexPool2 } } \ No newline at end of file diff --git a/projects/mantradao/index.js b/projects/mantradao/index.js index 03fb869b60..359374e50c 100644 --- a/projects/mantradao/index.js +++ b/projects/mantradao/index.js @@ -1,7 +1,6 @@ -const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const { getCompoundV2Tvl } = require("../helper/compound"); +const { compoundExports } = require("../helper/compound"); const StakingContract = "0x9E15Ad979919bB4db331Bfe864475Ae3BFFebA93"; const OM = "0x3593d125a4f7849a1b059e64f4517a86dd60c95d"; @@ -13,28 +12,19 @@ const comptroller = "0x606246e9EF6C70DCb6CEE42136cd06D127E2B7C7"; const zenETH = "0x4F905f75F5576228eD2D0EA508Fb0c32a0696090"; const zenETHEquivalent = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; -const ethTvl = async (...params) => { - return getCompoundV2Tvl( - comptroller, - "ethereum", - (addr) => addr, - zenETH, - zenETHEquivalent - )(...params); -}; - module.exports = { + timetravel: true, + doublecounted: false, misrepresentedTokens: true, - staking: { - tvl: staking(StakingContract, OM), - }, - pool2: { - tvl: pool2(StakingContract_OM_ETH, OM_ETH_UNIV2), - }, ethereum: { - tvl: ethTvl, + staking: staking(StakingContract, OM), + pool2: pool2(StakingContract_OM_ETH, OM_ETH_UNIV2), + ...compoundExports( comptroller, + "ethereum", + zenETH, + zenETHEquivalent + ) }, - tvl: sdk.util.sumChainTvls([ethTvl]), methodology: "We count liquidity on the pool2, and on the markets same as compound", }; diff --git a/projects/rari/onchain.js b/projects/rari/onchain.js index 27962a79eb..ee0b061f57 100644 --- a/projects/rari/onchain.js +++ b/projects/rari/onchain.js @@ -1,8 +1,8 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi"); const { default: BigNumber } = require("bignumber.js"); -const {getCompoundV2Tvl} = require('../helper/compound') -const {pool2} = require('../helper/pool2') +const { getCompoundV2Tvl } = require('../helper/compound') +const { pool2 } = require('../helper/pool2') //const {getCompoundV2Tvl} = require('../helper/compound') const earnETHPoolFundControllerAddressesIncludingLegacy = [ @@ -34,15 +34,54 @@ const ETHAddress = '0x0000000000000000000000000000000000000000' const bigNumZero = BigNumber('0') const tokenMapWithKeysAsSymbol = { - 'DAI':'0x6b175474e89094c44da98b954eedeac495271d0f', - 'USDC':'0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - 'USDT':'0xdac17f958d2ee523a2206206994597c13d831ec7', - 'TUSD':'0x0000000000085d4780b73119b644ae5ecd22b376', - 'BUSD':'0x4fabb145d64652a948d72533023f6e7a623c7c53', - 'SUSD':'0x57ab1ec28d129707052df4df418d58a2d46d5f51', - 'MUSD':'0xe2f2a5c287993345a840db3b0845fbc70f5935a5' + 'DAI': '0x6b175474e89094c44da98b954eedeac495271d0f', + 'USDC': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + 'USDT': '0xdac17f958d2ee523a2206206994597c13d831ec7', + 'TUSD': '0x0000000000085d4780b73119b644ae5ecd22b376', + 'BUSD': '0x4fabb145d64652a948d72533023f6e7a623c7c53', + 'SUSD': '0x57ab1ec28d129707052df4df418d58a2d46d5f51', + 'MUSD': '0xe2f2a5c287993345a840db3b0845fbc70f5935a5' } +async function getFusePools(timestamp, block, balances, borrowed) { + const fusePools = (await sdk.api.abi.call({ + target: fusePoolDirectoryAddress, + block, + abi: abi['getPublicPools'] + })).output['1'] + + const poolSummaries = (await sdk.api.abi.multiCall({ + target: fusePoolLensAddress, + abi: abi['getPoolSummary'], + block, + calls: fusePools.map((poolInfo) => ({ + params: [poolInfo[2]] + })) + })).output + + for (let summaryResult of poolSummaries) { + if (summaryResult.success) { + const summary = summaryResult.output + // https://docs.rari.capital/fuse/#get-pools-by-account-with-data + let amount; + if(borrowed){ + amount = BigNumber(summary['1']) + } else { + amount = BigNumber(summary['0']).minus(summary['1']) + } + sdk.util.sumSingleBalance(balances, ETHAddress, amount.toFixed(0)) + } else { + const newBalances = await getCompoundV2Tvl(summaryResult.input.params[0], 'ethereum', id => id, undefined, undefined, borrowed)(timestamp, block, {}) + Object.entries(newBalances).forEach(entry => sdk.util.sumSingleBalance(balances, entry[0], entry[1])) + } + } +} + +async function borrowed(timestamp, block) { + const balances = {} + await getFusePools(timestamp, block, balances, true) + return balances +} async function tvl(timestamp, block) { const balances = {} @@ -74,7 +113,7 @@ async function tvl(timestamp, block) { for (let i = 0; i < earnPoolData[j]['0'].length; i++) { const tokenSymbol = earnPoolData[j]['0'][i].toUpperCase() const tokenContractAddress = tokenMapWithKeysAsSymbol[tokenSymbol] - if(tokenContractAddress){ + if (tokenContractAddress) { const tokenAmount = BigNumber(earnPoolData[j]['1'][i]) if (tokenAmount.isGreaterThan(bigNumZero)) { updateBalance(tokenContractAddress, tokenAmount) @@ -97,69 +136,42 @@ async function tvl(timestamp, block) { // Earn yield pool const earnYieldProxyAddress = getEarnYieldProxyAddressAsArray(block) - await getBalancesFromEarnPool(earnYieldProxyAddress) + await getBalancesFromEarnPool(earnYieldProxyAddress) //Earn ETH pool - const ethPoolData = (await sdk.api.abi.multiCall({ - block, - abi: abi['getRawFundBalances'], - calls: earnETHPoolFundControllerAddressesIncludingLegacy.map((address) => ({ - target: address - })) - })).output.map((resp) => resp.output).flat() - for (let i = 0; i < ethPoolData.length; i++) { - const ethAmount = BigNumber(ethPoolData[i]['0']) - if (ethAmount.isGreaterThan(bigNumZero)) { - updateBalance(ETHAddress, ethAmount) - } + const ethPoolData = (await sdk.api.abi.multiCall({ + block, + abi: abi['getRawFundBalances'], + calls: earnETHPoolFundControllerAddressesIncludingLegacy.map((address) => ({ + target: address + })) + })).output.map((resp) => resp.output).flat() + for (let i = 0; i < ethPoolData.length; i++) { + const ethAmount = BigNumber(ethPoolData[i]['0']) + if (ethAmount.isGreaterThan(bigNumZero)) { + updateBalance(ETHAddress, ethAmount) } + } // Earn DAI pool - await getBalancesFromEarnPool(earnDAIPoolControllerAddressesIncludingLegacy) + await getBalancesFromEarnPool(earnDAIPoolControllerAddressesIncludingLegacy) // Earn stable pool - await getBalancesFromEarnPool(earnStablePoolAddressesIncludingLegacy) + await getBalancesFromEarnPool(earnStablePoolAddressesIncludingLegacy) // Fuse - const fusePools = (await sdk.api.abi.call({ - target: fusePoolDirectoryAddress, - block, - abi: abi['getPublicPools'] - })).output['1'] - //console.log(fusePools.map((poolInfo) => (poolInfo[2]))) - - const poolSummaries = (await sdk.api.abi.multiCall({ - target: fusePoolLensAddress, - abi: abi['getPoolSummary'], - block, - calls: fusePools.map((poolInfo) => ({ - params: [poolInfo[2]] - })) - })).output - //console.log("summaries", poolSummaries.map(t=>t[0])) - - for (let summaryResult of poolSummaries) { - if (summaryResult.success) { - const summary = summaryResult.output - // https://docs.rari.capital/fuse/#get-pools-by-account-with-data - const collateral = BigNumber(summary['0']).minus(summary['1']) - if (collateral.isGreaterThan(bigNumZero)) { - updateBalance(ETHAddress, collateral) - } - } else { - const newBalances = await getCompoundV2Tvl(summaryResult.input.params[0], 'ethereum', id=>id)(timestamp, block, {}) - Object.entries(newBalances).forEach(entry=>sdk.util.sumSingleBalance(balances, entry[0], entry[1])) - } - } + await getFusePools(timestamp, block, balances, false) return balances } module.exports = { + timetravel: true, misrepresentedTokens: true, start: 1596236058, // July 14, 2020 - ethereum:{ + ethereum: { tvl, - pool2: pool2(rariGovernanceTokenUniswapDistributorAddress, RGTETHSushiLPTokenAddress) + pool2: pool2(rariGovernanceTokenUniswapDistributorAddress, RGTETHSushiLPTokenAddress), + borrowed, } } diff --git a/projects/sashimiswap/index.js b/projects/sashimiswap/index.js index f669b8ad6a..b292dd2c54 100644 --- a/projects/sashimiswap/index.js +++ b/projects/sashimiswap/index.js @@ -1,11 +1,7 @@ const sdk = require("@defillama/sdk"); -const erc20 = require("../helper/abis/erc20.json"); const {uniTvlExport} = require("../helper/calculateUniTvl"); -const { getCompoundV2Tvl } = require("../helper/compound"); -const { - transformBscAddress, - transformHecoAddress, -} = require("../helper/portedTokens"); +const { compoundExports } = require("../helper/compound"); +const { staking } = require("../helper/staking"); const factoryETH = "0xF028F723ED1D0fE01cC59973C49298AA95c57472"; const comprollerETH = "0xB5d53eC97Bed54fe4c2b77f275025c3fc132D770"; @@ -22,58 +18,26 @@ const comprollerHECO = "0x6Cb9d7ecf84b0d3E7704ed91046e16f9D45C00FA"; const sIHT = "0xf13d3E10DEE31b80887422c89285112Dd00ce0B5"; const WHTEquivalent = "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f"; -const staking = async (timestamp, ethBlock) => { - const balances = {}; +const {tvl: ethMarketsTvl, borrowed: borrowedEth} = compoundExports( + comprollerETH, + "ethereum", + sIETH, + WETHEquivalent +) - const bal = ( - await sdk.api.abi.call({ - abi: erc20.balanceOf, - target: "0xC28E27870558cF22ADD83540d2126da2e4b464c2", - params: "0x6ed306DbA10E6c6B20BBa693892Fac21f3B91977", - block: ethBlock, - }) - ).output; +const {tvl: bscMarketsTvl, borrowed: borrowedBsc} = compoundExports( + comprollerBSC, + "bsc", + sIBNB, + WBNBEquivalent +) - sdk.util.sumSingleBalance( - balances, - "0xC28E27870558cF22ADD83540d2126da2e4b464c2", - bal - ); - - return balances; -}; - -const ethMarketsTvl = async (...params) => { - return getCompoundV2Tvl( - comprollerETH, - "ethereum", - (addr) => addr, - sIETH, - WETHEquivalent - )(...params); -}; - -const bscMarketsTvl = async (...params) => { - const transformAdress = await transformBscAddress(); - return getCompoundV2Tvl( - comprollerBSC, - "bsc", - transformAdress, - sIBNB, - WBNBEquivalent - )(...params); -}; - -const hecoMarketsTvl = async (...params) => { - const transformAdress = await transformHecoAddress(); - return getCompoundV2Tvl( - comprollerHECO, - "heco", - transformAdress, - sIHT, - WHTEquivalent - )(...params); -}; +const {tvl: hecoMarketsTvl, borrowed: borrowedHeco} = compoundExports( + comprollerHECO, + "heco", + sIHT, + WHTEquivalent +) const ethTvl = uniTvlExport(factoryETH, "ethereum"); @@ -82,25 +46,20 @@ const bscTvl = uniTvlExport(factoryBSC, "bsc"); const hecoTvl = uniTvlExport(factoryHECO, "heco"); module.exports = { - tvl: sdk.util.sumChainTvls([ - ethTvl, - ethMarketsTvl, - bscTvl, - bscMarketsTvl, - hecoTvl, - hecoMarketsTvl, - ]), - staking: { - tvl: staking, - }, + timetravel: true, + doublecounted: false, ethereum: { tvl: sdk.util.sumChainTvls([ethTvl,ethMarketsTvl]), + staking: staking("0x6ed306DbA10E6c6B20BBa693892Fac21f3B91977", "0xC28E27870558cF22ADD83540d2126da2e4b464c2"), + borrowed: borrowedEth, }, bsc: { tvl: sdk.util.sumChainTvls([bscTvl, bscMarketsTvl]), + borrowed: borrowedBsc, }, heco: { tvl: sdk.util.sumChainTvls([hecoTvl,hecoMarketsTvl]), + borrowed: borrowedHeco, }, methodology: "We count liquidity on the Farms (LP tokens) threw Factory Contract; and on the lending markets same as compound", diff --git a/projects/scream/index.js b/projects/scream/index.js index 757713b942..f727a95ab8 100644 --- a/projects/scream/index.js +++ b/projects/scream/index.js @@ -1,22 +1,27 @@ -const {getCompoundV2Tvl} = require('../helper/compound') -const {transformFantomAddress} = require('../helper/portedTokens') -const {staking} = require('../helper/staking') +const { getCompoundV2Tvl } = require('../helper/compound') +const { transformFantomAddress } = require('../helper/portedTokens') +const { staking } = require('../helper/staking') -async function tvl(...params) { - const transformAdress= await transformFantomAddress() - const balances = await getCompoundV2Tvl("0x260e596dabe3afc463e75b6cc05d8c46acacfb09", "fantom", addr=>{ - if(addr === "0xAd84341756Bf337f5a0164515b1f6F993D194E1f"){ - return "0x0000000000085d4780b73119b644ae5ecd22b376" - } - return transformAdress(addr) - })(...params) - return Object.fromEntries(Object.entries(balances).filter(b=>Number(b[1])>1)) +function lending(borrowed) { + return async (...params) => { + const transformAdress = await transformFantomAddress() + const balances = await getCompoundV2Tvl("0x260e596dabe3afc463e75b6cc05d8c46acacfb09", "fantom", addr => { + if (addr === "0xAd84341756Bf337f5a0164515b1f6F993D194E1f") { + return "0x0000000000085d4780b73119b644ae5ecd22b376" + } + return transformAdress(addr) + }, undefined, undefined, borrowed)(...params) + return Object.fromEntries(Object.entries(balances).filter(b => Number(b[1]) > 1)) + } } -module.exports={ +module.exports = { methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets. fUSD is returned as TUSD", - staking:{ - tvl: staking("0xe3d17c7e840ec140a7a51aca351a482231760824", "0xe0654C8e6fd4D733349ac7E09f6f23DA256bF475", "fantom") - }, - tvl + timetravel: true, + doublecounted: false, + fantom: { + staking: staking("0xe3d17c7e840ec140a7a51aca351a482231760824", "0xe0654C8e6fd4D733349ac7E09f6f23DA256bF475", "fantom"), + tvl: lending(false), + borrowed: lending(true), + } } diff --git a/projects/strike/index.js b/projects/strike/index.js index 037b0d5ce8..c93a23b020 100644 --- a/projects/strike/index.js +++ b/projects/strike/index.js @@ -1,8 +1,5 @@ -const {getCompoundV2Tvl} = require('../helper/compound') +const {fullCoumpoundExports} = require('../helper/compound') const comptroller = "0xe2e17b2CBbf48211FA7eB8A875360e5e39bA2602" -module.exports={ - tvl: getCompoundV2Tvl(comptroller, "ethereum", id=>id, "0xbEe9Cf658702527b0AcB2719c1FAA29EdC006a92"), - methodology: "Excludes borrowed amounts" -} \ No newline at end of file +module.exports=fullCoumpoundExports(comptroller, "ethereum", "0xbEe9Cf658702527b0AcB2719c1FAA29EdC006a92", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2") \ No newline at end of file diff --git a/projects/traderjoe/index.js b/projects/traderjoe/index.js index 0e05123e6d..3ecbae0576 100644 --- a/projects/traderjoe/index.js +++ b/projects/traderjoe/index.js @@ -1,5 +1,5 @@ const sdk = require('@defillama/sdk') -const {transformAvaxAddress, fixAvaxBalances} = require('../helper/portedTokens') +const {transformAvaxAddress} = require('../helper/portedTokens') const {calculateUniTvl} = require('../helper/calculateUniTvl') const {getCompoundV2Tvl} = require('../helper/compound') @@ -11,28 +11,18 @@ async function swapTvl(timestamp, ethBlock, chainBlocks){ } const { getChainTvl } = require('../helper/getUniSubgraphTvl'); +const { staking } = require('../helper/staking') const joeBar = "0x57319d41F71E81F3c65F2a47CA4e001EbAFd4F33" const joeToken = "0x6e84a6216eA6dACC71eE8E6b0a5B7322EEbC0fDd" const graphUrls = { avax: 'https://api.thegraph.com/subgraphs/name/traderjoe-xyz/exchange', } -const chainTvl = getChainTvl(graphUrls, "factories", "liquidityUSD") - -async function staking(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const stakedJoe = sdk.api.erc20.balanceOf({ - target: joeToken, - owner: joeBar, - chain: 'avax', - block: chainBlocks.avax - }) - sdk.util.sumSingleBalance(balances, 'avax:' + joeToken, (await stakedJoe).output) - return balances; -} +const chainTvl = getChainTvl(graphUrls, "factories", "liquidityUSD")("avax") module.exports = { timetravel: true, + doublecounted: false, misrepresentedTokens: true, methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/exchange" subgraph. The staking portion of TVL includes the JoeTokens within the JoeBar contract.', avalanche:{ @@ -40,6 +30,7 @@ module.exports = { swapTvl, getCompoundV2Tvl(comptroller, "avax", addr=>`avax:${addr}`, "0xC22F01ddc8010Ee05574028528614634684EC29e", "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7") ]), - staking + borrowed: getCompoundV2Tvl(comptroller, "avax", addr=>`avax:${addr}`, "0xC22F01ddc8010Ee05574028528614634684EC29e", "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", true), + staking: staking(joeBar, joeToken, "avax"), } } diff --git a/projects/unfederalreserve/index.js b/projects/unfederalreserve/index.js index 9dd2f47a76..0796d56e0b 100644 --- a/projects/unfederalreserve/index.js +++ b/projects/unfederalreserve/index.js @@ -1,10 +1,3 @@ -const {getCompoundV2Tvl} = require('../helper/compound') +const {fullCoumpoundExports} = require('../helper/compound') -async function tvl(...params) { - return getCompoundV2Tvl("0x3105D328c66d8d55092358cF595d54608178E9B5", "ethereum", a=>a, "0xFaCecE87e14B50eafc85C44C01702F5f485CA460", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")(...params) -} - -module.exports={ - methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", - tvl -} +module.exports=fullCoumpoundExports("0x3105D328c66d8d55092358cF595d54608178E9B5", "ethereum", "0xFaCecE87e14B50eafc85C44C01702F5f485CA460", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2") \ No newline at end of file From 272f96dec465760a0843b949c4916d524bc570d2 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 5 Dec 2021 22:08:47 +0000 Subject: [PATCH 180/393] add borrows to compound --- projects/compound-onchain/index.js | 69 ++++++++++++++++++++-- projects/compound-onchain/v1Abi.json | 86 ++++++++++++++++++++++++++++ 2 files changed, 150 insertions(+), 5 deletions(-) create mode 100644 projects/compound-onchain/v1Abi.json diff --git a/projects/compound-onchain/index.js b/projects/compound-onchain/index.js index 086ab46403..1232649fe9 100644 --- a/projects/compound-onchain/index.js +++ b/projects/compound-onchain/index.js @@ -1,6 +1,7 @@ const _ = require('underscore'); const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); +const v1abi = require('./v1Abi.json'); const BigNumber = require('bignumber.js'); const {lendingMarket} = require('../helper/methodologies') @@ -117,8 +118,40 @@ async function getMarkets(block) { } } -async function tvl(timestamp, block) { - let balances = {}; +const v1Contract = '0x3FDA67f7583380E67ef93072294a7fAc882FD7E7' +async function v1Tvl(balances, block, borrowed){ + const marketsLength = await sdk.api.abi.call({ + target: v1Contract, + block, + abi: v1abi.getCollateralMarketsLength + }); + const underlyings = await sdk.api.abi.multiCall({ + calls: Array(Number(marketsLength.output)).fill().map((n, i)=>({ + target: v1Contract, + params: [i] + })), + block, + abi: v1abi.collateralMarkets + }); + const markets = await sdk.api.abi.multiCall({ + calls: underlyings.output.map(m=>({ + target: v1Contract, + params: [m.output] + })), + block, + abi: v1abi.markets + }); + markets.output.forEach(m=>{ + const token = m.input.params[0] + let amount + if(borrowed){ + amount = m.output.totalBorrows + } + sdk.util.sumSingleBalance(balances, token, amount) + }) +} + +async function v2Tvl(balances, block, borrowed){ let markets = await getMarkets(block); // Get V1 tokens locked @@ -139,7 +172,7 @@ async function tvl(timestamp, block) { calls: _.map(markets, (market) => ({ target: market.cToken, })), - abi: abi['getCash'], + abi: borrowed?abi.totalBorrows: abi['getCash'], }); _.each(markets, (market) => { @@ -151,11 +184,37 @@ async function tvl(timestamp, block) { return balances; } +async function borrowed(timestamp, block){ + const balances = {}; + await v1Tvl(balances, block, true) + await v2Tvl(balances, block, true) + return balances +} + +async function tvl(timestamp, block) { + let balances = {}; + + // Get V1 tokens locked + let v1Locked = await sdk.api.abi.multiCall({ + block, + calls: _.map(markets, (market) => ({ + target: market.underlying, + params: v1Contract, + })), + abi: 'erc20:balanceOf', + }); + + sdk.util.sumMultiBalanceOf(balances, v1Locked); + + await v2Tvl(balances, block, false) + return balances; +} + module.exports = { timetravel: true, ethereum: { - tvl + tvl, + borrowed }, methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko.`, - tvl, }; diff --git a/projects/compound-onchain/v1Abi.json b/projects/compound-onchain/v1Abi.json new file mode 100644 index 0000000000..2fb5640757 --- /dev/null +++ b/projects/compound-onchain/v1Abi.json @@ -0,0 +1,86 @@ +{ + "getCollateralMarketsLength": { + "constant": true, + "inputs": [], + "name": "getCollateralMarketsLength", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "markets": { + "constant": true, + "inputs": [ + { + "name": "", + "type": "address" + } + ], + "name": "markets", + "outputs": [ + { + "name": "isSupported", + "type": "bool" + }, + { + "name": "blockNumber", + "type": "uint256" + }, + { + "name": "interestRateModel", + "type": "address" + }, + { + "name": "totalSupply", + "type": "uint256" + }, + { + "name": "supplyRateMantissa", + "type": "uint256" + }, + { + "name": "supplyIndex", + "type": "uint256" + }, + { + "name": "totalBorrows", + "type": "uint256" + }, + { + "name": "borrowRateMantissa", + "type": "uint256" + }, + { + "name": "borrowIndex", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "collateralMarkets": { + "constant": true, + "inputs": [ + { + "name": "", + "type": "uint256" + } + ], + "name": "collateralMarkets", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file From 8f4b045e3cbb32abb1ec2cdfa460f765edfe8d3b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 5 Dec 2021 22:44:29 +0000 Subject: [PATCH 181/393] add borrows to usd comp forks --- projects/fusefi/index.js | 5 ++++- projects/fusefi/olalending.js | 6 ++---- projects/helper/compound.js | 21 ++++++++++++++------- projects/neku/index.js | 16 ++++++---------- projects/olafinance/index.js | 13 +++++-------- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/projects/fusefi/index.js b/projects/fusefi/index.js index d66c419ee2..9280cc3147 100644 --- a/projects/fusefi/index.js +++ b/projects/fusefi/index.js @@ -3,5 +3,8 @@ const swap = require('./swap') const olalending = require('./olalending') module.exports = { - tvl: sdk.util.sumChainTvls([swap.tvl, olalending.tvl]), + fuse:{ + tvl: sdk.util.sumChainTvls([swap.tvl, olalending.tvl]), + borrowed: olalending.borrowed + } } \ No newline at end of file diff --git a/projects/fusefi/olalending.js b/projects/fusefi/olalending.js index d88edefcfc..4df9a0af77 100644 --- a/projects/fusefi/olalending.js +++ b/projects/fusefi/olalending.js @@ -1,4 +1,4 @@ -const {getCompoundUsdTvl} = require('../helper/compound'); +const {usdCompoundExports} = require('../helper/compound'); const unitroller_fuse = "0x26a562B713648d7F3D1E1031DCc0860A4F3Fa340" @@ -7,6 +7,4 @@ const abis = { underlyingPrice: {"constant":true,"inputs":[{"internalType":"address","name":"cToken","type":"address"}],"name":"getPriceForUnderling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}, } -module.exports={ - tvl: getCompoundUsdTvl(unitroller_fuse, "fuse", "0x025B0ff0920298e087308F3b2de0CF6399685909", abis) -} \ No newline at end of file +module.exports=usdCompoundExports(unitroller_fuse, "fuse", "0x025B0ff0920298e087308F3b2de0CF6399685909", abis) \ No newline at end of file diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 5a464f80fd..94b71c7f64 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -137,17 +137,17 @@ async function getUnderlyingPrice(block, chain, oracle, token, methodAbi) { return underlyingPrice; } -async function getCash(block, chain, token) { +async function getCash(block, chain, token, borrowed) { const { output: cash } = await sdk.api.abi.call({ target: token, - abi: abi['getCash'], + abi: borrowed?abi.totalBorrows: abi['getCash'], block, chain: chain, }); return cash; } -function getCompoundUsdTvl(comptroller, chain, cether, abis={ +function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis={ oracle: abi['oracle'], underlyingPrice: abi['getUnderlyingPrice'] }) { @@ -160,9 +160,9 @@ function getCompoundUsdTvl(comptroller, chain, cether, abis={ await Promise.all( allMarkets.map(async token => { - let cash = new BigNumber(await getCash(block, chain, token)); + let amount = new BigNumber(await getCash(block, chain, token, borrowed)); let decimals = await getUnderlyingDecimals(block, chain, token, cether); - let locked = cash.div(10 ** decimals); + let locked = amount.div(10 ** decimals); let underlyingPrice = new BigNumber(await getUnderlyingPrice(block, chain, oracle, token, abis.underlyingPrice)).div( 10 ** (18 + 18 - decimals) ); @@ -205,10 +205,17 @@ function fullCoumpoundExports(comptroller, chain, cether, cetheEquivalent){ } } +function usdCompoundExports(comptroller, chain, cether, abis){ + return { + tvl: getCompoundUsdTvl(comptroller, chain, cether, false, abis), + borrowed: getCompoundUsdTvl(comptroller, chain, cether, true, abis) + } +} + module.exports = { getCompoundV2Tvl, - getCompoundUsdTvl, compoundExports, compoundExportsWithAsyncTransform, - fullCoumpoundExports + fullCoumpoundExports, + usdCompoundExports }; diff --git a/projects/neku/index.js b/projects/neku/index.js index c9a1713820..7071101878 100644 --- a/projects/neku/index.js +++ b/projects/neku/index.js @@ -1,15 +1,11 @@ -const {getCompoundUsdTvl} = require('../helper/compound') +const {usdCompoundExports} = require('../helper/compound') const unitroller = "0xD5B649c7d27C13a2b80425daEe8Cb6023015Dc6B" // node test.js projects/neku/index.js module.exports={ - arbitrum:{ - tvl: getCompoundUsdTvl(unitroller, "arbitrum", "0xBC4a19345c598D73939b62371cF9891128ecCB8B") - }, - moonriver:{ - tvl: getCompoundUsdTvl(unitroller, "moonriver", "0xBC4a19345c598D73939b62371cF9891128ecCB8B") - }, - bsc:{ - tvl: getCompoundUsdTvl(unitroller, "bsc", "0xBC4a19345c598D73939b62371cF9891128ecCB8B") - } + timetravel: true, + doublecounted: false, + arbitrum:usdCompoundExports(unitroller, "arbitrum", "0xBC4a19345c598D73939b62371cF9891128ecCB8B"), + moonriver:usdCompoundExports(unitroller, "moonriver", "0xBC4a19345c598D73939b62371cF9891128ecCB8B"), + bsc:usdCompoundExports(unitroller, "bsc", "0xBC4a19345c598D73939b62371cF9891128ecCB8B"), } \ No newline at end of file diff --git a/projects/olafinance/index.js b/projects/olafinance/index.js index 3557250337..47f0576c2c 100644 --- a/projects/olafinance/index.js +++ b/projects/olafinance/index.js @@ -1,4 +1,4 @@ -const {getCompoundUsdTvl} = require('../helper/compound') +const {usdCompoundExports} = require('../helper/compound') const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" const unitroller_bsc = "0xAD48B2C9DC6709a560018c678e918253a65df86e" @@ -12,11 +12,8 @@ const abis = { module.exports={ - fantom:{ - tvl: getCompoundUsdTvl(unitroller_fantom, "fantom", "0xed8F2C964b47D4d607a429D4eeA972B186E6f111", abis) - }, - bsc:{ - tvl: getCompoundUsdTvl(unitroller_bsc, "bsc", "0x34878F6a484005AA90E7188a546Ea9E52b538F6f", abis) - } - + timetravel: true, + doublecounted: false, + fantom:usdCompoundExports(unitroller_fantom, "fantom", "0xed8F2C964b47D4d607a429D4eeA972B186E6f111", abis), + bsc:usdCompoundExports(unitroller_bsc, "bsc", "0x34878F6a484005AA90E7188a546Ea9E52b538F6f", abis), } \ No newline at end of file From b3b155f45b9c7b21210846bcedbcaee8d785e47d Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 00:37:07 +0000 Subject: [PATCH 182/393] add borrowed to filda and fix unrecognized tokens --- projects/filda/index.js | 114 ++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 46 deletions(-) diff --git a/projects/filda/index.js b/projects/filda/index.js index eae320b782..ec02ac93f7 100644 --- a/projects/filda/index.js +++ b/projects/filda/index.js @@ -2,6 +2,7 @@ const _ = require('underscore'); const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); const { getBlock } = require('../helper/getBlock') +const { unwrapUniswapLPs } = require('../helper/unwrapLPs') const comptroller = "0xb74633f2022452f377403B638167b0A135DB096d" @@ -26,13 +27,21 @@ async function getUnderlying(block, cToken) { target: cToken, abi: abi['underlying'], })).output; - if (token === '0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a') { - return '0x6b175474e89094c44da98b954eedeac495271d0f';//DAI => DAI - } else if (token === '0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B') { - return '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';//USDC => USDC - } else { - return 'heco:' + token - } + return token + } +} + +function transformAddress(token){ + if(token === '0x6f259637dcd74c767781e37bc6133cd6a68aa161'){ + return token + } else if (token === '0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a') { + return '0x6b175474e89094c44da98b954eedeac495271d0f';//DAI => DAI + } else if (token === '0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B') { + return '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';//USDC => USDC + } else if (token === "0x5eE41aB6edd38cDfB9f6B4e6Cf7F75c87E170d98"){ + return "0x0000000000085d4780b73119b644ae5ecd22b376" //TUSD + } else { + return 'heco:' + token } } @@ -42,16 +51,8 @@ async function getMarkets(block) { const markets = [] await ( Promise.all(allCTokens.map(async (cToken) => { - let foundMarket = false; - for (let market of markets) { - if (market.cToken.toLowerCase() === cToken.toLowerCase()) { - foundMarket = true; - } - } - if (!foundMarket) { - let underlying = await getUnderlying(block, cToken); - markets.push({ underlying, cToken }) - } + let underlying = await getUnderlying(block, cToken); + markets.push({ underlying, cToken }) })) ); @@ -59,54 +60,75 @@ async function getMarkets(block) { } const replacements = { - "heco:0xc2CB6B5357CcCE1B99Cd22232942D9A225Ea4eb1": { + "0xc2CB6B5357CcCE1B99Cd22232942D9A225Ea4eb1": { coingecko: "bitcoin-cash-sv", decimals: 1e18 }, //"heco:0x581EdD7eAb23896513360D7EE8DfE07A5Cad2aBd": "tether", - "heco:0x6514a5Ebff7944099591Ae3e8A5c0979C83B2571": { + "0x6514a5Ebff7944099591Ae3e8A5c0979C83B2571": { coingecko: "neo", decimals: 1e8 }, - "heco:0x45e97daD828AD735af1dF0473fc2735F0Fd5330c": { + "0x45e97daD828AD735af1dF0473fc2735F0Fd5330c": { coingecko: "tezos", decimals: 1e18, } } -async function tvl(timestamp, ethBlock, chainBlocks) { - let balances = {}; - const block = undefined //await getBlock(timestamp, 'heco', chainBlocks) - let markets = await getMarkets(block); +function lending(borrowed) { + return async (timestamp, ethBlock, chainBlocks) => { + let balances = {}; + const block = await getBlock(timestamp, 'heco', chainBlocks, true) + let markets = await getMarkets(block); - // Get V2 tokens locked - let v2Locked = await sdk.api.abi.multiCall({ - block, - calls: _.map(markets, (market) => ({ - target: market.cToken, - })), - chain: 'heco', - abi: abi['getCash'], - }); + let v2Locked = await sdk.api.abi.multiCall({ + block, + calls: _.map(markets, (market) => ({ + target: market.cToken, + })), + chain: 'heco', + abi: borrowed ? abi.totalBorrows : abi['getCash'], + }); - _.each(markets, (market) => { - let getCash = _.find(v2Locked.output, (result) => result.input.target === market.cToken); + const symbols = await sdk.api.abi.multiCall({ + block, + calls: _.map(markets, (market) => ({ + target: market.cToken, + })), + chain: 'heco', + abi: "erc20:symbol", + }); - if (getCash) { - if(getCash.output === null){ + const lps = [] + _.each(markets, (market, idx) => { + let getCash = _.find(v2Locked.output, (result) => result.input.target === market.cToken); + const symbol = _.find(symbols.output, (result) => result.input.target === market.cToken); + if (getCash.output === null) { throw new Error("getCash failed") } - const replacement = replacements[market.underlying] - if(replacement === undefined){ - sdk.util.sumSingleBalance(balances, market.underlying, getCash.output) + if (symbol.output.endsWith("LP")) { + lps.push({ + token: market.underlying, + balance: getCash.output + }) } else { - sdk.util.sumSingleBalance(balances, replacement.coingecko, Number(getCash.output)/replacement.decimals) + const replacement = replacements[market.underlying] + if (replacement === undefined) { + sdk.util.sumSingleBalance(balances, transformAddress(market.underlying), getCash.output) + } else { + sdk.util.sumSingleBalance(balances, replacement.coingecko, Number(getCash.output) / replacement.decimals) + } } - } - }); - - return balances; + }); + + await unwrapUniswapLPs(balances, lps, block, "heco", transformAddress) + return balances; + } } module.exports = { - tvl, + timetravel: true, // Impossible because getBlock will rug tho + heco: { + tvl: lending(false), + borrowed: lending(true) + } }; From db7488088d6f49d544087b9712d1d830640aac15 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 02:06:43 +0000 Subject: [PATCH 183/393] move staking to pool2 for handlefi and delete 0 fx tokens --- projects/handlefi/index.js | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/projects/handlefi/index.js b/projects/handlefi/index.js index bf8a5abcaf..69dc0e049d 100644 --- a/projects/handlefi/index.js +++ b/projects/handlefi/index.js @@ -1,6 +1,7 @@ const sdk = require("@defillama/sdk") const BigNumber = require("bignumber.js") const { sumTokens, unwrapUniswapLPs } = require("../helper/unwrapLPs") +const {pool2 } = require("../helper/pool2") const { getBlock } = require("../helper/getBlock") const abi = require("./abi.json"); @@ -37,26 +38,6 @@ async function arbitrum_tvl(timestamp, ethBlock, chainBlocks, chain) { return balances } -// Arbitrum Staking is sushiswap LP FOREX/WETH provided to staking contract -async function arbitrum_staking(timestamp, ethBlock, chainBlocks, chain) { - const balances = {} - const block = await getBlock(timestamp, "arbitrum", chainBlocks) - // Sushiswap LP FOREX/WETH staking on arbitrum - const { output: FOREX_WETH_LP_tokens } = await sdk.api.erc20.balanceOf({ - target: WETH_FOREX_sushi_LP, - owner: LP_staking_contract, - block, - chain: 'arbitrum' - }) - const lpBalances = [{ - 'token': WETH_FOREX_sushi_LP, - 'balance': FOREX_WETH_LP_tokens - }] - //console.log('Sushiswap FOREX/WETH LP staked in masterchef', FOREX_WETH_LP_tokens / 1e18) - await unwrapUniswapLPs(balances, lpBalances, chainBlocks['arbitrum'], 'arbitrum', transformArbitrumAddress) - return balances -} - // Eth-mainnet TVL is locked in RariCapital Fuse pool #72 and #116 async function ethereum_tvl(timestamp, ethBlock, chainBlocks) { const balances = {} @@ -104,7 +85,7 @@ async function ethereum_tvl(timestamp, ethBlock, chainBlocks) { // Set to zero balance of fxTokens, which are not collateral but are backed by the other assets of rari pools for (const [key, value] of Object.entries(fxTokens)) { - balances[value] = '0' + delete balances[value]; } return balances } @@ -112,7 +93,7 @@ async function ethereum_tvl(timestamp, ethBlock, chainBlocks) { module.exports = { arbitrum: { tvl: arbitrum_tvl, - staking: arbitrum_staking + pool2: pool2(LP_staking_contract, WETH_FOREX_sushi_LP, "arbitrum") }, ethereum: { tvl: ethereum_tvl, From 6bd2cdd1775daf31bdc72d147ec9feaa85c4f6e4 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 02:37:11 +0000 Subject: [PATCH 184/393] add borrowed to more projects --- projects/ironfinance/index.js | 68 +++------------ projects/jetfuelfinance/index.js | 66 ++------------- projects/wepiggy.js | 137 ++----------------------------- 3 files changed, 29 insertions(+), 242 deletions(-) diff --git a/projects/ironfinance/index.js b/projects/ironfinance/index.js index e9d2129139..eefd7d4776 100644 --- a/projects/ironfinance/index.js +++ b/projects/ironfinance/index.js @@ -1,6 +1,7 @@ const sdk = require('@defillama/sdk'); const abiPolygon = require('./abi-polygon.json'); const { transformAddress } = require('./utils'); +const { compoundExports } = require('../helper/compound'); const Contracts = { polygon: { @@ -65,60 +66,10 @@ const poolTvl = async (chain, poolAddress, block, addressTransformer) => { return sum; }; -const lendingTvl = async (chain, block, addressTransformer) => { - const controller = Contracts[chain].lend.ironController; - const { output: markets } = await sdk.api.abi.call({ - target: controller, - abi: abiPolygon.IronController.getAllMarkets, - chain, - block, - }); - - const [symbols, cash, underlyingAddress] = await Promise.all([ - sdk.api.abi.multiCall({ - abi: abiPolygon.rToken.symbol, - calls: markets.map((t) => ({ - target: t, - })), - chain, - block, - }), - - sdk.api.abi.multiCall({ - abi: abiPolygon.rToken.getCash, - calls: markets.map((t) => ({ - target: t, - })), - chain, - block, - }), - - sdk.api.abi.multiCall({ - abi: abiPolygon.rToken.underlying, - calls: markets.map((t) => ({ - target: t, - })), - chain, - block, - }), - ]); - - const sum = {}; - symbols.output.forEach((symbol, i) => { - let underlying = underlyingAddress.output[i].output; - if (!underlying) { - underlying = Contracts[chain].wrappedNative; - } - sdk.util.sumSingleBalance(sum, addressTransformer(underlying), cash.output[i].output); - }); - - return sum; -}; - const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { let block = chainBlocks['polygon']; const addressTransformer = await transformAddress('polygon'); - const tvl = await lendingTvl('polygon', block, addressTransformer); + const tvl = {}; for (let address of Object.values(Contracts.polygon.pools)) { const balances = await poolTvl( @@ -159,7 +110,7 @@ const fantomTvl = async (timestamp, ethBlock, chainBlocks) => { const addressTransformer = await transformAddress('fantom'); const block = chainBlocks['fantom']; - let tvl = await lendingTvl('fantom', block, addressTransformer); + let tvl = {}; for (let address of Object.values(Contracts.fantom.pools)) { const balances = await poolTvl( 'fantom', @@ -176,15 +127,22 @@ const fantomTvl = async (timestamp, ethBlock, chainBlocks) => { return tvl; }; +const {tvl: polygonLending, borrowed: polygonBorrowed} = + compoundExports(Contracts.polygon.lend.ironController, "polygon", "0xCa0F37f73174a28a64552D426590d3eD601ecCa1", Contracts.polygon.wrappedNative) +const {tvl: fantomLending, borrowed: fantomBorrowed} = + compoundExports(Contracts.fantom.lend.ironController, "fantom", "0xdfce3E14a8c77D32fe2455a9E56424F149E2F271", Contracts.fantom.wrappedNative) + module.exports = { + timetravel: true, polygon: { - tvl: polygonTvl, + tvl: sdk.util.sumChainTvls([polygonTvl, polygonLending]), + borrowed: polygonBorrowed }, avalanche: { tvl: avaxTvl, }, fantom: { - tvl: fantomTvl, + tvl: sdk.util.sumChainTvls([fantomTvl, fantomLending]), + borrowed: fantomBorrowed }, - tvl: sdk.util.sumChainTvls([polygonTvl, avaxTvl, fantomTvl]), }; diff --git a/projects/jetfuelfinance/index.js b/projects/jetfuelfinance/index.js index 63162c84d9..8e3da7ac50 100644 --- a/projects/jetfuelfinance/index.js +++ b/projects/jetfuelfinance/index.js @@ -2,7 +2,8 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); const { transformBscAddress } = require("../helper/portedTokens"); -const tvlOnPairs = require("../helper/processPairs.js"); +const { compoundExports } = require("../helper/compound"); +const {calculateUniTvl} = require("../helper/calculateUniTvl"); // Jetswap section const factory = "0x0eb58E5c8aA63314ff5547289185cC4583DfCBD5"; @@ -49,36 +50,9 @@ const single_side_assets = [ "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", ]; -const markets = [ - //fUSDC - "0x3ef88D7FDe18Fe966474FE3878b802F678b029bC", - //fUSDT - "0x554530ecDE5A4Ba780682F479BC9F64F4bBFf3a1", - //fBUSD - "0x8BB0d002bAc7F1845cB2F14fe3D6Aae1D1601e29", - //fBTC - "0x47BAA29244c342f1e6cDe11C968632E7403aE258", - //fETH - "0x5F3EF8B418a8cd7E3950123D980810A0A1865981", - //fLTC - "0xE75b16cc66F8820Fb97f52f0C25F41982ba4daF3", - //fXRP - "0xa7FB72808de4FFcaCf9a815Bd1CcbE70F03b54ca", - //fADA - "0x4C0933453359733b4867DfF1145A9a0749931A00", - //fDAI - "0x5F30fDDdCf14a0997a52fdb7D7F23b93F0f21998", - //fDOT - "0x8fc4f7A57BB19E701108b17d785a28118604a3D1", - //fBETH - "0x8ed1f4c1326E5d3C1b6E99Ac9E5EC6651E11e3Da", -]; - const bscTvl = async (timestamp, block, chainBlocks) => { - const balances = {}; - // Jetswap section - await tvlOnPairs("bsc", chainBlocks, factory, balances); + const balances = await calculateUniTvl(addr=>`bsc:${addr}`, chainBlocks.bsc, "bsc", factory, 0, true) // Vault section in their repo const vault_balances = ( @@ -131,39 +105,15 @@ const bscTvl = async (timestamp, block, chainBlocks) => { sdk.util.sumSingleBalance(balances, `bsc:${single_side_assets[idx]}`, bal); }); - // Fortress section - const underlyings = ( - await sdk.api.abi.multiCall({ - abi: abi.underlying, - calls: markets.map((address) => ({ target: address })), - chain: "bsc", - block: chainBlocks["bsc"], - }) - ).output.map((el) => el.output); - - const balances_markets = ( - await sdk.api.abi.multiCall({ - abi: abi.getCash, - calls: markets.map((address) => ({ target: address })), - chain: "bsc", - block: chainBlocks["bsc"], - }) - ).output.map((el) => el.output); - - underlyings.forEach((underlying, idx) => { - sdk.util.sumSingleBalance( - balances, - `bsc:${underlying}`, - balances_markets[idx] - ); - }); - return balances; }; +const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "bsc", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c") + module.exports = { + timetravel: true, bsc: { - tvl: bscTvl, + tvl: sdk.util.sumChainTvls([bscTvl, lendingTvl]), + borrowed }, - tvl: sdk.util.sumChainTvls([bscTvl]), }; diff --git a/projects/wepiggy.js b/projects/wepiggy.js index 5793fb6742..a739732334 100644 --- a/projects/wepiggy.js +++ b/projects/wepiggy.js @@ -1,6 +1,4 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js').default; -const abi = require('./config/wepiggy/abi.json'); +const {usdCompoundExports} = require('./helper/compound'); const contracts = { ethereum: { @@ -54,132 +52,13 @@ const contracts = { }, }; -// ask comptroller for all markets array -async function getAllMarkets(block, chain, comptroller) { - const { output: markets } = await sdk.api.abi.call({ - target: comptroller, - abi: abi['getAllMarkets'], - block, - chain: chain, - }); - return markets; -} +const chainExports = {} +Object.entries(contracts).forEach(([chain, chainData])=>{ + chainExports[chain]=usdCompoundExports(chainData.comptroller, chain, chainData.gas.pToken) +}) -// ask comptroller for oracle -async function getOracle(block, chain, comptroller) { - const { output: oracle } = await sdk.api.abi.call({ - target: comptroller, - abi: abi['oracle'], - block, - chain: chain, - }); - return oracle; -} - -async function getUnderlyingDecimals(block, chain, token) { - // if (token === '0x27A94869341838D5783368a8503FdA5fbCd7987c') { - // return { underlying: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', decimals: 18 }; //pETH => WETH - // } - if (token.toLowerCase() === contracts[chain].gas.pToken.toLowerCase()) { - return contracts[chain].gas.decimals; - } - - const { output: underlying } = await sdk.api.abi.call({ - target: token, - abi: abi['underlying'], - block, - chain: chain, - }); - const { output: decimals } = await sdk.api.abi.call({ - target: underlying, - abi: abi['decimals'], - block, - chain: chain, - }); - return decimals; -} - -async function getUnderlyingPrice(block, chain, oracle, token) { - const { output: underlyingPrice } = await sdk.api.abi.call({ - target: oracle, - abi: abi['getUnderlyingPrice'], - block, - params: [token], - chain: chain, - }); - return underlyingPrice; -} - -async function getCash(block, chain, token) { - const { output: cash } = await sdk.api.abi.call({ - target: token, - abi: abi['getCash'], - block, - chain: chain, - }); - return cash; -} - -function fetchChain(chain) { - return async () => { - let tvl = new BigNumber('0'); - let { comptroller } = contracts[chain]; - let block = null; - // const { block } = await sdk.api.util.lookupBlock(timestamp, { - // chain: chain, - // }); - let allMarkets = await getAllMarkets(block, chain, comptroller); - let oracle = await getOracle(block, chain, comptroller); - - await Promise.all( - allMarkets.map(async token => { - let cash = new BigNumber(await getCash(block, chain, token)); - let decimals = await getUnderlyingDecimals(block, chain, token); - let locked = cash.div(10 ** decimals); - let underlyingPrice = new BigNumber(await getUnderlyingPrice(block, chain, oracle, token)).div( - 10 ** (18 + 18 - decimals) - ); - tvl = tvl.plus(locked.times(underlyingPrice)); - }) - ); - return tvl.toNumber(); - }; -} - -async function fetch() { - let tvl = - (await fetchChain('ethereum')()) + - (await fetchChain('okexchain')()) + - (await fetchChain('bsc')()) + - (await fetchChain('polygon')()) + - (await fetchChain('heco')()) + - (await fetchChain('arbitrum')()) + - (await fetchChain('optimism')()); - return tvl; -} - -module.exports = { - ethereum: { - fetch: fetchChain('ethereum'), - }, - okexchain: { - fetch: fetchChain('okexchain'), - }, - bsc: { - fetch: fetchChain('bsc'), - }, - polygon: { - fetch: fetchChain('polygon'), - }, - heco: { - fetch: fetchChain('heco'), - }, - arbitrum: { - fetch: fetchChain('arbitrum'), - }, - optimism: { - fetch: fetchChain('optimism'), - }, - fetch, +module.exports={ + timetravel: true, + ...chainExports, methodology: `TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.` }; From a12f4cd266ebeb2a37899676abedd8b2f2cd7dec Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 02:55:46 +0000 Subject: [PATCH 185/393] separate borrowing and deposits for ram --- projects/ram.js | 51 +++---------------------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/projects/ram.js b/projects/ram.js index 7d5d30bda2..39eccde407 100644 --- a/projects/ram.js +++ b/projects/ram.js @@ -1,53 +1,8 @@ -const retry = require("async-retry"); -const Web3 = require("web3"); -const BigNumber = require("bignumber.js"); -const abis = require("./config/ram/abis.js"); +const {usdCompoundExports} = require("./helper/compound"); -const rpcUrl = "https://mainnet-rpc.thundercore.com"; const controllerAddress = "0x0d4fe8832857Bb557d8CFCf3737cbFc8aE784106"; -function fetch() { - return retry(async () => await getTVL()); -} - -async function getTVL() { - const web3 = new Web3(new Web3.providers.HttpProvider(rpcUrl)); - const controller = new web3.eth.Contract( - abis.abis.controller, - controllerAddress - ); - const oracleAddress = await controller.methods.oracle().call(); - const oracle = new web3.eth.Contract(abis.abis.oracle, oracleAddress); - const markets = await controller.methods.getAllMarkets().call(); - const sum = await getMarketsTotalSupply(web3, markets, oracle); - return sum; -} - -async function getTokenValue(tokenContract, oracle) { - const [totalSupply, rate, price] = await Promise.all([ - tokenContract.methods.totalSupply().call(), - tokenContract.methods.exchangeRateCurrent().call(), - oracle.methods.getUnderlyingPrice(tokenContract.options.address).call(), - ]); - const tokenPrice = new BigNumber(price); - const valueLocked = tokenPrice - .multipliedBy(totalSupply) - .multipliedBy(rate) - .div(10 ** 54); - return valueLocked; -} - -async function getMarketsTotalSupply(web3, markets, oracle) { - const tokenContracts = markets.map( - (market) => new web3.eth.Contract(abis.abis.rtoken, market) - ); - const values = await Promise.all( - tokenContracts.map((tokenContract) => getTokenValue(tokenContract, oracle)) - ); - const value = values.reduce((accu, cur) => accu.plus(cur), new BigNumber(0)); - return value.toNumber(); -} - module.exports = { - fetch, + timetravel: true, // but we don't have a thundercore archive node atm + thundercore: usdCompoundExports(controllerAddress, "thundercore", "0xeF5A0CE54a519B1Db3F350EB902C4cFbf7671D88") }; From 58f125f6aa223abb00ab9b64418053db9864aa6a Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 03:08:45 +0000 Subject: [PATCH 186/393] add borrowed to anchor --- projects/anchor/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/anchor/index.js b/projects/anchor/index.js index 76009f189e..5cd4cfd846 100644 --- a/projects/anchor/index.js +++ b/projects/anchor/index.js @@ -1,4 +1,5 @@ const { request, gql } = require("graphql-request"); +const { fetchURL } = require("../helper/utils"); const graphUrl = 'https://mantle.terra.dev/' const query = gql` @@ -43,11 +44,19 @@ async function tvl(timestamp, block) { } } +async function borrowed(){ + const data = await fetchURL("https://api.anchorprotocol.com/api/v1/borrow") + return { + "terrausd": Number(data.data.total_borrowed) / 1e6 + } +} + module.exports = { - tvl, + timetravel: false, methodology: `We use the Anchor subgraph to get the amount of bLUNA and bETH used as collateral on anchor and the UST that is on anchor but has not been lent, we then use Coingecko to price the tokens in USD.`, terra: { tvl, + borrowed } } \ No newline at end of file From a16481d0dafbe3b70f34ecf59adb7d78eb24f7ec Mon Sep 17 00:00:00 2001 From: GalaxyGoggle Date: Sun, 5 Dec 2021 22:40:34 -0500 Subject: [PATCH 187/393] Add GalaxyGoggle Adapter --- projects/galaxygoggle/index.js | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 projects/galaxygoggle/index.js diff --git a/projects/galaxygoggle/index.js b/projects/galaxygoggle/index.js new file mode 100644 index 0000000000..36e7bbf39d --- /dev/null +++ b/projects/galaxygoggle/index.js @@ -0,0 +1,40 @@ +const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); + +const GgStaking = "0xBD79c01140CeE7040f8F5E935B72e13540a801b6" +const gg = "0xF2F7CE610a091B94d41D69f4fF1129434a82E2f0" + +// https://app.galaxygoggle.money/#/bonds +const treasury = "0xD5F922e23693e552793fE0431F9a95ba67A60A23" +const dao = "0xDEEdd1646984F9372Cc9D3d7E13AC1606cC2B548" +const mim = "0x130966628846BFd36ff31a822705796e8cb8C18D" +const wavax = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" +const joe = "0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd" + +async function tvl(timestamp, block, chainBlocks) { + const balances = {}; + + await sumTokensAndLPsSharedOwners( + balances, + [ + [mim, false], + [wavax, false], + [joe, false], + ["0xe9E8d6b6ce6D94Fc9d724711e80784Ec096949Fc", true], // mim-gg + ], + [treasury, dao], + chainBlocks.avax, + 'avax', + ); + + return balances; +} + +module.exports = { + avalanche: { + tvl, + staking: staking(GgStaking, gg, "avax") + }, + methodology: + "Counts tokens on the treasury for tvl and staked GG for staking", +}; From f8ce9d8fe995e237e1b496b00c236636a7e3e302 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 03:55:36 +0000 Subject: [PATCH 188/393] find qubit markets dynamically and add borrowed --- projects/qubit/index.js | 91 +++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 53 deletions(-) diff --git a/projects/qubit/index.js b/projects/qubit/index.js index b3f1c7550e..fcfefa3f15 100644 --- a/projects/qubit/index.js +++ b/projects/qubit/index.js @@ -1,66 +1,51 @@ const sdk = require("@defillama/sdk"); +const abi = require('./abi.json') const qBnb = "0xbE1B5D17777565D67A5D2793f879aBF59Ae5D351"; // qBNB const wBnb = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; //wBNB - -const qTokens = [ - "0xd055D32E50C57B413F7c2a4A052faF6933eA7927", // qBTC - "0xb4b77834C73E9f66de57e6584796b034D41Ce39A", // qETH - "0x1dd6E079CF9a82c91DaF3D8497B27430259d32C2", // qUSDC - "0x99309d2e7265528dC7C3067004cC4A90d37b7CC3", // qUSDT - "0x474010701715658fC8004f51860c90eEF4584D2B", // qDAI - "0xa3A155E76175920A40d2c8c765cbCB1148aeB9D1", // qBUSD - "0xaB9eb4AE93B705b0A74d3419921bBec97F51b264", // qCAKE - "0xFF858dB0d6aA9D3fCA13F6341a1693BE4416A550", //qMDX - "0xcD2CD343CFbe284220677C78A08B1648bFa39865", // qQBT -]; - -const tokenAddresses = [ - "0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //BTCB - "0x2170ed0880ac9a755fd29b2688956bd959f933f8", //ETH - "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d", //USDC - "0x55d398326f99059ff775485246999027b3197955", //BSC_USDT - "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3", //DAI - "0xe9e7cea3dedca5984780bafc599bd69add087d56", //BUSD - "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", //CAKE - "0x9c65ab58d8d978db963e63f2bfb7121627e3a739", //MDX - "0x17b7163cf1dbd286e262ddc68b553d899b93f526", //QBT -]; - -async function bsc(timestamp, block, chainBlocks) { - let balances = {}; - - const qBnbBalance = await sdk.api.eth.getBalance({ - target: qBnb, - block: chainBlocks.bsc, - chain: "bsc", - }); - - sdk.util.sumSingleBalance(balances, `bsc:${wBnb}`, qBnbBalance.output); - - for (let i = 0; i < qTokens.length; i++) { - const balance = await sdk.api.erc20.balanceOf({ - target: tokenAddresses[i], - owner: qTokens[i], - block: chainBlocks.bsc, - chain: "bsc", - }); - sdk.util.sumSingleBalance( - balances, - `bsc:${tokenAddresses[i]}`, - balance.output - ); +const qoreComptroller = "0xf70314eb9c7fe7d88e6af5aa7f898b3a162dcd48" + +function tvl(borrowed) { + return async (timestamp, ethBlock, chainBlocks) => { + const chain = "bsc" + const block = chainBlocks[chain] + const balances = {}; + + const qTokens = (await sdk.api.abi.call({ + target: qoreComptroller, + block, + chain, + abi: abi.allMarkets + })).output + const [amounts, underlyings] = await Promise.all([borrowed?abi.totalBorrow: abi.getCash, abi.underlying].map(abi=>sdk.api.abi.multiCall({ + calls: qTokens.map(qt=>({target:qt})), + abi, + block, + chain + }))) + + for (let i = 0; i < qTokens.length; i++) { + const qtoken = qTokens[i] + const amount = amounts.output[i].output + const underlying = qtoken===qBnb?wBnb:underlyings.output[i].output + sdk.util.sumSingleBalance( + balances, + `bsc:${underlying}`, + amount + ); + } + + return balances; } - - return balances; } module.exports = { + timetravel: true, + doublecounted: false, methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There are multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", - misrepresentedTokens: true, bsc: { - tvl: bsc, + tvl: tvl(false), + borrowed: tvl(true), }, - tvl: sdk.util.sumChainTvls([bsc]), }; From 81bff9222e745157e8fc57d3620efc3da934ecde Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 03:55:54 +0000 Subject: [PATCH 189/393] add qubit abi --- projects/qubit/abi.json | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 projects/qubit/abi.json diff --git a/projects/qubit/abi.json b/projects/qubit/abi.json new file mode 100644 index 0000000000..9ee4978d5c --- /dev/null +++ b/projects/qubit/abi.json @@ -0,0 +1,54 @@ +{ + "allMarkets": { + "inputs": [], + "name": "allMarkets", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getCash": { + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "underlying": { + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "totalBorrow": { + "inputs": [], + "name": "totalBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file From fd7d15b32b2fcd439dadd235c9447496ef7666a3 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 04:06:58 +0000 Subject: [PATCH 190/393] venus sdk adapter --- projects/venus.js | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/projects/venus.js b/projects/venus.js index a6a6f86961..3b89325ac2 100644 --- a/projects/venus.js +++ b/projects/venus.js @@ -1,21 +1,10 @@ -const utils = require('./helper/utils'); +const {fullCoumpoundExports} = require('./helper/compound'); -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ -async function fetch() { - var markets = await utils.fetchURL('https://api.venus.io/api/governance/venus') - let tvl = 0; - markets.data.data.markets.map(async(m) => { - tvl += parseFloat(m.liquidity) - }) - return tvl; +const replace = { + "0x250632378e573c6be1ac2f97fcdf00515d0aa91b": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // beth->weth + "0xfb6115445bff7b52feb98650c87f44907e58f802": "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9", // aave } - -module.exports = { - timetravel: false, - methodology: 'TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.', - fetch, -} +module.exports = fullCoumpoundExports("0xfd36e2c2a6789db23113685031d7f16329158384", "bsc", "0xA07c5b74C9B40447a954e1466938b865b6BBea36", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", addr=>{ + return replace[addr.toLowerCase()] || `bsc:${addr}` +}) From 76d4774059d8d54b84ab1480b14a6daea0b588af Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 04:08:08 +0000 Subject: [PATCH 191/393] minor fixes and feature upgrades for compound's helper --- projects/helper/compound.js | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 94b71c7f64..299373d5cb 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -1,6 +1,8 @@ const _ = require('underscore'); const sdk = require('@defillama/sdk'); const abi = require('./abis/compound.json'); +const {getBlock} = require('./getBlock'); +const { unwrapUniswapLPs } = require('./unwrapLPs'); // ask comptroller for all markets array async function getAllCTokens(comptroller, block, chain) { @@ -51,9 +53,9 @@ async function getMarkets(comptroller, block, chain, cether, cetheEquivalent) { return markets; } -function getCompoundV2Tvl(comptroller, chain="ethereum", transformAdress = addr=>addr, cether="0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", borrowed=false) { +function getCompoundV2Tvl(comptroller, chain="ethereum", transformAdress = addr=>addr, cether="0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", borrowed=false, checkForLPTokens=undefined) { return async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] + const block = await getBlock(timestamp, chain, chainBlocks, true); let balances = {}; let markets = await getMarkets(comptroller, block, chain, cether, cetheEquivalent); @@ -67,11 +69,34 @@ function getCompoundV2Tvl(comptroller, chain="ethereum", transformAdress = addr= abi: borrowed? abi.totalBorrows: abi['getCash'], }); - _.each(markets, (market) => { + let symbols; + if(checkForLPTokens!==undefined){ + symbols = await sdk.api.abi.multiCall({ + block, + chain, + calls: _.map(markets, (market) => ({ + target: market.cToken, + })), + abi: "erc20:symbol", + }); + } + + const lpPositions = [] + _.each(markets, (market, idx) => { let getCash = _.find(v2Locked.output, (result) => result.input.target === market.cToken); - sdk.util.sumSingleBalance(balances, transformAdress(market.underlying), getCash.output) + if(checkForLPTokens!==undefined && checkForLPTokens(symbols.output[idx].output)){ + lpPositions.push({ + token: market.underlying, + balance: getCash.output + }) + } else { + sdk.util.sumSingleBalance(balances, transformAdress(market.underlying), getCash.output) + } }); + if(lpPositions.length > 0){ + await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAdress) + } return balances; } } @@ -152,7 +177,7 @@ function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis={ underlyingPrice: abi['getUnderlyingPrice'] }) { return async (timestamp, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] + const block = await getBlock(timestamp, chain, chainBlocks, true); let tvl = new BigNumber('0'); let allMarkets = await getAllMarkets(block, chain, comptroller); @@ -179,7 +204,7 @@ function compoundExports(comptroller, chain, cether, cetheEquivalent, transformA throw new Error("You need to define the underlying for native cAsset") } return { - tvl: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent), + tvl: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, false), borrowed: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true) } } @@ -197,11 +222,11 @@ function compoundExportsWithAsyncTransform(comptroller, chain, cether, cetheEqui } } -function fullCoumpoundExports(comptroller, chain, cether, cetheEquivalent){ +function fullCoumpoundExports(comptroller, chain, cether, cetheEquivalent, transformAdress){ return { timetravel: true, doublecounted: false, - [chain]:compoundExports(comptroller, chain, cether, cetheEquivalent) + [chain]:compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdress) } } From 96bc6504e5c6d93ea9a765e71cc02a7ae653f365 Mon Sep 17 00:00:00 2001 From: Jeff Date: Mon, 6 Dec 2021 13:46:58 +0800 Subject: [PATCH 192/393] update on-chain tvl --- projects/mobiusfinance/abis/AssetPrice.json | 14653 ++++++ projects/mobiusfinance/abis/IERC20.json | 2300 + projects/mobiusfinance/abis/Mobius.json | 42433 ++++++++++++++++ projects/mobiusfinance/abis/Resolver.json | 13530 +++++ .../mobiusfinance/abis/am3CrvmoUSDPool.json | 34 + projects/mobiusfinance/index.js | 96 +- projects/mobiusfinance/utilities/cfg.js | 7 + projects/mobiusfinance/utilities/utilities.js | 61 + 8 files changed, 73105 insertions(+), 9 deletions(-) create mode 100644 projects/mobiusfinance/abis/AssetPrice.json create mode 100644 projects/mobiusfinance/abis/IERC20.json create mode 100644 projects/mobiusfinance/abis/Mobius.json create mode 100644 projects/mobiusfinance/abis/Resolver.json create mode 100644 projects/mobiusfinance/abis/am3CrvmoUSDPool.json create mode 100644 projects/mobiusfinance/utilities/cfg.js create mode 100644 projects/mobiusfinance/utilities/utilities.js diff --git a/projects/mobiusfinance/abis/AssetPrice.json b/projects/mobiusfinance/abis/AssetPrice.json new file mode 100644 index 0000000000..5db2d95991 --- /dev/null +++ b/projects/mobiusfinance/abis/AssetPrice.json @@ -0,0 +1,14653 @@ +{ + "contractName": "AssetPrice", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "ManagerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "previousValue", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "newValue", + "type": "uint256" + } + ], + "name": "MaxDelayTimeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "OracleChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + } + ], + "name": "OracleRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "OwnerChanged", + "type": "event" + }, + { + "inputs": [], + "name": "contractName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxDelayTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_manager", + "type": "address" + } + ], + "name": "setManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "oracle", + "type": "address" + } + ], + "name": "setOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + } + ], + "name": "removeOracle", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "time", + "type": "uint256" + } + ], + "name": "setMaxDelayTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + } + ], + "name": "getPriceFromOracle", + "outputs": [ + { + "internalType": "uint256", + "name": "round", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "price", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "time", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "assets", + "type": "bytes32[]" + } + ], + "name": "getPrices", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "asset", + "type": "bytes32" + } + ], + "name": "getPriceAndStatus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "assets", + "type": "bytes32[]" + } + ], + "name": "getPricesAndStatus", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"ManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"previousValue\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"newValue\",\"type\":\"uint256\"}],\"name\":\"MaxDelayTimeChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"asset\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"OracleChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"asset\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"}],\"name\":\"OracleRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"OwnerChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"contractName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"asset\",\"type\":\"bytes32\"}],\"name\":\"getPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"asset\",\"type\":\"bytes32\"}],\"name\":\"getPriceAndStatus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"asset\",\"type\":\"bytes32\"}],\"name\":\"getPriceFromOracle\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"round\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"assets\",\"type\":\"bytes32[]\"}],\"name\":\"getPrices\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"assets\",\"type\":\"bytes32[]\"}],\"name\":\"getPricesAndStatus\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"manager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxDelayTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"asset\",\"type\":\"bytes32\"}],\"name\":\"removeOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_manager\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"name\":\"setMaxDelayTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"asset\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"oracle\",\"type\":\"address\"}],\"name\":\"setOracle\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/AssetPrice.sol\":\"AssetPrice\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":4294967295},\"remappings\":[]},\"sources\":{\"project:/contracts/AssetPrice.sol\":{\"keccak256\":\"0xbca9c7114929719c40ebf07bb1b8caa62c76d3b7f2054f6dee0ad60cb68b6379\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ecc1dbad1d51d5dc71cdf7e4c159f2fa47b0c323d1112153eb616e466a89101e\",\"dweb:/ipfs/QmSosKXjhheygB6fYi8SBcwN9UUNGXi1nvB3kmqr627E9c\"]},\"project:/contracts/base/Constants.sol\":{\"keccak256\":\"0xd385eb2024741177af7f0e7a63bec671e75ffced38c5fcdba3323dead24d3f4f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://68e3ecc6063c5c44c5016634d0039ff8d16fb0164c450e9ffdffc744abe7d12b\",\"dweb:/ipfs/QmcsiDHkYGWtZ4kvxwV1FhmADrw92dCBHbRzusRj4R2F5V\"]},\"project:/contracts/base/Ownable.sol\":{\"keccak256\":\"0xfe1332448b6dd2a5d47fda27141b45000dd9c01dd6efa8dc8b6fd9c0d0a6bef9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4b81e14d8dcb2661121fc118a1235f7f471c4c98f14676ff409ec4db4009425c\",\"dweb:/ipfs/QmaPdHCQvFPhu1zwSouaCYHLpb5jGMepCHsE5aEWgwpXsX\"]},\"project:/contracts/base/Storage.sol\":{\"keccak256\":\"0x12b5e8ac158169be922e9b2b61efcb0f86312cc91aea18831fcfb54f3c1ae912\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bff6bdc09b7972576fd6849ea209c59134ccc96bd353febd1540bfe806f03201\",\"dweb:/ipfs/QmQ4JUiq9NqY7XkHknVge7QQmJrkv1eZjmfvNn4dVtivJy\"]},\"project:/contracts/interfaces/IAssetPrice.sol\":{\"keccak256\":\"0xc4747058cc3237da39eeaf6039e95c99a64ff5a109e240c39be1ebdde9f7c380\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b3266132faacb2e7d4e1e7e0a7be123dea861f3b5f4099af00ffce3c1aee3a1c\",\"dweb:/ipfs/QmNpzhHmjGXdMPAnkWXvTUFuWASy3KdMK7vAqY6bEfAEm7\"]},\"project:/contracts/interfaces/IOracle.sol\":{\"keccak256\":\"0x00d586e7095f2d0ed738b73933cf80ee997e58a2fce2edde5839567142081b88\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://7e39eb131f471a58e2b7db2b10663151775091610601bf56156b64607b67af3c\",\"dweb:/ipfs/QmPpoCMFf65WCL14upco5WjB8ZeTdyrL8gLS8Xk3kmVTwX\"]},\"project:/contracts/interfaces/IOwnable.sol\":{\"keccak256\":\"0xea183866d1027f5768a4d255951113131eb740accb17e2b8feee4c682b23c2bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e7cb7b1d50aee53c2734aa3629cb4ea5d809a9ae381a017656a79b7740b40329\",\"dweb:/ipfs/QmZMcDrxXWkNYjAHuqPVvhkRnuFN2A6xs7JYs35k2jRTK8\"]},\"project:/contracts/lib/Strings.sol\":{\"keccak256\":\"0x0bc282501099b51b91ecb68fa0f40f88cd590a6a8fda8bb455581a8d619f1c97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f4461279953516d98257db0c5066294814d592de8f14ea10206449810a5ae60a\",\"dweb:/ipfs/QmbHMCcH9hFgQep2tPq3cX2izkxXnTKVVUsY7bW6RgVsp4\"]},\"project:/contracts/storages/AddressStorage.sol\":{\"keccak256\":\"0x3f5a1524c4a8709a92d9d385e66d9c4b797bec21c205bd25a28472adf84f58b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ecaa7a1f5358bbbfa44a912c5cab40b82f1c90e15425dd1fa689b2deff706ad\",\"dweb:/ipfs/QmNa5VeTfLHioSS8PwWDe857QHjz9yusxx5tvszmpzFTw9\"]}},\"version\":1}", + "bytecode": "0x6080604052610e106004553480156200001757600080fd5b5060018054336001600160a01b0319918216811790925560028054909116909117905562000052694173736574507269636560b01b62000058565b6200016c565b60408051602080820184905282518083038201815291830190925280516200008592600092019062000089565b5050565b82805462000097906200012f565b90600052602060002090601f016020900481019282620000bb576000855562000106565b82601f10620000d657805160ff191683800117855562000106565b8280016001018555821562000106579182015b8281111562000106578251825591602001919060010190620000e9565b506200011492915062000118565b5090565b5b8082111562000114576000815560010162000119565b600181811c908216806200014457607f821691505b602082108114156200016657634e487b7160e01b600052602260045260246000fd5b50919050565b6115fc806200017c6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806371bb238e1161008c578063c519a3c911610066578063c519a3c914610229578063d0ebdbe714610257578063f56c85471461026a578063fea227d41461027357600080fd5b806371bb238e146101e157806375d0c0dc146101f45780638da5cb5b1461020957600080fd5b80633902ca61116100c85780633902ca611461014e578063481c6a75146101765780635ea8dffb146101bb5780636e2eb512146101ce57600080fd5b806313af4035146100ef57806326ee48361461010457806331d98b3f1461012d575b600080fd5b6101026100fd3660046111cd565b610294565b005b6101176101123660046111ee565b610505565b604051610124919061142c565b60405180910390f35b61014061013b36600461131e565b61054e565b604051908152602001610124565b61016161015c36600461131e565b610562565b60408051928352602083019190915201610124565b6002546101969073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610124565b6101026101c9366004611336565b610720565b6101026101dc36600461131e565b6108a0565b6101026101ef36600461131e565b610a03565b6101fc610ad5565b604051610124919061146d565b6001546101969073ffffffffffffffffffffffffffffffffffffffff1681565b61023c61023736600461131e565b610b63565b60408051938452602084019290925290820152606001610124565b6101026102653660046111cd565b610d2b565b61014060045481565b61028661028136600461125e565b610eea565b60405161012492919061143f565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926103859291906102f990611505565b80601f016020809104026020016040519081016040528092919081815260200182805461032590611505565b80156103725780601f1061034757610100808354040283529160200191610372565b820191906000526020600020905b81548152906001019060200180831161035557829003601f168201915b505050505061114990919063ffffffff16565b906103c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561043e6040518060400160405280601f81526020017f3a206e6577206f776e657220697320746865207a65726f206164647265737300815250600080546102f990611505565b90610476576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606000610545848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610eea92505050565b50949350505050565b60008061055a83610562565b509392505050565b6000807f6d6f5553440000000000000000000000000000000000000000000000000000008314806105b25750827f5553445400000000000000000000000000000000000000000000000000000000145b156105ca5750670de0b6b3a764000092600092509050565b6000806105d685610b63565b9250925050600082116106b36040518060400160405280601481526020017f3a205072696365206973207a65726f20466f7220000000000000000000000000815250876000805461062690611505565b80601f016020809104026020016040519081016040528092919081815260200182805461065290611505565b801561069f5780601f106106745761010080835404028352916020019161069f565b820191906000526020600020905b81548152906001019060200180831161068257829003601f168201915b50505050506111759092919063ffffffff16565b906106eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506000600454426106fc91906114be565b905080821015610713575090946001945092505050565b5090946000945092505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926107859291906102f990611505565b906107bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060008281527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604080822054905173ffffffffffffffffffffffffffffffffffffffff8481169392169185917fffaab7bfd4c24267948958cc1dec10900dd71073248da9e3e4cfd274a0490bf59190a460008281527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926109059291906102f990611505565b9061093d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060008181527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604080822054905173ffffffffffffffffffffffffffffffffffffffff9091169183917fa69709ef8582cb75d44d08e318fd90f7368d781e645af3e2788ca761606dab0b9190a360009081527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610a689291906102f990611505565b90610aa0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506004546040518291907f80796916b7785004b191602bd839776969d772f6dad6249b9ecea028c196ad4a90600090a3600455565b60008054610ae290611505565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0e90611505565b8015610b5b5780601f10610b3057610100808354040283529160200191610b5b565b820191906000526020600020905b815481529060010190602001808311610b3e57829003601f168201915b505050505081565b600080600080610bb48560009081527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b604080518082018252600a81527f41737365745072696365000000000000000000000000000000000000000000006020808301919091528251808401909352601583527f3a204d697373696e67204f7261636c6520466f722000000000000000000000009083015291925073ffffffffffffffffffffffffffffffffffffffff8316151590610c4590839089611175565b90610c7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506040517f31d98b3f0000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff8316906331d98b3f9060240160606040518083038186803b158015610ce457600080fd5b505afa158015610cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1c9190611361565b91989097509095509350505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610d909291906102f990611505565b90610dc8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e236040518060600160405280602181526020016115a660219139600080546102f990611505565b90610e5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a435090600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060806014835110610f386040518060400160405280602081526020017f3a2063616e6e6f742068617665206d6f7265207468616e203230206974656d73815250600080546102f990611505565b90610f70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506000835167ffffffffffffffff811115610fb4577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610fdd578160200160208202803683370190505b5090506000845167ffffffffffffffff811115611023577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561104c578160200160208202803683370190505b50905060005b855181101561113e576110a4868281518110611097577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151610562565b8483815181106110dd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010184848151811061111d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020908102919091010191909152528061113681611540565b915050611052565b509094909350915050565b6060828260405160200161115e9291906113c8565b604051602081830303815290604052905092915050565b606083838360405160200161118c939291906113f7565b60405160208183030381529060405290509392505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146111c857600080fd5b919050565b6000602082840312156111de578081fd5b6111e7826111a4565b9392505050565b60008060208385031215611200578081fd5b823567ffffffffffffffff80821115611217578283fd5b818501915085601f83011261122a578283fd5b813581811115611238578384fd5b8660208260051b850101111561124c578384fd5b60209290920196919550909350505050565b60006020808385031215611270578182fd5b823567ffffffffffffffff80821115611287578384fd5b818501915085601f83011261129a578384fd5b8135818111156112ac576112ac61158f565b8060051b604051601f19603f830116810181811085821117156112d1576112d161158f565b604052828152858101935084860182860187018a10156112ef578788fd5b8795505b838610156113115780358552600195909501949386019386016112f3565b5098975050505050505050565b60006020828403121561132f578081fd5b5035919050565b60008060408385031215611348578182fd5b82359150611358602084016111a4565b90509250929050565b600080600060608486031215611375578081fd5b8351925060208401519150604084015190509250925092565b6000815180845260208085019450808401835b838110156113bd578151875295820195908201906001016113a1565b509495945050505050565b600083516113da8184602088016114d5565b8351908301906113ee8183602088016114d5565b01949350505050565b600084516114098184602089016114d5565b84519083019061141d8183602089016114d5565b01928352505060200192915050565b6020815260006111e7602083018461138e565b604081526000611452604083018561138e565b8281036020840152611464818561138e565b95945050505050565b602081526000825180602084015261148c8160408501602087016114d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000828210156114d0576114d0611579565b500390565b60005b838110156114f05781810151838201526020016114d8565b838111156114ff576000848401525b50505050565b600181811c9082168061151957607f821691505b6020821081141561153a57634e487b7160e01b600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561157257611572611579565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe3a206e6577206d616e6167657220697320746865207a65726f2061646472657373a26469706673582212203dfb446268eb511446c76eacdaab6e59364aa0c00a4c3d58f4da361f1c46c25a64736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806371bb238e1161008c578063c519a3c911610066578063c519a3c914610229578063d0ebdbe714610257578063f56c85471461026a578063fea227d41461027357600080fd5b806371bb238e146101e157806375d0c0dc146101f45780638da5cb5b1461020957600080fd5b80633902ca61116100c85780633902ca611461014e578063481c6a75146101765780635ea8dffb146101bb5780636e2eb512146101ce57600080fd5b806313af4035146100ef57806326ee48361461010457806331d98b3f1461012d575b600080fd5b6101026100fd3660046111cd565b610294565b005b6101176101123660046111ee565b610505565b604051610124919061142c565b60405180910390f35b61014061013b36600461131e565b61054e565b604051908152602001610124565b61016161015c36600461131e565b610562565b60408051928352602083019190915201610124565b6002546101969073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610124565b6101026101c9366004611336565b610720565b6101026101dc36600461131e565b6108a0565b6101026101ef36600461131e565b610a03565b6101fc610ad5565b604051610124919061146d565b6001546101969073ffffffffffffffffffffffffffffffffffffffff1681565b61023c61023736600461131e565b610b63565b60408051938452602084019290925290820152606001610124565b6101026102653660046111cd565b610d2b565b61014060045481565b61028661028136600461125e565b610eea565b60405161012492919061143f565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926103859291906102f990611505565b80601f016020809104026020016040519081016040528092919081815260200182805461032590611505565b80156103725780601f1061034757610100808354040283529160200191610372565b820191906000526020600020905b81548152906001019060200180831161035557829003601f168201915b505050505061114990919063ffffffff16565b906103c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561043e6040518060400160405280601f81526020017f3a206e6577206f776e657220697320746865207a65726f206164647265737300815250600080546102f990611505565b90610476576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60606000610545848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610eea92505050565b50949350505050565b60008061055a83610562565b509392505050565b6000807f6d6f5553440000000000000000000000000000000000000000000000000000008314806105b25750827f5553445400000000000000000000000000000000000000000000000000000000145b156105ca5750670de0b6b3a764000092600092509050565b6000806105d685610b63565b9250925050600082116106b36040518060400160405280601481526020017f3a205072696365206973207a65726f20466f7220000000000000000000000000815250876000805461062690611505565b80601f016020809104026020016040519081016040528092919081815260200182805461065290611505565b801561069f5780601f106106745761010080835404028352916020019161069f565b820191906000526020600020905b81548152906001019060200180831161068257829003601f168201915b50505050506111759092919063ffffffff16565b906106eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506000600454426106fc91906114be565b905080821015610713575090946001945092505050565b5090946000945092505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926107859291906102f990611505565b906107bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060008281527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604080822054905173ffffffffffffffffffffffffffffffffffffffff8481169392169185917fffaab7bfd4c24267948958cc1dec10900dd71073248da9e3e4cfd274a0490bf59190a460008281527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926109059291906102f990611505565b9061093d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060008181527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604080822054905173ffffffffffffffffffffffffffffffffffffffff9091169183917fa69709ef8582cb75d44d08e318fd90f7368d781e645af3e2788ca761606dab0b9190a360009081527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020526040902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610a689291906102f990611505565b90610aa0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506004546040518291907f80796916b7785004b191602bd839776969d772f6dad6249b9ecea028c196ad4a90600090a3600455565b60008054610ae290611505565b80601f0160208091040260200160405190810160405280929190818152602001828054610b0e90611505565b8015610b5b5780601f10610b3057610100808354040283529160200191610b5b565b820191906000526020600020905b815481529060010190602001808311610b3e57829003601f168201915b505050505081565b600080600080610bb48560009081527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b604080518082018252600a81527f41737365745072696365000000000000000000000000000000000000000000006020808301919091528251808401909352601583527f3a204d697373696e67204f7261636c6520466f722000000000000000000000009083015291925073ffffffffffffffffffffffffffffffffffffffff8316151590610c4590839089611175565b90610c7d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506040517f31d98b3f0000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff8316906331d98b3f9060240160606040518083038186803b158015610ce457600080fd5b505afa158015610cf8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1c9190611361565b91989097509095509350505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610d909291906102f990611505565b90610dc8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610e236040518060600160405280602181526020016115a660219139600080546102f990611505565b90610e5b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b5060025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a435090600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6060806014835110610f386040518060400160405280602081526020017f3a2063616e6e6f742068617665206d6f7265207468616e203230206974656d73815250600080546102f990611505565b90610f70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bd919061146d565b506000835167ffffffffffffffff811115610fb4577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015610fdd578160200160208202803683370190505b5090506000845167ffffffffffffffff811115611023577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561104c578160200160208202803683370190505b50905060005b855181101561113e576110a4868281518110611097577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151610562565b8483815181106110dd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010184848151811061111d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020908102919091010191909152528061113681611540565b915050611052565b509094909350915050565b6060828260405160200161115e9291906113c8565b604051602081830303815290604052905092915050565b606083838360405160200161118c939291906113f7565b60405160208183030381529060405290509392505050565b803573ffffffffffffffffffffffffffffffffffffffff811681146111c857600080fd5b919050565b6000602082840312156111de578081fd5b6111e7826111a4565b9392505050565b60008060208385031215611200578081fd5b823567ffffffffffffffff80821115611217578283fd5b818501915085601f83011261122a578283fd5b813581811115611238578384fd5b8660208260051b850101111561124c578384fd5b60209290920196919550909350505050565b60006020808385031215611270578182fd5b823567ffffffffffffffff80821115611287578384fd5b818501915085601f83011261129a578384fd5b8135818111156112ac576112ac61158f565b8060051b604051601f19603f830116810181811085821117156112d1576112d161158f565b604052828152858101935084860182860187018a10156112ef578788fd5b8795505b838610156113115780358552600195909501949386019386016112f3565b5098975050505050505050565b60006020828403121561132f578081fd5b5035919050565b60008060408385031215611348578182fd5b82359150611358602084016111a4565b90509250929050565b600080600060608486031215611375578081fd5b8351925060208401519150604084015190509250925092565b6000815180845260208085019450808401835b838110156113bd578151875295820195908201906001016113a1565b509495945050505050565b600083516113da8184602088016114d5565b8351908301906113ee8183602088016114d5565b01949350505050565b600084516114098184602089016114d5565b84519083019061141d8183602089016114d5565b01928352505060200192915050565b6020815260006111e7602083018461138e565b604081526000611452604083018561138e565b8281036020840152611464818561138e565b95945050505050565b602081526000825180602084015261148c8160408501602087016114d5565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000828210156114d0576114d0611579565b500390565b60005b838110156114f05781810151838201526020016114d8565b838111156114ff576000848401525b50505050565b600181811c9082168061151957607f821691505b6020821081141561153a57634e487b7160e01b600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561157257611572611579565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfe3a206e6577206d616e6167657220697320746865207a65726f2061646472657373a26469706673582212203dfb446268eb511446c76eacdaab6e59364aa0c00a4c3d58f4da361f1c46c25a64736f6c63430008040033", + "immutableReferences": {}, + "generatedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:583:82", + "statements": [ + { + "nodeType": "YulBlock", + "src": "6:3:82", + "statements": [] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "133:63:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "150:3:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "155:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "143:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "143:19:82" + }, + "nodeType": "YulExpressionStatement", + "src": "143:19:82" + }, + { + "nodeType": "YulAssignment", + "src": "171:19:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "182:3:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "187:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "178:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "178:12:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "171:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_bytes32__to_t_bytes32__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "109:3:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "114:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "125:3:82", + "type": "" + } + ], + "src": "14:182:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "256:325:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "266:22:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "280:1:82", + "type": "", + "value": "1" + }, + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "283:4:82" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "276:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "276:12:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "266:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "297:38:82", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "327:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "333:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "323:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "323:12:82" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "301:18:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "374:31:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "376:27:82", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "390:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "398:4:82", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "386:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "386:17:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "376:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "354:18:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "347:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "347:26:82" + }, + "nodeType": "YulIf", + "src": "344:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "464:111:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "485:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "492:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "497:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "488:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "488:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "478:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "478:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "478:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "529:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "532:4:82", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "522:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "522:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "522:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "557:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "560:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "550:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "550:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "550:15:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "420:18:82" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "443:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "451:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "440:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "440:14:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "417:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "417:38:82" + }, + "nodeType": "YulIf", + "src": "414:2:82" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "236:4:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "245:6:82", + "type": "" + } + ], + "src": "201:380:82" + } + ] + }, + "contents": "{\n { }\n function abi_encode_tuple_packed_t_bytes32__to_t_bytes32__nonPadded_inplace_fromStack_reversed(pos, value0) -> end\n {\n mstore(pos, value0)\n end := add(pos, 32)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n}", + "id": 82, + "language": "Yul", + "name": "#utility.yul" + } + ], + "deployedGeneratedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:8159:82", + "statements": [ + { + "nodeType": "YulBlock", + "src": "6:3:82", + "statements": [] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "63:124:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "73:29:82", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "95:6:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "82:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "82:20:82" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "73:5:82" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "165:16:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "174:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "177:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "167:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "167:12:82" + }, + "nodeType": "YulExpressionStatement", + "src": "167:12:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "124:5:82" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "135:5:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "150:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "155:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "146:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "146:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "159:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "142:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "142:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "131:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "131:31:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "121:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "121:42:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "114:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "114:50:82" + }, + "nodeType": "YulIf", + "src": "111:2:82" + } + ] + }, + "name": "abi_decode_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "42:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "53:5:82", + "type": "" + } + ], + "src": "14:173:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "262:126:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "308:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "317:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "325:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "310:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "310:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "310:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "283:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "292:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "279:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "279:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "304:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "275:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "275:32:82" + }, + "nodeType": "YulIf", + "src": "272:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "343:39:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "372:9:82" + } + ], + "functionName": { + "name": "abi_decode_address", + "nodeType": "YulIdentifier", + "src": "353:18:82" + }, + "nodeType": "YulFunctionCall", + "src": "353:29:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "343:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "228:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "239:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "251:6:82", + "type": "" + } + ], + "src": "192:196:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "498:560:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "544:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "553:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "561:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "546:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "546:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "546:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "519:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "528:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "515:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "515:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "540:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "511:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "511:32:82" + }, + "nodeType": "YulIf", + "src": "508:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "579:37:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "606:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "593:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "593:23:82" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "583:6:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "625:28:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "643:2:82", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "647:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "639:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "639:10:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "651:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "635:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "635:18:82" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "629:2:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "680:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "689:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "697:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "682:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "682:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "682:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "668:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "676:2:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "665:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "665:14:82" + }, + "nodeType": "YulIf", + "src": "662:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "715:32:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "729:9:82" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "740:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "725:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "725:22:82" + }, + "variables": [ + { + "name": "_2", + "nodeType": "YulTypedName", + "src": "719:2:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "795:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "804:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "812:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "797:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "797:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "797:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "_2", + "nodeType": "YulIdentifier", + "src": "774:2:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "778:4:82", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "770:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "770:13:82" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "785:7:82" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "766:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "766:27:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "759:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "759:35:82" + }, + "nodeType": "YulIf", + "src": "756:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "830:30:82", + "value": { + "arguments": [ + { + "name": "_2", + "nodeType": "YulIdentifier", + "src": "857:2:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "844:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "844:16:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "834:6:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "887:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "896:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "904:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "889:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "889:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "889:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "875:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "883:2:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "872:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "872:14:82" + }, + "nodeType": "YulIf", + "src": "869:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "971:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "980:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "988:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "973:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "973:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "973:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "_2", + "nodeType": "YulIdentifier", + "src": "936:2:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "944:1:82", + "type": "", + "value": "5" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "947:6:82" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "940:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "940:14:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "932:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "932:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "957:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "928:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "928:32:82" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "962:7:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "925:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "925:45:82" + }, + "nodeType": "YulIf", + "src": "922:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "1006:21:82", + "value": { + "arguments": [ + { + "name": "_2", + "nodeType": "YulIdentifier", + "src": "1020:2:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1024:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1016:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1016:11:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1006:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1036:16:82", + "value": { + "name": "length", + "nodeType": "YulIdentifier", + "src": "1046:6:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1036:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_array$_t_bytes32_$dyn_calldata_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "456:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "467:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "479:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "487:6:82", + "type": "" + } + ], + "src": "393:665:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1158:1076:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "1168:12:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1178:2:82", + "type": "", + "value": "32" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "1172:2:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1225:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1234:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1242:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1227:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1227:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1227:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1200:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1209:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1196:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1196:23:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "1221:2:82" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1192:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1192:32:82" + }, + "nodeType": "YulIf", + "src": "1189:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1260:37:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1287:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "1274:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "1274:23:82" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "1264:6:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1306:28:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1324:2:82", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1328:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "1320:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1320:10:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1332:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1316:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1316:18:82" + }, + "variables": [ + { + "name": "_2", + "nodeType": "YulTypedName", + "src": "1310:2:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1361:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1370:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1378:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1363:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1363:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1363:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1349:6:82" + }, + { + "name": "_2", + "nodeType": "YulIdentifier", + "src": "1357:2:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1346:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1346:14:82" + }, + "nodeType": "YulIf", + "src": "1343:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1396:32:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1410:9:82" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1421:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1406:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1406:22:82" + }, + "variables": [ + { + "name": "_3", + "nodeType": "YulTypedName", + "src": "1400:2:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1476:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1485:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1493:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1478:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1478:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1478:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "_3", + "nodeType": "YulIdentifier", + "src": "1455:2:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1459:4:82", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1451:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1451:13:82" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1466:7:82" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1447:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1447:27:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "1440:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1440:35:82" + }, + "nodeType": "YulIf", + "src": "1437:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1511:26:82", + "value": { + "arguments": [ + { + "name": "_3", + "nodeType": "YulIdentifier", + "src": "1534:2:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "1521:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "1521:16:82" + }, + "variables": [ + { + "name": "_4", + "nodeType": "YulTypedName", + "src": "1515:2:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1560:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nodeType": "YulIdentifier", + "src": "1562:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "1562:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1562:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "_4", + "nodeType": "YulIdentifier", + "src": "1552:2:82" + }, + { + "name": "_2", + "nodeType": "YulIdentifier", + "src": "1556:2:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1549:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1549:10:82" + }, + "nodeType": "YulIf", + "src": "1546:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1591:20:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1605:1:82", + "type": "", + "value": "5" + }, + { + "name": "_4", + "nodeType": "YulIdentifier", + "src": "1608:2:82" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "1601:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1601:10:82" + }, + "variables": [ + { + "name": "_5", + "nodeType": "YulTypedName", + "src": "1595:2:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1620:23:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1640:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "1634:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "1634:9:82" + }, + "variables": [ + { + "name": "memPtr", + "nodeType": "YulTypedName", + "src": "1624:6:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1652:56:82", + "value": { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "1674:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "_5", + "nodeType": "YulIdentifier", + "src": "1690:2:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1694:2:82", + "type": "", + "value": "63" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1686:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1686:11:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1703:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "1699:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1699:7:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "1682:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1682:25:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1670:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1670:38:82" + }, + "variables": [ + { + "name": "newFreePtr", + "nodeType": "YulTypedName", + "src": "1656:10:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1767:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x41", + "nodeType": "YulIdentifier", + "src": "1769:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "1769:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1769:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "1726:10:82" + }, + { + "name": "_2", + "nodeType": "YulIdentifier", + "src": "1738:2:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1723:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1723:18:82" + }, + { + "arguments": [ + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "1746:10:82" + }, + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "1758:6:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "1743:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1743:22:82" + } + ], + "functionName": { + "name": "or", + "nodeType": "YulIdentifier", + "src": "1720:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1720:46:82" + }, + "nodeType": "YulIf", + "src": "1717:2:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1805:2:82", + "type": "", + "value": "64" + }, + { + "name": "newFreePtr", + "nodeType": "YulIdentifier", + "src": "1809:10:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "1798:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1798:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1798:22:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1829:17:82", + "value": { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "1840:6:82" + }, + "variables": [ + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "1833:3:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "1862:6:82" + }, + { + "name": "_4", + "nodeType": "YulIdentifier", + "src": "1870:2:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "1855:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1855:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1855:18:82" + }, + { + "nodeType": "YulAssignment", + "src": "1882:22:82", + "value": { + "arguments": [ + { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "1893:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "1901:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1889:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1889:15:82" + }, + "variableNames": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "1882:3:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1913:22:82", + "value": { + "arguments": [ + { + "name": "_3", + "nodeType": "YulIdentifier", + "src": "1928:2:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "1932:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1924:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1924:11:82" + }, + "variables": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "1917:3:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1981:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1990:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1998:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1983:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1983:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1983:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "_3", + "nodeType": "YulIdentifier", + "src": "1958:2:82" + }, + { + "name": "_5", + "nodeType": "YulIdentifier", + "src": "1962:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1954:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1954:11:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "1967:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1950:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1950:20:82" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1972:7:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1947:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1947:33:82" + }, + "nodeType": "YulIf", + "src": "1944:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "2016:15:82", + "value": { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2025:6:82" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "2020:1:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2085:118:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "2106:3:82" + }, + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "2124:3:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2111:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2111:17:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "2099:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2099:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2099:30:82" + }, + { + "nodeType": "YulAssignment", + "src": "2142:19:82", + "value": { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "2153:3:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "2158:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2149:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2149:12:82" + }, + "variableNames": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "2142:3:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2174:19:82", + "value": { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "2185:3:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "2190:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2181:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2181:12:82" + }, + "variableNames": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "2174:3:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "2051:1:82" + }, + { + "name": "_4", + "nodeType": "YulIdentifier", + "src": "2054:2:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "2048:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "2048:9:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "2058:18:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "2060:14:82", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "2069:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2072:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2065:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2065:9:82" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "2060:1:82" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "2044:3:82", + "statements": [] + }, + "src": "2040:163:82" + }, + { + "nodeType": "YulAssignment", + "src": "2212:16:82", + "value": { + "name": "memPtr", + "nodeType": "YulIdentifier", + "src": "2222:6:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2212:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_array$_t_bytes32_$dyn_memory_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1124:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1135:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1147:6:82", + "type": "" + } + ], + "src": "1063:1171:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2309:120:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2355:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2364:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2372:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2357:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2357:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2357:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2330:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2339:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2326:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2326:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2351:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2322:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2322:32:82" + }, + "nodeType": "YulIf", + "src": "2319:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2390:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2413:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2400:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2400:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2390:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2275:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2286:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2298:6:82", + "type": "" + } + ], + "src": "2239:190:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2521:177:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2567:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2576:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2584:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2569:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2569:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2569:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2542:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2551:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2538:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2538:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2563:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2534:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2534:32:82" + }, + "nodeType": "YulIf", + "src": "2531:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2602:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2625:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2612:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2612:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2602:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2644:48:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2677:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2688:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2673:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2673:18:82" + } + ], + "functionName": { + "name": "abi_decode_address", + "nodeType": "YulIdentifier", + "src": "2654:18:82" + }, + "nodeType": "YulFunctionCall", + "src": "2654:38:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "2644:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2479:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2490:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2502:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2510:6:82", + "type": "" + } + ], + "src": "2434:264:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2773:120:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2819:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2828:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2836:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2821:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2821:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2821:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2794:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2803:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2790:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2790:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2815:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2786:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2786:32:82" + }, + "nodeType": "YulIf", + "src": "2783:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2854:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2877:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2864:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2864:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2854:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2739:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2750:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2762:6:82", + "type": "" + } + ], + "src": "2703:190:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3013:201:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "3059:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "3068:6:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "3076:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "3061:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3061:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3061:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "3034:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3043:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3030:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3030:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3055:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "3026:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3026:32:82" + }, + "nodeType": "YulIf", + "src": "3023:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "3094:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3110:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3104:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3104:16:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3094:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3129:35:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3149:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3160:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3145:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3145:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3139:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3139:25:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "3129:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3173:35:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3193:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3204:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3189:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3189:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3183:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3183:25:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "3173:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256t_uint256t_uint256_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2963:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2974:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2986:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2994:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "3002:6:82", + "type": "" + } + ], + "src": "2898:316:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3280:376:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "3290:26:82", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3310:5:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3304:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3304:12:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3294:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3332:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3337:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3325:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3325:19:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3325:19:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3353:14:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3363:4:82", + "type": "", + "value": "0x20" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "3357:2:82", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3376:19:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3387:3:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "3392:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3383:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3383:12:82" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3376:3:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3404:28:82", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "3422:5:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "3429:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3418:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3418:14:82" + }, + "variables": [ + { + "name": "srcPtr", + "nodeType": "YulTypedName", + "src": "3408:6:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3441:12:82", + "value": { + "name": "end", + "nodeType": "YulIdentifier", + "src": "3450:3:82" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "3445:1:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3511:120:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3532:3:82" + }, + { + "arguments": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "3543:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3537:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3537:13:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3525:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3525:26:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3525:26:82" + }, + { + "nodeType": "YulAssignment", + "src": "3564:19:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3575:3:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "3580:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3571:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3571:12:82" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3564:3:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3596:25:82", + "value": { + "arguments": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "3610:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "3618:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3606:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3606:15:82" + }, + "variableNames": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "3596:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "3473:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3476:6:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "3470:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "3470:13:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "3484:18:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3486:14:82", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "3495:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3498:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3491:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3491:9:82" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "3486:1:82" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "3466:3:82", + "statements": [] + }, + "src": "3462:169:82" + }, + { + "nodeType": "YulAssignment", + "src": "3640:10:82", + "value": { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3647:3:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "3640:3:82" + } + ] + } + ] + }, + "name": "abi_encode_array_uint256_dyn", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "3257:5:82", + "type": "" + }, + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "3264:3:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "3272:3:82", + "type": "" + } + ], + "src": "3219:437:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3848:283:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "3858:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3878:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3872:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3872:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3862:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3920:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3928:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3916:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3916:17:82" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3935:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3940:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "3894:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "3894:53:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3894:53:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3956:29:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3973:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3978:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3969:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3969:16:82" + }, + "variables": [ + { + "name": "end_1", + "nodeType": "YulTypedName", + "src": "3960:5:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3994:29:82", + "value": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4016:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4010:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4010:13:82" + }, + "variables": [ + { + "name": "length_1", + "nodeType": "YulTypedName", + "src": "3998:8:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4058:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4066:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4054:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4054:17:82" + }, + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "4073:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "4080:8:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "4032:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "4032:57:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4032:57:82" + }, + { + "nodeType": "YulAssignment", + "src": "4098:27:82", + "value": { + "arguments": [ + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "4109:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "4116:8:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4105:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4105:20:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "4098:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "3816:3:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "3821:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3829:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "3840:3:82", + "type": "" + } + ], + "src": "3661:470:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4351:351:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4361:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4381:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4375:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4375:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4365:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4423:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4431:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4419:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4419:17:82" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4438:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4443:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "4397:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "4397:53:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4397:53:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4459:29:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4476:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4481:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4472:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4472:16:82" + }, + "variables": [ + { + "name": "end_1", + "nodeType": "YulTypedName", + "src": "4463:5:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4497:29:82", + "value": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4519:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4513:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4513:13:82" + }, + "variables": [ + { + "name": "length_1", + "nodeType": "YulTypedName", + "src": "4501:8:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4561:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4569:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4557:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4557:17:82" + }, + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "4576:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "4583:8:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "4535:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "4535:57:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4535:57:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4601:33:82", + "value": { + "arguments": [ + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "4618:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "4625:8:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4614:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4614:20:82" + }, + "variables": [ + { + "name": "end_2", + "nodeType": "YulTypedName", + "src": "4605:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "end_2", + "nodeType": "YulIdentifier", + "src": "4650:5:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "4657:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4643:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4643:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4643:21:82" + }, + { + "nodeType": "YulAssignment", + "src": "4673:23:82", + "value": { + "arguments": [ + { + "name": "end_2", + "nodeType": "YulIdentifier", + "src": "4684:5:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4691:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4680:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4680:16:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "4673:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__to_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "4311:3:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "4316:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "4324:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4332:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "4343:3:82", + "type": "" + } + ], + "src": "4136:566:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4808:102:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4818:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4830:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4841:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4826:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4826:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "4818:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4860:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4875:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4891:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4896:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "4887:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4887:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4900:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "4883:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4883:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4871:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4871:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4853:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4853:51:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4853:51:82" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4777:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4788:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "4799:4:82", + "type": "" + } + ], + "src": "4707:203:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5066:110:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5083:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5094:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5076:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5076:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5076:21:82" + }, + { + "nodeType": "YulAssignment", + "src": "5106:64:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5143:6:82" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5155:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5166:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5151:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5151:18:82" + } + ], + "functionName": { + "name": "abi_encode_array_uint256_dyn", + "nodeType": "YulIdentifier", + "src": "5114:28:82" + }, + "nodeType": "YulFunctionCall", + "src": "5114:56:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "5106:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_array$_t_uint256_$dyn_memory_ptr__to_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "5035:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "5046:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "5057:4:82", + "type": "" + } + ], + "src": "4915:261:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5410:236:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5427:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5438:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5420:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5420:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5420:21:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "5450:70:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5493:6:82" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5505:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5516:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5501:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5501:18:82" + } + ], + "functionName": { + "name": "abi_encode_array_uint256_dyn", + "nodeType": "YulIdentifier", + "src": "5464:28:82" + }, + "nodeType": "YulFunctionCall", + "src": "5464:56:82" + }, + "variables": [ + { + "name": "tail_1", + "nodeType": "YulTypedName", + "src": "5454:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5540:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5551:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5536:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5536:18:82" + }, + { + "arguments": [ + { + "name": "tail_1", + "nodeType": "YulIdentifier", + "src": "5560:6:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5568:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "5556:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5556:22:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5529:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5529:50:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5529:50:82" + }, + { + "nodeType": "YulAssignment", + "src": "5588:52:82", + "value": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "5625:6:82" + }, + { + "name": "tail_1", + "nodeType": "YulIdentifier", + "src": "5633:6:82" + } + ], + "functionName": { + "name": "abi_encode_array_uint256_dyn", + "nodeType": "YulIdentifier", + "src": "5596:28:82" + }, + "nodeType": "YulFunctionCall", + "src": "5596:44:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "5588:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr__to_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "5371:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "5382:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "5390:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "5401:4:82", + "type": "" + } + ], + "src": "5181:465:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5752:76:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "5762:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5774:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5785:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5770:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5770:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "5762:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5804:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5815:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5797:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5797:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5797:25:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "5721:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "5732:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "5743:4:82", + "type": "" + } + ], + "src": "5651:177:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5954:262:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5971:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5982:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5964:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5964:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5964:21:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "5994:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6014:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "6008:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "6008:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "5998:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6041:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6052:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6037:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6037:18:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6057:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6030:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6030:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6030:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6099:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6107:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6095:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6095:15:82" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6116:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6127:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6112:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6112:18:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6132:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "6073:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "6073:66:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6073:66:82" + }, + { + "nodeType": "YulAssignment", + "src": "6148:62:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6164:9:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6183:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6191:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6179:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6179:15:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6200:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "6196:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6196:7:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "6175:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6175:29:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6160:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6160:45:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6207:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6156:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6156:54:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "6148:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "5923:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "5934:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "5945:4:82", + "type": "" + } + ], + "src": "5833:383:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6322:76:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6332:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6344:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6355:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6340:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6340:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "6332:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6374:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6385:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6367:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6367:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6367:25:82" + } + ] + }, + "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "6291:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "6302:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "6313:4:82", + "type": "" + } + ], + "src": "6221:177:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6532:119:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6542:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6554:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6565:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6550:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6550:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "6542:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6584:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6595:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6577:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6577:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6577:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6622:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6633:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6618:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6618:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "6638:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6611:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6611:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6611:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "6493:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "6504:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "6512:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "6523:4:82", + "type": "" + } + ], + "src": "6403:248:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6813:162:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6823:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6835:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6846:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6831:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6831:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "6823:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6865:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6876:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6858:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6858:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6858:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6903:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6914:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6899:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6899:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "6919:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6892:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6892:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6892:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "6946:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6957:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6942:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6942:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "6962:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6935:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6935:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6935:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_uint256_t_uint256_t_uint256__to_t_uint256_t_uint256_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "6766:9:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "6777:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "6785:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "6793:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "6804:4:82", + "type": "" + } + ], + "src": "6656:319:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7029:76:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "7051:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "7053:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "7053:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7053:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "7045:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "7048:1:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "7042:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "7042:8:82" + }, + "nodeType": "YulIf", + "src": "7039:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "7082:17:82", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "7094:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "7097:1:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "7090:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7090:9:82" + }, + "variableNames": [ + { + "name": "diff", + "nodeType": "YulIdentifier", + "src": "7082:4:82" + } + ] + } + ] + }, + "name": "checked_sub_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "7011:1:82", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "7014:1:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "diff", + "nodeType": "YulTypedName", + "src": "7020:4:82", + "type": "" + } + ], + "src": "6980:125:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7163:205:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "7173:10:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7182:1:82", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "7177:1:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7242:63:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "7267:3:82" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "7272:1:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7263:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7263:11:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "7286:3:82" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "7291:1:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7282:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7282:11:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "7276:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "7276:18:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7256:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7256:39:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7256:39:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "7203:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "7206:6:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "7200:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "7200:13:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "7214:19:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7216:15:82", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "7225:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7228:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7221:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7221:10:82" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "7216:1:82" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "7196:3:82", + "statements": [] + }, + "src": "7192:113:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7331:31:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "7344:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "7349:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7340:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7340:16:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7358:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7333:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7333:27:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7333:27:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "7320:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "7323:6:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "7317:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "7317:13:82" + }, + "nodeType": "YulIf", + "src": "7314:2:82" + } + ] + }, + "name": "copy_memory_to_memory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "7141:3:82", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "7146:3:82", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "7151:6:82", + "type": "" + } + ], + "src": "7110:258:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7428:325:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7438:22:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7452:1:82", + "type": "", + "value": "1" + }, + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "7455:4:82" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "7448:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7448:12:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "7438:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "7469:38:82", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "7499:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7505:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "7495:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7495:12:82" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "7473:18:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7546:31:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7548:27:82", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "7562:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7570:4:82", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "7558:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7558:17:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "7548:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "7526:18:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "7519:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7519:26:82" + }, + "nodeType": "YulIf", + "src": "7516:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7636:111:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7657:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7664:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7669:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "7660:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7660:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7650:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7650:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7650:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7701:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7704:4:82", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7694:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7694:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7694:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7729:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7732:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "7722:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7722:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7722:15:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "7592:18:82" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "7615:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7623:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "7612:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "7612:14:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "7589:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "7589:38:82" + }, + "nodeType": "YulIf", + "src": "7586:2:82" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "7408:4:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "7417:6:82", + "type": "" + } + ], + "src": "7373:380:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7805:88:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "7836:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "7838:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "7838:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7838:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "7821:5:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7832:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "7828:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7828:6:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "7818:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "7818:17:82" + }, + "nodeType": "YulIf", + "src": "7815:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "7867:20:82", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "7878:5:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7885:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7874:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7874:13:82" + }, + "variableNames": [ + { + "name": "ret", + "nodeType": "YulIdentifier", + "src": "7867:3:82" + } + ] + } + ] + }, + "name": "increment_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "7787:5:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "ret", + "nodeType": "YulTypedName", + "src": "7797:3:82", + "type": "" + } + ], + "src": "7758:135:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7930:95:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7947:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7954:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7959:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "7950:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7950:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7940:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7940:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7940:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7987:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7990:4:82", + "type": "", + "value": "0x11" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7980:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7980:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7980:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8011:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8014:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "8004:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8004:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8004:15:82" + } + ] + }, + "name": "panic_error_0x11", + "nodeType": "YulFunctionDefinition", + "src": "7898:127:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8062:95:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8079:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8086:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8091:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "8082:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8082:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8072:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8072:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8072:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8119:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8122:4:82", + "type": "", + "value": "0x41" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8112:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8112:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8112:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8143:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8146:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "8136:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8136:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8136:15:82" + } + ] + }, + "name": "panic_error_0x41", + "nodeType": "YulFunctionDefinition", + "src": "8030:127:82" + } + ] + }, + "contents": "{\n { }\n function abi_decode_address(offset) -> value\n {\n value := calldataload(offset)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n }\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := abi_decode_address(headStart)\n }\n function abi_decode_tuple_t_array$_t_bytes32_$dyn_calldata_ptr(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value1, value1) }\n let offset := calldataload(headStart)\n let _1 := sub(shl(64, 1), 1)\n if gt(offset, _1) { revert(value1, value1) }\n let _2 := add(headStart, offset)\n if iszero(slt(add(_2, 0x1f), dataEnd)) { revert(value1, value1) }\n let length := calldataload(_2)\n if gt(length, _1) { revert(value1, value1) }\n if gt(add(add(_2, shl(5, length)), 32), dataEnd) { revert(value1, value1) }\n value0 := add(_2, 32)\n value1 := length\n }\n function abi_decode_tuple_t_array$_t_bytes32_$dyn_memory_ptr(headStart, dataEnd) -> value0\n {\n let _1 := 32\n if slt(sub(dataEnd, headStart), _1) { revert(value0, value0) }\n let offset := calldataload(headStart)\n let _2 := sub(shl(64, 1), 1)\n if gt(offset, _2) { revert(value0, value0) }\n let _3 := add(headStart, offset)\n if iszero(slt(add(_3, 0x1f), dataEnd)) { revert(value0, value0) }\n let _4 := calldataload(_3)\n if gt(_4, _2) { panic_error_0x41() }\n let _5 := shl(5, _4)\n let memPtr := mload(64)\n let newFreePtr := add(memPtr, and(add(_5, 63), not(31)))\n if or(gt(newFreePtr, _2), lt(newFreePtr, memPtr)) { panic_error_0x41() }\n mstore(64, newFreePtr)\n let dst := memPtr\n mstore(memPtr, _4)\n dst := add(memPtr, _1)\n let src := add(_3, _1)\n if gt(add(add(_3, _5), _1), dataEnd) { revert(value0, value0) }\n let i := value0\n for { } lt(i, _4) { i := add(i, 1) }\n {\n mstore(dst, calldataload(src))\n dst := add(dst, _1)\n src := add(src, _1)\n }\n value0 := memPtr\n }\n function abi_decode_tuple_t_bytes32(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := calldataload(headStart)\n }\n function abi_decode_tuple_t_bytes32t_address(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := abi_decode_address(add(headStart, 32))\n }\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := calldataload(headStart)\n }\n function abi_decode_tuple_t_uint256t_uint256t_uint256_fromMemory(headStart, dataEnd) -> value0, value1, value2\n {\n if slt(sub(dataEnd, headStart), 96) { revert(value2, value2) }\n value0 := mload(headStart)\n value1 := mload(add(headStart, 32))\n value2 := mload(add(headStart, 64))\n }\n function abi_encode_array_uint256_dyn(value, pos) -> end\n {\n let length := mload(value)\n mstore(pos, length)\n let _1 := 0x20\n pos := add(pos, _1)\n let srcPtr := add(value, _1)\n let i := end\n for { } lt(i, length) { i := add(i, 1) }\n {\n mstore(pos, mload(srcPtr))\n pos := add(pos, _1)\n srcPtr := add(srcPtr, _1)\n }\n end := pos\n }\n function abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr__nonPadded_inplace_fromStack_reversed(pos, value1, value0) -> end\n {\n let length := mload(value0)\n copy_memory_to_memory(add(value0, 0x20), pos, length)\n let end_1 := add(pos, length)\n let length_1 := mload(value1)\n copy_memory_to_memory(add(value1, 0x20), end_1, length_1)\n end := add(end_1, length_1)\n }\n function abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__to_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__nonPadded_inplace_fromStack_reversed(pos, value2, value1, value0) -> end\n {\n let length := mload(value0)\n copy_memory_to_memory(add(value0, 0x20), pos, length)\n let end_1 := add(pos, length)\n let length_1 := mload(value1)\n copy_memory_to_memory(add(value1, 0x20), end_1, length_1)\n let end_2 := add(end_1, length_1)\n mstore(end_2, value2)\n end := add(end_2, 0x20)\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_array$_t_uint256_$dyn_memory_ptr__to_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n tail := abi_encode_array_uint256_dyn(value0, add(headStart, 32))\n }\n function abi_encode_tuple_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr__to_t_array$_t_uint256_$dyn_memory_ptr_t_array$_t_uint256_$dyn_memory_ptr__fromStack_reversed(headStart, value1, value0) -> tail\n {\n mstore(headStart, 64)\n let tail_1 := abi_encode_array_uint256_dyn(value0, add(headStart, 64))\n mstore(add(headStart, 32), sub(tail_1, headStart))\n tail := abi_encode_array_uint256_dyn(value1, tail_1)\n }\n function abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n let length := mload(value0)\n mstore(add(headStart, 32), length)\n copy_memory_to_memory(add(value0, 32), add(headStart, 64), length)\n tail := add(add(headStart, and(add(length, 31), not(31))), 64)\n }\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n }\n function abi_encode_tuple_t_uint256_t_uint256_t_uint256__to_t_uint256_t_uint256_t_uint256__fromStack_reversed(headStart, value2, value1, value0) -> tail\n {\n tail := add(headStart, 96)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n }\n function checked_sub_t_uint256(x, y) -> diff\n {\n if lt(x, y) { panic_error_0x11() }\n diff := sub(x, y)\n }\n function copy_memory_to_memory(src, dst, length)\n {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n if gt(i, length) { mstore(add(dst, length), 0) }\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function increment_t_uint256(value) -> ret\n {\n if eq(value, not(0)) { panic_error_0x11() }\n ret := add(value, 1)\n }\n function panic_error_0x11()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n function panic_error_0x41()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x41)\n revert(0, 0x24)\n }\n}", + "id": 82, + "language": "Yul", + "name": "#utility.yul" + } + ], + "sourceMap": "172:2536:0:-:0;;;289:4;259:34;;300:68;;;;;;;;;-1:-1:-1;347:5:21;:18;;355:10;-1:-1:-1;;;;;;347:18:21;;;;;;;;375:7;:20;;;;;;;;;;324:37:0;-1:-1:-1;;;324:15:0;:37::i;:::-;172:2536;;1389:128:21;1478:31;;;;;;;143:19:82;;;1478:31:21;;;;;;;;;178:12:82;;;1478:31:21;;;1456:54;;;;:12;;:54;;;:::i;:::-;;1389:128;:::o;172:2536:0:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;172:2536:0;;;-1:-1:-1;172:2536:0;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;201:380:82;280:1;276:12;;;;323;;;344:2;;398:4;390:6;386:17;376:27;;344:2;451;443:6;440:14;420:18;417:38;414:2;;;497:10;492:3;488:20;485:1;478:31;532:4;529:1;522:15;560:4;557:1;550:15;414:2;;256:325;;;:::o;:::-;172:2536:0;;;;;;", + "deployedSourceMap": "172:2536:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;913:219:21;;;;;;:::i;:::-;;:::i;:::-;;1530:192:0;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1369:155;;;;;;:::i;:::-;;:::i;:::-;;;5797:25:82;;;5785:2;5770:18;1369:155:0;5752:76:82;1728:459:0;;;;;;:::i;:::-;;:::i;:::-;;;;6577:25:82;;;6633:2;6618:18;;6611:34;;;;6550:18;1728:459:0;6532:119:82;294:22:21;;;;;;;;;;;;4883:19:82;4871:32;;;4853:51;;4841:2;4826:18;294:22:21;4808:102:82;374:183:0;;;;;;:::i;:::-;;:::i;563:157::-;;;;;;:::i;:::-;;:::i;726:148::-;;;;;;:::i;:::-;;:::i;227:35:21:-;;;:::i;:::-;;;;;;;:::i;268:20::-;;;;;;;;;880:483:0;;;;;;:::i;:::-;;:::i;:::-;;;;6858:25:82;;;6914:2;6899:18;;6892:34;;;;6942:18;;;6935:34;6846:2;6831:18;880:483:0;6813:162:82;1138:245:21;;;;;;:::i;:::-;;:::i;259:34:0:-;;;;;;2193:513;;;;;;:::i;:::-;;:::i;:::-;;;;;;;;:::i;913:219:21:-;461:5;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:48;;;;:::i;:::-;439:78;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;1000:1:::1;982:20;;:6;:20;;;;1004:54;;;;;;;;;;;;;;;;;::::0;:12:::1;:19;;;;;:::i;:54::-;974:85;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;1087:5:21::1;::::0;1074:27:::1;::::0;::::1;::::0;;::::1;::::0;1087:5:::1;::::0;1074:27:::1;::::0;1087:5:::1;::::0;1074:27:::1;1111:5;:14:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;913:219::o;1530:192:0:-;1608:16;1637:23;1666:26;1685:6;;1666:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1666:18:0;;-1:-1:-1;;;1666:26:0:i;:::-;-1:-1:-1;1636:56:0;1530:192;-1:-1:-1;;;;1530:192:0:o;1369:155::-;1432:7;1452:13;1471:24;1489:5;1471:17;:24::i;:::-;-1:-1:-1;1451:44:0;1369:155;-1:-1:-1;;;1369:155:0:o;1728:459::-;1800:7;1809;1841:3;1832:5;:12;:31;;;;1848:5;:15;;1832:31;1828:56;;;-1:-1:-1;1873:7:0;;1882:1;;-1:-1:-1;1728:459:0;-1:-1:-1;1728:459:0:o;1828:56::-;1897:13;1912:18;1934:25;1953:5;1934:18;:25::i;:::-;1894:65;;;;;1985:1;1977:5;:9;1988:50;;;;;;;;;;;;;;;;;;2032:5;1988:12;:19;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:50;;;;;:::i;:::-;1969:70;;;;;;;;;;;;;;:::i;:::-;;2050:16;2087:12;;2069:15;:30;;;;:::i;:::-;2050:49;;2126:8;2113:10;:21;2109:44;;;-1:-1:-1;2144:5:0;;2151:1;;-1:-1:-1;1728:459:0;-1:-1:-1;;;1728:459:0:o;2109:44::-;-1:-1:-1;2171:5:0;;2178:1;;-1:-1:-1;1728:459:0;-1:-1:-1;;;1728:459:0:o;374:183::-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;478:7:65;504:22;;;:17;;:22;:17;:22;;;;458:52:0;;::::1;::::0;;::::1;::::0;504:22:65;;;;;458:52:0::1;::::0;478:7:65;458:52:0::1;272:17:65::0;:22;;;:17;;:22;:17;:22;;:30;;;;;;;;;;374:183:0;;:::o;563:157::-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;478:7:65;504:22;;;:17;;:22;:17;:22;;;;634:44:0;;504:22:65;;;;;;;634:44:0::1;::::0;478:7:65;634:44:0::1;382:17:65::0;:22;;;:17;;:22;:17;:22;;375:29;;;;;;563:157:0:o;726:148::-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;819:12:0::1;::::0;799:39:::1;::::0;833:4;;819:12;799:39:::1;::::0;;;::::1;848:12;:19:::0;726:148::o;227:35:21:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;880:483:0:-;998:13;1025;1052:12;1089:21;1113:22;1129:5;478:7:65;504:22;;;:17;;:22;:17;:22;;;;;;417:116;1113:22:0;1145:41;;;;;;;;;;;;;;;;;;;;1233:51;;;;;;;;;;;;;;;;1089:46;;-1:-1:-1;1204:27:0;;;;;;1233:51;;1145:41;;1278:5;1233:19;:51::i;:::-;1196:89;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;1318:38:0;;;;;;;;5797:25:82;;;1318:31:0;;;;;;5770:18:82;;1318:38:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1295:61;;;;-1:-1:-1;1295:61:0;;-1:-1:-1;880:483:0;-1:-1:-1;;;;880:483:0:o;1138:245:21:-;461:5;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;;1239:1:::1;1219:22;;:8;:22;;;;1243:56;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:56::-;1211:89;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;1330:7:21::1;::::0;1315:33:::1;::::0;::::1;::::0;;::::1;::::0;1330:7:::1;::::0;1315:33:::1;::::0;1330:7:::1;::::0;1315:33:::1;1358:7;:18:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;1138:245::o;2193:513:0:-;2276:16;2294;2346:2;2330:6;:13;:18;2350:55;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:55::-;2322:84;;;;;;;;;;;;;;:::i;:::-;;2417:23;2457:6;:13;2443:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2443:28:0;;2417:54;;2481:23;2521:6;:13;2507:28;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2507:28:0;;2481:54;;2550:9;2545:122;2569:6;:13;2565:1;:17;2545:122;;;2628:28;2646:6;2653:1;2646:9;;;;;;;;;;;;;;;;;;;;;;2628:17;:28::i;:::-;2604:6;2611:1;2604:9;;;;;;;;;;;;;;;;;;;;;2615:6;2622:1;2615:9;;;;;;;;;;;;;;;;;;;;;;;;;2603:53;;;;;2584:3;;;;:::i;:::-;;;;2545:122;;;-1:-1:-1;2684:6:0;;2692;;-1:-1:-1;2193:513:0;-1:-1:-1;;2193:513:0:o;261:142:62:-;334:13;390:1;393;373:22;;;;;;;;;:::i;:::-;;;;;;;;;;;;;359:37;;261:142;;;;:::o;409:186::-;523:13;579:1;582;585;562:25;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;548:40;;409:186;;;;;:::o;14:173:82:-;82:20;;142:19;131:31;;121:42;;111:2;;177:1;174;167:12;111:2;63:124;;;:::o;192:196::-;251:6;304:2;292:9;283:7;279:23;275:32;272:2;;;325:6;317;310:22;272:2;353:29;372:9;353:29;:::i;:::-;343:39;262:126;-1:-1:-1;;;262:126:82:o;393:665::-;479:6;487;540:2;528:9;519:7;515:23;511:32;508:2;;;561:6;553;546:22;508:2;593:23;;635:18;665:14;;;662:2;;;697:6;689;682:22;662:2;740:6;729:9;725:22;715:32;;785:7;778:4;774:2;770:13;766:27;756:2;;812:6;804;797:22;756:2;857;844:16;883:2;875:6;872:14;869:2;;;904:6;896;889:22;869:2;962:7;957:2;947:6;944:1;940:14;936:2;932:23;928:32;925:45;922:2;;;988:6;980;973:22;922:2;1024;1016:11;;;;;1046:6;;-1:-1:-1;498:560:82;;-1:-1:-1;;;;498:560:82:o;1063:1171::-;1147:6;1178:2;1221;1209:9;1200:7;1196:23;1192:32;1189:2;;;1242:6;1234;1227:22;1189:2;1274:23;;1316:18;1346:14;;;1343:2;;;1378:6;1370;1363:22;1343:2;1421:6;1410:9;1406:22;1396:32;;1466:7;1459:4;1455:2;1451:13;1447:27;1437:2;;1493:6;1485;1478:22;1437:2;1534;1521:16;1556:2;1552;1549:10;1546:2;;;1562:18;;:::i;:::-;1608:2;1605:1;1601:10;1640:2;1634:9;1703:2;1699:7;1694:2;1690;1686:11;1682:25;1674:6;1670:38;1758:6;1746:10;1743:22;1738:2;1726:10;1723:18;1720:46;1717:2;;;1769:18;;:::i;:::-;1805:2;1798:22;1855:18;;;1889:15;;;;-1:-1:-1;1924:11:82;;;1954;;;1950:20;;1947:33;-1:-1:-1;1944:2:82;;;1998:6;1990;1983:22;1944:2;2025:6;2016:15;;2040:163;2054:2;2051:1;2048:9;2040:163;;;2111:17;;2099:30;;2072:1;2065:9;;;;;2149:12;;;;2181;;2040:163;;;-1:-1:-1;2222:6:82;1158:1076;-1:-1:-1;;;;;;;;1158:1076:82:o;2239:190::-;2298:6;2351:2;2339:9;2330:7;2326:23;2322:32;2319:2;;;2372:6;2364;2357:22;2319:2;-1:-1:-1;2400:23:82;;2309:120;-1:-1:-1;2309:120:82:o;2434:264::-;2502:6;2510;2563:2;2551:9;2542:7;2538:23;2534:32;2531:2;;;2584:6;2576;2569:22;2531:2;2625:9;2612:23;2602:33;;2654:38;2688:2;2677:9;2673:18;2654:38;:::i;:::-;2644:48;;2521:177;;;;;:::o;2898:316::-;2986:6;2994;3002;3055:2;3043:9;3034:7;3030:23;3026:32;3023:2;;;3076:6;3068;3061:22;3023:2;3110:9;3104:16;3094:26;;3160:2;3149:9;3145:18;3139:25;3129:35;;3204:2;3193:9;3189:18;3183:25;3173:35;;3013:201;;;;;:::o;3219:437::-;3272:3;3310:5;3304:12;3337:6;3332:3;3325:19;3363:4;3392:2;3387:3;3383:12;3376:19;;3429:2;3422:5;3418:14;3450:3;3462:169;3476:6;3473:1;3470:13;3462:169;;;3537:13;;3525:26;;3571:12;;;;3606:15;;;;3498:1;3491:9;3462:169;;;-1:-1:-1;3647:3:82;;3280:376;-1:-1:-1;;;;;3280:376:82:o;3661:470::-;3840:3;3878:6;3872:13;3894:53;3940:6;3935:3;3928:4;3920:6;3916:17;3894:53;:::i;:::-;4010:13;;3969:16;;;;4032:57;4010:13;3969:16;4066:4;4054:17;;4032:57;:::i;:::-;4105:20;;3848:283;-1:-1:-1;;;;3848:283:82:o;4136:566::-;4343:3;4381:6;4375:13;4397:53;4443:6;4438:3;4431:4;4423:6;4419:17;4397:53;:::i;:::-;4513:13;;4472:16;;;;4535:57;4513:13;4472:16;4569:4;4557:17;;4535:57;:::i;:::-;4614:20;4643:21;;;-1:-1:-1;;4691:4:82;4680:16;;4351:351;-1:-1:-1;;4351:351:82:o;4915:261::-;5094:2;5083:9;5076:21;5057:4;5114:56;5166:2;5155:9;5151:18;5143:6;5114:56;:::i;5181:465::-;5438:2;5427:9;5420:21;5401:4;5464:56;5516:2;5505:9;5501:18;5493:6;5464:56;:::i;:::-;5568:9;5560:6;5556:22;5551:2;5540:9;5536:18;5529:50;5596:44;5633:6;5625;5596:44;:::i;:::-;5588:52;5410:236;-1:-1:-1;;;;;5410:236:82:o;5833:383::-;5982:2;5971:9;5964:21;5945:4;6014:6;6008:13;6057:6;6052:2;6041:9;6037:18;6030:34;6073:66;6132:6;6127:2;6116:9;6112:18;6107:2;6099:6;6095:15;6073:66;:::i;:::-;6200:2;6179:15;6196:7;6175:29;6160:45;;;;6207:2;6156:54;;5954:262;-1:-1:-1;;5954:262:82:o;6980:125::-;7020:4;7048:1;7045;7042:8;7039:2;;;7053:18;;:::i;:::-;-1:-1:-1;7090:9:82;;7029:76::o;7110:258::-;7182:1;7192:113;7206:6;7203:1;7200:13;7192:113;;;7282:11;;;7276:18;7263:11;;;7256:39;7228:2;7221:10;7192:113;;;7323:6;7320:1;7317:13;7314:2;;;7358:1;7349:6;7344:3;7340:16;7333:27;7314:2;;7163:205;;;:::o;7373:380::-;7452:1;7448:12;;;;7495;;;7516:2;;7570:4;7562:6;7558:17;7548:27;;7516:2;7623;7615:6;7612:14;7592:18;7589:38;7586:2;;;7669:10;7664:3;7660:20;7657:1;7650:31;7704:4;7701:1;7694:15;7732:4;7729:1;7722:15;7586:2;;7428:325;;;:::o;7758:135::-;7797:3;7828:6;7818:17;;7815:2;;;7838:18;;:::i;:::-;-1:-1:-1;7885:1:82;7874:13;;7805:88::o;7898:127::-;7959:10;7954:3;7950:20;7947:1;7940:31;7990:4;7987:1;7980:15;8014:4;8011:1;8004:15;8030:127;8091:10;8086:3;8082:20;8079:1;8072:31;8122:4;8119:1;8112:15;8146:4;8143:1;8136:15", + "source": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.4;\n\nimport './storages/AddressStorage.sol';\nimport './interfaces/IOracle.sol';\nimport './interfaces/IAssetPrice.sol';\n\ncontract AssetPrice is AddressStorage, IAssetPrice {\n using Strings for string;\n uint256 public maxDelayTime = 3600;\n\n constructor() {\n setContractName(CONTRACT_ASSET_PRICE);\n }\n\n function setOracle(bytes32 asset, address oracle) external onlyOwner {\n emit OracleChanged(asset, getAddressValue(asset), oracle);\n setAddressValue(asset, oracle);\n }\n\n function removeOracle(bytes32 asset) external onlyOwner {\n emit OracleRemoved(asset, getAddressValue(asset));\n removeAddressValue(asset);\n }\n\n function setMaxDelayTime(uint256 time) external onlyOwner {\n emit MaxDelayTimeChanged(maxDelayTime, time);\n maxDelayTime = time;\n }\n\n function getPriceFromOracle(bytes32 asset)\n public\n override\n view\n returns (\n uint256 round,\n uint256 price,\n uint256 time\n )\n {\n address oracleAddress = getAddressValue(asset);\n string memory errorMessage = 'AssetPrice';\n require(oracleAddress != address(0), errorMessage.concat(': Missing Oracle For ', asset));\n (round, price, time) = IOracle(oracleAddress).getPrice(asset);\n }\n\n function getPrice(bytes32 asset) public override view returns (uint256) {\n (uint256 price, ) = getPriceAndStatus(asset);\n return price;\n }\n\n function getPrices(bytes32[] calldata assets) external override view returns (uint256[] memory) {\n (uint256[] memory prices, ) = getPricesAndStatus(assets);\n return prices;\n }\n\n function getPriceAndStatus(bytes32 asset) public override view returns (uint256, uint256) {\n if (asset == USD || asset == 'USDT') return (1 ether, 0);\n (, uint256 price, uint256 updateTime) = getPriceFromOracle(asset);\n require(price > 0, contractName.concat(': Price is zero For ', asset));\n\n uint256 lastTime = block.timestamp - maxDelayTime;\n if (updateTime < lastTime) return (price, 1);\n return (price, 0);\n }\n\n function getPricesAndStatus(bytes32[] memory assets) public override view returns (uint256[] memory, uint256[] memory) {\n require(assets.length < 20, contractName.concat(': cannot have more than 20 items'));\n\n uint256[] memory prices = new uint256[](assets.length);\n uint256[] memory status = new uint256[](assets.length);\n for (uint256 i = 0; i < assets.length; i++) {\n (prices[i], status[i]) = getPriceAndStatus(assets[i]);\n }\n return (prices, status);\n }\n}\n", + "sourcePath": "/home/colin/Workspace/src/Mobius/contracts/contracts/AssetPrice.sol", + "ast": { + "absolutePath": "project:/contracts/AssetPrice.sol", + "exportedSymbols": { + "AddressStorage": [ + 12792 + ], + "AssetPrice": [ + 311 + ], + "Constants": [ + 8570 + ], + "IAssetPrice": [ + 9620 + ], + "IOracle": [ + 10222 + ], + "IOwnable": [ + 10242 + ], + "Ownable": [ + 9135 + ], + "Storage": [ + 9205 + ], + "Strings": [ + 12299 + ] + }, + "id": 312, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:0" + }, + { + "absolutePath": "project:/contracts/storages/AddressStorage.sol", + "file": "./storages/AddressStorage.sol", + "id": 2, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 312, + "sourceUnit": 12793, + "src": "57:39:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IOracle.sol", + "file": "./interfaces/IOracle.sol", + "id": 3, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 312, + "sourceUnit": 10223, + "src": "97:34:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IAssetPrice.sol", + "file": "./interfaces/IAssetPrice.sol", + "id": 4, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 312, + "sourceUnit": 9621, + "src": "132:38:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 5, + "name": "AddressStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12792, + "src": "195:14:0" + }, + "id": 6, + "nodeType": "InheritanceSpecifier", + "src": "195:14:0" + }, + { + "baseName": { + "id": 7, + "name": "IAssetPrice", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9620, + "src": "211:11:0" + }, + "id": 8, + "nodeType": "InheritanceSpecifier", + "src": "211:11:0" + } + ], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 311, + "linearizedBaseContracts": [ + 311, + 9620, + 12792, + 9205, + 9135, + 10242, + 8570 + ], + "name": "AssetPrice", + "nameLocation": "181:10:0", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 11, + "libraryName": { + "id": 9, + "name": "Strings", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12299, + "src": "235:7:0" + }, + "nodeType": "UsingForDirective", + "src": "229:25:0", + "typeName": { + "id": 10, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "247:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + { + "constant": false, + "functionSelector": "f56c8547", + "id": 14, + "mutability": "mutable", + "name": "maxDelayTime", + "nameLocation": "274:12:0", + "nodeType": "VariableDeclaration", + "scope": 311, + "src": "259:34:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 12, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "259:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "33363030", + "id": 13, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "289:4:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_3600_by_1", + "typeString": "int_const 3600" + }, + "value": "3600" + }, + "visibility": "public" + }, + { + "body": { + "id": 21, + "nodeType": "Block", + "src": "314:54:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 18, + "name": "CONTRACT_ASSET_PRICE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8521, + "src": "340:20:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 17, + "name": "setContractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9134, + "src": "324:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "324:37:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 20, + "nodeType": "ExpressionStatement", + "src": "324:37:0" + } + ] + }, + "id": 22, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [], + "src": "311:2:0" + }, + "returnParameters": { + "id": 16, + "nodeType": "ParameterList", + "parameters": [], + "src": "314:0:0" + }, + "scope": 311, + "src": "300:68:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 44, + "nodeType": "Block", + "src": "443:114:0", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "id": 32, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "472:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 34, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "495:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 33, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "479:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 35, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "479:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 36, + "name": "oracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26, + "src": "503:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 31, + "name": "OracleChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9613, + "src": "458:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 37, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "458:52:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 38, + "nodeType": "EmitStatement", + "src": "453:57:0" + }, + { + "expression": { + "arguments": [ + { + "id": 40, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "536:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 41, + "name": "oracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26, + "src": "543:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 39, + "name": "setAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12715, + 12760 + ], + "referencedDeclaration": 12715, + "src": "520:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 42, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "520:30:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 43, + "nodeType": "ExpressionStatement", + "src": "520:30:0" + } + ] + }, + "functionSelector": "5ea8dffb", + "id": 45, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 29, + "kind": "modifierInvocation", + "modifierName": { + "id": 28, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "433:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "433:9:0" + } + ], + "name": "setOracle", + "nameLocation": "383:9:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 27, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 24, + "mutability": "mutable", + "name": "asset", + "nameLocation": "401:5:0", + "nodeType": "VariableDeclaration", + "scope": 45, + "src": "393:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 23, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "393:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26, + "mutability": "mutable", + "name": "oracle", + "nameLocation": "416:6:0", + "nodeType": "VariableDeclaration", + "scope": 45, + "src": "408:14:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 25, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "408:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "392:31:0" + }, + "returnParameters": { + "id": 30, + "nodeType": "ParameterList", + "parameters": [], + "src": "443:0:0" + }, + "scope": 311, + "src": "374:183:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 63, + "nodeType": "Block", + "src": "619:101:0", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "id": 53, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 47, + "src": "648:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 55, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 47, + "src": "671:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 54, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "655:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 56, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "655:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 52, + "name": "OracleRemoved", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9619, + "src": "634:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 57, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "634:44:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 58, + "nodeType": "EmitStatement", + "src": "629:49:0" + }, + { + "expression": { + "arguments": [ + { + "id": 60, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 47, + "src": "707:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 59, + "name": "removeAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12728, + 12775 + ], + "referencedDeclaration": 12728, + "src": "688:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "688:25:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 62, + "nodeType": "ExpressionStatement", + "src": "688:25:0" + } + ] + }, + "functionSelector": "6e2eb512", + "id": 64, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 50, + "kind": "modifierInvocation", + "modifierName": { + "id": 49, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "609:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "609:9:0" + } + ], + "name": "removeOracle", + "nameLocation": "572:12:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 48, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 47, + "mutability": "mutable", + "name": "asset", + "nameLocation": "593:5:0", + "nodeType": "VariableDeclaration", + "scope": 64, + "src": "585:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 46, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "585:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "584:15:0" + }, + "returnParameters": { + "id": 51, + "nodeType": "ParameterList", + "parameters": [], + "src": "619:0:0" + }, + "scope": 311, + "src": "563:157:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 80, + "nodeType": "Block", + "src": "784:90:0", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "id": 72, + "name": "maxDelayTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "819:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 73, + "name": "time", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 66, + "src": "833:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 71, + "name": "MaxDelayTimeChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9605, + "src": "799:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (uint256,uint256)" + } + }, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "799:39:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 75, + "nodeType": "EmitStatement", + "src": "794:44:0" + }, + { + "expression": { + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 76, + "name": "maxDelayTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "848:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 77, + "name": "time", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 66, + "src": "863:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "848:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 79, + "nodeType": "ExpressionStatement", + "src": "848:19:0" + } + ] + }, + "functionSelector": "71bb238e", + "id": 81, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 69, + "kind": "modifierInvocation", + "modifierName": { + "id": 68, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "774:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "774:9:0" + } + ], + "name": "setMaxDelayTime", + "nameLocation": "735:15:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 67, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 66, + "mutability": "mutable", + "name": "time", + "nameLocation": "759:4:0", + "nodeType": "VariableDeclaration", + "scope": 81, + "src": "751:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 65, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "751:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "750:14:0" + }, + "returnParameters": { + "id": 70, + "nodeType": "ParameterList", + "parameters": [], + "src": "784:0:0" + }, + "scope": 311, + "src": "726:148:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9599 + ], + "body": { + "id": 129, + "nodeType": "Block", + "src": "1079:284:0", + "statements": [ + { + "assignments": [ + 94 + ], + "declarations": [ + { + "constant": false, + "id": 94, + "mutability": "mutable", + "name": "oracleAddress", + "nameLocation": "1097:13:0", + "nodeType": "VariableDeclaration", + "scope": 129, + "src": "1089:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 93, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1089:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 98, + "initialValue": { + "arguments": [ + { + "id": 96, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1129:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 95, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "1113:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 97, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1113:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1089:46:0" + }, + { + "assignments": [ + 100 + ], + "declarations": [ + { + "constant": false, + "id": 100, + "mutability": "mutable", + "name": "errorMessage", + "nameLocation": "1159:12:0", + "nodeType": "VariableDeclaration", + "scope": 129, + "src": "1145:26:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 99, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1145:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 102, + "initialValue": { + "hexValue": "41737365745072696365", + "id": 101, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1174:12:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_90ae8eb85273dc23aeacd3c6a707448b6d3f3ede9ca47d66a3bfa9b5286237b0", + "typeString": "literal_string \"AssetPrice\"" + }, + "value": "AssetPrice" + }, + "nodeType": "VariableDeclarationStatement", + "src": "1145:41:0" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 104, + "name": "oracleAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "1204:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 107, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1229:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 106, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1221:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 105, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1221:7:0", + "typeDescriptions": {} + } + }, + "id": 108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1221:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1204:27:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "hexValue": "3a204d697373696e67204f7261636c6520466f7220", + "id": 112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1253:23:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_5c757ff990aab492c02b8da5baccdb880c3d7b242c5669738b105a04168efa59", + "typeString": "literal_string \": Missing Oracle For \"" + }, + "value": ": Missing Oracle For " + }, + { + "id": 113, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1278:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_5c757ff990aab492c02b8da5baccdb880c3d7b242c5669738b105a04168efa59", + "typeString": "literal_string \": Missing Oracle For \"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 110, + "name": "errorMessage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1233:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "concat", + "nodeType": "MemberAccess", + "referencedDeclaration": 12298, + "src": "1233:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_bytes32_$returns$_t_string_memory_ptr_$bound_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string memory,bytes32) pure returns (string memory)" + } + }, + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1233:51:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 103, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1196:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1196:89:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 116, + "nodeType": "ExpressionStatement", + "src": "1196:89:0" + }, + { + "expression": { + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 117, + "name": "round", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "1296:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 118, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 89, + "src": "1303:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 119, + "name": "time", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 91, + "src": "1310:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 120, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1295:20:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 125, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1350:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [ + { + "id": 122, + "name": "oracleAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "1326:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 121, + "name": "IOracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10222, + "src": "1318:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IOracle_$10222_$", + "typeString": "type(contract IOracle)" + } + }, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1318:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IOracle_$10222", + "typeString": "contract IOracle" + } + }, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getPrice", + "nodeType": "MemberAccess", + "referencedDeclaration": 10210, + "src": "1318:31:0", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view external returns (uint256,uint256,uint256)" + } + }, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1318:38:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "1295:61:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "1295:61:0" + } + ] + }, + "functionSelector": "c519a3c9", + "id": 130, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPriceFromOracle", + "nameLocation": "889:18:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 85, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "946:8:0" + }, + "parameters": { + "id": 84, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 83, + "mutability": "mutable", + "name": "asset", + "nameLocation": "916:5:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "908:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 82, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "908:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "907:15:0" + }, + "returnParameters": { + "id": 92, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 87, + "mutability": "mutable", + "name": "round", + "nameLocation": "1006:5:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "998:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 86, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "998:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 89, + "mutability": "mutable", + "name": "price", + "nameLocation": "1033:5:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "1025:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 88, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1025:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 91, + "mutability": "mutable", + "name": "time", + "nameLocation": "1060:4:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "1052:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 90, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1052:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "984:90:0" + }, + "scope": 311, + "src": "880:483:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 9558 + ], + "body": { + "id": 146, + "nodeType": "Block", + "src": "1441:83:0", + "statements": [ + { + "assignments": [ + 139, + null + ], + "declarations": [ + { + "constant": false, + "id": 139, + "mutability": "mutable", + "name": "price", + "nameLocation": "1460:5:0", + "nodeType": "VariableDeclaration", + "scope": 146, + "src": "1452:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 138, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1452:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + null + ], + "id": 143, + "initialValue": { + "arguments": [ + { + "id": 141, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 132, + "src": "1489:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 140, + "name": "getPriceAndStatus", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 230, + "src": "1471:17:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view returns (uint256,uint256)" + } + }, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1471:24:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1451:44:0" + }, + { + "expression": { + "id": 144, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 139, + "src": "1512:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 137, + "id": 145, + "nodeType": "Return", + "src": "1505:12:0" + } + ] + }, + "functionSelector": "31d98b3f", + "id": 147, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPrice", + "nameLocation": "1378:8:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 134, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1409:8:0" + }, + "parameters": { + "id": 133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 132, + "mutability": "mutable", + "name": "asset", + "nameLocation": "1395:5:0", + "nodeType": "VariableDeclaration", + "scope": 147, + "src": "1387:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 131, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1387:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1386:15:0" + }, + "returnParameters": { + "id": 137, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 136, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 147, + "src": "1432:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 135, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1432:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1431:9:0" + }, + "scope": 311, + "src": "1369:155:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 9567 + ], + "body": { + "id": 168, + "nodeType": "Block", + "src": "1626:96:0", + "statements": [ + { + "assignments": [ + 161, + null + ], + "declarations": [ + { + "constant": false, + "id": 161, + "mutability": "mutable", + "name": "prices", + "nameLocation": "1654:6:0", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1637:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 159, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1637:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 160, + "nodeType": "ArrayTypeName", + "src": "1637:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + }, + null + ], + "id": 165, + "initialValue": { + "arguments": [ + { + "id": 163, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 150, + "src": "1685:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + ], + "id": 162, + "name": "getPricesAndStatus", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "1666:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_bytes32_$dyn_memory_ptr_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (bytes32[] memory) view returns (uint256[] memory,uint256[] memory)" + } + }, + "id": 164, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1666:26:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "tuple(uint256[] memory,uint256[] memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1636:56:0" + }, + { + "expression": { + "id": 166, + "name": "prices", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 161, + "src": "1709:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "functionReturnParameters": 156, + "id": 167, + "nodeType": "Return", + "src": "1702:13:0" + } + ] + }, + "functionSelector": "26ee4836", + "id": 169, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPrices", + "nameLocation": "1539:9:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 152, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1585:8:0" + }, + "parameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 150, + "mutability": "mutable", + "name": "assets", + "nameLocation": "1568:6:0", + "nodeType": "VariableDeclaration", + "scope": 169, + "src": "1549:25:0", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 148, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1549:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 149, + "nodeType": "ArrayTypeName", + "src": "1549:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + } + ], + "src": "1548:27:0" + }, + "returnParameters": { + "id": 156, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 155, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 169, + "src": "1608:16:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 153, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1608:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 154, + "nodeType": "ArrayTypeName", + "src": "1608:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "1607:18:0" + }, + "scope": 311, + "src": "1530:192:0", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9576 + ], + "body": { + "id": 229, + "nodeType": "Block", + "src": "1818:369:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 185, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 179, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "1832:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 180, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "1841:3:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "1832:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 184, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 182, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "1848:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "55534454", + "id": 183, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1857:6:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8b1a1d9c2b109e527c9134b25b1a1833b16b6594f92daa9f6d9b7a6024bce9d0", + "typeString": "literal_string \"USDT\"" + }, + "value": "USDT" + }, + "src": "1848:15:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "1832:31:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 190, + "nodeType": "IfStatement", + "src": "1828:56:0", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "31", + "id": 186, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1873:7:0", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + }, + "value": "1" + }, + { + "hexValue": "30", + "id": 187, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1882:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 188, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1872:12:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_rational_1000000000000000000_by_1_$_t_rational_0_by_1_$", + "typeString": "tuple(int_const 1000000000000000000,int_const 0)" + } + }, + "functionReturnParameters": 178, + "id": 189, + "nodeType": "Return", + "src": "1865:19:0" + } + }, + { + "assignments": [ + null, + 192, + 194 + ], + "declarations": [ + null, + { + "constant": false, + "id": 192, + "mutability": "mutable", + "name": "price", + "nameLocation": "1905:5:0", + "nodeType": "VariableDeclaration", + "scope": 229, + "src": "1897:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 191, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1897:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 194, + "mutability": "mutable", + "name": "updateTime", + "nameLocation": "1920:10:0", + "nodeType": "VariableDeclaration", + "scope": 229, + "src": "1912:18:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 193, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1912:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 198, + "initialValue": { + "arguments": [ + { + "id": 196, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "1953:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 195, + "name": "getPriceFromOracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "1934:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view returns (uint256,uint256,uint256)" + } + }, + "id": 197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1934:25:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1894:65:0" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 202, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 200, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 192, + "src": "1977:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 201, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1985:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1977:9:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "hexValue": "3a205072696365206973207a65726f20466f7220", + "id": 205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2008:22:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c4024a1cb63f6b53fd59149176d1aa2d31234ce610bdd0d169775a17e45983d0", + "typeString": "literal_string \": Price is zero For \"" + }, + "value": ": Price is zero For " + }, + { + "id": 206, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "2032:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c4024a1cb63f6b53fd59149176d1aa2d31234ce610bdd0d169775a17e45983d0", + "typeString": "literal_string \": Price is zero For \"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 203, + "name": "contractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8987, + "src": "1988:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 204, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "concat", + "nodeType": "MemberAccess", + "referencedDeclaration": 12298, + "src": "1988:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_bytes32_$returns$_t_string_memory_ptr_$bound_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string memory,bytes32) pure returns (string memory)" + } + }, + "id": 207, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1988:50:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 199, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1969:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 208, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1969:70:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 209, + "nodeType": "ExpressionStatement", + "src": "1969:70:0" + }, + { + "assignments": [ + 211 + ], + "declarations": [ + { + "constant": false, + "id": 211, + "mutability": "mutable", + "name": "lastTime", + "nameLocation": "2058:8:0", + "nodeType": "VariableDeclaration", + "scope": 229, + "src": "2050:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 210, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2050:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 216, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 215, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 212, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967292, + "src": "2069:5:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "timestamp", + "nodeType": "MemberAccess", + "src": "2069:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 214, + "name": "maxDelayTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "2087:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2069:30:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2050:49:0" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 219, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 217, + "name": "updateTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 194, + "src": "2113:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 218, + "name": "lastTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 211, + "src": "2126:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2113:21:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 224, + "nodeType": "IfStatement", + "src": "2109:44:0", + "trueBody": { + "expression": { + "components": [ + { + "id": 220, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 192, + "src": "2144:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "31", + "id": 221, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2151:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "id": 222, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2143:10:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_rational_1_by_1_$", + "typeString": "tuple(uint256,int_const 1)" + } + }, + "functionReturnParameters": 178, + "id": 223, + "nodeType": "Return", + "src": "2136:17:0" + } + }, + { + "expression": { + "components": [ + { + "id": 225, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 192, + "src": "2171:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 226, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2178:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 227, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2170:10:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_rational_0_by_1_$", + "typeString": "tuple(uint256,int_const 0)" + } + }, + "functionReturnParameters": 178, + "id": 228, + "nodeType": "Return", + "src": "2163:17:0" + } + ] + }, + "functionSelector": "3902ca61", + "id": 230, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPriceAndStatus", + "nameLocation": "1737:17:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 173, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1777:8:0" + }, + "parameters": { + "id": 172, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 171, + "mutability": "mutable", + "name": "asset", + "nameLocation": "1763:5:0", + "nodeType": "VariableDeclaration", + "scope": 230, + "src": "1755:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 170, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1755:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1754:15:0" + }, + "returnParameters": { + "id": 178, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 175, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 230, + "src": "1800:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1800:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 177, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 230, + "src": "1809:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 176, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1809:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1799:18:0" + }, + "scope": 311, + "src": "1728:459:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 9588 + ], + "body": { + "id": 309, + "nodeType": "Block", + "src": "2312:394:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 244, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2330:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2330:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3230", + "id": 246, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2346:2:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_20_by_1", + "typeString": "int_const 20" + }, + "value": "20" + }, + "src": "2330:18:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "hexValue": "3a2063616e6e6f742068617665206d6f7265207468616e203230206974656d73", + "id": 250, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2370:34:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cbefc34fe464d005b102f42da70283e058a1d1c2c903e4d2e0d13bb6e2b29468", + "typeString": "literal_string \": cannot have more than 20 items\"" + }, + "value": ": cannot have more than 20 items" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_cbefc34fe464d005b102f42da70283e058a1d1c2c903e4d2e0d13bb6e2b29468", + "typeString": "literal_string \": cannot have more than 20 items\"" + } + ], + "expression": { + "id": 248, + "name": "contractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8987, + "src": "2350:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "concat", + "nodeType": "MemberAccess", + "referencedDeclaration": 12276, + "src": "2350:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_string_memory_ptr_$returns$_t_string_memory_ptr_$bound_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string memory) pure returns (string memory)" + } + }, + "id": 251, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2350:55:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 243, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "2322:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2322:84:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 253, + "nodeType": "ExpressionStatement", + "src": "2322:84:0" + }, + { + "assignments": [ + 258 + ], + "declarations": [ + { + "constant": false, + "id": 258, + "mutability": "mutable", + "name": "prices", + "nameLocation": "2434:6:0", + "nodeType": "VariableDeclaration", + "scope": 309, + "src": "2417:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 256, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2417:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 257, + "nodeType": "ArrayTypeName", + "src": "2417:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "id": 265, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 262, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2457:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 263, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2457:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 261, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2443:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 259, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2447:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 260, + "nodeType": "ArrayTypeName", + "src": "2447:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2443:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2417:54:0" + }, + { + "assignments": [ + 270 + ], + "declarations": [ + { + "constant": false, + "id": 270, + "mutability": "mutable", + "name": "status", + "nameLocation": "2498:6:0", + "nodeType": "VariableDeclaration", + "scope": 309, + "src": "2481:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 268, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2481:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 269, + "nodeType": "ArrayTypeName", + "src": "2481:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "id": 277, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 274, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2521:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2521:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 273, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2507:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 271, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2511:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 272, + "nodeType": "ArrayTypeName", + "src": "2511:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2507:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2481:54:0" + }, + { + "body": { + "id": 303, + "nodeType": "Block", + "src": "2589:78:0", + "statements": [ + { + "expression": { + "id": 301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "baseExpression": { + "id": 289, + "name": "prices", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 258, + "src": "2604:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 291, + "indexExpression": { + "id": 290, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2611:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2604:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 292, + "name": "status", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 270, + "src": "2615:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 294, + "indexExpression": { + "id": 293, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2622:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2615:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 295, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2603:22:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "baseExpression": { + "id": 297, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2646:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 299, + "indexExpression": { + "id": 298, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2653:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2646:9:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 296, + "name": "getPriceAndStatus", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 230, + "src": "2628:17:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view returns (uint256,uint256)" + } + }, + "id": 300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2628:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2603:53:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 302, + "nodeType": "ExpressionStatement", + "src": "2603:53:0" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 285, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 282, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2565:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 283, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2569:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2569:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2565:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 304, + "initializationExpression": { + "assignments": [ + 279 + ], + "declarations": [ + { + "constant": false, + "id": 279, + "mutability": "mutable", + "name": "i", + "nameLocation": "2558:1:0", + "nodeType": "VariableDeclaration", + "scope": 304, + "src": "2550:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 278, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2550:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 281, + "initialValue": { + "hexValue": "30", + "id": 280, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2562:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "2550:13:0" + }, + "loopExpression": { + "expression": { + "id": 287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "2584:3:0", + "subExpression": { + "id": 286, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2584:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 288, + "nodeType": "ExpressionStatement", + "src": "2584:3:0" + }, + "nodeType": "ForStatement", + "src": "2545:122:0" + }, + { + "expression": { + "components": [ + { + "id": 305, + "name": "prices", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 258, + "src": "2684:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + { + "id": 306, + "name": "status", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 270, + "src": "2692:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + } + ], + "id": 307, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2683:16:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "tuple(uint256[] memory,uint256[] memory)" + } + }, + "functionReturnParameters": 242, + "id": 308, + "nodeType": "Return", + "src": "2676:23:0" + } + ] + }, + "functionSelector": "fea227d4", + "id": 310, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPricesAndStatus", + "nameLocation": "2202:18:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 235, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2253:8:0" + }, + "parameters": { + "id": 234, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 233, + "mutability": "mutable", + "name": "assets", + "nameLocation": "2238:6:0", + "nodeType": "VariableDeclaration", + "scope": 310, + "src": "2221:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 231, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2221:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 232, + "nodeType": "ArrayTypeName", + "src": "2221:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + } + ], + "src": "2220:25:0" + }, + "returnParameters": { + "id": 242, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 238, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 310, + "src": "2276:16:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 236, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2276:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 237, + "nodeType": "ArrayTypeName", + "src": "2276:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 241, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 310, + "src": "2294:16:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 239, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2294:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 240, + "nodeType": "ArrayTypeName", + "src": "2294:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "2275:36:0" + }, + "scope": 311, + "src": "2193:513:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + } + ], + "scope": 312, + "src": "172:2536:0", + "usedErrors": [] + } + ], + "src": "32:2677:0" + }, + "legacyAST": { + "absolutePath": "project:/contracts/AssetPrice.sol", + "exportedSymbols": { + "AddressStorage": [ + 12792 + ], + "AssetPrice": [ + 311 + ], + "Constants": [ + 8570 + ], + "IAssetPrice": [ + 9620 + ], + "IOracle": [ + 10222 + ], + "IOwnable": [ + 10242 + ], + "Ownable": [ + 9135 + ], + "Storage": [ + 9205 + ], + "Strings": [ + 12299 + ] + }, + "id": 312, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:0" + }, + { + "absolutePath": "project:/contracts/storages/AddressStorage.sol", + "file": "./storages/AddressStorage.sol", + "id": 2, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 312, + "sourceUnit": 12793, + "src": "57:39:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IOracle.sol", + "file": "./interfaces/IOracle.sol", + "id": 3, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 312, + "sourceUnit": 10223, + "src": "97:34:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IAssetPrice.sol", + "file": "./interfaces/IAssetPrice.sol", + "id": 4, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 312, + "sourceUnit": 9621, + "src": "132:38:0", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 5, + "name": "AddressStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12792, + "src": "195:14:0" + }, + "id": 6, + "nodeType": "InheritanceSpecifier", + "src": "195:14:0" + }, + { + "baseName": { + "id": 7, + "name": "IAssetPrice", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9620, + "src": "211:11:0" + }, + "id": 8, + "nodeType": "InheritanceSpecifier", + "src": "211:11:0" + } + ], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 311, + "linearizedBaseContracts": [ + 311, + 9620, + 12792, + 9205, + 9135, + 10242, + 8570 + ], + "name": "AssetPrice", + "nameLocation": "181:10:0", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 11, + "libraryName": { + "id": 9, + "name": "Strings", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12299, + "src": "235:7:0" + }, + "nodeType": "UsingForDirective", + "src": "229:25:0", + "typeName": { + "id": 10, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "247:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + } + }, + { + "constant": false, + "functionSelector": "f56c8547", + "id": 14, + "mutability": "mutable", + "name": "maxDelayTime", + "nameLocation": "274:12:0", + "nodeType": "VariableDeclaration", + "scope": 311, + "src": "259:34:0", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 12, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "259:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": { + "hexValue": "33363030", + "id": 13, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "289:4:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_3600_by_1", + "typeString": "int_const 3600" + }, + "value": "3600" + }, + "visibility": "public" + }, + { + "body": { + "id": 21, + "nodeType": "Block", + "src": "314:54:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 18, + "name": "CONTRACT_ASSET_PRICE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8521, + "src": "340:20:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 17, + "name": "setContractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9134, + "src": "324:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 19, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "324:37:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 20, + "nodeType": "ExpressionStatement", + "src": "324:37:0" + } + ] + }, + "id": 22, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 15, + "nodeType": "ParameterList", + "parameters": [], + "src": "311:2:0" + }, + "returnParameters": { + "id": 16, + "nodeType": "ParameterList", + "parameters": [], + "src": "314:0:0" + }, + "scope": 311, + "src": "300:68:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 44, + "nodeType": "Block", + "src": "443:114:0", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "id": 32, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "472:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 34, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "495:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 33, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "479:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 35, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "479:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 36, + "name": "oracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26, + "src": "503:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 31, + "name": "OracleChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9613, + "src": "458:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 37, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "458:52:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 38, + "nodeType": "EmitStatement", + "src": "453:57:0" + }, + { + "expression": { + "arguments": [ + { + "id": 40, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 24, + "src": "536:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 41, + "name": "oracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 26, + "src": "543:6:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 39, + "name": "setAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12715, + 12760 + ], + "referencedDeclaration": 12715, + "src": "520:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 42, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "520:30:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 43, + "nodeType": "ExpressionStatement", + "src": "520:30:0" + } + ] + }, + "functionSelector": "5ea8dffb", + "id": 45, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 29, + "kind": "modifierInvocation", + "modifierName": { + "id": 28, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "433:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "433:9:0" + } + ], + "name": "setOracle", + "nameLocation": "383:9:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 27, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 24, + "mutability": "mutable", + "name": "asset", + "nameLocation": "401:5:0", + "nodeType": "VariableDeclaration", + "scope": 45, + "src": "393:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 23, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "393:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 26, + "mutability": "mutable", + "name": "oracle", + "nameLocation": "416:6:0", + "nodeType": "VariableDeclaration", + "scope": 45, + "src": "408:14:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 25, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "408:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "392:31:0" + }, + "returnParameters": { + "id": 30, + "nodeType": "ParameterList", + "parameters": [], + "src": "443:0:0" + }, + "scope": 311, + "src": "374:183:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 63, + "nodeType": "Block", + "src": "619:101:0", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "id": 53, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 47, + "src": "648:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 55, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 47, + "src": "671:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 54, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "655:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 56, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "655:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 52, + "name": "OracleRemoved", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9619, + "src": "634:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 57, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "634:44:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 58, + "nodeType": "EmitStatement", + "src": "629:49:0" + }, + { + "expression": { + "arguments": [ + { + "id": 60, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 47, + "src": "707:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 59, + "name": "removeAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12728, + 12775 + ], + "referencedDeclaration": 12728, + "src": "688:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "688:25:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 62, + "nodeType": "ExpressionStatement", + "src": "688:25:0" + } + ] + }, + "functionSelector": "6e2eb512", + "id": 64, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 50, + "kind": "modifierInvocation", + "modifierName": { + "id": 49, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "609:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "609:9:0" + } + ], + "name": "removeOracle", + "nameLocation": "572:12:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 48, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 47, + "mutability": "mutable", + "name": "asset", + "nameLocation": "593:5:0", + "nodeType": "VariableDeclaration", + "scope": 64, + "src": "585:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 46, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "585:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "584:15:0" + }, + "returnParameters": { + "id": 51, + "nodeType": "ParameterList", + "parameters": [], + "src": "619:0:0" + }, + "scope": 311, + "src": "563:157:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 80, + "nodeType": "Block", + "src": "784:90:0", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "id": 72, + "name": "maxDelayTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "819:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 73, + "name": "time", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 66, + "src": "833:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 71, + "name": "MaxDelayTimeChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9605, + "src": "799:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (uint256,uint256)" + } + }, + "id": 74, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "799:39:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 75, + "nodeType": "EmitStatement", + "src": "794:44:0" + }, + { + "expression": { + "id": 78, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 76, + "name": "maxDelayTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "848:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 77, + "name": "time", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 66, + "src": "863:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "848:19:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 79, + "nodeType": "ExpressionStatement", + "src": "848:19:0" + } + ] + }, + "functionSelector": "71bb238e", + "id": 81, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 69, + "kind": "modifierInvocation", + "modifierName": { + "id": 68, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "774:9:0" + }, + "nodeType": "ModifierInvocation", + "src": "774:9:0" + } + ], + "name": "setMaxDelayTime", + "nameLocation": "735:15:0", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 67, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 66, + "mutability": "mutable", + "name": "time", + "nameLocation": "759:4:0", + "nodeType": "VariableDeclaration", + "scope": 81, + "src": "751:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 65, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "751:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "750:14:0" + }, + "returnParameters": { + "id": 70, + "nodeType": "ParameterList", + "parameters": [], + "src": "784:0:0" + }, + "scope": 311, + "src": "726:148:0", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9599 + ], + "body": { + "id": 129, + "nodeType": "Block", + "src": "1079:284:0", + "statements": [ + { + "assignments": [ + 94 + ], + "declarations": [ + { + "constant": false, + "id": 94, + "mutability": "mutable", + "name": "oracleAddress", + "nameLocation": "1097:13:0", + "nodeType": "VariableDeclaration", + "scope": 129, + "src": "1089:21:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 93, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1089:7:0", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 98, + "initialValue": { + "arguments": [ + { + "id": 96, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1129:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 95, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "1113:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 97, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1113:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1089:46:0" + }, + { + "assignments": [ + 100 + ], + "declarations": [ + { + "constant": false, + "id": 100, + "mutability": "mutable", + "name": "errorMessage", + "nameLocation": "1159:12:0", + "nodeType": "VariableDeclaration", + "scope": 129, + "src": "1145:26:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 99, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "1145:6:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "id": 102, + "initialValue": { + "hexValue": "41737365745072696365", + "id": 101, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1174:12:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_90ae8eb85273dc23aeacd3c6a707448b6d3f3ede9ca47d66a3bfa9b5286237b0", + "typeString": "literal_string \"AssetPrice\"" + }, + "value": "AssetPrice" + }, + "nodeType": "VariableDeclarationStatement", + "src": "1145:41:0" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 109, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 104, + "name": "oracleAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "1204:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 107, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1229:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 106, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "1221:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 105, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1221:7:0", + "typeDescriptions": {} + } + }, + "id": 108, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1221:10:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "1204:27:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "hexValue": "3a204d697373696e67204f7261636c6520466f7220", + "id": 112, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1253:23:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_5c757ff990aab492c02b8da5baccdb880c3d7b242c5669738b105a04168efa59", + "typeString": "literal_string \": Missing Oracle For \"" + }, + "value": ": Missing Oracle For " + }, + { + "id": 113, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1278:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_5c757ff990aab492c02b8da5baccdb880c3d7b242c5669738b105a04168efa59", + "typeString": "literal_string \": Missing Oracle For \"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 110, + "name": "errorMessage", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 100, + "src": "1233:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + }, + "id": 111, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "concat", + "nodeType": "MemberAccess", + "referencedDeclaration": 12298, + "src": "1233:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_bytes32_$returns$_t_string_memory_ptr_$bound_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string memory,bytes32) pure returns (string memory)" + } + }, + "id": 114, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1233:51:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 103, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1196:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 115, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1196:89:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 116, + "nodeType": "ExpressionStatement", + "src": "1196:89:0" + }, + { + "expression": { + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "id": 117, + "name": "round", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "1296:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 118, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 89, + "src": "1303:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 119, + "name": "time", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 91, + "src": "1310:4:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 120, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "1295:20:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 125, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "1350:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [ + { + "id": 122, + "name": "oracleAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 94, + "src": "1326:13:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 121, + "name": "IOracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10222, + "src": "1318:7:0", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IOracle_$10222_$", + "typeString": "type(contract IOracle)" + } + }, + "id": 123, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1318:22:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IOracle_$10222", + "typeString": "contract IOracle" + } + }, + "id": 124, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getPrice", + "nodeType": "MemberAccess", + "referencedDeclaration": 10210, + "src": "1318:31:0", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view external returns (uint256,uint256,uint256)" + } + }, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1318:38:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "src": "1295:61:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "1295:61:0" + } + ] + }, + "functionSelector": "c519a3c9", + "id": 130, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPriceFromOracle", + "nameLocation": "889:18:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 85, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "946:8:0" + }, + "parameters": { + "id": 84, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 83, + "mutability": "mutable", + "name": "asset", + "nameLocation": "916:5:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "908:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 82, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "908:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "907:15:0" + }, + "returnParameters": { + "id": 92, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 87, + "mutability": "mutable", + "name": "round", + "nameLocation": "1006:5:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "998:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 86, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "998:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 89, + "mutability": "mutable", + "name": "price", + "nameLocation": "1033:5:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "1025:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 88, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1025:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 91, + "mutability": "mutable", + "name": "time", + "nameLocation": "1060:4:0", + "nodeType": "VariableDeclaration", + "scope": 130, + "src": "1052:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 90, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1052:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "984:90:0" + }, + "scope": 311, + "src": "880:483:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 9558 + ], + "body": { + "id": 146, + "nodeType": "Block", + "src": "1441:83:0", + "statements": [ + { + "assignments": [ + 139, + null + ], + "declarations": [ + { + "constant": false, + "id": 139, + "mutability": "mutable", + "name": "price", + "nameLocation": "1460:5:0", + "nodeType": "VariableDeclaration", + "scope": 146, + "src": "1452:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 138, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1452:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + null + ], + "id": 143, + "initialValue": { + "arguments": [ + { + "id": 141, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 132, + "src": "1489:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 140, + "name": "getPriceAndStatus", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 230, + "src": "1471:17:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view returns (uint256,uint256)" + } + }, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1471:24:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1451:44:0" + }, + { + "expression": { + "id": 144, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 139, + "src": "1512:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 137, + "id": 145, + "nodeType": "Return", + "src": "1505:12:0" + } + ] + }, + "functionSelector": "31d98b3f", + "id": 147, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPrice", + "nameLocation": "1378:8:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 134, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1409:8:0" + }, + "parameters": { + "id": 133, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 132, + "mutability": "mutable", + "name": "asset", + "nameLocation": "1395:5:0", + "nodeType": "VariableDeclaration", + "scope": 147, + "src": "1387:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 131, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1387:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1386:15:0" + }, + "returnParameters": { + "id": 137, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 136, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 147, + "src": "1432:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 135, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1432:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1431:9:0" + }, + "scope": 311, + "src": "1369:155:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 9567 + ], + "body": { + "id": 168, + "nodeType": "Block", + "src": "1626:96:0", + "statements": [ + { + "assignments": [ + 161, + null + ], + "declarations": [ + { + "constant": false, + "id": 161, + "mutability": "mutable", + "name": "prices", + "nameLocation": "1654:6:0", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "1637:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 159, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1637:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 160, + "nodeType": "ArrayTypeName", + "src": "1637:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + }, + null + ], + "id": 165, + "initialValue": { + "arguments": [ + { + "id": 163, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 150, + "src": "1685:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + ], + "id": 162, + "name": "getPricesAndStatus", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "1666:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_bytes32_$dyn_memory_ptr_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (bytes32[] memory) view returns (uint256[] memory,uint256[] memory)" + } + }, + "id": 164, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1666:26:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "tuple(uint256[] memory,uint256[] memory)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1636:56:0" + }, + { + "expression": { + "id": 166, + "name": "prices", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 161, + "src": "1709:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "functionReturnParameters": 156, + "id": 167, + "nodeType": "Return", + "src": "1702:13:0" + } + ] + }, + "functionSelector": "26ee4836", + "id": 169, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPrices", + "nameLocation": "1539:9:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 152, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1585:8:0" + }, + "parameters": { + "id": 151, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 150, + "mutability": "mutable", + "name": "assets", + "nameLocation": "1568:6:0", + "nodeType": "VariableDeclaration", + "scope": 169, + "src": "1549:25:0", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 148, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1549:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 149, + "nodeType": "ArrayTypeName", + "src": "1549:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + } + ], + "src": "1548:27:0" + }, + "returnParameters": { + "id": 156, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 155, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 169, + "src": "1608:16:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 153, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1608:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 154, + "nodeType": "ArrayTypeName", + "src": "1608:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "1607:18:0" + }, + "scope": 311, + "src": "1530:192:0", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9576 + ], + "body": { + "id": 229, + "nodeType": "Block", + "src": "1818:369:0", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 185, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 181, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 179, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "1832:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 180, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "1841:3:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "1832:12:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 184, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 182, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "1848:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "hexValue": "55534454", + "id": 183, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1857:6:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8b1a1d9c2b109e527c9134b25b1a1833b16b6594f92daa9f6d9b7a6024bce9d0", + "typeString": "literal_string \"USDT\"" + }, + "value": "USDT" + }, + "src": "1848:15:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "1832:31:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 190, + "nodeType": "IfStatement", + "src": "1828:56:0", + "trueBody": { + "expression": { + "components": [ + { + "hexValue": "31", + "id": 186, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1873:7:0", + "subdenomination": "ether", + "typeDescriptions": { + "typeIdentifier": "t_rational_1000000000000000000_by_1", + "typeString": "int_const 1000000000000000000" + }, + "value": "1" + }, + { + "hexValue": "30", + "id": 187, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1882:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 188, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1872:12:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_rational_1000000000000000000_by_1_$_t_rational_0_by_1_$", + "typeString": "tuple(int_const 1000000000000000000,int_const 0)" + } + }, + "functionReturnParameters": 178, + "id": 189, + "nodeType": "Return", + "src": "1865:19:0" + } + }, + { + "assignments": [ + null, + 192, + 194 + ], + "declarations": [ + null, + { + "constant": false, + "id": 192, + "mutability": "mutable", + "name": "price", + "nameLocation": "1905:5:0", + "nodeType": "VariableDeclaration", + "scope": 229, + "src": "1897:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 191, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1897:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 194, + "mutability": "mutable", + "name": "updateTime", + "nameLocation": "1920:10:0", + "nodeType": "VariableDeclaration", + "scope": 229, + "src": "1912:18:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 193, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1912:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 198, + "initialValue": { + "arguments": [ + { + "id": 196, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "1953:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 195, + "name": "getPriceFromOracle", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "1934:18:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view returns (uint256,uint256,uint256)" + } + }, + "id": 197, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1934:25:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1894:65:0" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 202, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 200, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 192, + "src": "1977:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 201, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1985:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "1977:9:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "hexValue": "3a205072696365206973207a65726f20466f7220", + "id": 205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2008:22:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_c4024a1cb63f6b53fd59149176d1aa2d31234ce610bdd0d169775a17e45983d0", + "typeString": "literal_string \": Price is zero For \"" + }, + "value": ": Price is zero For " + }, + { + "id": 206, + "name": "asset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 171, + "src": "2032:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_c4024a1cb63f6b53fd59149176d1aa2d31234ce610bdd0d169775a17e45983d0", + "typeString": "literal_string \": Price is zero For \"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 203, + "name": "contractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8987, + "src": "1988:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 204, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "concat", + "nodeType": "MemberAccess", + "referencedDeclaration": 12298, + "src": "1988:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_string_memory_ptr_$_t_bytes32_$returns$_t_string_memory_ptr_$bound_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string memory,bytes32) pure returns (string memory)" + } + }, + "id": 207, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1988:50:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 199, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1969:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 208, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1969:70:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 209, + "nodeType": "ExpressionStatement", + "src": "1969:70:0" + }, + { + "assignments": [ + 211 + ], + "declarations": [ + { + "constant": false, + "id": 211, + "mutability": "mutable", + "name": "lastTime", + "nameLocation": "2058:8:0", + "nodeType": "VariableDeclaration", + "scope": 229, + "src": "2050:16:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 210, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2050:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 216, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 215, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 212, + "name": "block", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967292, + "src": "2069:5:0", + "typeDescriptions": { + "typeIdentifier": "t_magic_block", + "typeString": "block" + } + }, + "id": 213, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "timestamp", + "nodeType": "MemberAccess", + "src": "2069:15:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "id": 214, + "name": "maxDelayTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 14, + "src": "2087:12:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2069:30:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2050:49:0" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 219, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 217, + "name": "updateTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 194, + "src": "2113:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "id": 218, + "name": "lastTime", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 211, + "src": "2126:8:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2113:21:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 224, + "nodeType": "IfStatement", + "src": "2109:44:0", + "trueBody": { + "expression": { + "components": [ + { + "id": 220, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 192, + "src": "2144:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "31", + "id": 221, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2151:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_1_by_1", + "typeString": "int_const 1" + }, + "value": "1" + } + ], + "id": 222, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2143:10:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_rational_1_by_1_$", + "typeString": "tuple(uint256,int_const 1)" + } + }, + "functionReturnParameters": 178, + "id": 223, + "nodeType": "Return", + "src": "2136:17:0" + } + }, + { + "expression": { + "components": [ + { + "id": 225, + "name": "price", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 192, + "src": "2171:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "hexValue": "30", + "id": 226, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2178:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "id": 227, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2170:10:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_rational_0_by_1_$", + "typeString": "tuple(uint256,int_const 0)" + } + }, + "functionReturnParameters": 178, + "id": 228, + "nodeType": "Return", + "src": "2163:17:0" + } + ] + }, + "functionSelector": "3902ca61", + "id": 230, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPriceAndStatus", + "nameLocation": "1737:17:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 173, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1777:8:0" + }, + "parameters": { + "id": 172, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 171, + "mutability": "mutable", + "name": "asset", + "nameLocation": "1763:5:0", + "nodeType": "VariableDeclaration", + "scope": 230, + "src": "1755:13:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 170, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1755:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1754:15:0" + }, + "returnParameters": { + "id": 178, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 175, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 230, + "src": "1800:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 174, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1800:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 177, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 230, + "src": "1809:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 176, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1809:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1799:18:0" + }, + "scope": 311, + "src": "1728:459:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 9588 + ], + "body": { + "id": 309, + "nodeType": "Block", + "src": "2312:394:0", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 244, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2330:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 245, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2330:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "hexValue": "3230", + "id": 246, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2346:2:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_20_by_1", + "typeString": "int_const 20" + }, + "value": "20" + }, + "src": "2330:18:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "hexValue": "3a2063616e6e6f742068617665206d6f7265207468616e203230206974656d73", + "id": 250, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2370:34:0", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_cbefc34fe464d005b102f42da70283e058a1d1c2c903e4d2e0d13bb6e2b29468", + "typeString": "literal_string \": cannot have more than 20 items\"" + }, + "value": ": cannot have more than 20 items" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_cbefc34fe464d005b102f42da70283e058a1d1c2c903e4d2e0d13bb6e2b29468", + "typeString": "literal_string \": cannot have more than 20 items\"" + } + ], + "expression": { + "id": 248, + "name": "contractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8987, + "src": "2350:12:0", + "typeDescriptions": { + "typeIdentifier": "t_string_storage", + "typeString": "string storage ref" + } + }, + "id": 249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "concat", + "nodeType": "MemberAccess", + "referencedDeclaration": 12276, + "src": "2350:19:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_string_memory_ptr_$_t_string_memory_ptr_$returns$_t_string_memory_ptr_$bound_to$_t_string_memory_ptr_$", + "typeString": "function (string memory,string memory) pure returns (string memory)" + } + }, + "id": 251, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2350:55:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string memory" + } + ], + "id": 243, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "2322:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 252, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2322:84:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 253, + "nodeType": "ExpressionStatement", + "src": "2322:84:0" + }, + { + "assignments": [ + 258 + ], + "declarations": [ + { + "constant": false, + "id": 258, + "mutability": "mutable", + "name": "prices", + "nameLocation": "2434:6:0", + "nodeType": "VariableDeclaration", + "scope": 309, + "src": "2417:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 256, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2417:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 257, + "nodeType": "ArrayTypeName", + "src": "2417:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "id": 265, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 262, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2457:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 263, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2457:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 261, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2443:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 259, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2447:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 260, + "nodeType": "ArrayTypeName", + "src": "2447:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2443:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2417:54:0" + }, + { + "assignments": [ + 270 + ], + "declarations": [ + { + "constant": false, + "id": 270, + "mutability": "mutable", + "name": "status", + "nameLocation": "2498:6:0", + "nodeType": "VariableDeclaration", + "scope": 309, + "src": "2481:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 268, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2481:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 269, + "nodeType": "ArrayTypeName", + "src": "2481:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "id": 277, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 274, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2521:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2521:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 273, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "2507:13:0", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "function (uint256) pure returns (uint256[] memory)" + }, + "typeName": { + "baseType": { + "id": 271, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2511:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 272, + "nodeType": "ArrayTypeName", + "src": "2511:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + } + }, + "id": 276, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2507:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2481:54:0" + }, + { + "body": { + "id": 303, + "nodeType": "Block", + "src": "2589:78:0", + "statements": [ + { + "expression": { + "id": 301, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "components": [ + { + "baseExpression": { + "id": 289, + "name": "prices", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 258, + "src": "2604:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 291, + "indexExpression": { + "id": 290, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2611:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2604:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "baseExpression": { + "id": 292, + "name": "status", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 270, + "src": "2615:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + "id": 294, + "indexExpression": { + "id": 293, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2622:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "2615:9:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 295, + "isConstant": false, + "isInlineArray": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "TupleExpression", + "src": "2603:22:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "baseExpression": { + "id": 297, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2646:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 299, + "indexExpression": { + "id": 298, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2653:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2646:9:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 296, + "name": "getPriceAndStatus", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 230, + "src": "2628:17:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32) view returns (uint256,uint256)" + } + }, + "id": 300, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2628:28:0", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "src": "2603:53:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 302, + "nodeType": "ExpressionStatement", + "src": "2603:53:0" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 285, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 282, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2565:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 283, + "name": "assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 233, + "src": "2569:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[] memory" + } + }, + "id": 284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2569:13:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2565:17:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 304, + "initializationExpression": { + "assignments": [ + 279 + ], + "declarations": [ + { + "constant": false, + "id": 279, + "mutability": "mutable", + "name": "i", + "nameLocation": "2558:1:0", + "nodeType": "VariableDeclaration", + "scope": 304, + "src": "2550:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 278, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2550:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 281, + "initialValue": { + "hexValue": "30", + "id": 280, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2562:1:0", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "2550:13:0" + }, + "loopExpression": { + "expression": { + "id": 287, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "2584:3:0", + "subExpression": { + "id": 286, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 279, + "src": "2584:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 288, + "nodeType": "ExpressionStatement", + "src": "2584:3:0" + }, + "nodeType": "ForStatement", + "src": "2545:122:0" + }, + { + "expression": { + "components": [ + { + "id": 305, + "name": "prices", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 258, + "src": "2684:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + }, + { + "id": 306, + "name": "status", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 270, + "src": "2692:6:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[] memory" + } + } + ], + "id": 307, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2683:16:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_array$_t_uint256_$dyn_memory_ptr_$_t_array$_t_uint256_$dyn_memory_ptr_$", + "typeString": "tuple(uint256[] memory,uint256[] memory)" + } + }, + "functionReturnParameters": 242, + "id": 308, + "nodeType": "Return", + "src": "2676:23:0" + } + ] + }, + "functionSelector": "fea227d4", + "id": 310, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getPricesAndStatus", + "nameLocation": "2202:18:0", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 235, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2253:8:0" + }, + "parameters": { + "id": 234, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 233, + "mutability": "mutable", + "name": "assets", + "nameLocation": "2238:6:0", + "nodeType": "VariableDeclaration", + "scope": 310, + "src": "2221:23:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 231, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2221:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 232, + "nodeType": "ArrayTypeName", + "src": "2221:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + } + ], + "src": "2220:25:0" + }, + "returnParameters": { + "id": 242, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 238, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 310, + "src": "2276:16:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 236, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2276:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 237, + "nodeType": "ArrayTypeName", + "src": "2276:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 241, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 310, + "src": "2294:16:0", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_memory_ptr", + "typeString": "uint256[]" + }, + "typeName": { + "baseType": { + "id": 239, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2294:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 240, + "nodeType": "ArrayTypeName", + "src": "2294:9:0", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_uint256_$dyn_storage_ptr", + "typeString": "uint256[]" + } + }, + "visibility": "internal" + } + ], + "src": "2275:36:0" + }, + "scope": 311, + "src": "2193:513:0", + "stateMutability": "view", + "virtual": false, + "visibility": "public" + } + ], + "scope": 312, + "src": "172:2536:0", + "usedErrors": [] + } + ], + "src": "32:2677:0" + }, + "compiler": { + "name": "solc", + "version": "0.8.4+commit.c7e474f2.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.4.3", + "updatedAt": "2021-11-09T08:27:51.660Z", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/projects/mobiusfinance/abis/IERC20.json b/projects/mobiusfinance/abis/IERC20.json new file mode 100644 index 0000000000..6472036528 --- /dev/null +++ b/projects/mobiusfinance/abis/IERC20.json @@ -0,0 +1,2300 @@ +{ + "contractName": "IERC20", + "abi": [ + { + "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": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"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\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"Transfer\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"}],\"name\":\"allowance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"spender\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"approve\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"balanceOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"decimals\",\"outputs\":[{\"internalType\":\"uint8\",\"name\":\"\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"name\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"symbol\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSupply\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transferFrom\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/interfaces/IERC20.sol\":\"IERC20\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":4294967295},\"remappings\":[]},\"sources\":{\"project:/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x8e49e39018d207233f6170cd9d0c9ae90c832c742212bc0e1950b9351a0010a8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e5cc135ca761b45aa3f49d121d20029ed2fb7001b19682e851662108b4c2ebb1\",\"dweb:/ipfs/QmVaAtX6kYgA2t15rmZqQZ5LZnAyKpUoUiJPGdJC35BYtL\"]}},\"version\":1}", + "bytecode": "0x", + "deployedBytecode": "0x", + "immutableReferences": {}, + "generatedSources": [], + "deployedGeneratedSources": [], + "sourceMap": "", + "deployedSourceMap": "", + "source": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.4;\n\ninterface IERC20 {\n function name() external view returns (string memory);\n\n function symbol() external view returns (string memory);\n\n function decimals() external view returns (uint8);\n\n function totalSupply() external view returns (uint256);\n\n function balanceOf(address owner) external view returns (uint256);\n\n function transfer(address recipient, uint256 value) external returns (bool);\n\n function allowance(address owner, address spender) external view returns (uint256);\n\n function approve(address spender, uint256 value) external returns (bool);\n\n function transferFrom(\n address sender,\n address recipient,\n uint256 value\n ) external returns (bool);\n\n event Transfer(address indexed from, address indexed to, uint256 value);\n event Approval(address indexed owner, address indexed spender, uint256 value);\n}\n", + "sourcePath": "/home/colin/Workspace/src/Mobius/contracts/contracts/interfaces/IERC20.sol", + "ast": { + "absolutePath": "project:/contracts/interfaces/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 9727 + ] + }, + "id": 9728, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 9645, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:27" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "interface", + "fullyImplemented": false, + "id": 9727, + "linearizedBaseContracts": [ + 9727 + ], + "name": "IERC20", + "nameLocation": "67:6:27", + "nodeType": "ContractDefinition", + "nodes": [ + { + "functionSelector": "06fdde03", + "id": 9650, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "name", + "nameLocation": "89:4:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9646, + "nodeType": "ParameterList", + "parameters": [], + "src": "93:2:27" + }, + "returnParameters": { + "id": 9649, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9648, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9650, + "src": "119:13:27", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 9647, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "119:6:27", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "118:15:27" + }, + "scope": 9727, + "src": "80:54:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "95d89b41", + "id": 9655, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "symbol", + "nameLocation": "149:6:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9651, + "nodeType": "ParameterList", + "parameters": [], + "src": "155:2:27" + }, + "returnParameters": { + "id": 9654, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9653, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9655, + "src": "181:13:27", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 9652, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "181:6:27", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "180:15:27" + }, + "scope": 9727, + "src": "140:56:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "313ce567", + "id": 9660, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "decimals", + "nameLocation": "211:8:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9656, + "nodeType": "ParameterList", + "parameters": [], + "src": "219:2:27" + }, + "returnParameters": { + "id": 9659, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9658, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9660, + "src": "245:5:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 9657, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "245:5:27", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "244:7:27" + }, + "scope": 9727, + "src": "202:50:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "18160ddd", + "id": 9665, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "totalSupply", + "nameLocation": "267:11:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9661, + "nodeType": "ParameterList", + "parameters": [], + "src": "278:2:27" + }, + "returnParameters": { + "id": 9664, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9663, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9665, + "src": "304:7:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9662, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "304:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "303:9:27" + }, + "scope": 9727, + "src": "258:55:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "70a08231", + "id": 9672, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "balanceOf", + "nameLocation": "328:9:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9668, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9667, + "mutability": "mutable", + "name": "owner", + "nameLocation": "346:5:27", + "nodeType": "VariableDeclaration", + "scope": 9672, + "src": "338:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9666, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "338:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "337:15:27" + }, + "returnParameters": { + "id": 9671, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9670, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9672, + "src": "376:7:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "376:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "375:9:27" + }, + "scope": 9727, + "src": "319:66:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "a9059cbb", + "id": 9681, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transfer", + "nameLocation": "400:8:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9677, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9674, + "mutability": "mutable", + "name": "recipient", + "nameLocation": "417:9:27", + "nodeType": "VariableDeclaration", + "scope": 9681, + "src": "409:17:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9673, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "409:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9676, + "mutability": "mutable", + "name": "value", + "nameLocation": "436:5:27", + "nodeType": "VariableDeclaration", + "scope": 9681, + "src": "428:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9675, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "428:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "408:34:27" + }, + "returnParameters": { + "id": 9680, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9679, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9681, + "src": "461:4:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 9678, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "461:4:27", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "460:6:27" + }, + "scope": 9727, + "src": "391:76:27", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "dd62ed3e", + "id": 9690, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "allowance", + "nameLocation": "482:9:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9686, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9683, + "mutability": "mutable", + "name": "owner", + "nameLocation": "500:5:27", + "nodeType": "VariableDeclaration", + "scope": 9690, + "src": "492:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9682, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "492:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9685, + "mutability": "mutable", + "name": "spender", + "nameLocation": "515:7:27", + "nodeType": "VariableDeclaration", + "scope": 9690, + "src": "507:15:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9684, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "507:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "491:32:27" + }, + "returnParameters": { + "id": 9689, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9688, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9690, + "src": "547:7:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9687, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "547:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "546:9:27" + }, + "scope": 9727, + "src": "473:83:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "095ea7b3", + "id": 9699, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approve", + "nameLocation": "571:7:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9695, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9692, + "mutability": "mutable", + "name": "spender", + "nameLocation": "587:7:27", + "nodeType": "VariableDeclaration", + "scope": 9699, + "src": "579:15:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9691, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "579:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9694, + "mutability": "mutable", + "name": "value", + "nameLocation": "604:5:27", + "nodeType": "VariableDeclaration", + "scope": 9699, + "src": "596:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9693, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "596:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "578:32:27" + }, + "returnParameters": { + "id": 9698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9697, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9699, + "src": "629:4:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 9696, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "629:4:27", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "628:6:27" + }, + "scope": 9727, + "src": "562:73:27", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "23b872dd", + "id": 9710, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFrom", + "nameLocation": "650:12:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9706, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9701, + "mutability": "mutable", + "name": "sender", + "nameLocation": "680:6:27", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "672:14:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9700, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "672:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9703, + "mutability": "mutable", + "name": "recipient", + "nameLocation": "704:9:27", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "696:17:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9702, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "696:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9705, + "mutability": "mutable", + "name": "value", + "nameLocation": "731:5:27", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "723:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9704, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "723:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "662:80:27" + }, + "returnParameters": { + "id": 9709, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9708, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "761:4:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 9707, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "761:4:27", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "760:6:27" + }, + "scope": 9727, + "src": "641:126:27", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "anonymous": false, + "id": 9718, + "name": "Transfer", + "nameLocation": "779:8:27", + "nodeType": "EventDefinition", + "parameters": { + "id": 9717, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9712, + "indexed": true, + "mutability": "mutable", + "name": "from", + "nameLocation": "804:4:27", + "nodeType": "VariableDeclaration", + "scope": 9718, + "src": "788:20:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9711, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "788:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9714, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "826:2:27", + "nodeType": "VariableDeclaration", + "scope": 9718, + "src": "810:18:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9713, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "810:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9716, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "838:5:27", + "nodeType": "VariableDeclaration", + "scope": 9718, + "src": "830:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9715, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "830:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "787:57:27" + }, + "src": "773:72:27" + }, + { + "anonymous": false, + "id": 9726, + "name": "Approval", + "nameLocation": "856:8:27", + "nodeType": "EventDefinition", + "parameters": { + "id": 9725, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9720, + "indexed": true, + "mutability": "mutable", + "name": "owner", + "nameLocation": "881:5:27", + "nodeType": "VariableDeclaration", + "scope": 9726, + "src": "865:21:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9719, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "865:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9722, + "indexed": true, + "mutability": "mutable", + "name": "spender", + "nameLocation": "904:7:27", + "nodeType": "VariableDeclaration", + "scope": 9726, + "src": "888:23:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9721, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "888:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9724, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "921:5:27", + "nodeType": "VariableDeclaration", + "scope": 9726, + "src": "913:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9723, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "913:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "864:63:27" + }, + "src": "850:78:27" + } + ], + "scope": 9728, + "src": "57:873:27", + "usedErrors": [] + } + ], + "src": "32:899:27" + }, + "legacyAST": { + "absolutePath": "project:/contracts/interfaces/IERC20.sol", + "exportedSymbols": { + "IERC20": [ + 9727 + ] + }, + "id": 9728, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 9645, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:27" + }, + { + "abstract": false, + "baseContracts": [], + "contractDependencies": [], + "contractKind": "interface", + "fullyImplemented": false, + "id": 9727, + "linearizedBaseContracts": [ + 9727 + ], + "name": "IERC20", + "nameLocation": "67:6:27", + "nodeType": "ContractDefinition", + "nodes": [ + { + "functionSelector": "06fdde03", + "id": 9650, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "name", + "nameLocation": "89:4:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9646, + "nodeType": "ParameterList", + "parameters": [], + "src": "93:2:27" + }, + "returnParameters": { + "id": 9649, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9648, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9650, + "src": "119:13:27", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 9647, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "119:6:27", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "118:15:27" + }, + "scope": 9727, + "src": "80:54:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "95d89b41", + "id": 9655, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "symbol", + "nameLocation": "149:6:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9651, + "nodeType": "ParameterList", + "parameters": [], + "src": "155:2:27" + }, + "returnParameters": { + "id": 9654, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9653, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9655, + "src": "181:13:27", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_string_memory_ptr", + "typeString": "string" + }, + "typeName": { + "id": 9652, + "name": "string", + "nodeType": "ElementaryTypeName", + "src": "181:6:27", + "typeDescriptions": { + "typeIdentifier": "t_string_storage_ptr", + "typeString": "string" + } + }, + "visibility": "internal" + } + ], + "src": "180:15:27" + }, + "scope": 9727, + "src": "140:56:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "313ce567", + "id": 9660, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "decimals", + "nameLocation": "211:8:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9656, + "nodeType": "ParameterList", + "parameters": [], + "src": "219:2:27" + }, + "returnParameters": { + "id": 9659, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9658, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9660, + "src": "245:5:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 9657, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "245:5:27", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "visibility": "internal" + } + ], + "src": "244:7:27" + }, + "scope": 9727, + "src": "202:50:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "18160ddd", + "id": 9665, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "totalSupply", + "nameLocation": "267:11:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9661, + "nodeType": "ParameterList", + "parameters": [], + "src": "278:2:27" + }, + "returnParameters": { + "id": 9664, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9663, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9665, + "src": "304:7:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9662, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "304:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "303:9:27" + }, + "scope": 9727, + "src": "258:55:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "70a08231", + "id": 9672, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "balanceOf", + "nameLocation": "328:9:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9668, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9667, + "mutability": "mutable", + "name": "owner", + "nameLocation": "346:5:27", + "nodeType": "VariableDeclaration", + "scope": 9672, + "src": "338:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9666, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "338:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "337:15:27" + }, + "returnParameters": { + "id": 9671, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9670, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9672, + "src": "376:7:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9669, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "376:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "375:9:27" + }, + "scope": 9727, + "src": "319:66:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "a9059cbb", + "id": 9681, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transfer", + "nameLocation": "400:8:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9677, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9674, + "mutability": "mutable", + "name": "recipient", + "nameLocation": "417:9:27", + "nodeType": "VariableDeclaration", + "scope": 9681, + "src": "409:17:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9673, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "409:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9676, + "mutability": "mutable", + "name": "value", + "nameLocation": "436:5:27", + "nodeType": "VariableDeclaration", + "scope": 9681, + "src": "428:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9675, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "428:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "408:34:27" + }, + "returnParameters": { + "id": 9680, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9679, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9681, + "src": "461:4:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 9678, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "461:4:27", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "460:6:27" + }, + "scope": 9727, + "src": "391:76:27", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "dd62ed3e", + "id": 9690, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "allowance", + "nameLocation": "482:9:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9686, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9683, + "mutability": "mutable", + "name": "owner", + "nameLocation": "500:5:27", + "nodeType": "VariableDeclaration", + "scope": 9690, + "src": "492:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9682, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "492:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9685, + "mutability": "mutable", + "name": "spender", + "nameLocation": "515:7:27", + "nodeType": "VariableDeclaration", + "scope": 9690, + "src": "507:15:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9684, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "507:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "491:32:27" + }, + "returnParameters": { + "id": 9689, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9688, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9690, + "src": "547:7:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9687, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "547:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "546:9:27" + }, + "scope": 9727, + "src": "473:83:27", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "095ea7b3", + "id": 9699, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "approve", + "nameLocation": "571:7:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9695, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9692, + "mutability": "mutable", + "name": "spender", + "nameLocation": "587:7:27", + "nodeType": "VariableDeclaration", + "scope": 9699, + "src": "579:15:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9691, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "579:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9694, + "mutability": "mutable", + "name": "value", + "nameLocation": "604:5:27", + "nodeType": "VariableDeclaration", + "scope": 9699, + "src": "596:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9693, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "596:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "578:32:27" + }, + "returnParameters": { + "id": 9698, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9697, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9699, + "src": "629:4:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 9696, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "629:4:27", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "628:6:27" + }, + "scope": 9727, + "src": "562:73:27", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "functionSelector": "23b872dd", + "id": 9710, + "implemented": false, + "kind": "function", + "modifiers": [], + "name": "transferFrom", + "nameLocation": "650:12:27", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 9706, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9701, + "mutability": "mutable", + "name": "sender", + "nameLocation": "680:6:27", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "672:14:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9700, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "672:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9703, + "mutability": "mutable", + "name": "recipient", + "nameLocation": "704:9:27", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "696:17:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9702, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "696:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9705, + "mutability": "mutable", + "name": "value", + "nameLocation": "731:5:27", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "723:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9704, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "723:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "662:80:27" + }, + "returnParameters": { + "id": 9709, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9708, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 9710, + "src": "761:4:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 9707, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "761:4:27", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "760:6:27" + }, + "scope": 9727, + "src": "641:126:27", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "anonymous": false, + "id": 9718, + "name": "Transfer", + "nameLocation": "779:8:27", + "nodeType": "EventDefinition", + "parameters": { + "id": 9717, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9712, + "indexed": true, + "mutability": "mutable", + "name": "from", + "nameLocation": "804:4:27", + "nodeType": "VariableDeclaration", + "scope": 9718, + "src": "788:20:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9711, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "788:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9714, + "indexed": true, + "mutability": "mutable", + "name": "to", + "nameLocation": "826:2:27", + "nodeType": "VariableDeclaration", + "scope": 9718, + "src": "810:18:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9713, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "810:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9716, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "838:5:27", + "nodeType": "VariableDeclaration", + "scope": 9718, + "src": "830:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9715, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "830:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "787:57:27" + }, + "src": "773:72:27" + }, + { + "anonymous": false, + "id": 9726, + "name": "Approval", + "nameLocation": "856:8:27", + "nodeType": "EventDefinition", + "parameters": { + "id": 9725, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 9720, + "indexed": true, + "mutability": "mutable", + "name": "owner", + "nameLocation": "881:5:27", + "nodeType": "VariableDeclaration", + "scope": 9726, + "src": "865:21:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9719, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "865:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9722, + "indexed": true, + "mutability": "mutable", + "name": "spender", + "nameLocation": "904:7:27", + "nodeType": "VariableDeclaration", + "scope": 9726, + "src": "888:23:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 9721, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "888:7:27", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 9724, + "indexed": false, + "mutability": "mutable", + "name": "value", + "nameLocation": "921:5:27", + "nodeType": "VariableDeclaration", + "scope": 9726, + "src": "913:13:27", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 9723, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "913:7:27", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "864:63:27" + }, + "src": "850:78:27" + } + ], + "scope": 9728, + "src": "57:873:27", + "usedErrors": [] + } + ], + "src": "32:899:27" + }, + "compiler": { + "name": "solc", + "version": "0.8.4+commit.c7e474f2.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.4.3", + "updatedAt": "2021-11-09T08:27:51.787Z", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/projects/mobiusfinance/abis/Mobius.json b/projects/mobiusfinance/abis/Mobius.json new file mode 100644 index 0000000000..48f29b8b8d --- /dev/null +++ b/projects/mobiusfinance/abis/Mobius.json @@ -0,0 +1,42433 @@ +{ + "contractName": "Mobius", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IResolver", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "_nativeCoin", + "type": "bytes32" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Burned", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "recipient", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Claimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "liquidator", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stakeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "burnAmount", + "type": "uint256" + } + ], + "name": "Liquidated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "ManagerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stakeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "issuerAmount", + "type": "uint256" + } + ], + "name": "Minted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "OwnerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bool", + "name": "previousValue", + "type": "bool" + }, + { + "indexed": true, + "internalType": "bool", + "name": "newValue", + "type": "bool" + } + ], + "name": "PauseChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "synth", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stakeAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "debtAmount", + "type": "uint256" + } + ], + "name": "Shorted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "stakeAmount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "fromSynth", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "toSynth", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toAmount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "tradingFee", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromSynthPrice", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toSynthPirce", + "type": "uint256" + } + ], + "name": "Traded", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "addAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "contractName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getImports", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nativeCoin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "refreshCache", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "resolver", + "outputs": [ + { + "internalType": "contract IResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_manager", + "type": "address" + } + ], + "name": "setManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_paused", + "type": "bool" + } + ], + "name": "setPaused", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "collateralRate", + "type": "uint256" + } + ], + "name": "mintFromCoin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "collateralRate", + "type": "uint256" + } + ], + "name": "mintFromToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "mintFromPreviousStake", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "collateralRate", + "type": "uint256" + } + ], + "name": "shortFromCoin", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "collateralRate", + "type": "uint256" + } + ], + "name": "shortFromToken", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "shortFromPreviousStake", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "withdraw", + "type": "bool" + } + ], + "name": "burn", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "claim", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + } + ], + "name": "stakeFromCoin", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stakeFromToken", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "fromSynth", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "fromAmount", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "toSynth", + "type": "bytes32" + } + ], + "name": "trade", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "stake", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "debtType", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "liquidate", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IResolver\",\"name\":\"_resolver\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_nativeCoin\",\"type\":\"bytes32\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Burned\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Claimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"liquidator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"burnAmount\",\"type\":\"uint256\"}],\"name\":\"Liquidated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"ManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"issuerAmount\",\"type\":\"uint256\"}],\"name\":\"Minted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"OwnerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"previousValue\",\"type\":\"bool\"},{\"indexed\":true,\"internalType\":\"bool\",\"name\":\"newValue\",\"type\":\"bool\"}],\"name\":\"PauseChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"synth\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debtAmount\",\"type\":\"uint256\"}],\"name\":\"Shorted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"stakeAmount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"fromSynth\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"toSynth\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"tradingFee\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"fromSynthPrice\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"toSynthPirce\",\"type\":\"uint256\"}],\"name\":\"Traded\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"addAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"withdraw\",\"type\":\"bool\"}],\"name\":\"burn\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"claim\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"contractName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"getAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getImports\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"liquidate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"manager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"collateralRate\",\"type\":\"uint256\"}],\"name\":\"mintFromCoin\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"mintFromPreviousStake\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"collateralRate\",\"type\":\"uint256\"}],\"name\":\"mintFromToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nativeCoin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"refreshCache\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resolver\",\"outputs\":[{\"internalType\":\"contract IResolver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_manager\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_paused\",\"type\":\"bool\"}],\"name\":\"setPaused\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"collateralRate\",\"type\":\"uint256\"}],\"name\":\"shortFromCoin\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"shortFromPreviousStake\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"collateralRate\",\"type\":\"uint256\"}],\"name\":\"shortFromToken\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"}],\"name\":\"stakeFromCoin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"stake\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"debtType\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"stakeFromToken\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"fromSynth\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"fromAmount\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"toSynth\",\"type\":\"bytes32\"}],\"name\":\"trade\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Mobius.sol\":\"Mobius\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":4294967295},\"remappings\":[]},\"sources\":{\"project:/contracts/Mobius.sol\":{\"keccak256\":\"0x86df067917e0aace112ec73d8534259384786efb641a3f1169b6211c5c13805f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://05d42cc673c57c199de85f941a483a10b5ca4be990f31ca6301b21010bdda2d3\",\"dweb:/ipfs/QmQz1zg51LxL9JUGpNPc7GGTJiDkq1sjutg1XSY5FeR3aL\"]},\"project:/contracts/base/Constants.sol\":{\"keccak256\":\"0xd385eb2024741177af7f0e7a63bec671e75ffced38c5fcdba3323dead24d3f4f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://68e3ecc6063c5c44c5016634d0039ff8d16fb0164c450e9ffdffc744abe7d12b\",\"dweb:/ipfs/QmcsiDHkYGWtZ4kvxwV1FhmADrw92dCBHbRzusRj4R2F5V\"]},\"project:/contracts/base/Importable.sol\":{\"keccak256\":\"0xa3083c6ed634d324219b49fbf6292cf7f10c1a70020ab790721fca01edec2418\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2c7566c6c9448b64945d3de36d8555722b6203970e2e1865c266d6df083dac48\",\"dweb:/ipfs/QmU4PtwezRi6CbfeBKguzvGHXw6wwAqaheScCcEbyCtWpM\"]},\"project:/contracts/base/Ownable.sol\":{\"keccak256\":\"0xfe1332448b6dd2a5d47fda27141b45000dd9c01dd6efa8dc8b6fd9c0d0a6bef9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4b81e14d8dcb2661121fc118a1235f7f471c4c98f14676ff409ec4db4009425c\",\"dweb:/ipfs/QmaPdHCQvFPhu1zwSouaCYHLpb5jGMepCHsE5aEWgwpXsX\"]},\"project:/contracts/base/Pausable.sol\":{\"keccak256\":\"0xeab744d19b590af7b53b47249fc2b7ba70163342bcfeccc287923dbe04625480\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ca4ccd18fe31ebde5ab7bddeb9b17887ee357f77dc154048261392b44550601c\",\"dweb:/ipfs/Qmc9PKSRstZ5tHJGgkSNewvGx1pWtcFQ7m94EKTCj9JFy6\"]},\"project:/contracts/interfaces/IAssetPrice.sol\":{\"keccak256\":\"0xc4747058cc3237da39eeaf6039e95c99a64ff5a109e240c39be1ebdde9f7c380\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b3266132faacb2e7d4e1e7e0a7be123dea861f3b5f4099af00ffce3c1aee3a1c\",\"dweb:/ipfs/QmNpzhHmjGXdMPAnkWXvTUFuWASy3KdMK7vAqY6bEfAEm7\"]},\"project:/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x8e49e39018d207233f6170cd9d0c9ae90c832c742212bc0e1950b9351a0010a8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e5cc135ca761b45aa3f49d121d20029ed2fb7001b19682e851662108b4c2ebb1\",\"dweb:/ipfs/QmVaAtX6kYgA2t15rmZqQZ5LZnAyKpUoUiJPGdJC35BYtL\"]},\"project:/contracts/interfaces/IIssuer.sol\":{\"keccak256\":\"0x0f9dfc9f3408ed8552655c7085cbab1d6646e61a8e61ec15e9ef01504c50d08f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://d5432f56a86f67460e1d27d75e648a8d99694af4528d64697c98fa9d94f95f17\",\"dweb:/ipfs/QmSFYisYJ7jMM2ffih1N6D8YWrnZgefUeRbTshhWaRD1NK\"]},\"project:/contracts/interfaces/ILiquidator.sol\":{\"keccak256\":\"0x312743bf303dbc5c008616f678fae03039c62c2247c196f639a053e7569cad91\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://59c6ae465c6c06d7066a400b80a098889807e0bb258b13c7ff018112f72347fa\",\"dweb:/ipfs/QmafmTn2nKDfJdc4qSFNKHXUk51CzmtW4yQuGX14ZxagoK\"]},\"project:/contracts/interfaces/IMobius.sol\":{\"keccak256\":\"0xff528a267387a130a72ac0ae57af9631b52bf02bcfec02e11e511e6f218b6aec\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://a303186ab2ed35092e8102512b9bc9d2db7b27edd3cd72d8c132923bf630f0ec\",\"dweb:/ipfs/QmdXUWvDEag9hsaWvtbFEuiy847wYu4qKToPvQeC6Fyo3x\"]},\"project:/contracts/interfaces/IOwnable.sol\":{\"keccak256\":\"0xea183866d1027f5768a4d255951113131eb740accb17e2b8feee4c682b23c2bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e7cb7b1d50aee53c2734aa3629cb4ea5d809a9ae381a017656a79b7740b40329\",\"dweb:/ipfs/QmZMcDrxXWkNYjAHuqPVvhkRnuFN2A6xs7JYs35k2jRTK8\"]},\"project:/contracts/interfaces/IResolver.sol\":{\"keccak256\":\"0x48c68564c0059469b79155383b438440db48f5151c5dc4e92fbd04e0563a4f60\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2d13304155a5ef002edb8b2992b0c299f05688cafaf3c0f37adcde9d4bdf7d5c\",\"dweb:/ipfs/QmVh4rn3iqxeR2tm4FQs7xA6bQBoxPjBUVfd2nsKvNiWaP\"]},\"project:/contracts/interfaces/ISetting.sol\":{\"keccak256\":\"0x584e994798c9ce851e37581c4a2fcd8430d741cd6b1576cf36e1880130c12af4\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f3d660ab2bf8201b51b0ad22adb91cd642c2e43146039295984eb206750877b9\",\"dweb:/ipfs/QmbXMLFJqM4gXYNMKbbjxdVVEzadRVGZA3iNjQSJxeu6Zg\"]},\"project:/contracts/interfaces/IStaker.sol\":{\"keccak256\":\"0x8dc78a51693006c320137af5888eaa83e3814b358cd899e212c57b60ed090932\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://26ceb22f9f32dc8e403d1a9bc04a0ddaa4d2c5adee20daeaf34648e13d1df05f\",\"dweb:/ipfs/QmNMzP4x4urk5y7jRfn1nv2sWqr3trw9Z2CrqHDuM7DEK1\"]},\"project:/contracts/interfaces/ITrader.sol\":{\"keccak256\":\"0xf743a3048320c2ddffcfb8b813935f26d520385252c2863311ed796df0377fb0\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://254c21349a43f3c1b21e2072bcf04d251a0983926c82f1bc3fb435a70da8a834\",\"dweb:/ipfs/QmV27b7LBWhd3dpG7x4r7rquA5raNdtzH7b59MZN7bqZkr\"]},\"project:/contracts/lib/Address.sol\":{\"keccak256\":\"0xe514d01ac326ed8595e811374a0d463eb3f91cbc658c8a7a848f47d2453f599d\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f3721ee5cf640e077a685d71124e7fb467885d76689fa7f0bc36a4f1edcfc42e\",\"dweb:/ipfs/QmWgiGjLRC623A78JU5YieYAwBQvBxkGAYipZ9AmHY561m\"]},\"project:/contracts/lib/PreciseMath.sol\":{\"keccak256\":\"0xd1cf8433407cac8cd77b34c3c01485d2971ce4d3a80c17830cab05d25c0a256f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://dc1c99ccd7d759775c8b760ba08481a7f4cead20f0c180456f197da42ff6a10a\",\"dweb:/ipfs/QmeEhgpcUA1NeebdjujTcRUDfjx1vNk42fySmc1R8wYBrk\"]},\"project:/contracts/lib/ReentrancyGuard.sol\":{\"keccak256\":\"0xb1b9307f8b4ffc6979b8b7efc4b4f9c9954ea6534eb49e0a2a6bc9f6a00f1836\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://66e9ccfa96214f49e9d6c3d349046374d44c9b1dc9c1fc271770b467d12fb38e\",\"dweb:/ipfs/Qmb6oXJVHT2NTZidUWyzRrgBNm4sFkAz7P1KZLEe418vic\"]},\"project:/contracts/lib/SafeERC20.sol\":{\"keccak256\":\"0x710e47d25fd0e4a6d69aad46333df808a7b6bbd591725f5774ce25a583e991f7\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://673341b44dd69a4ef4362608591395e0a27d36e58f55705afd99a880c2a86536\",\"dweb:/ipfs/QmSZTcTQd2ebPyME9Rj1XJVqMNhLhMAE5haCER8Tv1kT3J\"]},\"project:/contracts/lib/Strings.sol\":{\"keccak256\":\"0x0bc282501099b51b91ecb68fa0f40f88cd590a6a8fda8bb455581a8d619f1c97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f4461279953516d98257db0c5066294814d592de8f14ea10206449810a5ae60a\",\"dweb:/ipfs/QmbHMCcH9hFgQep2tPq3cX2izkxXnTKVVUsY7bW6RgVsp4\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506040516200455c3803806200455c83398101604081905262000034916200026c565b60018054336001600160a01b031991821681178355600280546001600160a81b03191660ff60a01b19909216919091179055600380549091166001600160a01b038516179055600655600781905562000096654d6f6269757360d01b62000158565b6040518061010001604052806529ba30b5b2b960d11b8152602001694173736574507269636560b01b81526020016653657474696e6760c81b81526020016524b9b9bab2b960d11b8152602001652a3930b232b960d11b81526020016a26b7b134bab9aa37b5b2b760a91b8152602001692634b8bab4b230ba37b960b11b81526020017f4c69717569646174696f6e46656541646472657373000000000000000000000081525060049060086200014f92919062000189565b505050620002e3565b604080516020808201849052825180830382018152918301909252805162000185926000920190620001d9565b5050565b828054828255906000526020600020908101928215620001c7579160200282015b82811115620001c7578251825591602001919060010190620001aa565b50620001d592915062000255565b5090565b828054620001e790620002a6565b90600052602060002090601f0160209004810192826200020b5760008555620001c7565b82601f106200022657805160ff1916838001178555620001c7565b82800160010185558215620001c75791820182811115620001c7578251825591602001919060010190620001aa565b5b80821115620001d5576000815560010162000256565b600080604083850312156200027f578182fd5b82516001600160a01b038116811462000296578283fd5b6020939093015192949293505050565b600181811c90821680620002bb57607f821691505b60208210811415620002dd57634e487b7160e01b600052602260045260246000fd5b50919050565b61426980620002f36000396000f3fe6080604052600436106101965760003560e01c8063612cd04b116100e1578063946a970e1161008a578063d5c2c8ca11610064578063d5c2c8ca146104c9578063dbf1207f146104de578063ea110b7d146104fe578063f9df4a6c1461051e57600080fd5b8063946a970e14610476578063b1636f3914610489578063d0ebdbe7146104a957600080fd5b80638aed3c32116100bb5780638aed3c32146104095780638da5cb5b1461042957806393709b301461045657600080fd5b8063612cd04b146103b457806375d0c0dc146103d4578063768ab0fc146103f657600080fd5b806316c38b3c116101435780632dba42731161011d5780632dba427314610335578063481c6a75146103555780635c975abb1461038257600080fd5b806316c38b3c146102af57806321f8a721146102cf578063271cdc681461031257600080fd5b80631325188f116101745780631325188f1461024257806313af403514610277578063167b78cd1461029957600080fd5b806304f3bcec1461019b57806305635bc4146101f2578063126779c214610220575b600080fd5b3480156101a757600080fd5b506003546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156101fe57600080fd5b5061021261020d366004613d57565b61053e565b6040519081526020016101e9565b34801561022c57600080fd5b506102356106b0565b6040516101e99190613f25565b34801561024e57600080fd5b5061026261025d366004613d82565b610708565b604080519283526020830191909152016101e9565b34801561028357600080fd5b50610297610292366004613c5a565b610b54565b005b3480156102a557600080fd5b5061021260075481565b3480156102bb57600080fd5b506102976102ca366004613c92565b610d30565b3480156102db57600080fd5b506101c86102ea366004613d03565b60009081526005602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b610325610320366004613d03565b610e90565b60405190151581526020016101e9565b34801561034157600080fd5b50610325610350366004613d57565b6110b9565b34801561036157600080fd5b506002546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b34801561038e57600080fd5b506002546103259074010000000000000000000000000000000000000000900460ff1681565b3480156103c057600080fd5b506102126103cf366004613de3565b6113db565b3480156103e057600080fd5b506103e96114fa565b6040516101e99190613f69565b610212610404366004613d03565b611588565b34801561041557600080fd5b50610297610424366004613d03565b611666565b34801561043557600080fd5b506001546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b34801561046257600080fd5b50610325610471366004613dc2565b611829565b610212610484366004613dc2565b611a35565b34801561049557600080fd5b506103256104a4366004613d57565b611ad4565b3480156104b557600080fd5b506102976104c4366004613c5a565b611d89565b3480156104d557600080fd5b50610297611f48565b3480156104ea57600080fd5b506103256104f9366004613d57565b612141565b34801561050a57600080fd5b50610212610519366004613d1b565b612320565b34801561052a57600080fd5b50610212610539366004613d57565b612a56565b6000600260065414156105b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600655600754841415610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f60448201527f6d436f696e222066756e6374696f6e000000000000000000000000000000000060648201526084016105a9565b610674847f6d6f55534400000000000000000000000000000000000000000000000000000085612c8c565b60006106a285857f6d6f55534400000000000000000000000000000000000000000000000000000086612ef9565b600160065595945050505050565b606060048054806020026020016040519081016040528092919081815260200182805480156106fe57602002820191906000526020600020905b8154815260200190600101908083116106ea575b5050505050905090565b600080600260149054906101000a900460ff16156107ee6040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b80601f016020809104026020016040519081016040528092919081815260200182805461078e90614158565b80156107db5780601f106107b0576101008083540402835291602001916107db565b820191906000526020600020905b8154815290600101906020018083116107be57829003601f168201915b505050505061333490919063ffffffff16565b90610826576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415610894576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065560006108a3613361565b6040517f52cc6269000000000000000000000000000000000000000000000000000000008152600481018990523360248201526044810188905273ffffffffffffffffffffffffffffffffffffffff91909116906352cc62699060640160206040518083038186803b15801561091857600080fd5b505afa15801561092c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109509190613e14565b9050600061095c613391565b6040517f13b98d84000000000000000000000000000000000000000000000000000000008152600481018a90523360248201819052604482018a905260648201899052608482015273ffffffffffffffffffffffffffffffffffffffff91909116906313b98d849060a401602060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190613e14565b905060008515610aef57610a2b613361565b6040517f1154b219000000000000000000000000000000000000000000000000000000008152600481018b9052336024820152604481018a90526064810185905273ffffffffffffffffffffffffffffffffffffffff9190911690631154b2199060840160206040518083038186803b158015610aa757600080fd5b505afa158015610abb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adf9190613e14565b9050610aed898983336133bc565b505b87893373ffffffffffffffffffffffffffffffffffffffff167f741c87317c42567221d5db60c90a18c676c6ba3f8cfb4c3cf300ba8ad0a9adbe85604051610b3991815260200190565b60405180910390a46001600655909890975095505050505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610bb992919061076290614158565b90610bf1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c696040518060400160405280601f81526020017f3a206e6577206f776e657220697320746865207a65726f2061646472657373008152506000805461076290614158565b90610ca1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610d9592919061076290614158565b90610dcd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060025460ff740100000000000000000000000000000000000000009091041615158115151415610dfb5750565b6002546040518215159174010000000000000000000000000000000000000000900460ff161515907fac1664632d6278432aa05a6afc0aa83e5ea08e8df9a1436736daa5d6283211c090600090a3600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000831515021790555b50565b600060026006541415610eff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b60026006556000610f0e613391565b6007546040517f8018b8cb00000000000000000000000000000000000000000000000000000000815260048101919091523360248201526044810185905273ffffffffffffffffffffffffffffffffffffffff9190911690638018b8cb9060640160206040518083038186803b158015610f8757600080fd5b505afa158015610f9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbf9190613e14565b1161104c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4d6f626975733a2044656274206d75737420626520677265617465722074686160448201527f6e207a65726f000000000000000000000000000000000000000000000000000060648201526084016105a9565b6110596007548334612c8c565b816007543373ffffffffffffffffffffffffffffffffffffffff167fcee7446526e8c7f656298d54a07b7c1bec6225ac0acc4c454cb03b966237eb4f346040516110a591815260200190565b60405180910390a450600180600655919050565b6000600260149054906101000a900460ff16156111126040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b9061114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50600260065414156111b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065560006111c761354f565b6040517f39189e9b000000000000000000000000000000000000000000000000000000008152600481018790526024810186905273ffffffffffffffffffffffffffffffffffffffff91909116906339189e9b9060440160206040518083038186803b15801561123657600080fd5b505afa15801561124a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126e9190613e14565b9050600061127a613361565b6040517f1154b21900000000000000000000000000000000000000000000000000000000815260048101889052336024820152604481018790526064810184905273ffffffffffffffffffffffffffffffffffffffff9190911690631154b2199060840160206040518083038186803b1580156112f657600080fd5b505afa15801561130a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132e9190613e14565b9050838110156113c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d6f626975733a207472616e7366657220616d6f756e7420657863656564732060448201527f636c61696d61626c65000000000000000000000000000000000000000000000060648201526084016105a9565b6113cc868686336133bc565b60016006559695505050505050565b60006002600654141561144a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b60026006556007548514156114e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4d6f626975733a204e617469766520436f696e20757365202273686f7274467260448201527f6f6d546f6b656e222066756e6374696f6e00000000000000000000000000000060648201526084016105a9565b6114ec858486612c8c565b60006113cc86868686612ef9565b6000805461150790614158565b80601f016020809104026020016040519081016040528092919081815260200182805461153390614158565b80156115805780601f1061155557610100808354040283529160200191611580565b820191906000526020600020905b81548152906001019060200180831161156357829003601f168201915b505050505081565b6000600260065414156115f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065560075461162a907f6d6f55534400000000000000000000000000000000000000000000000000000034612c8c565b600061165a600754347f6d6f55534400000000000000000000000000000000000000000000000000000086612ef9565b60016006559392505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926116cb92919061076290614158565b90611703576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b506003546040517f21f8a7210000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906321f8a7219060240160206040518083038186803b15801561176e57600080fd5b505afa158015611782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a69190613c76565b600082815260056020526040812080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff93909316929092179091556004805460018101825591527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0155565b6000600260149054906101000a900460ff16156118826040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b906118ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415611928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655611935613391565b6040517fb036e64c000000000000000000000000000000000000000000000000000000008152600481018590523360248201527f6d6f55534400000000000000000000000000000000000000000000000000000060448201526064810184905273ffffffffffffffffffffffffffffffffffffffff919091169063b036e64c90608401600060405180830381600087803b1580156119d257600080fd5b505af11580156119e6573d6000803e3d6000fd5b50506040805160008152602081018690528693503392507f1eba155afe217abd462a2edbeadbfc49bcc9c9fb4ea11f28992964f6527c518e910160405180910390a35060018060065592915050565b600060026006541415611aa4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655600754611ab7908434612c8c565b6000611ac7600754348686612ef9565b6001600655949350505050565b600060026006541415611b43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655600754841415611bda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f60448201527f6d436f696e222066756e6374696f6e000000000000000000000000000000000060648201526084016105a9565b6000611be4613391565b6040517f8018b8cb000000000000000000000000000000000000000000000000000000008152600481018790523360248201526044810186905273ffffffffffffffffffffffffffffffffffffffff9190911690638018b8cb9060640160206040518083038186803b158015611c5957600080fd5b505afa158015611c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c919190613e14565b11611d1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4d6f626975733a2044656274206d75737420626520677265617465722074686160448201527f6e207a65726f000000000000000000000000000000000000000000000000000060648201526084016105a9565b611d29848484612c8c565b82843373ffffffffffffffffffffffffffffffffffffffff167fcee7446526e8c7f656298d54a07b7c1bec6225ac0acc4c454cb03b966237eb4f85604051611d7391815260200190565b60405180910390a4506001806006559392505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492611dee92919061076290614158565b90611e26576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e81604051806060016040528060218152602001614213602191396000805461076290614158565b90611eb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a435090600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492611fad92919061076290614158565b90611fe5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060005b600454811015610e8d5760006004828154811061202f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602090912001546003546040517f21f8a7210000000000000000000000000000000000000000000000000000000081526004810183905291925073ffffffffffffffffffffffffffffffffffffffff16906321f8a7219060240160206040518083038186803b1580156120a657600080fd5b505afa1580156120ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120de9190613c76565b60009182526005602052604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790558061213981614193565b915050611fe9565b6000600260149054906101000a900460ff161561219a6040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b906121d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415612240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065561224d613391565b6040517fb036e64c00000000000000000000000000000000000000000000000000000000815260048101869052336024820152604481018590526064810184905273ffffffffffffffffffffffffffffffffffffffff919091169063b036e64c90608401600060405180830381600087803b1580156122cb57600080fd5b505af11580156122df573d6000803e3d6000fd5b505060408051600081526020810186905286935087925033917f71026f827618f4e4492b72e7f7fd8bf4a6c7db4b438f427a77850a178fd16f789101611d73565b6000600260149054906101000a900460ff16156123796040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b906123b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b506002600654141561241f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655600061242e61357a565b6040517f9ff06bb40000000000000000000000000000000000000000000000000000000081526004810188905273ffffffffffffffffffffffffffffffffffffffff8781166024830152604482018790529190911690639ff06bb49060640160206040518083038186803b1580156124a557600080fd5b505afa1580156124b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124dd9190613e14565b90508281101561256f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4d6f626975733a206c697175696461746520616d6f756e74206578636565647360448201527f206c697175696461626c6500000000000000000000000000000000000000000060648201526084016105a9565b60008061257a61357a565b6040517fd9745288000000000000000000000000000000000000000000000000000000008152600481018a9052602481018890526044810187905273ffffffffffffffffffffffffffffffffffffffff919091169063d974528890606401604080518083038186803b1580156125ef57600080fd5b505afa158015612603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126279190613e2c565b909250905060006126388284613fba565b9050612642613391565b6040517f13b98d84000000000000000000000000000000000000000000000000000000008152600481018b905273ffffffffffffffffffffffffffffffffffffffff8a81166024830152604482018a90526064820189905233608483015291909116906313b98d849060a401602060405180830381600087803b1580156126c857600080fd5b505af11580156126dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127009190613e14565b50612709613361565b6040517fea71c363000000000000000000000000000000000000000000000000000000008152600481018b905273ffffffffffffffffffffffffffffffffffffffff8a81166024830152604482018a905260648201849052919091169063ea71c36390608401600060405180830381600087803b15801561278957600080fd5b505af115801561279d573d6000803e3d6000fd5b5050505060075489141561284d57604051339084156108fc029085906000818181858888f193505050501580156127d8573d6000803e3d6000fd5b506128027f4c69717569646174696f6e4665654164647265737300000000000000000000006135a1565b73ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015612847573d6000803e3d6000fd5b506129e8565b60006128797f5374616b650000000000000000000000000000000000000000000000000000008b613705565b905061292c3361290e60125b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129039190613e84565b88919060ff1661383f565b73ffffffffffffffffffffffffffffffffffffffff841691906138b4565b6129e66129587f4c69717569646174696f6e4665654164647265737300000000000000000000006135a1565b61290e60128473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156129a357600080fd5b505afa1580156129b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129db9190613e84565b87919060ff1661383f565b505b604080518881526020810183905290810187905273ffffffffffffffffffffffffffffffffffffffff8916908a9033907f13d9b11eea39efc96532ca38597be4e2da48096efc54c76721163b6bc1288f4f9060600160405180910390a4505060016006559695505050505050565b6000600260149054906101000a900460ff1615612aaf6040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b90612ae7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415612b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b60026006556000808080612b6761398d565b6040517fb2d3aec9000000000000000000000000000000000000000000000000000000008152336004820152602481018a9052604481018990526064810188905273ffffffffffffffffffffffffffffffffffffffff919091169063b2d3aec990608401608060405180830381600087803b158015612be557600080fd5b505af1158015612bf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1d9190613e4f565b604080518c8152602081018690529081018490526060810183905260808101829052939750919550935091508690899033907f2dff74d4ff22afe46775738f294c317785cc0d87cff24600a649f10d00320c5b9060a00160405180910390a45050600160065550949350505050565b600260149054906101000a900460ff1615612ce36040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b90612d1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060008111612dac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f4d6f626975733a20616d6f756e74206d7573742062652067726561746572207460448201527f68616e207a65726f00000000000000000000000000000000000000000000000060648201526084016105a9565b6007548314612e56576000612de17f5374616b6500000000000000000000000000000000000000000000000000000085613705565b905080612e533330612e3460128573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156128cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff85169291906139b8565b50505b612e5e613361565b6040517ff6f8398200000000000000000000000000000000000000000000000000000000815260048101859052336024820152604481018490526064810183905273ffffffffffffffffffffffffffffffffffffffff919091169063f6f8398290608401600060405180830381600087803b158015612edc57600080fd5b505af1158015612ef0573d6000803e3d6000fd5b50505050505050565b6000600260149054906101000a900460ff1615612f526040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b90612f8a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b506000612f9561354f565b6040517f39189e9b000000000000000000000000000000000000000000000000000000008152600481018890526024810186905273ffffffffffffffffffffffffffffffffffffffff91909116906339189e9b9060440160206040518083038186803b15801561300457600080fd5b505afa158015613018573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303c9190613e14565b9050600081116130a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d6f626975733a204d697373696e6720436f6c6c61746572616c20526174650060448201526064016105a9565b80831015613112576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d6f626975733a20436f6c6c61746572616c205261746520746f6f206c6f770060448201526064016105a9565b60008361311d613a1c565b73ffffffffffffffffffffffffffffffffffffffff166331d98b3f896040518263ffffffff1660e01b815260040161315791815260200190565b60206040518083038186803b15801561316f57600080fd5b505afa158015613183573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a79190613e14565b6131b190886140f6565b6131bb9190613fd2565b905060006131c7613391565b6040517f28eb79de000000000000000000000000000000000000000000000000000000008152600481018a9052336024820152604481018890526064810184905273ffffffffffffffffffffffffffffffffffffffff91909116906328eb79de90608401602060405180830381600087803b15801561324557600080fd5b505af1158015613259573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061327d9190613e14565b90507f6d6f5553440000000000000000000000000000000000000000000000000000008614156132e9576040805188815260208101849052899133917f1eba155afe217abd462a2edbeadbfc49bcc9c9fb4ea11f28992964f6527c518e910160405180910390a3613329565b604080518881526020810183905287918a9133917f71026f827618f4e4492b72e7f7fd8bf4a6c7db4b438f427a77850a178fd16f78910160405180910390a45b979650505050505050565b60608282604051602001613349929190613ec1565b60405160208183030381529060405290505b92915050565b600061338c7f5374616b657200000000000000000000000000000000000000000000000000006135a1565b905090565b600061338c7f49737375657200000000000000000000000000000000000000000000000000006135a1565b60006133c6613361565b6040517fea71c3630000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff84811660248301526044820187905260648201869052919091169063ea71c36390608401600060405180830381600087803b15801561344657600080fd5b505af115801561345a573d6000803e3d6000fd5b505050506007548514156134b15760405173ffffffffffffffffffffffffffffffffffffffff83169084156108fc029085906000818181858888f193505050501580156134ab573d6000803e3d6000fd5b506134ef565b60006134dd7f5374616b6500000000000000000000000000000000000000000000000000000087613705565b90506134ed8361290e6012612885565b505b604080518581526020810185905273ffffffffffffffffffffffffffffffffffffffff841691879183917f14c325b3a2f5a1a5c15aaa7d090a0c915b7739feff5268d9b49fdc688f783c9e910160405180910390a4506001949350505050565b600061338c7f53657474696e67000000000000000000000000000000000000000000000000006135a1565b600061338c7f4c697175696461746f72000000000000000000000000000000000000000000005b6000818152600560209081526040808320548151808301909252600a82527f3a204d697373696e67200000000000000000000000000000000000000000000092820192909252825473ffffffffffffffffffffffffffffffffffffffff9092161515916136a391908590859061361690614158565b80601f016020809104026020016040519081016040528092919081815260200182805461364290614158565b801561368f5780601f106136645761010080835404028352916020019161368f565b820191906000526020600020905b81548152906001019060200180831161367257829003601f168201915b5050505050613a479092919063ffffffff16565b906136db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b505060009081526005602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6003546040517f659b9d7000000000000000000000000000000000000000000000000000000000815260048101849052602481018390526000918291829173ffffffffffffffffffffffffffffffffffffffff169063659b9d7090604401604080518083038186803b15801561377a57600080fd5b505afa15801561378e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137b29190613cca565b91509150816137fe6040518060400160405280601681526020017f3a204d697373696e6720417373657420546f6b656e2000000000000000000000815250866000805461361690614158565b90613836576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50949350505050565b60008361384e575060006138ad565b8183141561385d5750826138ad565b8183101561388b5761386f8383614115565b61387a90600a61404e565b61388490856140f6565b90506138ad565b6138958284614115565b6138a090600a61404e565b6138aa9085613fd2565b90505b9392505050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526139889084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613a76565b505050565b600061338c7f54726164657200000000000000000000000000000000000000000000000000006135a1565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052613a169085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401613906565b50505050565b600061338c7f41737365745072696365000000000000000000000000000000000000000000006135a1565b6060838383604051602001613a5e93929190613ef0565b60405160208183030381529060405290509392505050565b6000613ad8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b829092919063ffffffff16565b8051909150156139885780806020019051810190613af69190613cae565b613988576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105a9565b60606000808573ffffffffffffffffffffffffffffffffffffffff1685604051613bac9190613ea5565b6000604051808303816000865af19150503d8060008114613be9576040519150601f19603f3d011682016040523d82523d6000602084013e613bee565b606091505b5091509150613bfe828286613c08565b9695505050505050565b60608315613c175750816138ad565b8251613c5157816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b82518084602001fd5b600060208284031215613c6b578081fd5b81356138ad816141e2565b600060208284031215613c87578081fd5b81516138ad816141e2565b600060208284031215613ca3578081fd5b81356138ad81614204565b600060208284031215613cbf578081fd5b81516138ad81614204565b60008060408385031215613cdc578081fd5b8251613ce781614204565b6020840151909250613cf8816141e2565b809150509250929050565b600060208284031215613d14578081fd5b5035919050565b60008060008060808587031215613d30578182fd5b843593506020850135613d42816141e2565b93969395505050506040820135916060013590565b600080600060608486031215613d6b578283fd5b505081359360208301359350604090920135919050565b60008060008060808587031215613d97578384fd5b8435935060208501359250604085013591506060850135613db781614204565b939692955090935050565b60008060408385031215613dd4578182fd5b50508035926020909101359150565b60008060008060808587031215613df8578384fd5b5050823594602084013594506040840135936060013592509050565b600060208284031215613e25578081fd5b5051919050565b60008060408385031215613e3e578182fd5b505080516020909101519092909150565b60008060008060808587031215613e64578182fd5b505082516020840151604085015160609095015191969095509092509050565b600060208284031215613e95578081fd5b815160ff811681146138ad578182fd5b60008251613eb781846020870161412c565b9190910192915050565b60008351613ed381846020880161412c565b835190830190613ee781836020880161412c565b01949350505050565b60008451613f0281846020890161412c565b845190830190613f1681836020890161412c565b01928352505060200192915050565b6020808252825182820181905260009190848201906040850190845b81811015613f5d57835183529284019291840191600101613f41565b50909695505050505050565b6020815260008251806020840152613f8881604085016020870161412c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115613fcd57613fcd6141cc565b500190565b600082614006577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b600181815b8085111561404657816000190482111561402c5761402c6141cc565b8085161561403957918102915b93841c9390800290614010565b509250929050565b60006138ad83836000826140645750600161335b565b816140715750600061335b565b81600181146140875760028114614091576140ad565b600191505061335b565b60ff8411156140a2576140a26141cc565b50506001821b61335b565b5060208310610133831016604e8410600b84101617156140d0575081810a61335b565b6140da838361400b565b80600019048211156140ee576140ee6141cc565b029392505050565b6000816000190483118215151615614110576141106141cc565b500290565b600082821015614127576141276141cc565b500390565b60005b8381101561414757818101518382015260200161412f565b83811115613a165750506000910152565b600181811c9082168061416c57607f821691505b6020821081141561418d57634e487b7160e01b600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156141c5576141c56141cc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610e8d57600080fd5b8015158114610e8d57600080fdfe3a206e6577206d616e6167657220697320746865207a65726f2061646472657373a2646970667358221220b3524b0da22fdba1669d2ae5e989802d20ee7329ae04bc190f61ba6071e605c464736f6c63430008040033", + "deployedBytecode": "0x6080604052600436106101965760003560e01c8063612cd04b116100e1578063946a970e1161008a578063d5c2c8ca11610064578063d5c2c8ca146104c9578063dbf1207f146104de578063ea110b7d146104fe578063f9df4a6c1461051e57600080fd5b8063946a970e14610476578063b1636f3914610489578063d0ebdbe7146104a957600080fd5b80638aed3c32116100bb5780638aed3c32146104095780638da5cb5b1461042957806393709b301461045657600080fd5b8063612cd04b146103b457806375d0c0dc146103d4578063768ab0fc146103f657600080fd5b806316c38b3c116101435780632dba42731161011d5780632dba427314610335578063481c6a75146103555780635c975abb1461038257600080fd5b806316c38b3c146102af57806321f8a721146102cf578063271cdc681461031257600080fd5b80631325188f116101745780631325188f1461024257806313af403514610277578063167b78cd1461029957600080fd5b806304f3bcec1461019b57806305635bc4146101f2578063126779c214610220575b600080fd5b3480156101a757600080fd5b506003546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156101fe57600080fd5b5061021261020d366004613d57565b61053e565b6040519081526020016101e9565b34801561022c57600080fd5b506102356106b0565b6040516101e99190613f25565b34801561024e57600080fd5b5061026261025d366004613d82565b610708565b604080519283526020830191909152016101e9565b34801561028357600080fd5b50610297610292366004613c5a565b610b54565b005b3480156102a557600080fd5b5061021260075481565b3480156102bb57600080fd5b506102976102ca366004613c92565b610d30565b3480156102db57600080fd5b506101c86102ea366004613d03565b60009081526005602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b610325610320366004613d03565b610e90565b60405190151581526020016101e9565b34801561034157600080fd5b50610325610350366004613d57565b6110b9565b34801561036157600080fd5b506002546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b34801561038e57600080fd5b506002546103259074010000000000000000000000000000000000000000900460ff1681565b3480156103c057600080fd5b506102126103cf366004613de3565b6113db565b3480156103e057600080fd5b506103e96114fa565b6040516101e99190613f69565b610212610404366004613d03565b611588565b34801561041557600080fd5b50610297610424366004613d03565b611666565b34801561043557600080fd5b506001546101c89073ffffffffffffffffffffffffffffffffffffffff1681565b34801561046257600080fd5b50610325610471366004613dc2565b611829565b610212610484366004613dc2565b611a35565b34801561049557600080fd5b506103256104a4366004613d57565b611ad4565b3480156104b557600080fd5b506102976104c4366004613c5a565b611d89565b3480156104d557600080fd5b50610297611f48565b3480156104ea57600080fd5b506103256104f9366004613d57565b612141565b34801561050a57600080fd5b50610212610519366004613d1b565b612320565b34801561052a57600080fd5b50610212610539366004613d57565b612a56565b6000600260065414156105b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b6002600655600754841415610649576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f60448201527f6d436f696e222066756e6374696f6e000000000000000000000000000000000060648201526084016105a9565b610674847f6d6f55534400000000000000000000000000000000000000000000000000000085612c8c565b60006106a285857f6d6f55534400000000000000000000000000000000000000000000000000000086612ef9565b600160065595945050505050565b606060048054806020026020016040519081016040528092919081815260200182805480156106fe57602002820191906000526020600020905b8154815260200190600101908083116106ea575b5050505050905090565b600080600260149054906101000a900460ff16156107ee6040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b80601f016020809104026020016040519081016040528092919081815260200182805461078e90614158565b80156107db5780601f106107b0576101008083540402835291602001916107db565b820191906000526020600020905b8154815290600101906020018083116107be57829003601f168201915b505050505061333490919063ffffffff16565b90610826576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415610894576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065560006108a3613361565b6040517f52cc6269000000000000000000000000000000000000000000000000000000008152600481018990523360248201526044810188905273ffffffffffffffffffffffffffffffffffffffff91909116906352cc62699060640160206040518083038186803b15801561091857600080fd5b505afa15801561092c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109509190613e14565b9050600061095c613391565b6040517f13b98d84000000000000000000000000000000000000000000000000000000008152600481018a90523360248201819052604482018a905260648201899052608482015273ffffffffffffffffffffffffffffffffffffffff91909116906313b98d849060a401602060405180830381600087803b1580156109e157600080fd5b505af11580156109f5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a199190613e14565b905060008515610aef57610a2b613361565b6040517f1154b219000000000000000000000000000000000000000000000000000000008152600481018b9052336024820152604481018a90526064810185905273ffffffffffffffffffffffffffffffffffffffff9190911690631154b2199060840160206040518083038186803b158015610aa757600080fd5b505afa158015610abb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610adf9190613e14565b9050610aed898983336133bc565b505b87893373ffffffffffffffffffffffffffffffffffffffff167f741c87317c42567221d5db60c90a18c676c6ba3f8cfb4c3cf300ba8ad0a9adbe85604051610b3991815260200190565b60405180910390a46001600655909890975095505050505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610bb992919061076290614158565b90610bf1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c696040518060400160405280601f81526020017f3a206e6577206f776e657220697320746865207a65726f2061646472657373008152506000805461076290614158565b90610ca1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610d9592919061076290614158565b90610dcd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060025460ff740100000000000000000000000000000000000000009091041615158115151415610dfb5750565b6002546040518215159174010000000000000000000000000000000000000000900460ff161515907fac1664632d6278432aa05a6afc0aa83e5ea08e8df9a1436736daa5d6283211c090600090a3600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000831515021790555b50565b600060026006541415610eff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b60026006556000610f0e613391565b6007546040517f8018b8cb00000000000000000000000000000000000000000000000000000000815260048101919091523360248201526044810185905273ffffffffffffffffffffffffffffffffffffffff9190911690638018b8cb9060640160206040518083038186803b158015610f8757600080fd5b505afa158015610f9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fbf9190613e14565b1161104c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4d6f626975733a2044656274206d75737420626520677265617465722074686160448201527f6e207a65726f000000000000000000000000000000000000000000000000000060648201526084016105a9565b6110596007548334612c8c565b816007543373ffffffffffffffffffffffffffffffffffffffff167fcee7446526e8c7f656298d54a07b7c1bec6225ac0acc4c454cb03b966237eb4f346040516110a591815260200190565b60405180910390a450600180600655919050565b6000600260149054906101000a900460ff16156111126040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b9061114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50600260065414156111b8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065560006111c761354f565b6040517f39189e9b000000000000000000000000000000000000000000000000000000008152600481018790526024810186905273ffffffffffffffffffffffffffffffffffffffff91909116906339189e9b9060440160206040518083038186803b15801561123657600080fd5b505afa15801561124a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061126e9190613e14565b9050600061127a613361565b6040517f1154b21900000000000000000000000000000000000000000000000000000000815260048101889052336024820152604481018790526064810184905273ffffffffffffffffffffffffffffffffffffffff9190911690631154b2199060840160206040518083038186803b1580156112f657600080fd5b505afa15801561130a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061132e9190613e14565b9050838110156113c0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f4d6f626975733a207472616e7366657220616d6f756e7420657863656564732060448201527f636c61696d61626c65000000000000000000000000000000000000000000000060648201526084016105a9565b6113cc868686336133bc565b60016006559695505050505050565b60006002600654141561144a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b60026006556007548514156114e1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f4d6f626975733a204e617469766520436f696e20757365202273686f7274467260448201527f6f6d546f6b656e222066756e6374696f6e00000000000000000000000000000060648201526084016105a9565b6114ec858486612c8c565b60006113cc86868686612ef9565b6000805461150790614158565b80601f016020809104026020016040519081016040528092919081815260200182805461153390614158565b80156115805780601f1061155557610100808354040283529160200191611580565b820191906000526020600020905b81548152906001019060200180831161156357829003601f168201915b505050505081565b6000600260065414156115f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065560075461162a907f6d6f55534400000000000000000000000000000000000000000000000000000034612c8c565b600061165a600754347f6d6f55534400000000000000000000000000000000000000000000000000000086612ef9565b60016006559392505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926116cb92919061076290614158565b90611703576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b506003546040517f21f8a7210000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff909116906321f8a7219060240160206040518083038186803b15801561176e57600080fd5b505afa158015611782573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a69190613c76565b600082815260056020526040812080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff93909316929092179091556004805460018101825591527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0155565b6000600260149054906101000a900460ff16156118826040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b906118ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415611928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655611935613391565b6040517fb036e64c000000000000000000000000000000000000000000000000000000008152600481018590523360248201527f6d6f55534400000000000000000000000000000000000000000000000000000060448201526064810184905273ffffffffffffffffffffffffffffffffffffffff919091169063b036e64c90608401600060405180830381600087803b1580156119d257600080fd5b505af11580156119e6573d6000803e3d6000fd5b50506040805160008152602081018690528693503392507f1eba155afe217abd462a2edbeadbfc49bcc9c9fb4ea11f28992964f6527c518e910160405180910390a35060018060065592915050565b600060026006541415611aa4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655600754611ab7908434612c8c565b6000611ac7600754348686612ef9565b6001600655949350505050565b600060026006541415611b43576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655600754841415611bda576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f60448201527f6d436f696e222066756e6374696f6e000000000000000000000000000000000060648201526084016105a9565b6000611be4613391565b6040517f8018b8cb000000000000000000000000000000000000000000000000000000008152600481018790523360248201526044810186905273ffffffffffffffffffffffffffffffffffffffff9190911690638018b8cb9060640160206040518083038186803b158015611c5957600080fd5b505afa158015611c6d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c919190613e14565b11611d1e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4d6f626975733a2044656274206d75737420626520677265617465722074686160448201527f6e207a65726f000000000000000000000000000000000000000000000000000060648201526084016105a9565b611d29848484612c8c565b82843373ffffffffffffffffffffffffffffffffffffffff167fcee7446526e8c7f656298d54a07b7c1bec6225ac0acc4c454cb03b966237eb4f85604051611d7391815260200190565b60405180910390a4506001806006559392505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492611dee92919061076290614158565b90611e26576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e81604051806060016040528060218152602001614213602191396000805461076290614158565b90611eb9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a435090600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492611fad92919061076290614158565b90611fe5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060005b600454811015610e8d5760006004828154811061202f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000918252602090912001546003546040517f21f8a7210000000000000000000000000000000000000000000000000000000081526004810183905291925073ffffffffffffffffffffffffffffffffffffffff16906321f8a7219060240160206040518083038186803b1580156120a657600080fd5b505afa1580156120ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120de9190613c76565b60009182526005602052604090912080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790558061213981614193565b915050611fe9565b6000600260149054906101000a900460ff161561219a6040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b906121d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415612240576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b600260065561224d613391565b6040517fb036e64c00000000000000000000000000000000000000000000000000000000815260048101869052336024820152604481018590526064810184905273ffffffffffffffffffffffffffffffffffffffff919091169063b036e64c90608401600060405180830381600087803b1580156122cb57600080fd5b505af11580156122df573d6000803e3d6000fd5b505060408051600081526020810186905286935087925033917f71026f827618f4e4492b72e7f7fd8bf4a6c7db4b438f427a77850a178fd16f789101611d73565b6000600260149054906101000a900460ff16156123796040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b906123b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b506002600654141561241f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b6002600655600061242e61357a565b6040517f9ff06bb40000000000000000000000000000000000000000000000000000000081526004810188905273ffffffffffffffffffffffffffffffffffffffff8781166024830152604482018790529190911690639ff06bb49060640160206040518083038186803b1580156124a557600080fd5b505afa1580156124b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124dd9190613e14565b90508281101561256f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f4d6f626975733a206c697175696461746520616d6f756e74206578636565647360448201527f206c697175696461626c6500000000000000000000000000000000000000000060648201526084016105a9565b60008061257a61357a565b6040517fd9745288000000000000000000000000000000000000000000000000000000008152600481018a9052602481018890526044810187905273ffffffffffffffffffffffffffffffffffffffff919091169063d974528890606401604080518083038186803b1580156125ef57600080fd5b505afa158015612603573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126279190613e2c565b909250905060006126388284613fba565b9050612642613391565b6040517f13b98d84000000000000000000000000000000000000000000000000000000008152600481018b905273ffffffffffffffffffffffffffffffffffffffff8a81166024830152604482018a90526064820189905233608483015291909116906313b98d849060a401602060405180830381600087803b1580156126c857600080fd5b505af11580156126dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127009190613e14565b50612709613361565b6040517fea71c363000000000000000000000000000000000000000000000000000000008152600481018b905273ffffffffffffffffffffffffffffffffffffffff8a81166024830152604482018a905260648201849052919091169063ea71c36390608401600060405180830381600087803b15801561278957600080fd5b505af115801561279d573d6000803e3d6000fd5b5050505060075489141561284d57604051339084156108fc029085906000818181858888f193505050501580156127d8573d6000803e3d6000fd5b506128027f4c69717569646174696f6e4665654164647265737300000000000000000000006135a1565b73ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015612847573d6000803e3d6000fd5b506129e8565b60006128797f5374616b650000000000000000000000000000000000000000000000000000008b613705565b905061292c3361290e60125b8473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129039190613e84565b88919060ff1661383f565b73ffffffffffffffffffffffffffffffffffffffff841691906138b4565b6129e66129587f4c69717569646174696f6e4665654164647265737300000000000000000000006135a1565b61290e60128473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156129a357600080fd5b505afa1580156129b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129db9190613e84565b87919060ff1661383f565b505b604080518881526020810183905290810187905273ffffffffffffffffffffffffffffffffffffffff8916908a9033907f13d9b11eea39efc96532ca38597be4e2da48096efc54c76721163b6bc1288f4f9060600160405180910390a4505060016006559695505050505050565b6000600260149054906101000a900460ff1615612aaf6040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b90612ae7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060026006541415612b55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016105a9565b60026006556000808080612b6761398d565b6040517fb2d3aec9000000000000000000000000000000000000000000000000000000008152336004820152602481018a9052604481018990526064810188905273ffffffffffffffffffffffffffffffffffffffff919091169063b2d3aec990608401608060405180830381600087803b158015612be557600080fd5b505af1158015612bf9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c1d9190613e4f565b604080518c8152602081018690529081018490526060810183905260808101829052939750919550935091508690899033907f2dff74d4ff22afe46775738f294c317785cc0d87cff24600a649f10d00320c5b9060a00160405180910390a45050600160065550949350505050565b600260149054906101000a900460ff1615612ce36040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b90612d1b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b5060008111612dac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f4d6f626975733a20616d6f756e74206d7573742062652067726561746572207460448201527f68616e207a65726f00000000000000000000000000000000000000000000000060648201526084016105a9565b6007548314612e56576000612de17f5374616b6500000000000000000000000000000000000000000000000000000085613705565b905080612e533330612e3460128573ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156128cb57600080fd5b73ffffffffffffffffffffffffffffffffffffffff85169291906139b8565b50505b612e5e613361565b6040517ff6f8398200000000000000000000000000000000000000000000000000000000815260048101859052336024820152604481018490526064810183905273ffffffffffffffffffffffffffffffffffffffff919091169063f6f8398290608401600060405180830381600087803b158015612edc57600080fd5b505af1158015612ef0573d6000803e3d6000fd5b50505050505050565b6000600260149054906101000a900460ff1615612f526040518060400160405280600881526020017f3a207061757365640000000000000000000000000000000000000000000000008152506000805461076290614158565b90612f8a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b506000612f9561354f565b6040517f39189e9b000000000000000000000000000000000000000000000000000000008152600481018890526024810186905273ffffffffffffffffffffffffffffffffffffffff91909116906339189e9b9060440160206040518083038186803b15801561300457600080fd5b505afa158015613018573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061303c9190613e14565b9050600081116130a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d6f626975733a204d697373696e6720436f6c6c61746572616c20526174650060448201526064016105a9565b80831015613112576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f4d6f626975733a20436f6c6c61746572616c205261746520746f6f206c6f770060448201526064016105a9565b60008361311d613a1c565b73ffffffffffffffffffffffffffffffffffffffff166331d98b3f896040518263ffffffff1660e01b815260040161315791815260200190565b60206040518083038186803b15801561316f57600080fd5b505afa158015613183573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131a79190613e14565b6131b190886140f6565b6131bb9190613fd2565b905060006131c7613391565b6040517f28eb79de000000000000000000000000000000000000000000000000000000008152600481018a9052336024820152604481018890526064810184905273ffffffffffffffffffffffffffffffffffffffff91909116906328eb79de90608401602060405180830381600087803b15801561324557600080fd5b505af1158015613259573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061327d9190613e14565b90507f6d6f5553440000000000000000000000000000000000000000000000000000008614156132e9576040805188815260208101849052899133917f1eba155afe217abd462a2edbeadbfc49bcc9c9fb4ea11f28992964f6527c518e910160405180910390a3613329565b604080518881526020810183905287918a9133917f71026f827618f4e4492b72e7f7fd8bf4a6c7db4b438f427a77850a178fd16f78910160405180910390a45b979650505050505050565b60608282604051602001613349929190613ec1565b60405160208183030381529060405290505b92915050565b600061338c7f5374616b657200000000000000000000000000000000000000000000000000006135a1565b905090565b600061338c7f49737375657200000000000000000000000000000000000000000000000000006135a1565b60006133c6613361565b6040517fea71c3630000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff84811660248301526044820187905260648201869052919091169063ea71c36390608401600060405180830381600087803b15801561344657600080fd5b505af115801561345a573d6000803e3d6000fd5b505050506007548514156134b15760405173ffffffffffffffffffffffffffffffffffffffff83169084156108fc029085906000818181858888f193505050501580156134ab573d6000803e3d6000fd5b506134ef565b60006134dd7f5374616b6500000000000000000000000000000000000000000000000000000087613705565b90506134ed8361290e6012612885565b505b604080518581526020810185905273ffffffffffffffffffffffffffffffffffffffff841691879183917f14c325b3a2f5a1a5c15aaa7d090a0c915b7739feff5268d9b49fdc688f783c9e910160405180910390a4506001949350505050565b600061338c7f53657474696e67000000000000000000000000000000000000000000000000006135a1565b600061338c7f4c697175696461746f72000000000000000000000000000000000000000000005b6000818152600560209081526040808320548151808301909252600a82527f3a204d697373696e67200000000000000000000000000000000000000000000092820192909252825473ffffffffffffffffffffffffffffffffffffffff9092161515916136a391908590859061361690614158565b80601f016020809104026020016040519081016040528092919081815260200182805461364290614158565b801561368f5780601f106136645761010080835404028352916020019161368f565b820191906000526020600020905b81548152906001019060200180831161367257829003601f168201915b5050505050613a479092919063ffffffff16565b906136db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b505060009081526005602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b6003546040517f659b9d7000000000000000000000000000000000000000000000000000000000815260048101849052602481018390526000918291829173ffffffffffffffffffffffffffffffffffffffff169063659b9d7090604401604080518083038186803b15801561377a57600080fd5b505afa15801561378e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137b29190613cca565b91509150816137fe6040518060400160405280601681526020017f3a204d697373696e6720417373657420546f6b656e2000000000000000000000815250866000805461361690614158565b90613836576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b50949350505050565b60008361384e575060006138ad565b8183141561385d5750826138ad565b8183101561388b5761386f8383614115565b61387a90600a61404e565b61388490856140f6565b90506138ad565b6138958284614115565b6138a090600a61404e565b6138aa9085613fd2565b90505b9392505050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526139889084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152613a76565b505050565b600061338c7f54726164657200000000000000000000000000000000000000000000000000006135a1565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052613a169085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401613906565b50505050565b600061338c7f41737365745072696365000000000000000000000000000000000000000000006135a1565b6060838383604051602001613a5e93929190613ef0565b60405160208183030381529060405290509392505050565b6000613ad8826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613b829092919063ffffffff16565b8051909150156139885780806020019051810190613af69190613cae565b613988576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016105a9565b60606000808573ffffffffffffffffffffffffffffffffffffffff1685604051613bac9190613ea5565b6000604051808303816000865af19150503d8060008114613be9576040519150601f19603f3d011682016040523d82523d6000602084013e613bee565b606091505b5091509150613bfe828286613c08565b9695505050505050565b60608315613c175750816138ad565b8251613c5157816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a99190613f69565b82518084602001fd5b600060208284031215613c6b578081fd5b81356138ad816141e2565b600060208284031215613c87578081fd5b81516138ad816141e2565b600060208284031215613ca3578081fd5b81356138ad81614204565b600060208284031215613cbf578081fd5b81516138ad81614204565b60008060408385031215613cdc578081fd5b8251613ce781614204565b6020840151909250613cf8816141e2565b809150509250929050565b600060208284031215613d14578081fd5b5035919050565b60008060008060808587031215613d30578182fd5b843593506020850135613d42816141e2565b93969395505050506040820135916060013590565b600080600060608486031215613d6b578283fd5b505081359360208301359350604090920135919050565b60008060008060808587031215613d97578384fd5b8435935060208501359250604085013591506060850135613db781614204565b939692955090935050565b60008060408385031215613dd4578182fd5b50508035926020909101359150565b60008060008060808587031215613df8578384fd5b5050823594602084013594506040840135936060013592509050565b600060208284031215613e25578081fd5b5051919050565b60008060408385031215613e3e578182fd5b505080516020909101519092909150565b60008060008060808587031215613e64578182fd5b505082516020840151604085015160609095015191969095509092509050565b600060208284031215613e95578081fd5b815160ff811681146138ad578182fd5b60008251613eb781846020870161412c565b9190910192915050565b60008351613ed381846020880161412c565b835190830190613ee781836020880161412c565b01949350505050565b60008451613f0281846020890161412c565b845190830190613f1681836020890161412c565b01928352505060200192915050565b6020808252825182820181905260009190848201906040850190845b81811015613f5d57835183529284019291840191600101613f41565b50909695505050505050565b6020815260008251806020840152613f8881604085016020870161412c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60008219821115613fcd57613fcd6141cc565b500190565b600082614006577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b600181815b8085111561404657816000190482111561402c5761402c6141cc565b8085161561403957918102915b93841c9390800290614010565b509250929050565b60006138ad83836000826140645750600161335b565b816140715750600061335b565b81600181146140875760028114614091576140ad565b600191505061335b565b60ff8411156140a2576140a26141cc565b50506001821b61335b565b5060208310610133831016604e8410600b84101617156140d0575081810a61335b565b6140da838361400b565b80600019048211156140ee576140ee6141cc565b029392505050565b6000816000190483118215151615614110576141106141cc565b500290565b600082821015614127576141276141cc565b500390565b60005b8381101561414757818101518382015260200161412f565b83811115613a165750506000910152565b600181811c9082168061416c57607f821691505b6020821081141561418d57634e487b7160e01b600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156141c5576141c56141cc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610e8d57600080fd5b8015158114610e8d57600080fdfe3a206e6577206d616e6167657220697320746865207a65726f2061646472657373a2646970667358221220b3524b0da22fdba1669d2ae5e989802d20ee7329ae04bc190f61ba6071e605c464736f6c63430008040033", + "immutableReferences": {}, + "generatedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:978:82", + "statements": [ + { + "nodeType": "YulBlock", + "src": "6:3:82", + "statements": [] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "131:273:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "177:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "186:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "194:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "179:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "179:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "179:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "152:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "161:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "148:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "148:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "173:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "144:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "144:32:82" + }, + "nodeType": "YulIf", + "src": "141:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "212:29:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "231:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "225:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "225:16:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "216:5:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "304:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "313:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "321:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "306:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "306:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "306:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "263:5:82" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "274:5:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "289:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "294:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "285:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "285:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "298:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "281:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "281:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "270:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "270:31:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "260:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "260:42:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "253:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "253:50:82" + }, + "nodeType": "YulIf", + "src": "250:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "339:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "349:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "339:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "363:35:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "383:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "394:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "379:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "379:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "373:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "373:25:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "363:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_contract$_IResolver_$10297t_bytes32_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "89:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "100:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "112:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "120:6:82", + "type": "" + } + ], + "src": "14:390:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "528:63:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "545:3:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "550:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "538:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "538:19:82" + }, + "nodeType": "YulExpressionStatement", + "src": "538:19:82" + }, + { + "nodeType": "YulAssignment", + "src": "566:19:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "577:3:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "582:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "573:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "573:12:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "566:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_bytes32__to_t_bytes32__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "504:3:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "509:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "520:3:82", + "type": "" + } + ], + "src": "409:182:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "651:325:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "661:22:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "675:1:82", + "type": "", + "value": "1" + }, + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "678:4:82" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "671:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "671:12:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "661:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "692:38:82", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "722:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "728:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "718:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "718:12:82" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "696:18:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "769:31:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "771:27:82", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "785:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "793:4:82", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "781:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "781:17:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "771:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "749:18:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "742:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "742:26:82" + }, + "nodeType": "YulIf", + "src": "739:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "859:111:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "880:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "887:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "892:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "883:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "883:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "873:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "873:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "873:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "924:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "927:4:82", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "917:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "917:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "917:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "952:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "955:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "945:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "945:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "945:15:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "815:18:82" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "838:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "846:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "835:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "835:14:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "812:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "812:38:82" + }, + "nodeType": "YulIf", + "src": "809:2:82" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "631:4:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "640:6:82", + "type": "" + } + ], + "src": "596:380:82" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_contract$_IResolver_$10297t_bytes32_fromMemory(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value0, value0) }\n let value := mload(headStart)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(value0, value0) }\n value0 := value\n value1 := mload(add(headStart, 32))\n }\n function abi_encode_tuple_packed_t_bytes32__to_t_bytes32__nonPadded_inplace_fromStack_reversed(pos, value0) -> end\n {\n mstore(pos, value0)\n end := add(pos, 32)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n}", + "id": 82, + "language": "Yul", + "name": "#utility.yul" + } + ], + "deployedGeneratedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:20710:82", + "statements": [ + { + "nodeType": "YulBlock", + "src": "6:3:82", + "statements": [] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "84:187:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "130:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "139:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "147:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "132:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "132:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "132:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "105:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "114:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "101:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "101:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "126:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "97:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "97:32:82" + }, + "nodeType": "YulIf", + "src": "94:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "165:36:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "191:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "178:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "178:23:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "169:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "235:5:82" + } + ], + "functionName": { + "name": "validator_revert_address", + "nodeType": "YulIdentifier", + "src": "210:24:82" + }, + "nodeType": "YulFunctionCall", + "src": "210:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "210:31:82" + }, + { + "nodeType": "YulAssignment", + "src": "250:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "260:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "250:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "50:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "61:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "73:6:82", + "type": "" + } + ], + "src": "14:257:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "357:180:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "403:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "412:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "420:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "405:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "405:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "405:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "378:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "387:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "374:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "374:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "399:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "370:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "370:32:82" + }, + "nodeType": "YulIf", + "src": "367:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "438:29:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "457:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "451:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "451:16:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "442:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "501:5:82" + } + ], + "functionName": { + "name": "validator_revert_address", + "nodeType": "YulIdentifier", + "src": "476:24:82" + }, + "nodeType": "YulFunctionCall", + "src": "476:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "476:31:82" + }, + { + "nodeType": "YulAssignment", + "src": "516:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "526:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "516:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "323:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "334:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "346:6:82", + "type": "" + } + ], + "src": "276:261:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "609:184:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "655:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "664:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "672:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "657:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "657:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "657:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "630:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "639:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "626:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "626:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "651:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "622:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "622:32:82" + }, + "nodeType": "YulIf", + "src": "619:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "690:36:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "716:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "703:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "703:23:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "694:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "757:5:82" + } + ], + "functionName": { + "name": "validator_revert_bool", + "nodeType": "YulIdentifier", + "src": "735:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "735:28:82" + }, + "nodeType": "YulExpressionStatement", + "src": "735:28:82" + }, + { + "nodeType": "YulAssignment", + "src": "772:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "782:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "772:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bool", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "575:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "586:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "598:6:82", + "type": "" + } + ], + "src": "542:251:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "876:177:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "922:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "931:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "939:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "924:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "924:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "924:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "897:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "906:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "893:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "893:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "918:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "889:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "889:32:82" + }, + "nodeType": "YulIf", + "src": "886:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "957:29:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "976:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "970:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "970:16:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "961:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1017:5:82" + } + ], + "functionName": { + "name": "validator_revert_bool", + "nodeType": "YulIdentifier", + "src": "995:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "995:28:82" + }, + "nodeType": "YulExpressionStatement", + "src": "995:28:82" + }, + { + "nodeType": "YulAssignment", + "src": "1032:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1042:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1032:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bool_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "842:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "853:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "865:6:82", + "type": "" + } + ], + "src": "798:255:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1153:294:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "1199:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1208:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1216:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1201:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1201:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1201:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1174:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1183:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1170:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1170:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1195:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1166:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1166:32:82" + }, + "nodeType": "YulIf", + "src": "1163:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1234:29:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1253:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "1247:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "1247:16:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1238:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1294:5:82" + } + ], + "functionName": { + "name": "validator_revert_bool", + "nodeType": "YulIdentifier", + "src": "1272:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "1272:28:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1272:28:82" + }, + { + "nodeType": "YulAssignment", + "src": "1309:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1319:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1309:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1333:40:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1358:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1369:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1354:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1354:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "1348:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "1348:25:82" + }, + "variables": [ + { + "name": "value_1", + "nodeType": "YulTypedName", + "src": "1337:7:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value_1", + "nodeType": "YulIdentifier", + "src": "1407:7:82" + } + ], + "functionName": { + "name": "validator_revert_address", + "nodeType": "YulIdentifier", + "src": "1382:24:82" + }, + "nodeType": "YulFunctionCall", + "src": "1382:33:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1382:33:82" + }, + { + "nodeType": "YulAssignment", + "src": "1424:17:82", + "value": { + "name": "value_1", + "nodeType": "YulIdentifier", + "src": "1434:7:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1424:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_boolt_address_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1111:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1122:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1134:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "1142:6:82", + "type": "" + } + ], + "src": "1058:389:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1522:120:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "1568:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1577:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1585:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1570:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1570:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1570:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1543:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1552:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1539:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1539:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1564:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1535:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1535:32:82" + }, + "nodeType": "YulIf", + "src": "1532:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "1603:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1626:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "1613:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "1613:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1603:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1488:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1499:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1511:6:82", + "type": "" + } + ], + "src": "1452:190:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1768:341:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "1815:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "1824:6:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "1832:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1817:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1817:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1817:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1789:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1798:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1785:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1785:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1810:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1781:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1781:33:82" + }, + "nodeType": "YulIf", + "src": "1778:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "1850:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1873:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "1860:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "1860:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1850:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1892:45:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1922:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1933:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1918:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1918:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "1905:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "1905:32:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1896:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1971:5:82" + } + ], + "functionName": { + "name": "validator_revert_address", + "nodeType": "YulIdentifier", + "src": "1946:24:82" + }, + "nodeType": "YulFunctionCall", + "src": "1946:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1946:31:82" + }, + { + "nodeType": "YulAssignment", + "src": "1986:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1996:5:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1986:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2010:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2037:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2048:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2033:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2033:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2020:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2020:32:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "2010:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2061:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2088:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2099:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2084:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2084:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2071:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2071:32:82" + }, + "variableNames": [ + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "2061:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_addresst_bytes32t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1710:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1721:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1733:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "1741:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "1749:6:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "1757:6:82", + "type": "" + } + ], + "src": "1647:462:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2218:222:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2264:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2273:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2281:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2266:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2266:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2266:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2239:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2248:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2235:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2235:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2260:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2231:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2231:32:82" + }, + "nodeType": "YulIf", + "src": "2228:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2299:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2322:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2309:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2309:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2299:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2341:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2368:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2379:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2364:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2364:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2351:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2351:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "2341:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2392:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2419:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2430:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2415:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2415:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2402:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2402:32:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "2392:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_bytes32t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2168:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2179:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2191:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2199:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "2207:6:82", + "type": "" + } + ], + "src": "2114:326:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2563:338:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2610:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2619:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2627:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2612:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2612:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2612:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2584:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2593:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2580:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2580:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2605:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2576:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2576:33:82" + }, + "nodeType": "YulIf", + "src": "2573:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2645:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2668:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2655:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2655:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2645:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2687:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2714:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2725:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2710:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2710:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2697:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2697:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "2687:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2738:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2765:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2776:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2761:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2761:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2748:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2748:32:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "2738:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "2789:45:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2819:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2830:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2815:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2815:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2802:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2802:32:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "2793:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2865:5:82" + } + ], + "functionName": { + "name": "validator_revert_bool", + "nodeType": "YulIdentifier", + "src": "2843:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "2843:28:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2843:28:82" + }, + { + "nodeType": "YulAssignment", + "src": "2880:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "2890:5:82" + }, + "variableNames": [ + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "2880:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_bytes32t_uint256t_bool", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2505:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2516:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2528:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2536:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "2544:6:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "2552:6:82", + "type": "" + } + ], + "src": "2445:456:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2993:171:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "3039:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3048:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3056:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "3041:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3041:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3041:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "3014:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3023:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3010:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3010:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3035:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "3006:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3006:32:82" + }, + "nodeType": "YulIf", + "src": "3003:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "3074:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3097:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3084:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3084:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3074:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3116:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3143:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3154:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3139:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3139:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3126:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3126:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "3116:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2951:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2962:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2974:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2982:6:82", + "type": "" + } + ], + "src": "2906:258:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3273:222:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "3319:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3328:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3336:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "3321:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3321:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3321:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "3294:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3303:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3290:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3290:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3315:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "3286:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3286:32:82" + }, + "nodeType": "YulIf", + "src": "3283:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "3354:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3377:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3364:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3364:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3354:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3396:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3423:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3434:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3419:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3419:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3406:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3406:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "3396:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3447:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3474:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3485:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3470:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3470:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3457:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3457:32:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "3447:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_uint256t_bytes32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3223:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "3234:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3246:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "3254:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "3262:6:82", + "type": "" + } + ], + "src": "3169:326:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3621:274:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "3668:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3677:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3685:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "3670:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3670:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3670:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "3642:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3651:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3638:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3638:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3663:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "3634:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3634:33:82" + }, + "nodeType": "YulIf", + "src": "3631:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "3703:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3726:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3713:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3713:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3703:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3745:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3772:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3783:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3768:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3768:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3755:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3755:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "3745:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3796:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3823:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3834:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3819:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3819:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3806:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3806:32:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "3796:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "3847:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3874:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3885:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3870:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3870:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "3857:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "3857:32:82" + }, + "variableNames": [ + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "3847:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_uint256t_bytes32t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3563:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "3574:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3586:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "3594:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "3602:6:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "3610:6:82", + "type": "" + } + ], + "src": "3500:395:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4004:222:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "4050:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4059:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4067:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "4052:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4052:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4052:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4025:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4034:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "4021:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4021:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4046:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "4017:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4017:32:82" + }, + "nodeType": "YulIf", + "src": "4014:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "4085:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4108:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "4095:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "4095:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4085:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4127:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4154:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4165:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4150:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4150:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "4137:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "4137:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4127:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4178:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4205:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4216:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4201:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4201:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "4188:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "4188:32:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "4178:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_uint256t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3954:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "3965:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3977:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "3985:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "3993:6:82", + "type": "" + } + ], + "src": "3900:326:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4301:120:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "4347:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4356:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4364:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "4349:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4349:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4349:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4322:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4331:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "4318:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4318:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4343:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "4314:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4314:32:82" + }, + "nodeType": "YulIf", + "src": "4311:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "4382:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4405:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "4392:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "4392:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4382:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4267:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "4278:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4290:6:82", + "type": "" + } + ], + "src": "4231:190:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4507:113:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "4553:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4562:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4570:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "4555:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4555:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4555:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4528:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4537:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "4524:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4524:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4549:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "4520:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4520:32:82" + }, + "nodeType": "YulIf", + "src": "4517:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "4588:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4604:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4598:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4598:16:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4588:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4473:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "4484:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4496:6:82", + "type": "" + } + ], + "src": "4426:194:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4723:157:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "4769:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4778:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4786:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "4771:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4771:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4771:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "4744:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4753:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "4740:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4740:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4765:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "4736:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4736:32:82" + }, + "nodeType": "YulIf", + "src": "4733:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "4804:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4820:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4814:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4814:16:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4804:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4839:35:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4859:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4870:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4855:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4855:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4849:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4849:25:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4839:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256t_uint256_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4681:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "4692:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4704:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "4712:6:82", + "type": "" + } + ], + "src": "4625:255:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5017:246:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "5064:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "5073:6:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "5081:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5066:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5066:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5066:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "5038:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5047:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "5034:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5034:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5059:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "5030:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5030:33:82" + }, + "nodeType": "YulIf", + "src": "5027:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "5099:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5115:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5109:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5109:16:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5099:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "5134:35:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5154:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5165:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5150:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5150:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5144:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5144:25:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "5134:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "5178:35:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5198:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5209:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5194:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5194:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5188:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5188:25:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "5178:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "5222:35:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5242:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5253:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5238:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5238:18:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5232:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5232:25:82" + }, + "variableNames": [ + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "5222:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4959:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "4970:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4982:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "4990:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "4998:6:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "5006:6:82", + "type": "" + } + ], + "src": "4885:378:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5347:214:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "5393:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5402:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5410:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5395:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5395:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5395:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "5368:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5377:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "5364:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5364:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5389:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "5360:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5360:32:82" + }, + "nodeType": "YulIf", + "src": "5357:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "5428:29:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5447:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5441:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5441:16:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "5432:5:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5505:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5514:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5522:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "5507:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5507:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5507:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5479:5:82" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5490:5:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5497:4:82", + "type": "", + "value": "0xff" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "5486:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5486:16:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "5476:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "5476:27:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "5469:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5469:35:82" + }, + "nodeType": "YulIf", + "src": "5466:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "5540:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "5550:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5540:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_uint8_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "5313:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "5324:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "5336:6:82", + "type": "" + } + ], + "src": "5268:293:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5703:137:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "5713:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5733:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5727:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5727:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "5717:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5775:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5783:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5771:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5771:17:82" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "5790:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "5795:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "5749:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "5749:53:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5749:53:82" + }, + { + "nodeType": "YulAssignment", + "src": "5811:23:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "5822:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "5827:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5818:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5818:16:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "5811:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "5679:3:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "5684:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "5695:3:82", + "type": "" + } + ], + "src": "5566:274:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6032:283:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "6042:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6062:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "6056:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "6056:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "6046:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6104:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6112:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6100:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6100:17:82" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "6119:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6124:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "6078:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "6078:53:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6078:53:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "6140:29:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "6157:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6162:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6153:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6153:16:82" + }, + "variables": [ + { + "name": "end_1", + "nodeType": "YulTypedName", + "src": "6144:5:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "6178:29:82", + "value": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "6200:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "6194:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "6194:13:82" + }, + "variables": [ + { + "name": "length_1", + "nodeType": "YulTypedName", + "src": "6182:8:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "6242:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6250:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6238:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6238:17:82" + }, + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "6257:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "6264:8:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "6216:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "6216:57:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6216:57:82" + }, + { + "nodeType": "YulAssignment", + "src": "6282:27:82", + "value": { + "arguments": [ + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "6293:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "6300:8:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6289:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6289:20:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "6282:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "6000:3:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "6005:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "6013:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "6024:3:82", + "type": "" + } + ], + "src": "5845:470:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6535:351:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "6545:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6565:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "6559:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "6559:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "6549:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "6607:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6615:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6603:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6603:17:82" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "6622:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6627:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "6581:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "6581:53:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6581:53:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "6643:29:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "6660:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6665:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6656:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6656:16:82" + }, + "variables": [ + { + "name": "end_1", + "nodeType": "YulTypedName", + "src": "6647:5:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "6681:29:82", + "value": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "6703:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "6697:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "6697:13:82" + }, + "variables": [ + { + "name": "length_1", + "nodeType": "YulTypedName", + "src": "6685:8:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "6745:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6753:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6741:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6741:17:82" + }, + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "6760:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "6767:8:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "6719:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "6719:57:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6719:57:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "6785:33:82", + "value": { + "arguments": [ + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "6802:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "6809:8:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6798:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6798:20:82" + }, + "variables": [ + { + "name": "end_2", + "nodeType": "YulTypedName", + "src": "6789:5:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "end_2", + "nodeType": "YulIdentifier", + "src": "6834:5:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "6841:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6827:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6827:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6827:21:82" + }, + { + "nodeType": "YulAssignment", + "src": "6857:23:82", + "value": { + "arguments": [ + { + "name": "end_2", + "nodeType": "YulIdentifier", + "src": "6868:5:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6875:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6864:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6864:16:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "6857:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__to_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "6495:3:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "6500:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "6508:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "6516:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "6527:3:82", + "type": "" + } + ], + "src": "6320:566:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6992:102:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7002:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7014:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7025:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7010:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7010:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "7002:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7044:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "7059:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7075:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7080:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "7071:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7071:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7084:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "7067:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7067:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "7055:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7055:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7037:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7037:51:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7037:51:82" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "6961:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "6972:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "6983:4:82", + "type": "" + } + ], + "src": "6891:203:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7256:218:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7266:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7278:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7289:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7274:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7274:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "7266:4:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "7301:29:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7319:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7324:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "7315:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7315:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7328:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "7311:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7311:19:82" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "7305:2:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7346:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "7361:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "7369:2:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "7357:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7357:15:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7339:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7339:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7339:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7393:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7404:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7389:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7389:18:82" + }, + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "7413:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "7421:2:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "7409:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7409:15:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7382:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7382:43:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7382:43:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7445:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7456:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7441:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7441:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "7461:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7434:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7434:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7434:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address_t_uint256__to_t_address_t_address_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "7209:9:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "7220:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "7228:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "7236:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "7247:4:82", + "type": "" + } + ], + "src": "7099:375:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "7664:232:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "7674:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7686:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7697:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7682:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7682:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "7674:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7717:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "7732:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7748:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7753:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "7744:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7744:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7757:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "7740:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7740:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "7728:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7728:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7710:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7710:51:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7710:51:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7781:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7792:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7777:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7777:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "7797:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7770:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7770:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7770:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7824:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7835:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7820:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7820:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "7840:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7813:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7813:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7813:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "7867:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "7878:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "7863:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "7863:18:82" + }, + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "7883:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "7856:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "7856:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "7856:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_bytes32_t_uint256_t_bytes32__to_t_address_t_bytes32_t_uint256_t_bytes32__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "7609:9:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "7620:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "7628:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "7636:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "7644:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "7655:4:82", + "type": "" + } + ], + "src": "7479:417:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8030:145:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "8040:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8052:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8063:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8048:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8048:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8040:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8082:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "8097:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8113:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8118:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "8109:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8109:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8122:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "8105:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8105:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "8093:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8093:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8075:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8075:51:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8075:51:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8146:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8157:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8142:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8142:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "8162:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8135:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8135:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8135:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "7991:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "8002:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "8010:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "8021:4:82", + "type": "" + } + ], + "src": "7901:274:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8331:484:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "8341:12:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8351:2:82", + "type": "", + "value": "32" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "8345:2:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "8362:32:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8380:9:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "8391:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8376:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8376:18:82" + }, + "variables": [ + { + "name": "tail_1", + "nodeType": "YulTypedName", + "src": "8366:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8410:9:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "8421:2:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8403:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8403:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8403:21:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "8433:17:82", + "value": { + "name": "tail_1", + "nodeType": "YulIdentifier", + "src": "8444:6:82" + }, + "variables": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "8437:3:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "8459:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "8479:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "8473:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "8473:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "8463:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "tail_1", + "nodeType": "YulIdentifier", + "src": "8502:6:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "8510:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8495:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8495:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8495:22:82" + }, + { + "nodeType": "YulAssignment", + "src": "8526:25:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8537:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8548:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8533:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8533:18:82" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8526:3:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "8560:29:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "8578:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "8586:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8574:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8574:15:82" + }, + "variables": [ + { + "name": "srcPtr", + "nodeType": "YulTypedName", + "src": "8564:6:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "8598:13:82", + "value": { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8607:4:82" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "8602:1:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8669:120:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8690:3:82" + }, + { + "arguments": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "8701:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "8695:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "8695:13:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8683:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8683:26:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8683:26:82" + }, + { + "nodeType": "YulAssignment", + "src": "8722:19:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8733:3:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "8738:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8729:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8729:12:82" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8722:3:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "8754:25:82", + "value": { + "arguments": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "8768:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "8776:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8764:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8764:15:82" + }, + "variableNames": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "8754:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "8631:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "8634:6:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "8628:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "8628:13:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "8642:18:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "8644:14:82", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "8653:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8656:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8649:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8649:9:82" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "8644:1:82" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "8624:3:82", + "statements": [] + }, + "src": "8620:169:82" + }, + { + "nodeType": "YulAssignment", + "src": "8798:11:82", + "value": { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "8806:3:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8798:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_array$_t_bytes32_$dyn_memory_ptr__to_t_array$_t_bytes32_$dyn_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "8300:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "8311:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "8322:4:82", + "type": "" + } + ], + "src": "8180:635:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "8915:92:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "8925:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8937:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "8948:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "8933:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "8933:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "8925:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "8967:9:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "8992:6:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "8985:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8985:14:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "8978:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8978:22:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "8960:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "8960:41:82" + }, + "nodeType": "YulExpressionStatement", + "src": "8960:41:82" + } + ] + }, + "name": "abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "8884:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "8895:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "8906:4:82", + "type": "" + } + ], + "src": "8820:187:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "9113:76:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "9123:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9135:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9146:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9131:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9131:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "9123:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9165:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "9176:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9158:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9158:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9158:25:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "9082:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "9093:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "9104:4:82", + "type": "" + } + ], + "src": "9012:177:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "9351:188:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "9361:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9373:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9384:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9369:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9369:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "9361:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9403:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "9414:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9396:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9396:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9396:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9441:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9452:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9437:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9437:18:82" + }, + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "9461:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9477:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9482:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "9473:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9473:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9486:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "9469:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9469:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "9457:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9457:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9430:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9430:60:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9430:60:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9510:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9521:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9506:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9506:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "9526:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9499:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9499:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9499:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_address_t_bytes32__to_t_bytes32_t_address_t_bytes32__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "9304:9:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "9315:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "9323:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "9331:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "9342:4:82", + "type": "" + } + ], + "src": "9194:345:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "9729:232:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "9739:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9751:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9762:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9747:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9747:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "9739:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9782:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "9793:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9775:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9775:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9775:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9820:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9831:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9816:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9816:18:82" + }, + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "9840:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9856:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9861:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "9852:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9852:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9865:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "9848:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9848:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "9836:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9836:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9809:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9809:60:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9809:60:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9889:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9900:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9885:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9885:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "9905:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9878:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9878:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9878:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "9932:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "9943:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "9928:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "9928:18:82" + }, + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "9948:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "9921:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "9921:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "9921:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_address_t_bytes32_t_uint256__to_t_bytes32_t_address_t_bytes32_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "9674:9:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "9685:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "9693:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "9701:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "9709:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "9720:4:82", + "type": "" + } + ], + "src": "9544:417:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "10179:306:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "10189:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10201:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10212:3:82", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10197:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10197:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "10189:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10232:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "10243:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10225:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10225:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10225:25:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "10259:29:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10277:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10282:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "10273:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10273:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10286:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "10269:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10269:19:82" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "10263:2:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10308:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10319:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10304:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10304:18:82" + }, + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "10328:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "10336:2:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "10324:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10324:15:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10297:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10297:43:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10297:43:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10360:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10371:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10356:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10356:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "10376:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10349:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10349:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10349:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10403:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10414:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10399:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10399:18:82" + }, + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "10419:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10392:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10392:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10392:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10446:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10457:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10442:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10442:19:82" + }, + { + "arguments": [ + { + "name": "value4", + "nodeType": "YulIdentifier", + "src": "10467:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "10475:2:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "10463:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10463:15:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10435:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10435:44:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10435:44:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_address_t_bytes32_t_uint256_t_address__to_t_bytes32_t_address_t_bytes32_t_uint256_t_address__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "10116:9:82", + "type": "" + }, + { + "name": "value4", + "nodeType": "YulTypedName", + "src": "10127:6:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "10135:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "10143:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "10151:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "10159:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "10170:4:82", + "type": "" + } + ], + "src": "9966:519:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "10619:119:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "10629:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10641:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10652:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10637:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10637:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "10629:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10671:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "10682:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10664:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10664:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10664:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10709:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10720:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10705:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10705:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "10725:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10698:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10698:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10698:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32__to_t_bytes32_t_bytes32__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "10580:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "10591:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "10599:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "10610:4:82", + "type": "" + } + ], + "src": "10490:248:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "10900:162:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "10910:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10922:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "10933:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10918:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10918:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "10910:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10952:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "10963:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10945:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10945:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10945:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "10990:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11001:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "10986:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "10986:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "11006:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "10979:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "10979:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "10979:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11033:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11044:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11029:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11029:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "11049:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11022:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "11022:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "11022:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_bytes32_t_uint256__to_t_bytes32_t_bytes32_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "10853:9:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "10864:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "10872:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "10880:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "10891:4:82", + "type": "" + } + ], + "src": "10743:319:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "11196:119:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "11206:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11218:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11229:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11214:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11214:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "11206:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11248:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "11259:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11241:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "11241:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "11241:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11286:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11297:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11282:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11282:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "11302:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11275:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "11275:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "11275:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_uint256__to_t_bytes32_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "11157:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "11168:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "11176:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "11187:4:82", + "type": "" + } + ], + "src": "11067:248:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "11477:162:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "11487:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11499:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11510:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11495:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11495:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "11487:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11529:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "11540:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11522:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "11522:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "11522:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11567:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11578:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11563:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11563:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "11583:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11556:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "11556:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "11556:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11610:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11621:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11606:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11606:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "11626:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11599:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "11599:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "11599:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_bytes32_t_uint256_t_uint256__to_t_bytes32_t_uint256_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "11430:9:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "11441:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "11449:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "11457:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "11468:4:82", + "type": "" + } + ], + "src": "11320:319:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "11764:102:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "11774:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11786:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11797:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "11782:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11782:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "11774:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "11816:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "11831:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11847:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11852:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "11843:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11843:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "11856:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "11839:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11839:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "11827:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "11827:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "11809:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "11809:51:82" + }, + "nodeType": "YulExpressionStatement", + "src": "11809:51:82" + } + ] + }, + "name": "abi_encode_tuple_t_contract$_IResolver_$10297__to_t_address__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "11733:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "11744:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "11755:4:82", + "type": "" + } + ], + "src": "11644:222:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "12008:119:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "12018:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12030:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12041:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12026:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12026:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "12018:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12060:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "12071:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12053:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12053:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12053:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12098:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12109:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12094:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12094:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "12114:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12087:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12087:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12087:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_rational_0_by_1_t_uint256__to_t_uint256_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "11969:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "11980:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "11988:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "11999:4:82", + "type": "" + } + ], + "src": "11871:256:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "12253:262:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12270:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12281:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12263:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12263:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12263:21:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "12293:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "12313:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "12307:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "12307:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "12297:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12340:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12351:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12336:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12336:18:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "12356:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12329:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12329:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12329:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "12398:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12406:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12394:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12394:15:82" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12415:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12426:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12411:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12411:18:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "12431:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "12372:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "12372:66:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12372:66:82" + }, + { + "nodeType": "YulAssignment", + "src": "12447:62:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12463:9:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "12482:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12490:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12478:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12478:15:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12499:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "12495:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12495:7:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "12474:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12474:29:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12459:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12459:45:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12506:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12455:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12455:54:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "12447:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "12222:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "12233:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "12244:4:82", + "type": "" + } + ], + "src": "12132:383:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "12694:294:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12711:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12722:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12704:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12704:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12704:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12745:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12756:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12741:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12741:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12761:2:82", + "type": "", + "value": "47" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12734:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12734:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12734:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12784:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12795:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12780:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12780:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12800:66:82", + "type": "", + "value": "0x4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12773:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12773:94:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12773:94:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12887:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12898:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12883:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12883:18:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12907:3:82", + "type": "", + "value": "137" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12912:32:82", + "type": "", + "value": "0x36a1b7b4b71110333ab731ba34b7b7" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "12903:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12903:42:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "12876:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "12876:70:82" + }, + "nodeType": "YulExpressionStatement", + "src": "12876:70:82" + }, + { + "nodeType": "YulAssignment", + "src": "12955:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "12967:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "12978:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "12963:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "12963:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "12955:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "12671:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "12685:4:82", + "type": "" + } + ], + "src": "12520:468:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "13167:181:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13184:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13195:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13177:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13177:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13177:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13218:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13229:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13214:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13214:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13234:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13207:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13207:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13207:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13257:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13268:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13253:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13253:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "13273:33:82", + "type": "", + "value": "Mobius: Missing Collateral Rate" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13246:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13246:61:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13246:61:82" + }, + { + "nodeType": "YulAssignment", + "src": "13316:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13328:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13339:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13324:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13324:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "13316:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_35d35c2448bc779e366373311d91f6adb640e3ec63c6a5f263ced52012750e38__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "13144:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "13158:4:82", + "type": "" + } + ], + "src": "12993:355:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "13527:231:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13544:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13555:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13537:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13537:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13537:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13578:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13589:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13574:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13574:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13594:2:82", + "type": "", + "value": "41" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13567:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13567:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13567:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13617:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13628:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13613:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13613:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "13633:34:82", + "type": "", + "value": "Mobius: transfer amount exceeds " + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13606:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13606:62:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13606:62:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13688:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13699:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13684:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13684:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "13704:11:82", + "type": "", + "value": "claimable" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13677:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13677:39:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13677:39:82" + }, + { + "nodeType": "YulAssignment", + "src": "13725:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13737:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13748:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13733:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13733:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "13725:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_383a6ebef3f1fab8a147c7052d2fe5baac23a5125ba031a71180eaf1c40ed986__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "13504:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "13518:4:82", + "type": "" + } + ], + "src": "13353:405:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "13937:230:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13954:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13965:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13947:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13947:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13947:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "13988:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "13999:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "13984:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "13984:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14004:2:82", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "13977:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "13977:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "13977:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14027:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14038:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14023:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14023:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "14043:34:82", + "type": "", + "value": "Mobius: amount must be greater t" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14016:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14016:62:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14016:62:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14098:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14109:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14094:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14094:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "14114:10:82", + "type": "", + "value": "han zero" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14087:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14087:38:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14087:38:82" + }, + { + "nodeType": "YulAssignment", + "src": "14134:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14146:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14157:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14142:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14142:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "14134:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_8134234dd9fc86052f4bc24ebeefa08d4567de47a47c9d7108b2cd53a31b643c__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "13914:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "13928:4:82", + "type": "" + } + ], + "src": "13763:404:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "14346:298:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14363:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14374:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14356:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14356:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14356:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14397:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14408:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14393:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14393:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14413:2:82", + "type": "", + "value": "49" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14386:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14386:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14386:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14436:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14447:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14432:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14432:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14452:66:82", + "type": "", + "value": "0x4d6f626975733a204e617469766520436f696e20757365202273686f72744672" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14425:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14425:94:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14425:94:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14539:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14550:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14535:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14535:18:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14559:3:82", + "type": "", + "value": "121" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14564:36:82", + "type": "", + "value": "0x37b6aa37b5b2b71110333ab731ba34b7b7" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "14555:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14555:46:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14528:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14528:74:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14528:74:82" + }, + { + "nodeType": "YulAssignment", + "src": "14611:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14623:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14634:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14619:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14619:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "14611:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_ab2fbd74cd1049bf631750db72ab64b9f0ef7c09b83c29c6fcf6e47e3b5cb850__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "14323:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "14337:4:82", + "type": "" + } + ], + "src": "14172:472:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "14823:233:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14840:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14851:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14833:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14833:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14833:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14874:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14885:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14870:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14870:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14890:2:82", + "type": "", + "value": "43" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14863:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14863:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14863:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14913:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14924:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14909:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14909:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "14929:34:82", + "type": "", + "value": "Mobius: liquidate amount exceeds" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14902:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14902:62:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14902:62:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "14984:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "14995:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "14980:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "14980:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "15000:13:82", + "type": "", + "value": " liquidable" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "14973:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "14973:41:82" + }, + "nodeType": "YulExpressionStatement", + "src": "14973:41:82" + }, + { + "nodeType": "YulAssignment", + "src": "15023:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15035:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15046:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15031:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15031:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "15023:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_af4d8cdf40d3e8e8e19a2e18f08b4065874ffee61c93af22483503bd9c3145fa__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "14800:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "14814:4:82", + "type": "" + } + ], + "src": "14649:407:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "15235:228:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15252:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15263:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15245:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15245:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15245:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15286:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15297:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15282:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15282:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15302:2:82", + "type": "", + "value": "38" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15275:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15275:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15275:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15325:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15336:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15321:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15321:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "15341:34:82", + "type": "", + "value": "Mobius: Debt must be greater tha" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15314:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15314:62:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15314:62:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15396:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15407:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15392:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15392:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "15412:8:82", + "type": "", + "value": "n zero" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15385:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15385:36:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15385:36:82" + }, + { + "nodeType": "YulAssignment", + "src": "15430:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15442:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15453:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15438:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15438:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "15430:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "15212:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "15226:4:82", + "type": "" + } + ], + "src": "15061:402:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "15642:232:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15659:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15670:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15652:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15652:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15652:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15693:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15704:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15689:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15689:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15709:2:82", + "type": "", + "value": "42" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15682:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15682:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15682:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15732:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15743:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15728:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15728:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "15748:34:82", + "type": "", + "value": "SafeERC20: ERC20 operation did n" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15721:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15721:62:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15721:62:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15803:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15814:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15799:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15799:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "15819:12:82", + "type": "", + "value": "ot succeed" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "15792:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "15792:40:82" + }, + "nodeType": "YulExpressionStatement", + "src": "15792:40:82" + }, + { + "nodeType": "YulAssignment", + "src": "15841:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "15853:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "15864:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "15849:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "15849:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "15841:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_e11ad79d1e4a7f2e5f376964cb99e8e8f7904e3fc16a109f7a7ecb9aa7956dcd__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "15619:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "15633:4:82", + "type": "" + } + ], + "src": "15468:406:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "16053:181:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16070:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16081:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16063:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16063:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16063:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16104:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16115:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16100:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16100:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16120:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16093:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16093:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16093:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16143:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16154:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16139:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16139:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "16159:33:82", + "type": "", + "value": "Mobius: Collateral Rate too low" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16132:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16132:61:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16132:61:82" + }, + { + "nodeType": "YulAssignment", + "src": "16202:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16214:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16225:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16210:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16210:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "16202:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_e30faf94e498eaeeb9198ebcaaa8204b0eea9b85b1c2b6609f6dea00348941b3__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "16030:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "16044:4:82", + "type": "" + } + ], + "src": "15879:355:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "16413:181:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16430:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16441:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16423:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16423:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16423:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16464:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16475:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16460:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16460:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16480:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16453:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16453:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16453:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16503:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16514:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16499:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16499:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "16519:33:82", + "type": "", + "value": "ReentrancyGuard: reentrant call" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16492:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16492:61:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16492:61:82" + }, + { + "nodeType": "YulAssignment", + "src": "16562:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16574:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16585:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16570:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16570:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "16562:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "16390:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "16404:4:82", + "type": "" + } + ], + "src": "16239:355:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "16700:76:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "16710:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16722:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16733:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16718:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16718:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "16710:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16752:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "16763:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16745:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16745:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16745:25:82" + } + ] + }, + "name": "abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "16669:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "16680:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "16691:4:82", + "type": "" + } + ], + "src": "16599:177:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "16910:119:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "16920:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16932:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "16943:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16928:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16928:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "16920:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "16962:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "16973:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16955:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16955:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16955:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "17000:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17011:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "16996:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "16996:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "17016:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "16989:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "16989:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "16989:34:82" + } + ] + }, + "name": "abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "16871:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "16882:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "16890:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "16901:4:82", + "type": "" + } + ], + "src": "16781:248:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "17247:250:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "17257:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "17269:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17280:3:82", + "type": "", + "value": "160" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "17265:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17265:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "17257:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "17300:9:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "17311:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "17293:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17293:25:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17293:25:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "17338:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17349:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "17334:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17334:18:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "17354:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "17327:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17327:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17327:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "17381:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17392:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "17377:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17377:18:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "17397:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "17370:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17370:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17370:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "17424:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17435:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "17420:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17420:18:82" + }, + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "17440:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "17413:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17413:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17413:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "17467:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17478:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "17463:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17463:19:82" + }, + { + "name": "value4", + "nodeType": "YulIdentifier", + "src": "17484:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "17456:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17456:35:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17456:35:82" + } + ] + }, + "name": "abi_encode_tuple_t_uint256_t_uint256_t_uint256_t_uint256_t_uint256__to_t_uint256_t_uint256_t_uint256_t_uint256_t_uint256__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "17184:9:82", + "type": "" + }, + { + "name": "value4", + "nodeType": "YulTypedName", + "src": "17195:6:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "17203:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "17211:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "17219:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "17227:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "17238:4:82", + "type": "" + } + ], + "src": "17034:463:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "17550:80:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "17577:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "17579:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "17579:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17579:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "17566:1:82" + }, + { + "arguments": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "17573:1:82" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "17569:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17569:6:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "17563:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "17563:13:82" + }, + "nodeType": "YulIf", + "src": "17560:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "17608:16:82", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "17619:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "17622:1:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "17615:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17615:9:82" + }, + "variableNames": [ + { + "name": "sum", + "nodeType": "YulIdentifier", + "src": "17608:3:82" + } + ] + } + ] + }, + "name": "checked_add_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "17533:1:82", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "17536:1:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "sum", + "nodeType": "YulTypedName", + "src": "17542:3:82", + "type": "" + } + ], + "src": "17502:128:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "17681:171:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "17712:111:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "r", + "nodeType": "YulIdentifier", + "src": "17733:1:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17740:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17745:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "17736:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17736:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "17726:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17726:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17726:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17777:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17780:4:82", + "type": "", + "value": "0x12" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "17770:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17770:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17770:15:82" + }, + { + "expression": { + "arguments": [ + { + "name": "r", + "nodeType": "YulIdentifier", + "src": "17805:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17808:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "17798:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17798:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "17798:15:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "17701:1:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "17694:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "17694:9:82" + }, + "nodeType": "YulIf", + "src": "17691:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "17832:14:82", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "17841:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "17844:1:82" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "17837:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "17837:9:82" + }, + "variableNames": [ + { + "name": "r", + "nodeType": "YulIdentifier", + "src": "17832:1:82" + } + ] + } + ] + }, + "name": "checked_div_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "17666:1:82", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "17669:1:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "r", + "nodeType": "YulTypedName", + "src": "17675:1:82", + "type": "" + } + ], + "src": "17635:217:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "17921:358:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "17931:16:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "17946:1:82", + "type": "", + "value": "1" + }, + "variables": [ + { + "name": "power_1", + "nodeType": "YulTypedName", + "src": "17935:7:82", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "17956:16:82", + "value": { + "name": "power_1", + "nodeType": "YulIdentifier", + "src": "17965:7:82" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "17956:5:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "17981:13:82", + "value": { + "name": "_base", + "nodeType": "YulIdentifier", + "src": "17989:5:82" + }, + "variableNames": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "17981:4:82" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "18045:228:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "18090:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "18092:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "18092:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "18092:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18065:4:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18079:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "18075:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18075:6:82" + }, + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18083:4:82" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "18071:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18071:17:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "18062:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18062:27:82" + }, + "nodeType": "YulIf", + "src": "18059:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "18151:29:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "18153:25:82", + "value": { + "arguments": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18166:5:82" + }, + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18173:4:82" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "18162:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18162:16:82" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18153:5:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18132:8:82" + }, + { + "name": "power_1", + "nodeType": "YulIdentifier", + "src": "18142:7:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "18128:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18128:22:82" + }, + "nodeType": "YulIf", + "src": "18125:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "18193:23:82", + "value": { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18205:4:82" + }, + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18211:4:82" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "18201:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18201:15:82" + }, + "variableNames": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18193:4:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "18229:34:82", + "value": { + "arguments": [ + { + "name": "power_1", + "nodeType": "YulIdentifier", + "src": "18245:7:82" + }, + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18254:8:82" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "18241:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18241:22:82" + }, + "variableNames": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18229:8:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18014:8:82" + }, + { + "name": "power_1", + "nodeType": "YulIdentifier", + "src": "18024:7:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "18011:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18011:21:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "18033:3:82", + "statements": [] + }, + "pre": { + "nodeType": "YulBlock", + "src": "18007:3:82", + "statements": [] + }, + "src": "18003:270:82" + } + ] + }, + "name": "checked_exp_helper", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "_base", + "nodeType": "YulTypedName", + "src": "17885:5:82", + "type": "" + }, + { + "name": "exponent", + "nodeType": "YulTypedName", + "src": "17892:8:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "power", + "nodeType": "YulTypedName", + "src": "17905:5:82", + "type": "" + }, + { + "name": "base", + "nodeType": "YulTypedName", + "src": "17912:4:82", + "type": "" + } + ], + "src": "17857:422:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "18354:61:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "18364:45:82", + "value": { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18394:4:82" + }, + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18400:8:82" + } + ], + "functionName": { + "name": "checked_exp_unsigned", + "nodeType": "YulIdentifier", + "src": "18373:20:82" + }, + "nodeType": "YulFunctionCall", + "src": "18373:36:82" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18364:5:82" + } + ] + } + ] + }, + "name": "checked_exp_t_uint256_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "base", + "nodeType": "YulTypedName", + "src": "18325:4:82", + "type": "" + }, + { + "name": "exponent", + "nodeType": "YulTypedName", + "src": "18331:8:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "power", + "nodeType": "YulTypedName", + "src": "18344:5:82", + "type": "" + } + ], + "src": "18284:131:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "18479:747:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "18517:52:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "18531:10:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18540:1:82", + "type": "", + "value": "1" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18531:5:82" + } + ] + }, + { + "nodeType": "YulLeave", + "src": "18554:5:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18499:8:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "18492:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "18492:16:82" + }, + "nodeType": "YulIf", + "src": "18489:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "18602:52:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "18616:10:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18625:1:82", + "type": "", + "value": "0" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18616:5:82" + } + ] + }, + { + "nodeType": "YulLeave", + "src": "18639:5:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18588:4:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "18581:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "18581:12:82" + }, + "nodeType": "YulIf", + "src": "18578:2:82" + }, + { + "cases": [ + { + "body": { + "nodeType": "YulBlock", + "src": "18690:52:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "18704:10:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18713:1:82", + "type": "", + "value": "1" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18704:5:82" + } + ] + }, + { + "nodeType": "YulLeave", + "src": "18727:5:82" + } + ] + }, + "nodeType": "YulCase", + "src": "18683:59:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18688:1:82", + "type": "", + "value": "1" + } + }, + { + "body": { + "nodeType": "YulBlock", + "src": "18758:123:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "18793:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "18795:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "18795:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "18795:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18778:8:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18788:3:82", + "type": "", + "value": "255" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "18775:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18775:17:82" + }, + "nodeType": "YulIf", + "src": "18772:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "18828:25:82", + "value": { + "arguments": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18841:8:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18851:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "18837:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18837:16:82" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18828:5:82" + } + ] + }, + { + "nodeType": "YulLeave", + "src": "18866:5:82" + } + ] + }, + "nodeType": "YulCase", + "src": "18751:130:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18756:1:82", + "type": "", + "value": "2" + } + } + ], + "expression": { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18670:4:82" + }, + "nodeType": "YulSwitch", + "src": "18663:218:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "18979:70:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "18993:28:82", + "value": { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "19006:4:82" + }, + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "19012:8:82" + } + ], + "functionName": { + "name": "exp", + "nodeType": "YulIdentifier", + "src": "19002:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19002:19:82" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "18993:5:82" + } + ] + }, + { + "nodeType": "YulLeave", + "src": "19034:5:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18903:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18909:2:82", + "type": "", + "value": "11" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "18900:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18900:12:82" + }, + { + "arguments": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18917:8:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18927:2:82", + "type": "", + "value": "78" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "18914:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18914:16:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "18896:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18896:35:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "18940:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18946:3:82", + "type": "", + "value": "307" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "18937:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18937:13:82" + }, + { + "arguments": [ + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "18955:8:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "18965:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "18952:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18952:16:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "18933:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "18933:36:82" + } + ], + "functionName": { + "name": "or", + "nodeType": "YulIdentifier", + "src": "18893:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "18893:77:82" + }, + "nodeType": "YulIf", + "src": "18890:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "19058:57:82", + "value": { + "arguments": [ + { + "name": "base", + "nodeType": "YulIdentifier", + "src": "19100:4:82" + }, + { + "name": "exponent", + "nodeType": "YulIdentifier", + "src": "19106:8:82" + } + ], + "functionName": { + "name": "checked_exp_helper", + "nodeType": "YulIdentifier", + "src": "19081:18:82" + }, + "nodeType": "YulFunctionCall", + "src": "19081:34:82" + }, + "variables": [ + { + "name": "power_1", + "nodeType": "YulTypedName", + "src": "19062:7:82", + "type": "" + }, + { + "name": "base_1", + "nodeType": "YulTypedName", + "src": "19071:6:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19160:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "19162:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "19162:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "19162:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "power_1", + "nodeType": "YulIdentifier", + "src": "19130:7:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19147:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "19143:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19143:6:82" + }, + { + "name": "base_1", + "nodeType": "YulIdentifier", + "src": "19151:6:82" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "19139:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19139:19:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "19127:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "19127:32:82" + }, + "nodeType": "YulIf", + "src": "19124:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "19191:29:82", + "value": { + "arguments": [ + { + "name": "power_1", + "nodeType": "YulIdentifier", + "src": "19204:7:82" + }, + { + "name": "base_1", + "nodeType": "YulIdentifier", + "src": "19213:6:82" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "19200:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19200:20:82" + }, + "variableNames": [ + { + "name": "power", + "nodeType": "YulIdentifier", + "src": "19191:5:82" + } + ] + } + ] + }, + "name": "checked_exp_unsigned", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "base", + "nodeType": "YulTypedName", + "src": "18450:4:82", + "type": "" + }, + { + "name": "exponent", + "nodeType": "YulTypedName", + "src": "18456:8:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "power", + "nodeType": "YulTypedName", + "src": "18469:5:82", + "type": "" + } + ], + "src": "18420:806:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19283:116:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "19342:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "19344:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "19344:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "19344:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "19314:1:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "19307:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "19307:9:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "19300:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "19300:17:82" + }, + { + "arguments": [ + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "19322:1:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19333:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "19329:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19329:6:82" + }, + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "19337:1:82" + } + ], + "functionName": { + "name": "div", + "nodeType": "YulIdentifier", + "src": "19325:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19325:14:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "19319:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "19319:21:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "19296:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19296:45:82" + }, + "nodeType": "YulIf", + "src": "19293:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "19373:20:82", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "19388:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "19391:1:82" + } + ], + "functionName": { + "name": "mul", + "nodeType": "YulIdentifier", + "src": "19384:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19384:9:82" + }, + "variableNames": [ + { + "name": "product", + "nodeType": "YulIdentifier", + "src": "19373:7:82" + } + ] + } + ] + }, + "name": "checked_mul_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "19262:1:82", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "19265:1:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "product", + "nodeType": "YulTypedName", + "src": "19271:7:82", + "type": "" + } + ], + "src": "19231:168:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19453:76:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "19475:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "19477:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "19477:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "19477:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "19469:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "19472:1:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "19466:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "19466:8:82" + }, + "nodeType": "YulIf", + "src": "19463:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "19506:17:82", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "19518:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "19521:1:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "19514:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19514:9:82" + }, + "variableNames": [ + { + "name": "diff", + "nodeType": "YulIdentifier", + "src": "19506:4:82" + } + ] + } + ] + }, + "name": "checked_sub_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "19435:1:82", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "19438:1:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "diff", + "nodeType": "YulTypedName", + "src": "19444:4:82", + "type": "" + } + ], + "src": "19404:125:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19587:205:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "19597:10:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19606:1:82", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "19601:1:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19666:63:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "19691:3:82" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "19696:1:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "19687:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19687:11:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "19710:3:82" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "19715:1:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "19706:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19706:11:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "19700:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "19700:18:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "19680:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "19680:39:82" + }, + "nodeType": "YulExpressionStatement", + "src": "19680:39:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "19627:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "19630:6:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "19624:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "19624:13:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "19638:19:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "19640:15:82", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "19649:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19652:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "19645:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19645:10:82" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "19640:1:82" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "19620:3:82", + "statements": [] + }, + "src": "19616:113:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19755:31:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "19768:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "19773:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "19764:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19764:16:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19782:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "19757:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "19757:27:82" + }, + "nodeType": "YulExpressionStatement", + "src": "19757:27:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "19744:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "19747:6:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "19741:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "19741:13:82" + }, + "nodeType": "YulIf", + "src": "19738:2:82" + } + ] + }, + "name": "copy_memory_to_memory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "19565:3:82", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "19570:3:82", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "19575:6:82", + "type": "" + } + ], + "src": "19534:258:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19852:325:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "19862:22:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19876:1:82", + "type": "", + "value": "1" + }, + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "19879:4:82" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "19872:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19872:12:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "19862:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "19893:38:82", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "19923:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19929:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "19919:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19919:12:82" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "19897:18:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "19970:31:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "19972:27:82", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "19986:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "19994:4:82", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "19982:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "19982:17:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "19972:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "19950:18:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "19943:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "19943:26:82" + }, + "nodeType": "YulIf", + "src": "19940:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "20060:111:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20081:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20088:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20093:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "20084:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "20084:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "20074:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20074:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20074:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20125:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20128:4:82", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "20118:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20118:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20118:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20153:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20156:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "20146:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20146:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20146:15:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "20016:18:82" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "20039:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20047:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "20036:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "20036:14:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "20013:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "20013:38:82" + }, + "nodeType": "YulIf", + "src": "20010:2:82" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "19832:4:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "19841:6:82", + "type": "" + } + ], + "src": "19797:380:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "20229:88:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "20260:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "20262:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "20262:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20262:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "20245:5:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20256:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "20252:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "20252:6:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "20242:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "20242:17:82" + }, + "nodeType": "YulIf", + "src": "20239:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "20291:20:82", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "20302:5:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20309:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "20298:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "20298:13:82" + }, + "variableNames": [ + { + "name": "ret", + "nodeType": "YulIdentifier", + "src": "20291:3:82" + } + ] + } + ] + }, + "name": "increment_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "20211:5:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "ret", + "nodeType": "YulTypedName", + "src": "20221:3:82", + "type": "" + } + ], + "src": "20182:135:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "20354:95:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20371:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20378:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20383:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "20374:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "20374:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "20364:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20364:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20364:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20411:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20414:4:82", + "type": "", + "value": "0x11" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "20404:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20404:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20404:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20435:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20438:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "20428:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20428:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20428:15:82" + } + ] + }, + "name": "panic_error_0x11", + "nodeType": "YulFunctionDefinition", + "src": "20322:127:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "20499:86:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "20563:16:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20572:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20575:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "20565:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20565:12:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20565:12:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "20522:5:82" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "20533:5:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20548:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20553:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "20544:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "20544:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20557:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "20540:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "20540:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "20529:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "20529:31:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "20519:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "20519:42:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "20512:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20512:50:82" + }, + "nodeType": "YulIf", + "src": "20509:2:82" + } + ] + }, + "name": "validator_revert_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "20488:5:82", + "type": "" + } + ], + "src": "20454:131:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "20632:76:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "20686:16:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20695:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "20698:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "20688:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20688:12:82" + }, + "nodeType": "YulExpressionStatement", + "src": "20688:12:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "20655:5:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "20676:5:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "20669:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20669:13:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "20662:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20662:21:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "20652:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "20652:32:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "20645:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "20645:40:82" + }, + "nodeType": "YulIf", + "src": "20642:2:82" + } + ] + }, + "name": "validator_revert_bool", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "20621:5:82", + "type": "" + } + ], + "src": "20590:118:82" + } + ] + }, + "contents": "{\n { }\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n let value := calldataload(headStart)\n validator_revert_address(value)\n value0 := value\n }\n function abi_decode_tuple_t_address_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n let value := mload(headStart)\n validator_revert_address(value)\n value0 := value\n }\n function abi_decode_tuple_t_bool(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n let value := calldataload(headStart)\n validator_revert_bool(value)\n value0 := value\n }\n function abi_decode_tuple_t_bool_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n let value := mload(headStart)\n validator_revert_bool(value)\n value0 := value\n }\n function abi_decode_tuple_t_boolt_address_fromMemory(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value1, value1) }\n let value := mload(headStart)\n validator_revert_bool(value)\n value0 := value\n let value_1 := mload(add(headStart, 32))\n validator_revert_address(value_1)\n value1 := value_1\n }\n function abi_decode_tuple_t_bytes32(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := calldataload(headStart)\n }\n function abi_decode_tuple_t_bytes32t_addresst_bytes32t_uint256(headStart, dataEnd) -> value0, value1, value2, value3\n {\n if slt(sub(dataEnd, headStart), 128) { revert(value2, value2) }\n value0 := calldataload(headStart)\n let value := calldataload(add(headStart, 32))\n validator_revert_address(value)\n value1 := value\n value2 := calldataload(add(headStart, 64))\n value3 := calldataload(add(headStart, 96))\n }\n function abi_decode_tuple_t_bytes32t_bytes32t_uint256(headStart, dataEnd) -> value0, value1, value2\n {\n if slt(sub(dataEnd, headStart), 96) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n value2 := calldataload(add(headStart, 64))\n }\n function abi_decode_tuple_t_bytes32t_bytes32t_uint256t_bool(headStart, dataEnd) -> value0, value1, value2, value3\n {\n if slt(sub(dataEnd, headStart), 128) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n value2 := calldataload(add(headStart, 64))\n let value := calldataload(add(headStart, 96))\n validator_revert_bool(value)\n value3 := value\n }\n function abi_decode_tuple_t_bytes32t_uint256(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n }\n function abi_decode_tuple_t_bytes32t_uint256t_bytes32(headStart, dataEnd) -> value0, value1, value2\n {\n if slt(sub(dataEnd, headStart), 96) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n value2 := calldataload(add(headStart, 64))\n }\n function abi_decode_tuple_t_bytes32t_uint256t_bytes32t_uint256(headStart, dataEnd) -> value0, value1, value2, value3\n {\n if slt(sub(dataEnd, headStart), 128) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n value2 := calldataload(add(headStart, 64))\n value3 := calldataload(add(headStart, 96))\n }\n function abi_decode_tuple_t_bytes32t_uint256t_uint256(headStart, dataEnd) -> value0, value1, value2\n {\n if slt(sub(dataEnd, headStart), 96) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n value2 := calldataload(add(headStart, 64))\n }\n function abi_decode_tuple_t_uint256(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := calldataload(headStart)\n }\n function abi_decode_tuple_t_uint256_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := mload(headStart)\n }\n function abi_decode_tuple_t_uint256t_uint256_fromMemory(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value0, value0) }\n value0 := mload(headStart)\n value1 := mload(add(headStart, 32))\n }\n function abi_decode_tuple_t_uint256t_uint256t_uint256t_uint256_fromMemory(headStart, dataEnd) -> value0, value1, value2, value3\n {\n if slt(sub(dataEnd, headStart), 128) { revert(value2, value2) }\n value0 := mload(headStart)\n value1 := mload(add(headStart, 32))\n value2 := mload(add(headStart, 64))\n value3 := mload(add(headStart, 96))\n }\n function abi_decode_tuple_t_uint8_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n let value := mload(headStart)\n if iszero(eq(value, and(value, 0xff))) { revert(value0, value0) }\n value0 := value\n }\n function abi_encode_tuple_packed_t_bytes_memory_ptr__to_t_bytes_memory_ptr__nonPadded_inplace_fromStack_reversed(pos, value0) -> end\n {\n let length := mload(value0)\n copy_memory_to_memory(add(value0, 0x20), pos, length)\n end := add(pos, length)\n }\n function abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr__nonPadded_inplace_fromStack_reversed(pos, value1, value0) -> end\n {\n let length := mload(value0)\n copy_memory_to_memory(add(value0, 0x20), pos, length)\n let end_1 := add(pos, length)\n let length_1 := mload(value1)\n copy_memory_to_memory(add(value1, 0x20), end_1, length_1)\n end := add(end_1, length_1)\n }\n function abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__to_t_string_memory_ptr_t_string_memory_ptr_t_bytes32__nonPadded_inplace_fromStack_reversed(pos, value2, value1, value0) -> end\n {\n let length := mload(value0)\n copy_memory_to_memory(add(value0, 0x20), pos, length)\n let end_1 := add(pos, length)\n let length_1 := mload(value1)\n copy_memory_to_memory(add(value1, 0x20), end_1, length_1)\n let end_2 := add(end_1, length_1)\n mstore(end_2, value2)\n end := add(end_2, 0x20)\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_address_t_address_t_uint256__to_t_address_t_address_t_uint256__fromStack_reversed(headStart, value2, value1, value0) -> tail\n {\n tail := add(headStart, 96)\n let _1 := sub(shl(160, 1), 1)\n mstore(headStart, and(value0, _1))\n mstore(add(headStart, 32), and(value1, _1))\n mstore(add(headStart, 64), value2)\n }\n function abi_encode_tuple_t_address_t_bytes32_t_uint256_t_bytes32__to_t_address_t_bytes32_t_uint256_t_bytes32__fromStack_reversed(headStart, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 128)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n }\n function abi_encode_tuple_t_address_t_uint256__to_t_address_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n mstore(add(headStart, 32), value1)\n }\n function abi_encode_tuple_t_array$_t_bytes32_$dyn_memory_ptr__to_t_array$_t_bytes32_$dyn_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n let _1 := 32\n let tail_1 := add(headStart, _1)\n mstore(headStart, _1)\n let pos := tail_1\n let length := mload(value0)\n mstore(tail_1, length)\n pos := add(headStart, 64)\n let srcPtr := add(value0, _1)\n let i := tail\n for { } lt(i, length) { i := add(i, 1) }\n {\n mstore(pos, mload(srcPtr))\n pos := add(pos, _1)\n srcPtr := add(srcPtr, _1)\n }\n tail := pos\n }\n function abi_encode_tuple_t_bool__to_t_bool__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, iszero(iszero(value0)))\n }\n function abi_encode_tuple_t_bytes32__to_t_bytes32__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function abi_encode_tuple_t_bytes32_t_address_t_bytes32__to_t_bytes32_t_address_t_bytes32__fromStack_reversed(headStart, value2, value1, value0) -> tail\n {\n tail := add(headStart, 96)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), value2)\n }\n function abi_encode_tuple_t_bytes32_t_address_t_bytes32_t_uint256__to_t_bytes32_t_address_t_bytes32_t_uint256__fromStack_reversed(headStart, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 128)\n mstore(headStart, value0)\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n }\n function abi_encode_tuple_t_bytes32_t_address_t_bytes32_t_uint256_t_address__to_t_bytes32_t_address_t_bytes32_t_uint256_t_address__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n let _1 := sub(shl(160, 1), 1)\n mstore(add(headStart, 32), and(value1, _1))\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), and(value4, _1))\n }\n function abi_encode_tuple_t_bytes32_t_bytes32__to_t_bytes32_t_bytes32__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n }\n function abi_encode_tuple_t_bytes32_t_bytes32_t_uint256__to_t_bytes32_t_bytes32_t_uint256__fromStack_reversed(headStart, value2, value1, value0) -> tail\n {\n tail := add(headStart, 96)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n }\n function abi_encode_tuple_t_bytes32_t_uint256__to_t_bytes32_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n }\n function abi_encode_tuple_t_bytes32_t_uint256_t_uint256__to_t_bytes32_t_uint256_t_uint256__fromStack_reversed(headStart, value2, value1, value0) -> tail\n {\n tail := add(headStart, 96)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n }\n function abi_encode_tuple_t_contract$_IResolver_$10297__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_rational_0_by_1_t_uint256__to_t_uint256_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n }\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n let length := mload(value0)\n mstore(add(headStart, 32), length)\n copy_memory_to_memory(add(value0, 32), add(headStart, 64), length)\n tail := add(add(headStart, and(add(length, 31), not(31))), 64)\n }\n function abi_encode_tuple_t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 47)\n mstore(add(headStart, 64), 0x4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f)\n mstore(add(headStart, 96), shl(137, 0x36a1b7b4b71110333ab731ba34b7b7))\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_t_stringliteral_35d35c2448bc779e366373311d91f6adb640e3ec63c6a5f263ced52012750e38__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 31)\n mstore(add(headStart, 64), \"Mobius: Missing Collateral Rate\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_383a6ebef3f1fab8a147c7052d2fe5baac23a5125ba031a71180eaf1c40ed986__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 41)\n mstore(add(headStart, 64), \"Mobius: transfer amount exceeds \")\n mstore(add(headStart, 96), \"claimable\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_t_stringliteral_8134234dd9fc86052f4bc24ebeefa08d4567de47a47c9d7108b2cd53a31b643c__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 40)\n mstore(add(headStart, 64), \"Mobius: amount must be greater t\")\n mstore(add(headStart, 96), \"han zero\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_t_stringliteral_ab2fbd74cd1049bf631750db72ab64b9f0ef7c09b83c29c6fcf6e47e3b5cb850__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 49)\n mstore(add(headStart, 64), 0x4d6f626975733a204e617469766520436f696e20757365202273686f72744672)\n mstore(add(headStart, 96), shl(121, 0x37b6aa37b5b2b71110333ab731ba34b7b7))\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_t_stringliteral_af4d8cdf40d3e8e8e19a2e18f08b4065874ffee61c93af22483503bd9c3145fa__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 43)\n mstore(add(headStart, 64), \"Mobius: liquidate amount exceeds\")\n mstore(add(headStart, 96), \" liquidable\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 38)\n mstore(add(headStart, 64), \"Mobius: Debt must be greater tha\")\n mstore(add(headStart, 96), \"n zero\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_t_stringliteral_e11ad79d1e4a7f2e5f376964cb99e8e8f7904e3fc16a109f7a7ecb9aa7956dcd__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 42)\n mstore(add(headStart, 64), \"SafeERC20: ERC20 operation did n\")\n mstore(add(headStart, 96), \"ot succeed\")\n tail := add(headStart, 128)\n }\n function abi_encode_tuple_t_stringliteral_e30faf94e498eaeeb9198ebcaaa8204b0eea9b85b1c2b6609f6dea00348941b3__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 31)\n mstore(add(headStart, 64), \"Mobius: Collateral Rate too low\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_stringliteral_ebf73bba305590e4764d5cb53b69bffd6d4d092d1a67551cb346f8cfcdab8619__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 31)\n mstore(add(headStart, 64), \"ReentrancyGuard: reentrant call\")\n tail := add(headStart, 96)\n }\n function abi_encode_tuple_t_uint256__to_t_uint256__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, value0)\n }\n function abi_encode_tuple_t_uint256_t_uint256__to_t_uint256_t_uint256__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n }\n function abi_encode_tuple_t_uint256_t_uint256_t_uint256_t_uint256_t_uint256__to_t_uint256_t_uint256_t_uint256_t_uint256_t_uint256__fromStack_reversed(headStart, value4, value3, value2, value1, value0) -> tail\n {\n tail := add(headStart, 160)\n mstore(headStart, value0)\n mstore(add(headStart, 32), value1)\n mstore(add(headStart, 64), value2)\n mstore(add(headStart, 96), value3)\n mstore(add(headStart, 128), value4)\n }\n function checked_add_t_uint256(x, y) -> sum\n {\n if gt(x, not(y)) { panic_error_0x11() }\n sum := add(x, y)\n }\n function checked_div_t_uint256(x, y) -> r\n {\n if iszero(y)\n {\n mstore(r, shl(224, 0x4e487b71))\n mstore(4, 0x12)\n revert(r, 0x24)\n }\n r := div(x, y)\n }\n function checked_exp_helper(_base, exponent) -> power, base\n {\n let power_1 := 1\n power := power_1\n base := _base\n for { } gt(exponent, power_1) { }\n {\n if gt(base, div(not(0), base)) { panic_error_0x11() }\n if and(exponent, power_1) { power := mul(power, base) }\n base := mul(base, base)\n exponent := shr(power_1, exponent)\n }\n }\n function checked_exp_t_uint256_t_uint256(base, exponent) -> power\n {\n power := checked_exp_unsigned(base, exponent)\n }\n function checked_exp_unsigned(base, exponent) -> power\n {\n if iszero(exponent)\n {\n power := 1\n leave\n }\n if iszero(base)\n {\n power := 0\n leave\n }\n switch base\n case 1 {\n power := 1\n leave\n }\n case 2 {\n if gt(exponent, 255) { panic_error_0x11() }\n power := shl(exponent, 1)\n leave\n }\n if or(and(lt(base, 11), lt(exponent, 78)), and(lt(base, 307), lt(exponent, 32)))\n {\n power := exp(base, exponent)\n leave\n }\n let power_1, base_1 := checked_exp_helper(base, exponent)\n if gt(power_1, div(not(0), base_1)) { panic_error_0x11() }\n power := mul(power_1, base_1)\n }\n function checked_mul_t_uint256(x, y) -> product\n {\n if and(iszero(iszero(x)), gt(y, div(not(0), x))) { panic_error_0x11() }\n product := mul(x, y)\n }\n function checked_sub_t_uint256(x, y) -> diff\n {\n if lt(x, y) { panic_error_0x11() }\n diff := sub(x, y)\n }\n function copy_memory_to_memory(src, dst, length)\n {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n if gt(i, length) { mstore(add(dst, length), 0) }\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function increment_t_uint256(value) -> ret\n {\n if eq(value, not(0)) { panic_error_0x11() }\n ret := add(value, 1)\n }\n function panic_error_0x11()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n function validator_revert_address(value)\n {\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n }\n function validator_revert_bool(value)\n {\n if iszero(eq(value, iszero(iszero(value)))) { revert(0, 0) }\n }\n}", + "id": 82, + "language": "Yul", + "name": "#utility.yul" + } + ], + "sourceMap": "506:9143:6:-:0;;;686:445;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;347:5:21;:18;;355:10;-1:-1:-1;;;;;;347:18:21;;;;;;;375:7;:20;;-1:-1:-1;;;;;;410:14:22;-1:-1:-1;;;;410:14:22;;;;;;;;;373:8:20;:20;;;;;-1:-1:-1;;;;;373:20:20;;;;;1741:7:60;:22;772:10:6::1;:24:::0;;;806:32:::1;-1:-1:-1::0;;;806:15:6::1;:32::i;:::-;848:276;;;;;;;;-1:-1:-1::0;;;848:276:6::1;;;;-1:-1:-1::0;;;848:276:6::1;;;;-1:-1:-1::0;;;848:276:6::1;;;;-1:-1:-1::0;;;848:276:6::1;;;;-1:-1:-1::0;;;848:276:6::1;;;;-1:-1:-1::0;;;848:276:6::1;;;;-1:-1:-1::0;;;848:276:6::1;;;;1091:23;848:276;;::::0;:7:::1;:276;;;;;;;:::i;:::-;;686:445:::0;;506:9143;;1389:128:21;1478:31;;;;;;;538:19:82;;;1478:31:21;;;;;;;;;573:12:82;;;1478:31:21;;;1456:54;;;;:12;;:54;;;:::i;:::-;;1389:128;:::o;506:9143:6:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;506:9143:6;;;-1:-1:-1;506:9143:6;:::i;:::-;;;:::o;:::-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;14:390:82;112:6;120;173:2;161:9;152:7;148:23;144:32;141:2;;;194:6;186;179:22;141:2;225:16;;-1:-1:-1;;;;;270:31:82;;260:42;;250:2;;321:6;313;306:22;250:2;394;379:18;;;;373:25;349:5;;373:25;;-1:-1:-1;;;131:273:82:o;596:380::-;675:1;671:12;;;;718;;;739:2;;793:4;785:6;781:17;771:27;;739:2;846;838:6;835:14;815:18;812:38;809:2;;;892:10;887:3;883:20;880:1;873:31;927:4;924:1;917:15;955:4;952:1;945:15;809:2;;651:325;;;:::o;:::-;506:9143:6;;;;;;", + "deployedSourceMap": "506:9143:6:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;217:25:20;;;;;;;;;;-1:-1:-1;217:25:20;;;;;;;;;;;7067:19:82;7055:32;;;7037:51;;7025:2;7010:18;217:25:20;;;;;;;;2147:351:6;;;;;;;;;;-1:-1:-1;2147:351:6;;;;;:::i;:::-;;:::i;:::-;;;9158:25:82;;;9146:2;9131:18;2147:351:6;9113:76:82;1753:94:20;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;4640:673:6:-;;;;;;;;;;-1:-1:-1;4640:673:6;;;;;:::i;:::-;;:::i;:::-;;;;10664:25:82;;;10720:2;10705:18;;10698:34;;;;10637:18;4640:673:6;10619:119:82;913:219:21;;;;;;;;;;-1:-1:-1;913:219:21;;;;;:::i;:::-;;:::i;:::-;;645:34:6;;;;;;;;;;;;;;;;437:168:22;;;;;;;;;;-1:-1:-1;437:168:22;;;;;:::i;:::-;;:::i;2632:102:20:-;;;;;;;;;;-1:-1:-1;2632:102:20;;;;;:::i;:::-;2689:7;2715:12;;;:6;:12;;;;;;;;;2632:102;6378:354:6;;;;;;:::i;:::-;;:::i;:::-;;;8985:14:82;;8978:22;8960:41;;8948:2;8933:18;6378:354:6;8915:92:82;5319:483:6;;;;;;;;;;-1:-1:-1;5319:483:6;;;;;:::i;:::-;;:::i;294:22:21:-;;;;;;;;;;-1:-1:-1;294:22:21;;;;;;;;181:18:22;;;;;;;;;;-1:-1:-1;181:18:22;;;;;;;;;;;3072:382:6;;;;;;;;;;-1:-1:-1;3072:382:6;;;;;:::i;:::-;;:::i;227:35:21:-;;;;;;;;;;;;;:::i;:::-;;;;;;;:::i;1888:253:6:-;;;;;;:::i;:::-;;:::i;2290:138:20:-;;;;;;;;;;-1:-1:-1;2290:138:20;;;;;:::i;:::-;;:::i;268:20:21:-;;;;;;;;;;-1:-1:-1;268:20:21;;;;;;;;2504:274:6;;;;;;;;;;-1:-1:-1;2504:274:6;;;;;:::i;:::-;;:::i;2784:282::-;;;;;;:::i;:::-;;:::i;6738:446::-;;;;;;;;;;-1:-1:-1;6738:446:6;;;;;:::i;:::-;;:::i;1138:245:21:-;;;;;;;;;;-1:-1:-1;1138:245:21;;;;;:::i;:::-;;:::i;1539:208:20:-;;;;;;;;;;;;;:::i;3460:309:6:-;;;;;;;;;;-1:-1:-1;3460:309:6;;;;;:::i;:::-;;:::i;8401:1246::-;;;;;;;;;;-1:-1:-1;8401:1246:6;;;;;:::i;:::-;;:::i;7797:598::-;;;;;;;;;;-1:-1:-1;7797:598:6;;;;;:::i;:::-;;:::i;2147:351::-;2265:7;1679:1:60;2258:7;;:19;;2250:63;;;;;;;16441:2:82;2250:63:60;;;16423:21:82;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60;;;;;;;;;1679:1;2388:7;:18;2301:10:6::1;::::0;2292:19;::::1;;2284:79;;;::::0;::::1;::::0;;12722:2:82;2284:79:6::1;::::0;::::1;12704:21:82::0;12761:2;12741:18;;;12734:30;12800:66;12780:18;;;12773:94;12903:42;12883:18;;;12876:70;12963:19;;2284:79:6::1;12694:294:82::0;2284:79:6::1;2374:26;2381:5;2388:3;2393:6;2374;:26::i;:::-;2410:14;2427:41;2433:5;2440:6;2448:3;2453:14;2427:5;:41::i;:::-;1636:1:60::0;2561:7;:22;2410:58:6;2147:351;-1:-1:-1;;;;;2147:351:6:o;1753:94:20:-;1798:16;1833:7;1826:14;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1753:94;:::o;4640:673:6:-;4768:7;4777;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:31;;;;:::i;:::-;313:49;;;;;;;;;;;;;;:::i;:::-;;1679:1:60::1;2258:7;;:19;;2250:63;;;::::0;::::1;::::0;;16441:2:82;2250:63:60::1;::::0;::::1;16423:21:82::0;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60::1;16413:181:82::0;2250:63:60::1;1679:1;2388:7;:18:::0;4796:28:6::2;4827:8;:6;:8::i;:::-;:55;::::0;;;;::::2;::::0;::::2;9396:25:82::0;;;4861:10:6::2;9437:18:82::0;;;9430:60;9506:18;;;9499:34;;;4827:26:6::2;::::0;;;::::2;::::0;::::2;::::0;9369:18:82;;4827:55:6::2;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4796:86;;4892:18;4913:8;:6;:8::i;:::-;:66;::::0;;;;::::2;::::0;::::2;10225:25:82::0;;;4938:10:6::2;10304:18:82::0;;;10297:43;;;10356:18;;;10349:34;;;10399:18;;;10392:34;;;10442:19;;;10435:44;4913:17:6::2;::::0;;;::::2;::::0;::::2;::::0;10197:19:82;;4913:66:6::2;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4892:87;;4990:17;5025:8;5021:183;;;5061:8;:6;:8::i;:::-;:72;::::0;;;;::::2;::::0;::::2;9775:25:82::0;;;5090:10:6::2;9816:18:82::0;;;9809:60;9885:18;;;9878:34;;;9928:18;;;9921:34;;;5061:21:6::2;::::0;;;::::2;::::0;::::2;::::0;9747:19:82;;5061:72:6::2;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;5049:84;;5147:46;5154:5;5161:8;5171:9;5182:10;5147:6;:46::i;:::-;;5021:183;5245:8;5238:5;5226:10;5219:47;;;5255:10;5219:47;;;;9158:25:82::0;;9146:2;9131:18;;9113:76;5219:47:6::2;;;;;;;;1636:1:60::1;2561:7;:22:::0;5284:10:6;;;;-1:-1:-1;4640:673:6;-1:-1:-1;;;;;;4640:673:6:o;913:219:21:-;461:5;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;;1000:1:::1;982:20;;:6;:20;;;;1004:54;;;;;;;;;;;;;;;;;::::0;:12:::1;:19;;;;;:::i;:54::-;974:85;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;1087:5:21::1;::::0;1074:27:::1;::::0;::::1;::::0;;::::1;::::0;1087:5:::1;::::0;1074:27:::1;::::0;1087:5:::1;::::0;1074:27:::1;1111:5;:14:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;913:219::o;437:168:22:-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;503:6:22::1;::::0;::::1;::::0;;;::::1;;:17;;::::0;::::1;;;499:30;;;437:168:::0;:::o;499:30::-:1;556:6;::::0;543:29:::1;::::0;;::::1;;::::0;556:6;;::::1;;;543:29;;::::0;::::1;::::0;;;::::1;582:6;:16:::0;;;::::1;::::0;;::::1;;;;::::0;;527:1:21::1;437:168:22::0;:::o;6378:354:6:-;6467:4;1679:1:60;2258:7;;:19;;2250:63;;;;;;;16441:2:82;2250:63:60;;;16423:21:82;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60;16413:181:82;2250:63:60;1679:1;2388:7;:18;6544:1:6::1;6491:8;:6;:8::i;:::-;6508:10;::::0;6491:50:::1;::::0;;;;::::1;::::0;::::1;9396:25:82::0;;;;6520:10:6::1;9437:18:82::0;;;9430:60;9506:18;;;9499:34;;;6491:16:6::1;::::0;;;::::1;::::0;::::1;::::0;9369:18:82;;6491:50:6::1;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:54;6483:105;;;::::0;::::1;::::0;;15263:2:82;6483:105:6::1;::::0;::::1;15245:21:82::0;15302:2;15282:18;;;15275:30;15341:34;15321:18;;;15314:62;15412:8;15392:18;;;15385:36;15438:19;;6483:105:6::1;15235:228:82::0;6483:105:6::1;6599:39;6606:10;;6618:8;6628:9;6599:6;:39::i;:::-;6684:8;6672:10;;6660;6653:51;;;6694:9;6653:51;;;;9158:25:82::0;;9146:2;9131:18;;9113:76;6653:51:6::1;;;;;;;;-1:-1:-1::0;6721:4:6::1;1636:1:60::0;2561:7;:22;6378:354:6;;-1:-1:-1;6378:354:6:o;5319:483::-;5463:4;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:31::-;313:49;;;;;;;;;;;;;;:::i;:::-;;1679:1:60::1;2258:7;;:19;;2250:63;;;::::0;::::1;::::0;;16441:2:82;2250:63:60::1;::::0;::::1;16423:21:82::0;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60::1;16413:181:82::0;2250:63:60::1;1679:1;2388:7;:18:::0;5479:26:6::2;5508:9;:7;:9::i;:::-;:44;::::0;;;;::::2;::::0;::::2;10664:25:82::0;;;10705:18;;;10698:34;;;5508:27:6::2;::::0;;;::::2;::::0;::::2;::::0;10637:18:82;;5508:44:6::2;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;5479:73;;5562:17;5582:8;:6;:8::i;:::-;:70;::::0;;;;::::2;::::0;::::2;9775:25:82::0;;;5611:10:6::2;9816:18:82::0;;;9809:60;9885:18;;;9878:34;;;9928:18;;;9921:34;;;5582:21:6::2;::::0;;;::::2;::::0;::::2;::::0;9747:19:82;;5582:70:6::2;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;5562:90;;5683:6;5670:9;:19;;5662:73;;;::::0;::::2;::::0;;13555:2:82;5662:73:6::2;::::0;::::2;13537:21:82::0;13594:2;13574:18;;;13567:30;13633:34;13613:18;;;13606:62;13704:11;13684:18;;;13677:39;13733:19;;5662:73:6::2;13527:231:82::0;5662:73:6::2;5752:43;5759:5;5766:8;5776:6;5784:10;5752:6;:43::i;:::-;1636:1:60::1;2561:7;:22:::0;5745:50:6;5319:483;-1:-1:-1;;;;;;5319:483:6:o;3072:382::-;3209:7;1679:1:60;2258:7;;:19;;2250:63;;;;;;;16441:2:82;2250:63:60;;;16423:21:82;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60;16413:181:82;2250:63:60;1679:1;2388:7;:18;3245:10:6::1;::::0;3236:19;::::1;;3228:81;;;::::0;::::1;::::0;;14374:2:82;3228:81:6::1;::::0;::::1;14356:21:82::0;14413:2;14393:18;;;14386:30;14452:66;14432:18;;;14425:94;14555:46;14535:18;;;14528:74;14619:19;;3228:81:6::1;14346:298:82::0;3228:81:6::1;3320:31;3327:5;3334:8;3344:6;3320;:31::i;:::-;3361:14;3378:46;3384:5;3391:6;3399:8;3409:14;3378:5;:46::i;227:35:21:-:0;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1888:253:6:-;1982:7;1679:1:60;2258:7;;:19;;2250:63;;;;;;;16441:2:82;2250:63:60;;;16423:21:82;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60;16413:181:82;2250:63:60;1679:1;2388:7;:18;2008:10:6::1;::::0;2001:34:::1;::::0;2020:3:::1;2025:9;2001:6;:34::i;:::-;2045:14;2062:49;2068:10;;2080:9;2091:3;2096:14;2062:5;:49::i;:::-;1636:1:60::0;2561:7;:22;2045:66:6;1888:253;-1:-1:-1;;;1888:253:6:o;2290:138:20:-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;2368:8:20::1;::::0;:25:::1;::::0;;;;::::1;::::0;::::1;9158::82::0;;;2368:8:20::1;::::0;;::::1;::::0;:19:::1;::::0;9131:18:82;;2368:25:20::1;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;2353:12;::::0;;;:6:::1;:12;::::0;;;;:40;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;;2403:7:::1;:18:::0;;-1:-1:-1;2403:18:20;::::1;::::0;;;;;::::1;::::0;2290:138::o;2504:274:6:-;2616:4;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:31::-;313:49;;;;;;;;;;;;;;:::i;:::-;;1679:1:60::1;2258:7;;:19;;2250:63;;;::::0;::::1;::::0;;16441:2:82;2250:63:60::1;::::0;::::1;16423:21:82::0;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60::1;16413:181:82::0;2250:63:60::1;1679:1;2388:7;:18:::0;2632:8:6::2;:6;:8::i;:::-;:67;::::0;;;;::::2;::::0;::::2;9775:25:82::0;;;2675:10:6::2;9816:18:82::0;;;9809:60;2687:3:6::2;9885:18:82::0;;;9878:34;9928:18;;;9921:34;;;2632:35:6::2;::::0;;;::::2;::::0;::::2;::::0;9747:19:82;;2632:67:6::2;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;-1:-1:-1::0;;2714:36:6::2;::::0;;2740:1:::2;10664:25:82::0;;10720:2;10705:18;;10698:34;;;2733:5:6;;-1:-1:-1;2721:10:6::2;::::0;-1:-1:-1;2714:36:6::2;::::0;10637:18:82;2714:36:6::2;;;;;;;-1:-1:-1::0;2767:4:6::2;1636:1:60::0;2561:7:::1;:22:::0;2504:274:6;;-1:-1:-1;;2504:274:6:o;2784:282::-;2897:7;1679:1:60;2258:7;;:19;;2250:63;;;;;;;16441:2:82;2250:63:60;;;16423:21:82;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60;16413:181:82;2250:63:60;1679:1;2388:7;:18;2923:10:6::1;::::0;2916:39:::1;::::0;2935:8;2945:9:::1;2916:6;:39::i;:::-;2965:14;2982:54;2988:10;;3000:9;3011:8;3021:14;2982:5;:54::i;:::-;1636:1:60::0;2561:7;:22;2965:71:6;2784:282;-1:-1:-1;;;;2784:282:6:o;6738:446::-;6851:4;1679:1:60;2258:7;;:19;;2250:63;;;;;;;16441:2:82;2250:63:60;;;16423:21:82;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60;16413:181:82;2250:63:60;1679:1;2388:7;:18;6884:10:6::1;::::0;6875:19;::::1;;6867:79;;;::::0;::::1;::::0;;12722:2:82;6867:79:6::1;::::0;::::1;12704:21:82::0;12761:2;12741:18;;;12734:30;12800:66;12780:18;;;12773:94;12903:42;12883:18;;;12876:70;12963:19;;6867:79:6::1;12694:294:82::0;6867:79:6::1;7012:1;6964:8;:6;:8::i;:::-;:45;::::0;;;;::::1;::::0;::::1;9396:25:82::0;;;6988:10:6::1;9437:18:82::0;;;9430:60;9506:18;;;9499:34;;;6964:16:6::1;::::0;;;::::1;::::0;::::1;::::0;9369:18:82;;6964:45:6::1;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;:49;6956:100;;;::::0;::::1;::::0;;15263:2:82;6956:100:6::1;::::0;::::1;15245:21:82::0;15302:2;15282:18;;;15275:30;15341:34;15321:18;;;15314:62;15412:8;15392:18;;;15385:36;15438:19;;6956:100:6::1;15235:228:82::0;6956:100:6::1;7067:31;7074:5;7081:8;7091:6;7067;:31::i;:::-;7139:8;7132:5;7120:10;7113:43;;;7149:6;7113:43;;;;9158:25:82::0;;9146:2;9131:18;;9113:76;7113:43:6::1;;;;;;;;-1:-1:-1::0;7173:4:6::1;1636:1:60::0;2561:7;:22;6738:446:6;;-1:-1:-1;;;6738:446:6:o;1138:245:21:-;461:5;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;;1239:1:::1;1219:22;;:8;:22;;;;1243:56;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:56::-;1211:89;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;1330:7:21::1;::::0;1315:33:::1;::::0;::::1;::::0;;::::1;::::0;1330:7:::1;::::0;1315:33:::1;::::0;1330:7:::1;::::0;1315:33:::1;1358:7;:18:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;1138:245::o;1539:208:20:-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;;1597:9:20::1;1592:149;1616:7;:14:::0;1612:18;::::1;1592:149;;;1651:12;1666:7;1674:1;1666:10;;;;;;;;;;;;;;;;;::::0;;;::::1;::::0;;;::::1;::::0;1705:8:::1;::::0;:25:::1;::::0;;;;::::1;::::0;::::1;9158::82::0;;;1666:10:20;;-1:-1:-1;1705:8:20::1;;::::0;:19:::1;::::0;9131:18:82;;1705:25:20::1;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1690:12;::::0;;;:6:::1;:12;::::0;;;;;:40;;;::::1;;::::0;;::::1;::::0;;;::::1;::::0;;1632:3;::::1;::::0;::::1;:::i;:::-;;;;1592:149;;3460:309:6::0;3591:4;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:31::-;313:49;;;;;;;;;;;;;;:::i;:::-;;1679:1:60::1;2258:7;;:19;;2250:63;;;::::0;::::1;::::0;;16441:2:82;2250:63:60::1;::::0;::::1;16423:21:82::0;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60::1;16413:181:82::0;2250:63:60::1;1679:1;2388:7;:18:::0;3607:8:6::2;:6;:8::i;:::-;:72;::::0;;;;::::2;::::0;::::2;9775:25:82::0;;;3650:10:6::2;9816:18:82::0;;;9809:60;9885:18;;;9878:34;;;9928:18;;;9921:34;;;3607:35:6::2;::::0;;;::::2;::::0;::::2;::::0;9747:19:82;;3607:72:6::2;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;-1:-1:-1::0;;3694:47:6::2;::::0;;3731:1:::2;10664:25:82::0;;10720:2;10705:18;;10698:34;;;3721:8:6;;-1:-1:-1;3714:5:6;;-1:-1:-1;3702:10:6::2;::::0;3694:47:::2;::::0;10637:18:82;3694:47:6::2;10619:119:82::0;8401:1246:6;8574:7;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:31::-;313:49;;;;;;;;;;;;;;:::i;:::-;;1679:1:60::1;2258:7;;:19;;2250:63;;;::::0;::::1;::::0;;16441:2:82;2250:63:60::1;::::0;::::1;16423:21:82::0;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60::1;16413:181:82::0;2250:63:60::1;1679:1;2388:7;:18:::0;8593::6::2;8614:12;:10;:12::i;:::-;:52;::::0;;;;::::2;::::0;::::2;9396:25:82::0;;;8614:26:6::2;9457:32:82::0;;;9437:18;;;9430:60;9506:18;;;9499:34;;;8614:26:6;;;::::2;::::0;::::2;::::0;9369:18:82;;8614:52:6::2;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8593:73;;8698:6;8684:10;:20;;8676:76;;;::::0;::::2;::::0;;14851:2:82;8676:76:6::2;::::0;::::2;14833:21:82::0;14890:2;14870:18;;;14863:30;14929:34;14909:18;;;14902:62;15000:13;14980:18;;;14973:41;15031:19;;8676:76:6::2;14823:233:82::0;8676:76:6::2;8765:15;8781:14:::0;8799:12:::2;:10;:12::i;:::-;:51;::::0;;;;::::2;::::0;::::2;10945:25:82::0;;;10986:18;;;10979:34;;;11029:18;;;11022:34;;;8799:26:6::2;::::0;;;::::2;::::0;::::2;::::0;10918:18:82;;8799:51:6::2;::::0;::::2;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8764:86:::0;;-1:-1:-1;8764:86:6;-1:-1:-1;8860:18:6::2;8881:16;8764:86:::0;;8881:16:::2;:::i;:::-;8860:37;;8907:8;:6;:8::i;:::-;:63;::::0;;;;::::2;::::0;::::2;10225:25:82::0;;;8907:17:6::2;10324:15:82::0;;;10304:18;;;10297:43;10356:18;;;10349:34;;;10399:18;;;10392:34;;;8959:10:6::2;10442:19:82::0;;;10435:44;8907:17:6;;;::::2;::::0;::::2;::::0;10197:19:82;;8907:63:6::2;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;8980:8;:6;:8::i;:::-;:54;::::0;;;;::::2;::::0;::::2;9775:25:82::0;;;8980:16:6::2;9836:32:82::0;;;9816:18;;;9809:60;9885:18;;;9878:34;;;9928:18;;;9921:34;;;8980:16:6;;;::::2;::::0;::::2;::::0;9747:19:82;;8980:54:6::2;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;9058:10;;9049:5;:19;9045:488;;;9084:37;::::0;9092:10:::2;::::0;9084:37;::::2;;;::::0;9113:7;;9084:37:::2;::::0;;;9113:7;9092:10;9084:37;::::2;;;;;;;;;;;;;::::0;::::2;;;;;;9143:39;9158:23;9143:14;:39::i;:::-;9135:57;;:65;9193:6;9135:65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;9045:488;;;9231:12;9253:28;;9275:5;9253:12;:28::i;:::-;9231:51:::0;-1:-1:-1;9296:92:6::2;9315:10;9327:60;120:2:59::0;9346:22:6::2;9370:5;:14;;;:16;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;9327:7:::0;;:60;::::2;;:18;:60::i;:::-;9296:18;::::0;::::2;::::0;:92;:18:::2;:92::i;:::-;9402:120;9421:39;9436:23;9421:14;:39::i;:::-;9462:59;120:2:59::0;9504:5:6::2;:14;;;:16;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;9462:6:::0;;:59;::::2;;:17;:59::i;9402:120::-;9045:488;;9548:68;::::0;;10945:25:82;;;11001:2;10986:18;;10979:34;;;11029:18;;;11022:34;;;9548:68:6::2;::::0;::::2;::::0;9571:5;;9559:10:::2;::::0;9548:68:::2;::::0;10933:2:82;10918:18;9548:68:6::2;;;;;;;-1:-1:-1::0;;1636:1:60::1;2561:7;:22:::0;9633:7:6;8401:1246;-1:-1:-1;;;;;;8401:1246:6:o;7797:598::-;7948:7;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:31::-;313:49;;;;;;;;;;;;;;:::i;:::-;;1679:1:60::1;2258:7;;:19;;2250:63;;;::::0;::::1;::::0;;16441:2:82;2250:63:60::1;::::0;::::1;16423:21:82::0;16480:2;16460:18;;;16453:30;16519:33;16499:18;;;16492:61;16570:18;;2250:63:60::1;16413:181:82::0;2250:63:60::1;1679:1;2388:7;:18:::0;7968:21:6::2;::::0;;;8071:8:::2;:6;:8::i;:::-;:58;::::0;;;;8086:10:::2;8071:58;::::0;::::2;7710:51:82::0;7777:18;;;7770:34;;;7820:18;;;7813:34;;;7863:18;;;7856:34;;;8071:14:6::2;::::0;;;::::2;::::0;::::2;::::0;7682:19:82;;8071:58:6::2;;;;;;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;::::0;::::2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;8145:213;::::0;;17293:25:82;;;17349:2;17334:18;;17327:34;;;17377:18;;;17370:34;;;17435:2;17420:18;;17413:34;;;17478:3;17463:19;;17456:35;;;7967:162:6;;-1:-1:-1;7967:162:6;;-1:-1:-1;7967:162:6;-1:-1:-1;7967:162:6;-1:-1:-1;8212:7:6;;8189:9;;8165:10:::2;::::0;8145:213:::2;::::0;17280:3:82;17265:19;8145:213:6::2;;;;;;;-1:-1:-1::0;;1636:1:60::1;2561:7;:22:::0;-1:-1:-1;8375:13:6;7797:598;-1:-1:-1;;;;7797:598:6:o;7190:601::-;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:31::-;313:49;;;;;;;;;;;;;;:::i;:::-;;7330:1:6::1;7321:6;:10;7313:63;;;::::0;::::1;::::0;;13965:2:82;7313:63:6::1;::::0;::::1;13947:21:82::0;14004:2;13984:18;;;13977:30;14043:34;14023:18;;;14016:62;14114:10;14094:18;;;14087:38;14142:19;;7313:63:6::1;13937:230:82::0;7313:63:6::1;7400:10;;7391:5;:19;7387:336;;7426:20;7449:28;;7471:5;7449:12;:28::i;:::-;7426:51:::0;-1:-1:-1;7426:51:6;7540:172:::1;7580:10;7616:4;7639:59;120:2:59::0;7681:5:6::1;:14;;;:16;;;;;;;;;;;;;;;;;;;;;;;;;;;::::0;::::1;7639:59;7540:22;::::0;::::1;::::0;:172;;:22:::1;:172::i;:::-;7387:336;;;7733:8;:6;:8::i;:::-;:51;::::0;;;;::::1;::::0;::::1;9775:25:82::0;;;7755:10:6::1;9816:18:82::0;;;9809:60;9885:18;;;9878:34;;;9928:18;;;9921:34;;;7733:14:6::1;::::0;;;::::1;::::0;::::1;::::0;9747:19:82;;7733:51:6::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;7190:601:::0;;;:::o;3775:859::-;3929:7;322:6:22;;;;;;;;;;;321:7;330:31;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:31::-;313:49;;;;;;;;;;;;;;:::i;:::-;;3947:26:6::1;3976:9;:7;:9::i;:::-;:44;::::0;;;;::::1;::::0;::::1;10664:25:82::0;;;10705:18;;;10698:34;;;3976:27:6::1;::::0;;;::::1;::::0;::::1;::::0;10637:18:82;;3976:44:6::1;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;3947:73;;4059:1;4038:18;:22;4030:66;;;::::0;::::1;::::0;;13195:2:82;4030:66:6::1;::::0;::::1;13177:21:82::0;13234:2;13214:18;;;13207:30;13273:33;13253:18;;;13246:61;13324:18;;4030:66:6::1;13167:181:82::0;4030:66:6::1;4132:18;4114:14;:36;;4106:80;;;::::0;::::1;::::0;;16081:2:82;4106:80:6::1;::::0;::::1;16063:21:82::0;16120:2;16100:18;;;16093:30;16159:33;16139:18;;;16132:61;16210:18;;4106:80:6::1;16053:181:82::0;4106:80:6::1;4197:24;4267:14;4234:12;:10;:12::i;:::-;:21;;;4256:5;4234:28;;;;;;;;;;;;;9158:25:82::0;;9146:2;9131:18;;9113:76;4234:28:6::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4224:39;::::0;:6;:39:::1;:::i;:::-;:58;;;;:::i;:::-;4197:85;;4292:24;4319:8;:6;:8::i;:::-;:65;::::0;;;;::::1;::::0;::::1;9775:25:82::0;;;4345:10:6::1;9816:18:82::0;;;9809:60;9885:18;;;9878:34;;;9928:18;;;9921:34;;;4319:18:6::1;::::0;;;::::1;::::0;::::1;::::0;9747:19:82;;4319:65:6::1;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4292:92;;4411:3;4399:8;:15;4395:200;;;4435:51;::::0;;10664:25:82;;;10720:2;10705:18;;10698:34;;;4454:5:6;;4442:10:::1;::::0;4435:51:::1;::::0;10637:18:82;4435:51:6::1;;;;;;;4395:200;;;4522:62;::::0;;10664:25:82;;;10720:2;10705:18;;10698:34;;;4549:8:6;;4542:5;;4530:10:::1;::::0;4522:62:::1;::::0;10637:18:82;4522:62:6::1;;;;;;;4395:200;4611:16:::0;3775:859;-1:-1:-1;;;;;;;3775:859:6:o;261:142:62:-;334:13;390:1;393;373:22;;;;;;;;;:::i;:::-;;;;;;;;;;;;;359:37;;261:142;;;;;:::o;1137:113:6:-;1177:7;1211:31;1226:15;1211:14;:31::i;:::-;1196:47;;1137:113;:::o;1515:::-;1555:7;1589:31;1604:15;1589:14;:31::i;5808:564::-;5951:4;5967:8;:6;:8::i;:::-;:47;;;;;;;;9775:25:82;;;5967:16:6;9836:32:82;;;9816:18;;;9809:60;9885:18;;;9878:34;;;9928:18;;;9921:34;;;5967:16:6;;;;;;;9747:19:82;;5967:47:6;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6038:10;;6029:5;:19;6025:261;;;6064:30;;:22;;;;:30;;;;;6087:6;;6064:30;;;;6087:6;6064:22;:30;;;;;;;;;;;;;;;;;;;;;6025:261;;;6125:12;6147:28;;6169:5;6147:12;:28::i;:::-;6125:51;-1:-1:-1;6190:85:6;6209:4;6215:59;120:2:59;6233:22:6;294:84:59;6190:85:6;6025:261;;6300:44;;;10664:25:82;;;10720:2;10705:18;;10698:34;;;6300:44:6;;;;6314:5;;6300:44;;;;10637:18:82;6300:44:6;;;;;;;-1:-1:-1;6361:4:6;5808:564;;;;;;:::o;1392:117::-;1433:8;1469:32;1484:16;1469:14;:32::i;1753:129::-;1797:11;1839:35;1854:19;2434:192:20;2495:7;2522:12;;;:6;:12;;;;;;;;;2550:39;;;;;;;;;;;;;;;;;;;:19;;2522:26;:12;;;:26;;;2550:39;;;2522:12;;2495:7;;2550:19;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:39;;;;;:::i;:::-;2514:76;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;2607:12:20;;;;:6;:12;;;;;;;;;2434:192::o;1853:296::-;1992:8;;:39;;;;;;;;10664:25:82;;;10705:18;;;10698:34;;;1936:7:20;;;;;;1992:8;;;:17;;10637:18:82;;1992:39:20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;1955:76;;;;2049:5;2056:56;;;;;;;;;;;;;;;;;;2102:9;2056:12;:19;;;;;:::i;:56::-;2041:72;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;2130:12:20;1853:296;-1:-1:-1;;;;1853:296:20:o;794:261:59:-;900:7;923:6;919:20;;-1:-1:-1;938:1:59;931:8;;919:20;958:1;953;:6;949:20;;;-1:-1:-1;968:1:59;961:8;;949:20;987:1;983;:5;979:35;;;1007:5;1011:1;1007;:5;:::i;:::-;1002:11;;:2;:11;:::i;:::-;997:17;;:1;:17;:::i;:::-;990:24;;;;979:35;1041:5;1045:1;1041;:5;:::i;:::-;1036:11;;:2;:11;:::i;:::-;1031:17;;:1;:17;:::i;:::-;1024:24;;794:261;;;;;;:::o;173:205:61:-;312:58;;8105:19:82;8093:32;;312:58:61;;;8075:51:82;8142:18;;;8135:34;;;285:86:61;;305:5;;335:23;;8048:18:82;;312:58:61;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;285:19;:86::i;:::-;173:205;;;:::o;1634:113:6:-;1674:7;1708:31;1723:15;1708:14;:31::i;384:241:61:-;549:68;;7311:19:82;7357:15;;;549:68:61;;;7339:34:82;7409:15;;7389:18;;;7382:43;7441:18;;;7434:34;;;522:96:61;;542:5;;572:27;;7274:18:82;;549:68:61;7256:218:82;522:96:61;384:241;;;;:::o;1256:130:6:-;1300:11;1342:36;1357:20;1342:14;:36::i;409:186:62:-;523:13;579:1;582;585;562:25;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;548:40;;409:186;;;;;:::o;1023:316:61:-;1103:23;1129:69;1157:4;1129:69;;;;;;;;;;;;;;;;;1137:5;1129:27;;;;:69;;;;;:::i;:::-;1212:17;;1103:95;;-1:-1:-1;1212:21:61;1208:124;;1266:10;1255:30;;;;;;;;;;;;:::i;:::-;1247:85;;;;;;;15670:2:82;1247:85:61;;;15652:21:82;15709:2;15689:18;;;15682:30;15748:34;15728:18;;;15721:62;15819:12;15799:18;;;15792:40;15849:19;;1247:85:61;15642:232:82;277:292:57;410:12;435;449:23;476:6;:11;;488:4;476:17;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;434:59;;;;510:52;528:7;537:10;549:12;510:17;:52::i;:::-;503:59;277:292;-1:-1:-1;;;;;;277:292:57:o;1204:362::-;1344:12;1372:7;1368:24;;;-1:-1:-1;1388:4:57;1381:11;;1368:24;1406:11;;1402:42;;1431:12;1424:20;;;;;;;;;;;:::i;1402:42::-;1500:4;1494:11;1540:9;1533:4;1529:2;1525:13;1518:32;14:257:82;73:6;126:2;114:9;105:7;101:23;97:32;94:2;;;147:6;139;132:22;94:2;191:9;178:23;210:31;235:5;210:31;:::i;276:261::-;346:6;399:2;387:9;378:7;374:23;370:32;367:2;;;420:6;412;405:22;367:2;457:9;451:16;476:31;501:5;476:31;:::i;542:251::-;598:6;651:2;639:9;630:7;626:23;622:32;619:2;;;672:6;664;657:22;619:2;716:9;703:23;735:28;757:5;735:28;:::i;798:255::-;865:6;918:2;906:9;897:7;893:23;889:32;886:2;;;939:6;931;924:22;886:2;976:9;970:16;995:28;1017:5;995:28;:::i;1058:389::-;1134:6;1142;1195:2;1183:9;1174:7;1170:23;1166:32;1163:2;;;1216:6;1208;1201:22;1163:2;1253:9;1247:16;1272:28;1294:5;1272:28;:::i;:::-;1369:2;1354:18;;1348:25;1319:5;;-1:-1:-1;1382:33:82;1348:25;1382:33;:::i;:::-;1434:7;1424:17;;;1153:294;;;;;:::o;1452:190::-;1511:6;1564:2;1552:9;1543:7;1539:23;1535:32;1532:2;;;1585:6;1577;1570:22;1532:2;-1:-1:-1;1613:23:82;;1522:120;-1:-1:-1;1522:120:82:o;1647:462::-;1733:6;1741;1749;1757;1810:3;1798:9;1789:7;1785:23;1781:33;1778:2;;;1832:6;1824;1817:22;1778:2;1873:9;1860:23;1850:33;;1933:2;1922:9;1918:18;1905:32;1946:31;1971:5;1946:31;:::i;:::-;1768:341;;1996:5;;-1:-1:-1;;;;2048:2:82;2033:18;;2020:32;;2099:2;2084:18;2071:32;;1768:341::o;2114:326::-;2191:6;2199;2207;2260:2;2248:9;2239:7;2235:23;2231:32;2228:2;;;2281:6;2273;2266:22;2228:2;-1:-1:-1;;2309:23:82;;;2379:2;2364:18;;2351:32;;-1:-1:-1;2430:2:82;2415:18;;;2402:32;;2218:222;-1:-1:-1;2218:222:82:o;2445:456::-;2528:6;2536;2544;2552;2605:3;2593:9;2584:7;2580:23;2576:33;2573:2;;;2627:6;2619;2612:22;2573:2;2668:9;2655:23;2645:33;;2725:2;2714:9;2710:18;2697:32;2687:42;;2776:2;2765:9;2761:18;2748:32;2738:42;;2830:2;2819:9;2815:18;2802:32;2843:28;2865:5;2843:28;:::i;:::-;2563:338;;;;-1:-1:-1;2563:338:82;;-1:-1:-1;;2563:338:82:o;2906:258::-;2974:6;2982;3035:2;3023:9;3014:7;3010:23;3006:32;3003:2;;;3056:6;3048;3041:22;3003:2;-1:-1:-1;;3084:23:82;;;3154:2;3139:18;;;3126:32;;-1:-1:-1;2993:171:82:o;3500:395::-;3586:6;3594;3602;3610;3663:3;3651:9;3642:7;3638:23;3634:33;3631:2;;;3685:6;3677;3670:22;3631:2;-1:-1:-1;;3713:23:82;;;3783:2;3768:18;;3755:32;;-1:-1:-1;3834:2:82;3819:18;;3806:32;;3885:2;3870:18;3857:32;;-1:-1:-1;3621:274:82;-1:-1:-1;3621:274:82:o;4426:194::-;4496:6;4549:2;4537:9;4528:7;4524:23;4520:32;4517:2;;;4570:6;4562;4555:22;4517:2;-1:-1:-1;4598:16:82;;4507:113;-1:-1:-1;4507:113:82:o;4625:255::-;4704:6;4712;4765:2;4753:9;4744:7;4740:23;4736:32;4733:2;;;4786:6;4778;4771:22;4733:2;-1:-1:-1;;4814:16:82;;4870:2;4855:18;;;4849:25;4814:16;;4849:25;;-1:-1:-1;4723:157:82:o;4885:378::-;4982:6;4990;4998;5006;5059:3;5047:9;5038:7;5034:23;5030:33;5027:2;;;5081:6;5073;5066:22;5027:2;-1:-1:-1;;5109:16:82;;5165:2;5150:18;;5144:25;5209:2;5194:18;;5188:25;5253:2;5238:18;;;5232:25;5109:16;;5144:25;;-1:-1:-1;5232:25:82;;-1:-1:-1;5017:246:82;-1:-1:-1;5017:246:82:o;5268:293::-;5336:6;5389:2;5377:9;5368:7;5364:23;5360:32;5357:2;;;5410:6;5402;5395:22;5357:2;5447:9;5441:16;5497:4;5490:5;5486:16;5479:5;5476:27;5466:2;;5522:6;5514;5507:22;5566:274;5695:3;5733:6;5727:13;5749:53;5795:6;5790:3;5783:4;5775:6;5771:17;5749:53;:::i;:::-;5818:16;;;;;5703:137;-1:-1:-1;;5703:137:82:o;5845:470::-;6024:3;6062:6;6056:13;6078:53;6124:6;6119:3;6112:4;6104:6;6100:17;6078:53;:::i;:::-;6194:13;;6153:16;;;;6216:57;6194:13;6153:16;6250:4;6238:17;;6216:57;:::i;:::-;6289:20;;6032:283;-1:-1:-1;;;;6032:283:82:o;6320:566::-;6527:3;6565:6;6559:13;6581:53;6627:6;6622:3;6615:4;6607:6;6603:17;6581:53;:::i;:::-;6697:13;;6656:16;;;;6719:57;6697:13;6656:16;6753:4;6741:17;;6719:57;:::i;:::-;6798:20;6827:21;;;-1:-1:-1;;6875:4:82;6864:16;;6535:351;-1:-1:-1;;6535:351:82:o;8180:635::-;8351:2;8403:21;;;8473:13;;8376:18;;;8495:22;;;8322:4;;8351:2;8574:15;;;;8548:2;8533:18;;;8322:4;8620:169;8634:6;8631:1;8628:13;8620:169;;;8695:13;;8683:26;;8764:15;;;;8729:12;;;;8656:1;8649:9;8620:169;;;-1:-1:-1;8806:3:82;;8331:484;-1:-1:-1;;;;;;8331:484:82:o;12132:383::-;12281:2;12270:9;12263:21;12244:4;12313:6;12307:13;12356:6;12351:2;12340:9;12336:18;12329:34;12372:66;12431:6;12426:2;12415:9;12411:18;12406:2;12398:6;12394:15;12372:66;:::i;:::-;12499:2;12478:15;12495:7;12474:29;12459:45;;;;12506:2;12455:54;;12253:262;-1:-1:-1;;12253:262:82:o;17502:128::-;17542:3;17573:1;17569:6;17566:1;17563:13;17560:2;;;17579:18;;:::i;:::-;-1:-1:-1;17615:9:82;;17550:80::o;17635:217::-;17675:1;17701;17691:2;;17736:20;17726:31;;17780:4;17777:1;17770:15;17808:4;17733:1;17798:15;17691:2;-1:-1:-1;17837:9:82;;17681:171::o;17857:422::-;17946:1;17989:5;17946:1;18003:270;18024:7;18014:8;18011:21;18003:270;;;18083:4;18079:1;18075:6;18071:17;18065:4;18062:27;18059:2;;;18092:18;;:::i;:::-;18142:7;18132:8;18128:22;18125:2;;;18162:16;;;;18125:2;18241:22;;;;18201:15;;;;18003:270;;;18007:3;17921:358;;;;;:::o;18284:131::-;18344:5;18373:36;18400:8;18394:4;18469:5;18499:8;18489:2;;-1:-1:-1;18540:1:82;18554:5;;18489:2;18588:4;18578:2;;-1:-1:-1;18625:1:82;18639:5;;18578:2;18670:4;18688:1;18683:59;;;;18756:1;18751:130;;;;18663:218;;18683:59;18713:1;18704:10;;18727:5;;;18751:130;18788:3;18778:8;18775:17;18772:2;;;18795:18;;:::i;:::-;-1:-1:-1;;18851:1:82;18837:16;;18866:5;;18663:218;;18965:2;18955:8;18952:16;18946:3;18940:4;18937:13;18933:36;18927:2;18917:8;18914:16;18909:2;18903:4;18900:12;18896:35;18893:77;18890:2;;;-1:-1:-1;19002:19:82;;;19034:5;;18890:2;19081:34;19106:8;19100:4;19081:34;:::i;:::-;19151:6;19147:1;19143:6;19139:19;19130:7;19127:32;19124:2;;;19162:18;;:::i;:::-;19200:20;;18479:747;-1:-1:-1;;;18479:747:82:o;19231:168::-;19271:7;19337:1;19333;19329:6;19325:14;19322:1;19319:21;19314:1;19307:9;19300:17;19296:45;19293:2;;;19344:18;;:::i;:::-;-1:-1:-1;19384:9:82;;19283:116::o;19404:125::-;19444:4;19472:1;19469;19466:8;19463:2;;;19477:18;;:::i;:::-;-1:-1:-1;19514:9:82;;19453:76::o;19534:258::-;19606:1;19616:113;19630:6;19627:1;19624:13;19616:113;;;19706:11;;;19700:18;19687:11;;;19680:39;19652:2;19645:10;19616:113;;;19747:6;19744:1;19741:13;19738:2;;;-1:-1:-1;;19782:1:82;19764:16;;19757:27;19587:205::o;19797:380::-;19876:1;19872:12;;;;19919;;;19940:2;;19994:4;19986:6;19982:17;19972:27;;19940:2;20047;20039:6;20036:14;20016:18;20013:38;20010:2;;;20093:10;20088:3;20084:20;20081:1;20074:31;20128:4;20125:1;20118:15;20156:4;20153:1;20146:15;20010:2;;19852:325;;;:::o;20182:135::-;20221:3;20252:6;20242:17;;20239:2;;;20262:18;;:::i;:::-;-1:-1:-1;20309:1:82;20298:13;;20229:88::o;20322:127::-;20383:10;20378:3;20374:20;20371:1;20364:31;20414:4;20411:1;20404:15;20438:4;20435:1;20428:15;20454:131;20540:19;20529:31;;20519:42;;20509:2;;20575:1;20572;20565:12;20590:118;20676:5;20669:13;20662:21;20655:5;20652:32;20642:2;;20698:1;20695;20688:12", + "source": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.4;\n\nimport './lib/PreciseMath.sol';\nimport './lib/SafeERC20.sol';\nimport './base/Pausable.sol';\nimport './base/Importable.sol';\nimport './interfaces/IMobius.sol';\nimport './interfaces/IStaker.sol';\nimport './interfaces/ITrader.sol';\nimport './interfaces/IAssetPrice.sol';\nimport './interfaces/ISetting.sol';\nimport './interfaces/IIssuer.sol';\nimport './interfaces/ILiquidator.sol';\nimport './interfaces/IERC20.sol';\nimport \"./lib/ReentrancyGuard.sol\";\n\ncontract Mobius is Pausable, Importable, IMobius, ReentrancyGuard{\n using PreciseMath for uint256;\n using SafeERC20 for IERC20;\n\n bytes32 public override nativeCoin;\n\n constructor(IResolver _resolver, bytes32 _nativeCoin) Importable(_resolver) {\n nativeCoin = _nativeCoin;\n setContractName(CONTRACT_MOBIUS);\n imports = [\n CONTRACT_STAKER,\n CONTRACT_ASSET_PRICE,\n CONTRACT_SETTING,\n CONTRACT_ISSUER,\n CONTRACT_TRADER,\n CONTRACT_MOBIUS_TOKEN,\n CONTRACT_LIQUIDATOR,\n LIQUIDATION_FEE_ADDRESS\n ];\n }\n\n function Staker() private view returns (IStaker) {\n return IStaker(requireAddress(CONTRACT_STAKER));\n }\n\n function AssetPrice() private view returns (IAssetPrice) {\n return IAssetPrice(requireAddress(CONTRACT_ASSET_PRICE));\n }\n\n function Setting() private view returns (ISetting) {\n return ISetting(requireAddress(CONTRACT_SETTING));\n }\n\n function Issuer() private view returns (IIssuer) {\n return IIssuer(requireAddress(CONTRACT_ISSUER));\n }\n\n function Trader() private view returns (ITrader) {\n return ITrader(requireAddress(CONTRACT_TRADER));\n }\n\n function Liquidator() private view returns (ILiquidator) {\n return ILiquidator(requireAddress(CONTRACT_LIQUIDATOR));\n }\n\n function mintFromCoin(uint256 collateralRate) external override payable nonReentrant returns (uint256) {\n _stake(nativeCoin, USD, msg.value);\n uint256 minted = _mint(nativeCoin, msg.value, USD, collateralRate);\n return minted;\n }\n\n function mintFromToken(bytes32 stake, uint256 amount, uint256 collateralRate) external override nonReentrant returns (uint256) {\n require(stake != nativeCoin, 'Mobius: Native Coin use \"mintFromCoin\" function');\n\n _stake(stake, USD, amount);\n uint256 minted = _mint(stake, amount, USD, collateralRate);\n return minted;\n }\n\n function mintFromPreviousStake(bytes32 stake, uint256 amount) external override notPaused nonReentrant returns (bool) {\n Issuer().issueDebtWithPreviousStake(stake, msg.sender, USD, amount);\n emit Minted(msg.sender, stake, 0, amount);\n return true;\n }\n\n function shortFromCoin(bytes32 debtType, uint256 collateralRate) external override payable nonReentrant returns (uint256) {\n _stake(nativeCoin, debtType, msg.value);\n uint256 minted = _mint(nativeCoin, msg.value, debtType, collateralRate);\n return minted;\n }\n\n function shortFromToken(bytes32 stake, uint256 amount, bytes32 debtType, uint256 collateralRate) external override nonReentrant returns (uint256) {\n require(stake != nativeCoin, 'Mobius: Native Coin use \"shortFromToken\" function');\n\n _stake(stake, debtType, amount);\n uint256 minted = _mint(stake, amount, debtType, collateralRate);\n return minted;\n }\n\n function shortFromPreviousStake(bytes32 stake, bytes32 debtType, uint256 amount) external override notPaused nonReentrant returns (bool) {\n Issuer().issueDebtWithPreviousStake(stake, msg.sender, debtType, amount);\n emit Shorted(msg.sender, stake, debtType, 0, amount);\n return true;\n }\n\n function _mint(\n bytes32 stake,\n uint256 amount,\n bytes32 debtType,\n uint256 collateralRate\n ) internal notPaused returns (uint256){\n uint256 safeCollateralRate = Setting().getCollateralRate(stake, debtType);\n require(safeCollateralRate > 0, 'Mobius: Missing Collateral Rate');\n require(collateralRate >= safeCollateralRate, 'Mobius: Collateral Rate too low');\n\n uint256 issueAmountInUSD = amount * (AssetPrice().getPrice(stake)) / (collateralRate);\n uint256 issueDebtInSynth = Issuer().issueDebt(stake, msg.sender, debtType, issueAmountInUSD);\n\n if (debtType == USD) {\n emit Minted(msg.sender, stake, amount, issueAmountInUSD);\n } else {\n emit Shorted(msg.sender, stake, debtType, amount, issueDebtInSynth);\n }\n return issueDebtInSynth;\n }\n\n function burn(bytes32 stake, bytes32 debtType, uint256 amount, bool withdraw) external override notPaused nonReentrant returns (uint256, uint256) {\n uint256 beforeCollateralRate = Staker().getCollateralRate(stake, msg.sender, debtType);\n uint256 burnAmount = Issuer().burnDebt(stake, msg.sender, debtType, amount, msg.sender);\n\n uint256 claimable = 0;\n if (withdraw) {\n claimable = Staker().getClaimable(stake, msg.sender, debtType, beforeCollateralRate);\n _claim(stake, debtType, claimable, msg.sender);\n }\n\n emit Burned(msg.sender, stake, debtType, burnAmount);\n return (burnAmount, claimable);\n }\n\n function claim(\n bytes32 stake,\n bytes32 debtType,\n uint256 amount\n ) external override notPaused nonReentrant returns (bool) {\n uint256 safeCollateralRate = Setting().getCollateralRate(stake, debtType);\n uint256 claimable = Staker().getClaimable(stake, msg.sender, debtType, safeCollateralRate);\n require(claimable >= amount, 'Mobius: transfer amount exceeds claimable');\n return _claim(stake, debtType, amount, msg.sender);\n }\n\n function _claim( \n bytes32 stake,\n bytes32 debtType,\n uint256 amount,\n address addr\n ) internal returns (bool) {\n Staker().unstake(stake, addr, debtType, amount);\n\n if (stake == nativeCoin) {\n payable(addr).transfer(amount);\n } else {\n IERC20 token = IERC20(requireAsset('Stake', stake));\n token.safeTransfer(addr, amount.decimalsTo(PreciseMath.DECIMALS(), token.decimals()));\n }\n emit Claimed(addr, stake, addr, debtType, amount);\n return true;\n }\n\n function stakeFromCoin(bytes32 debtType) external override payable nonReentrant returns (bool) {\n require(Issuer().getDebt(nativeCoin, msg.sender, debtType) > 0, 'Mobius: Debt must be greater than zero');\n\n _stake(nativeCoin, debtType, msg.value);\n emit Staked(msg.sender, nativeCoin, debtType, msg.value);\n return true;\n }\n\n function stakeFromToken(bytes32 stake, bytes32 debtType, uint256 amount) external override nonReentrant returns (bool) {\n require(stake != nativeCoin, 'Mobius: Native Coin use \"mintFromCoin\" function');\n require(Issuer().getDebt(stake, msg.sender, debtType) > 0, 'Mobius: Debt must be greater than zero');\n\n _stake(stake, debtType, amount);\n emit Staked(msg.sender, stake, debtType, amount);\n return true;\n }\n\n function _stake(\n bytes32 stake,\n bytes32 debtType,\n uint256 amount\n ) private notPaused {\n require(amount > 0, 'Mobius: amount must be greater than zero');\n\n if (stake != nativeCoin) {\n address stakeAddress = requireAsset('Stake', stake);\n IERC20 token = IERC20(stakeAddress);\n token.safeTransferFrom(\n msg.sender,\n address(this),\n amount.decimalsTo(PreciseMath.DECIMALS(), token.decimals())\n );\n }\n\n Staker().stake(stake, msg.sender, debtType, amount);\n }\n\n function trade(\n bytes32 fromSynth,\n uint256 fromAmount,\n bytes32 toSynth\n ) external override notPaused nonReentrant returns (uint256) {\n (uint256 tradingAmount, uint256 tradingFee, uint256 fromSynthPrice, uint256 toSynthPirce) =\n Trader().trade(msg.sender, fromSynth, fromAmount, toSynth);\n\n emit Traded(\n msg.sender,\n fromSynth,\n toSynth,\n fromAmount,\n tradingAmount,\n tradingFee,\n fromSynthPrice,\n toSynthPirce\n );\n return tradingAmount;\n }\n\n function liquidate(\n bytes32 stake,\n address account,\n bytes32 debtType,\n uint256 amount\n ) external override notPaused nonReentrant returns (uint256) {\n uint256 liquidable = Liquidator().getLiquidable(stake, account, debtType);\n require(liquidable >= amount, 'Mobius: liquidate amount exceeds liquidable');\n \n (uint256 toPayer,uint256 toPlat) = Liquidator().getUnstakable(stake, debtType, amount);\n uint256 unstakable = toPayer + toPlat;\n Issuer().burnDebt(stake, account, debtType, amount, msg.sender);\n Staker().unstake(stake, account, debtType, unstakable);\n\n if (stake == nativeCoin) {\n payable(msg.sender).transfer(toPayer);\n payable(requireAddress(LIQUIDATION_FEE_ADDRESS)).transfer(toPlat);\n } else {\n IERC20 token = IERC20(requireAsset('Stake', stake));\n token.safeTransfer(msg.sender, toPayer.decimalsTo(PreciseMath.DECIMALS(), token.decimals()));\n token.safeTransfer(requireAddress(LIQUIDATION_FEE_ADDRESS), toPlat.decimalsTo(PreciseMath.DECIMALS(), token.decimals()));\n }\n\n emit Liquidated(msg.sender, stake, account, debtType, unstakable, amount);\n return toPayer;\n }\n}\n", + "sourcePath": "/home/colin/Workspace/src/Mobius/contracts/contracts/Mobius.sol", + "ast": { + "absolutePath": "project:/contracts/Mobius.sol", + "exportedSymbols": { + "Address": [ + 11660 + ], + "Constants": [ + 8570 + ], + "IAssetPrice": [ + 9620 + ], + "IERC20": [ + 9727 + ], + "IIssuer": [ + 9873 + ], + "ILiquidator": [ + 9912 + ], + "IMobius": [ + 10173 + ], + "IOwnable": [ + 10242 + ], + "IResolver": [ + 10297 + ], + "ISetting": [ + 10732 + ], + "IStaker": [ + 10792 + ], + "ITrader": [ + 10913 + ], + "Importable": [ + 8972 + ], + "Mobius": [ + 3368 + ], + "Ownable": [ + 9135 + ], + "Pausable": [ + 9196 + ], + "PreciseMath": [ + 12065 + ], + "ReentrancyGuard": [ + 12105 + ], + "SafeERC20": [ + 12241 + ], + "Strings": [ + 12299 + ] + }, + "id": 3369, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2345, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:6" + }, + { + "absolutePath": "project:/contracts/lib/PreciseMath.sol", + "file": "./lib/PreciseMath.sol", + "id": 2346, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 12066, + "src": "57:31:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/lib/SafeERC20.sol", + "file": "./lib/SafeERC20.sol", + "id": 2347, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 12242, + "src": "89:29:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/base/Pausable.sol", + "file": "./base/Pausable.sol", + "id": 2348, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9197, + "src": "119:29:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/base/Importable.sol", + "file": "./base/Importable.sol", + "id": 2349, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 8973, + "src": "149:31:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IMobius.sol", + "file": "./interfaces/IMobius.sol", + "id": 2350, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10174, + "src": "181:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IStaker.sol", + "file": "./interfaces/IStaker.sol", + "id": 2351, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10793, + "src": "216:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/ITrader.sol", + "file": "./interfaces/ITrader.sol", + "id": 2352, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10914, + "src": "251:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IAssetPrice.sol", + "file": "./interfaces/IAssetPrice.sol", + "id": 2353, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9621, + "src": "286:38:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/ISetting.sol", + "file": "./interfaces/ISetting.sol", + "id": 2354, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10733, + "src": "325:35:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IIssuer.sol", + "file": "./interfaces/IIssuer.sol", + "id": 2355, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9874, + "src": "361:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/ILiquidator.sol", + "file": "./interfaces/ILiquidator.sol", + "id": 2356, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9913, + "src": "396:38:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IERC20.sol", + "file": "./interfaces/IERC20.sol", + "id": 2357, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9728, + "src": "435:33:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/lib/ReentrancyGuard.sol", + "file": "./lib/ReentrancyGuard.sol", + "id": 2358, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 12106, + "src": "469:35:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 2359, + "name": "Pausable", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9196, + "src": "525:8:6" + }, + "id": 2360, + "nodeType": "InheritanceSpecifier", + "src": "525:8:6" + }, + { + "baseName": { + "id": 2361, + "name": "Importable", + "nodeType": "IdentifierPath", + "referencedDeclaration": 8972, + "src": "535:10:6" + }, + "id": 2362, + "nodeType": "InheritanceSpecifier", + "src": "535:10:6" + }, + { + "baseName": { + "id": 2363, + "name": "IMobius", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10173, + "src": "547:7:6" + }, + "id": 2364, + "nodeType": "InheritanceSpecifier", + "src": "547:7:6" + }, + { + "baseName": { + "id": 2365, + "name": "ReentrancyGuard", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12105, + "src": "556:15:6" + }, + "id": 2366, + "nodeType": "InheritanceSpecifier", + "src": "556:15:6" + } + ], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 3368, + "linearizedBaseContracts": [ + 3368, + 12105, + 10173, + 8972, + 9196, + 9135, + 10242, + 8570 + ], + "name": "Mobius", + "nameLocation": "515:6:6", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 2369, + "libraryName": { + "id": 2367, + "name": "PreciseMath", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12065, + "src": "583:11:6" + }, + "nodeType": "UsingForDirective", + "src": "577:30:6", + "typeName": { + "id": 2368, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "599:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + { + "id": 2373, + "libraryName": { + "id": 2370, + "name": "SafeERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12241, + "src": "618:9:6" + }, + "nodeType": "UsingForDirective", + "src": "612:27:6", + "typeName": { + "id": 2372, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2371, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "632:6:6" + }, + "referencedDeclaration": 9727, + "src": "632:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + } + }, + { + "baseFunctions": [ + 9958 + ], + "constant": false, + "functionSelector": "167b78cd", + "id": 2376, + "mutability": "mutable", + "name": "nativeCoin", + "nameLocation": "669:10:6", + "nodeType": "VariableDeclaration", + "overrides": { + "id": 2375, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "660:8:6" + }, + "scope": 3368, + "src": "645:34:6", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2374, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "645:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "public" + }, + { + "body": { + "id": 2407, + "nodeType": "Block", + "src": "762:369:6", + "statements": [ + { + "expression": { + "id": 2389, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2387, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "772:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 2388, + "name": "_nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2381, + "src": "785:11:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "772:24:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 2390, + "nodeType": "ExpressionStatement", + "src": "772:24:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2392, + "name": "CONTRACT_MOBIUS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8527, + "src": "822:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2391, + "name": "setContractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9134, + "src": "806:15:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 2393, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "806:32:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2394, + "nodeType": "ExpressionStatement", + "src": "806:32:6" + }, + { + "expression": { + "id": 2405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2395, + "name": "imports", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8658, + "src": "848:7:6", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 2396, + "name": "CONTRACT_STAKER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8536, + "src": "872:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2397, + "name": "CONTRACT_ASSET_PRICE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8521, + "src": "901:20:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2398, + "name": "CONTRACT_SETTING", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8524, + "src": "935:16:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2399, + "name": "CONTRACT_ISSUER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8533, + "src": "965:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2400, + "name": "CONTRACT_TRADER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8539, + "src": "994:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2401, + "name": "CONTRACT_MOBIUS_TOKEN", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8545, + "src": "1023:21:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2402, + "name": "CONTRACT_LIQUIDATOR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8548, + "src": "1058:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2403, + "name": "LIQUIDATION_FEE_ADDRESS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8563, + "src": "1091:23:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 2404, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "858:266:6", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$8_memory_ptr", + "typeString": "bytes32[8] memory" + } + }, + "src": "848:276:6", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + "id": 2406, + "nodeType": "ExpressionStatement", + "src": "848:276:6" + } + ] + }, + "id": 2408, + "implemented": true, + "kind": "constructor", + "modifiers": [ + { + "arguments": [ + { + "id": 2384, + "name": "_resolver", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2379, + "src": "751:9:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IResolver_$10297", + "typeString": "contract IResolver" + } + } + ], + "id": 2385, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 2383, + "name": "Importable", + "nodeType": "IdentifierPath", + "referencedDeclaration": 8972, + "src": "740:10:6" + }, + "nodeType": "ModifierInvocation", + "src": "740:21:6" + } + ], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2382, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2379, + "mutability": "mutable", + "name": "_resolver", + "nameLocation": "708:9:6", + "nodeType": "VariableDeclaration", + "scope": 2408, + "src": "698:19:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IResolver_$10297", + "typeString": "contract IResolver" + }, + "typeName": { + "id": 2378, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2377, + "name": "IResolver", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10297, + "src": "698:9:6" + }, + "referencedDeclaration": 10297, + "src": "698:9:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IResolver_$10297", + "typeString": "contract IResolver" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2381, + "mutability": "mutable", + "name": "_nativeCoin", + "nameLocation": "727:11:6", + "nodeType": "VariableDeclaration", + "scope": 2408, + "src": "719:19:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2380, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "719:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "697:42:6" + }, + "returnParameters": { + "id": 2386, + "nodeType": "ParameterList", + "parameters": [], + "src": "762:0:6" + }, + "scope": 3368, + "src": "686:445:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 2420, + "nodeType": "Block", + "src": "1186:64:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2416, + "name": "CONTRACT_STAKER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8536, + "src": "1226:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2415, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1211:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2417, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1211:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2414, + "name": "IStaker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10792, + "src": "1203:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IStaker_$10792_$", + "typeString": "type(contract IStaker)" + } + }, + "id": 2418, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1203:40:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "functionReturnParameters": 2413, + "id": 2419, + "nodeType": "Return", + "src": "1196:47:6" + } + ] + }, + "id": 2421, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Staker", + "nameLocation": "1146:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2409, + "nodeType": "ParameterList", + "parameters": [], + "src": "1152:2:6" + }, + "returnParameters": { + "id": 2413, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2412, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2421, + "src": "1177:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + }, + "typeName": { + "id": 2411, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2410, + "name": "IStaker", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10792, + "src": "1177:7:6" + }, + "referencedDeclaration": 10792, + "src": "1177:7:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "visibility": "internal" + } + ], + "src": "1176:9:6" + }, + "scope": 3368, + "src": "1137:113:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2433, + "nodeType": "Block", + "src": "1313:73:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2429, + "name": "CONTRACT_ASSET_PRICE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8521, + "src": "1357:20:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2428, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1342:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1342:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2427, + "name": "IAssetPrice", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9620, + "src": "1330:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IAssetPrice_$9620_$", + "typeString": "type(contract IAssetPrice)" + } + }, + "id": 2431, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1330:49:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + } + }, + "functionReturnParameters": 2426, + "id": 2432, + "nodeType": "Return", + "src": "1323:56:6" + } + ] + }, + "id": 2434, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "AssetPrice", + "nameLocation": "1265:10:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2422, + "nodeType": "ParameterList", + "parameters": [], + "src": "1275:2:6" + }, + "returnParameters": { + "id": 2426, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2425, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2434, + "src": "1300:11:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + }, + "typeName": { + "id": 2424, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2423, + "name": "IAssetPrice", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9620, + "src": "1300:11:6" + }, + "referencedDeclaration": 9620, + "src": "1300:11:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + } + }, + "visibility": "internal" + } + ], + "src": "1299:13:6" + }, + "scope": 3368, + "src": "1256:130:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2446, + "nodeType": "Block", + "src": "1443:66:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2442, + "name": "CONTRACT_SETTING", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8524, + "src": "1484:16:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2441, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1469:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1469:32:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2440, + "name": "ISetting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10732, + "src": "1460:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ISetting_$10732_$", + "typeString": "type(contract ISetting)" + } + }, + "id": 2444, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1460:42:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "functionReturnParameters": 2439, + "id": 2445, + "nodeType": "Return", + "src": "1453:49:6" + } + ] + }, + "id": 2447, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Setting", + "nameLocation": "1401:7:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2435, + "nodeType": "ParameterList", + "parameters": [], + "src": "1408:2:6" + }, + "returnParameters": { + "id": 2439, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2438, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2447, + "src": "1433:8:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + }, + "typeName": { + "id": 2437, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2436, + "name": "ISetting", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10732, + "src": "1433:8:6" + }, + "referencedDeclaration": 10732, + "src": "1433:8:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "visibility": "internal" + } + ], + "src": "1432:10:6" + }, + "scope": 3368, + "src": "1392:117:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2459, + "nodeType": "Block", + "src": "1564:64:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2455, + "name": "CONTRACT_ISSUER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8533, + "src": "1604:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2454, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1589:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2456, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1589:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2453, + "name": "IIssuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9873, + "src": "1581:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IIssuer_$9873_$", + "typeString": "type(contract IIssuer)" + } + }, + "id": 2457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1581:40:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "functionReturnParameters": 2452, + "id": 2458, + "nodeType": "Return", + "src": "1574:47:6" + } + ] + }, + "id": 2460, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Issuer", + "nameLocation": "1524:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2448, + "nodeType": "ParameterList", + "parameters": [], + "src": "1530:2:6" + }, + "returnParameters": { + "id": 2452, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2451, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2460, + "src": "1555:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + }, + "typeName": { + "id": 2450, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2449, + "name": "IIssuer", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9873, + "src": "1555:7:6" + }, + "referencedDeclaration": 9873, + "src": "1555:7:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "visibility": "internal" + } + ], + "src": "1554:9:6" + }, + "scope": 3368, + "src": "1515:113:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2472, + "nodeType": "Block", + "src": "1683:64:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2468, + "name": "CONTRACT_TRADER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8539, + "src": "1723:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2467, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1708:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1708:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2466, + "name": "ITrader", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10913, + "src": "1700:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ITrader_$10913_$", + "typeString": "type(contract ITrader)" + } + }, + "id": 2470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1700:40:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + } + }, + "functionReturnParameters": 2465, + "id": 2471, + "nodeType": "Return", + "src": "1693:47:6" + } + ] + }, + "id": 2473, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Trader", + "nameLocation": "1643:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2461, + "nodeType": "ParameterList", + "parameters": [], + "src": "1649:2:6" + }, + "returnParameters": { + "id": 2465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2464, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1674:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + }, + "typeName": { + "id": 2463, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2462, + "name": "ITrader", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10913, + "src": "1674:7:6" + }, + "referencedDeclaration": 10913, + "src": "1674:7:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + } + }, + "visibility": "internal" + } + ], + "src": "1673:9:6" + }, + "scope": 3368, + "src": "1634:113:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2485, + "nodeType": "Block", + "src": "1810:72:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2481, + "name": "CONTRACT_LIQUIDATOR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8548, + "src": "1854:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2480, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1839:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1839:35:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2479, + "name": "ILiquidator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9912, + "src": "1827:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ILiquidator_$9912_$", + "typeString": "type(contract ILiquidator)" + } + }, + "id": 2483, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1827:48:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "functionReturnParameters": 2478, + "id": 2484, + "nodeType": "Return", + "src": "1820:55:6" + } + ] + }, + "id": 2486, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Liquidator", + "nameLocation": "1762:10:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2474, + "nodeType": "ParameterList", + "parameters": [], + "src": "1772:2:6" + }, + "returnParameters": { + "id": 2478, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2477, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2486, + "src": "1797:11:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + }, + "typeName": { + "id": 2476, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2475, + "name": "ILiquidator", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9912, + "src": "1797:11:6" + }, + "referencedDeclaration": 9912, + "src": "1797:11:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "visibility": "internal" + } + ], + "src": "1796:13:6" + }, + "scope": 3368, + "src": "1753:129:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "baseFunctions": [ + 9983 + ], + "body": { + "id": 2515, + "nodeType": "Block", + "src": "1991:150:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2497, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2008:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2498, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2020:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2499, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2025:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2500, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "2025:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2496, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "2001:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2501, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2001:34:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2502, + "nodeType": "ExpressionStatement", + "src": "2001:34:6" + }, + { + "assignments": [ + 2504 + ], + "declarations": [ + { + "constant": false, + "id": 2504, + "mutability": "mutable", + "name": "minted", + "nameLocation": "2053:6:6", + "nodeType": "VariableDeclaration", + "scope": 2515, + "src": "2045:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2503, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2045:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2512, + "initialValue": { + "arguments": [ + { + "id": 2506, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2068:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2507, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2080:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2508, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "2080:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2509, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2091:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2510, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2488, + "src": "2096:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2505, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "2062:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2062:49:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2045:66:6" + }, + { + "expression": { + "id": 2513, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2504, + "src": "2128:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2495, + "id": 2514, + "nodeType": "Return", + "src": "2121:13:6" + } + ] + }, + "functionSelector": "768ab0fc", + "id": 2516, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2492, + "kind": "modifierInvocation", + "modifierName": { + "id": 2491, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "1960:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "1960:12:6" + } + ], + "name": "mintFromCoin", + "nameLocation": "1897:12:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2490, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1943:8:6" + }, + "parameters": { + "id": 2489, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2488, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "1918:14:6", + "nodeType": "VariableDeclaration", + "scope": 2516, + "src": "1910:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2487, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1910:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1909:24:6" + }, + "returnParameters": { + "id": 2495, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2494, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2516, + "src": "1982:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2493, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1982:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1981:9:6" + }, + "scope": 3368, + "src": "1888:253:6", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9994 + ], + "body": { + "id": 2554, + "nodeType": "Block", + "src": "2274:224:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2531, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2518, + "src": "2292:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2532, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2301:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "2292:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f6d436f696e222066756e6374696f6e", + "id": 2534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2313:49:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + }, + "value": "Mobius: Native Coin use \"mintFromCoin\" function" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + } + ], + "id": 2530, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "2284:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2284:79:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2536, + "nodeType": "ExpressionStatement", + "src": "2284:79:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2538, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2518, + "src": "2381:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2539, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2388:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2540, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2520, + "src": "2393:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2537, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "2374:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2374:26:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2542, + "nodeType": "ExpressionStatement", + "src": "2374:26:6" + }, + { + "assignments": [ + 2544 + ], + "declarations": [ + { + "constant": false, + "id": 2544, + "mutability": "mutable", + "name": "minted", + "nameLocation": "2418:6:6", + "nodeType": "VariableDeclaration", + "scope": 2554, + "src": "2410:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2543, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2410:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2551, + "initialValue": { + "arguments": [ + { + "id": 2546, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2518, + "src": "2433:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2547, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2520, + "src": "2440:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2548, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2448:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2549, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2522, + "src": "2453:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2545, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "2427:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2427:41:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2410:58:6" + }, + { + "expression": { + "id": 2552, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2544, + "src": "2485:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2529, + "id": 2553, + "nodeType": "Return", + "src": "2478:13:6" + } + ] + }, + "functionSelector": "05635bc4", + "id": 2555, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2526, + "kind": "modifierInvocation", + "modifierName": { + "id": 2525, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "2243:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "2243:12:6" + } + ], + "name": "mintFromToken", + "nameLocation": "2156:13:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2524, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2234:8:6" + }, + "parameters": { + "id": 2523, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2518, + "mutability": "mutable", + "name": "stake", + "nameLocation": "2178:5:6", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2170:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2517, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2170:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2520, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2193:6:6", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2185:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2519, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2185:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2522, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "2209:14:6", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2201:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2521, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2201:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2169:55:6" + }, + "returnParameters": { + "id": 2529, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2528, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2265:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2527, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2265:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2264:9:6" + }, + "scope": 3368, + "src": "2147:351:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10003 + ], + "body": { + "id": 2589, + "nodeType": "Block", + "src": "2622:156:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2572, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2557, + "src": "2668:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2573, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2675:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2574, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2675:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2575, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2687:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2576, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2559, + "src": "2692:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2569, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "2632:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2632:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "issueDebtWithPreviousStake", + "nodeType": "MemberAccess", + "referencedDeclaration": 9786, + "src": "2632:35:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 2577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2632:67:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2578, + "nodeType": "ExpressionStatement", + "src": "2632:67:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2580, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2721:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2721:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2582, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2557, + "src": "2733:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "hexValue": "30", + "id": 2583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2740:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "id": 2584, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2559, + "src": "2743:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2579, + "name": "Minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10106, + "src": "2714:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,uint256,uint256)" + } + }, + "id": 2585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2714:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2586, + "nodeType": "EmitStatement", + "src": "2709:41:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 2587, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2767:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2568, + "id": 2588, + "nodeType": "Return", + "src": "2760:11:6" + } + ] + }, + "functionSelector": "93709b30", + "id": 2590, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2563, + "kind": "modifierInvocation", + "modifierName": { + "id": 2562, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "2584:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "2584:9:6" + }, + { + "id": 2565, + "kind": "modifierInvocation", + "modifierName": { + "id": 2564, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "2594:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "2594:12:6" + } + ], + "name": "mintFromPreviousStake", + "nameLocation": "2513:21:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2561, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2575:8:6" + }, + "parameters": { + "id": 2560, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2557, + "mutability": "mutable", + "name": "stake", + "nameLocation": "2543:5:6", + "nodeType": "VariableDeclaration", + "scope": 2590, + "src": "2535:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2556, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2535:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2559, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2558:6:6", + "nodeType": "VariableDeclaration", + "scope": 2590, + "src": "2550:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2558, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2550:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2534:31:6" + }, + "returnParameters": { + "id": 2568, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2567, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2590, + "src": "2616:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2566, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2616:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2615:6:6" + }, + "scope": 3368, + "src": "2504:274:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10012 + ], + "body": { + "id": 2621, + "nodeType": "Block", + "src": "2906:160:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2603, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2923:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2604, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2592, + "src": "2935:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2605, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2945:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2606, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "2945:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2602, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "2916:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2916:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2608, + "nodeType": "ExpressionStatement", + "src": "2916:39:6" + }, + { + "assignments": [ + 2610 + ], + "declarations": [ + { + "constant": false, + "id": 2610, + "mutability": "mutable", + "name": "minted", + "nameLocation": "2973:6:6", + "nodeType": "VariableDeclaration", + "scope": 2621, + "src": "2965:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2609, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2965:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2618, + "initialValue": { + "arguments": [ + { + "id": 2612, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2988:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2613, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "3000:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "3000:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2615, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2592, + "src": "3011:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2616, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2594, + "src": "3021:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2611, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "2982:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2617, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2982:54:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2965:71:6" + }, + { + "expression": { + "id": 2619, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2610, + "src": "3053:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2601, + "id": 2620, + "nodeType": "Return", + "src": "3046:13:6" + } + ] + }, + "functionSelector": "946a970e", + "id": 2622, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2598, + "kind": "modifierInvocation", + "modifierName": { + "id": 2597, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "2875:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "2875:12:6" + } + ], + "name": "shortFromCoin", + "nameLocation": "2793:13:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2596, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2858:8:6" + }, + "parameters": { + "id": 2595, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2592, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "2815:8:6", + "nodeType": "VariableDeclaration", + "scope": 2622, + "src": "2807:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2591, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2807:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2594, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "2833:14:6", + "nodeType": "VariableDeclaration", + "scope": 2622, + "src": "2825:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2593, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2825:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2806:42:6" + }, + "returnParameters": { + "id": 2601, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2600, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2622, + "src": "2897:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2599, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2897:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2896:9:6" + }, + "scope": 3368, + "src": "2784:282:6", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10025 + ], + "body": { + "id": 2662, + "nodeType": "Block", + "src": "3218:236:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2639, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2624, + "src": "3236:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2640, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "3245:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3236:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204e617469766520436f696e20757365202273686f727446726f6d546f6b656e222066756e6374696f6e", + "id": 2642, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3257:51:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_ab2fbd74cd1049bf631750db72ab64b9f0ef7c09b83c29c6fcf6e47e3b5cb850", + "typeString": "literal_string \"Mobius: Native Coin use \"shortFromToken\" function\"" + }, + "value": "Mobius: Native Coin use \"shortFromToken\" function" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_ab2fbd74cd1049bf631750db72ab64b9f0ef7c09b83c29c6fcf6e47e3b5cb850", + "typeString": "literal_string \"Mobius: Native Coin use \"shortFromToken\" function\"" + } + ], + "id": 2638, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "3228:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3228:81:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2644, + "nodeType": "ExpressionStatement", + "src": "3228:81:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2646, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2624, + "src": "3327:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2647, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2628, + "src": "3334:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2648, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2626, + "src": "3344:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2645, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "3320:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2649, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3320:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2650, + "nodeType": "ExpressionStatement", + "src": "3320:31:6" + }, + { + "assignments": [ + 2652 + ], + "declarations": [ + { + "constant": false, + "id": 2652, + "mutability": "mutable", + "name": "minted", + "nameLocation": "3369:6:6", + "nodeType": "VariableDeclaration", + "scope": 2662, + "src": "3361:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2651, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3361:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2659, + "initialValue": { + "arguments": [ + { + "id": 2654, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2624, + "src": "3384:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2655, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2626, + "src": "3391:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2656, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2628, + "src": "3399:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2657, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2630, + "src": "3409:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2653, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "3378:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2658, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3378:46:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3361:63:6" + }, + { + "expression": { + "id": 2660, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2652, + "src": "3441:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2637, + "id": 2661, + "nodeType": "Return", + "src": "3434:13:6" + } + ] + }, + "functionSelector": "612cd04b", + "id": 2663, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2634, + "kind": "modifierInvocation", + "modifierName": { + "id": 2633, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "3187:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "3187:12:6" + } + ], + "name": "shortFromToken", + "nameLocation": "3081:14:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2632, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "3178:8:6" + }, + "parameters": { + "id": 2631, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2624, + "mutability": "mutable", + "name": "stake", + "nameLocation": "3104:5:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3096:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2623, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3096:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2626, + "mutability": "mutable", + "name": "amount", + "nameLocation": "3119:6:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3111:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2625, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3111:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2628, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "3135:8:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3127:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2627, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3127:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2630, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "3153:14:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3145:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2629, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3145:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3095:73:6" + }, + "returnParameters": { + "id": 2637, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2636, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3209:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2635, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3209:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3208:9:6" + }, + "scope": 3368, + "src": "3072:382:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10036 + ], + "body": { + "id": 2700, + "nodeType": "Block", + "src": "3597:172:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2682, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "3643:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2683, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "3650:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2684, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "3650:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2685, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2667, + "src": "3662:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2686, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2669, + "src": "3672:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2679, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "3607:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2680, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3607:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "issueDebtWithPreviousStake", + "nodeType": "MemberAccess", + "referencedDeclaration": 9786, + "src": "3607:35:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 2687, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3607:72:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2688, + "nodeType": "ExpressionStatement", + "src": "3607:72:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2690, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "3702:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2691, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "3702:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2692, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "3714:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2693, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2667, + "src": "3721:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "hexValue": "30", + "id": 2694, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3731:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "id": 2695, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2669, + "src": "3734:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2689, + "name": "Shorted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10118, + "src": "3694:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256,uint256)" + } + }, + "id": 2696, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3694:47:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2697, + "nodeType": "EmitStatement", + "src": "3689:52:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 2698, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3758:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2678, + "id": 2699, + "nodeType": "Return", + "src": "3751:11:6" + } + ] + }, + "functionSelector": "dbf1207f", + "id": 2701, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2673, + "kind": "modifierInvocation", + "modifierName": { + "id": 2672, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "3559:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "3559:9:6" + }, + { + "id": 2675, + "kind": "modifierInvocation", + "modifierName": { + "id": 2674, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "3569:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "3569:12:6" + } + ], + "name": "shortFromPreviousStake", + "nameLocation": "3469:22:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2671, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "3550:8:6" + }, + "parameters": { + "id": 2670, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2665, + "mutability": "mutable", + "name": "stake", + "nameLocation": "3500:5:6", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3492:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2664, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3492:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2667, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "3515:8:6", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3507:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2666, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3507:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2669, + "mutability": "mutable", + "name": "amount", + "nameLocation": "3533:6:6", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3525:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2668, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3525:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3491:49:6" + }, + "returnParameters": { + "id": 2678, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2677, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3591:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2676, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3591:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3590:6:6" + }, + "scope": 3368, + "src": "3460:309:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 2790, + "nodeType": "Block", + "src": "3937:697:6", + "statements": [ + { + "assignments": [ + 2717 + ], + "declarations": [ + { + "constant": false, + "id": 2717, + "mutability": "mutable", + "name": "safeCollateralRate", + "nameLocation": "3955:18:6", + "nodeType": "VariableDeclaration", + "scope": 2790, + "src": "3947:26:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2716, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3947:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2724, + "initialValue": { + "arguments": [ + { + "id": 2721, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4004:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2722, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4011:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2718, + "name": "Setting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2447, + "src": "3976:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ISetting_$10732_$", + "typeString": "function () view returns (contract ISetting)" + } + }, + "id": 2719, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3976:9:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "id": 2720, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getCollateralRate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10668, + "src": "3976:27:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,bytes32) view external returns (uint256)" + } + }, + "id": 2723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3976:44:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3947:73:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2728, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2726, + "name": "safeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "4038:18:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 2727, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4059:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "4038:22:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204d697373696e6720436f6c6c61746572616c2052617465", + "id": 2729, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4062:33:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_35d35c2448bc779e366373311d91f6adb640e3ec63c6a5f263ced52012750e38", + "typeString": "literal_string \"Mobius: Missing Collateral Rate\"" + }, + "value": "Mobius: Missing Collateral Rate" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_35d35c2448bc779e366373311d91f6adb640e3ec63c6a5f263ced52012750e38", + "typeString": "literal_string \"Mobius: Missing Collateral Rate\"" + } + ], + "id": 2725, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "4030:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2730, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4030:66:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2731, + "nodeType": "ExpressionStatement", + "src": "4030:66:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2735, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2733, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2709, + "src": "4114:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 2734, + "name": "safeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "4132:18:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4114:36:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a20436f6c6c61746572616c205261746520746f6f206c6f77", + "id": 2736, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4152:33:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e30faf94e498eaeeb9198ebcaaa8204b0eea9b85b1c2b6609f6dea00348941b3", + "typeString": "literal_string \"Mobius: Collateral Rate too low\"" + }, + "value": "Mobius: Collateral Rate too low" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_e30faf94e498eaeeb9198ebcaaa8204b0eea9b85b1c2b6609f6dea00348941b3", + "typeString": "literal_string \"Mobius: Collateral Rate too low\"" + } + ], + "id": 2732, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "4106:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2737, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4106:80:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2738, + "nodeType": "ExpressionStatement", + "src": "4106:80:6" + }, + { + "assignments": [ + 2740 + ], + "declarations": [ + { + "constant": false, + "id": 2740, + "mutability": "mutable", + "name": "issueAmountInUSD", + "nameLocation": "4205:16:6", + "nodeType": "VariableDeclaration", + "scope": 2790, + "src": "4197:24:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2739, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4197:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2752, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2751, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2748, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2741, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2705, + "src": "4224:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "components": [ + { + "arguments": [ + { + "id": 2745, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4256:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2742, + "name": "AssetPrice", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2434, + "src": "4234:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IAssetPrice_$9620_$", + "typeString": "function () view returns (contract IAssetPrice)" + } + }, + "id": 2743, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4234:12:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + } + }, + "id": 2744, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getPrice", + "nodeType": "MemberAccess", + "referencedDeclaration": 9558, + "src": "4234:21:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32) view external returns (uint256)" + } + }, + "id": 2746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4234:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4233:30:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4224:39:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "components": [ + { + "id": 2749, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2709, + "src": "4267:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2750, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4266:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4224:58:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4197:85:6" + }, + { + "assignments": [ + 2754 + ], + "declarations": [ + { + "constant": false, + "id": 2754, + "mutability": "mutable", + "name": "issueDebtInSynth", + "nameLocation": "4300:16:6", + "nodeType": "VariableDeclaration", + "scope": 2790, + "src": "4292:24:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2753, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4292:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2764, + "initialValue": { + "arguments": [ + { + "id": 2758, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4338:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2759, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4345:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2760, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4345:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2761, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4357:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2762, + "name": "issueAmountInUSD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2740, + "src": "4367:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2755, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "4319:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4319:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2757, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "issueDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9775, + "src": "4319:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256) external returns (uint256)" + } + }, + "id": 2763, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4319:65:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4292:92:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2767, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2765, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4399:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2766, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "4411:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "4399:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2786, + "nodeType": "Block", + "src": "4503:92:6", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2778, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4530:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2779, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4530:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2780, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4542:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2781, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4549:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2782, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2705, + "src": "4559:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2783, + "name": "issueDebtInSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2754, + "src": "4567:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2777, + "name": "Shorted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10118, + "src": "4522:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256,uint256)" + } + }, + "id": 2784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4522:62:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2785, + "nodeType": "EmitStatement", + "src": "4517:67:6" + } + ] + }, + "id": 2787, + "nodeType": "IfStatement", + "src": "4395:200:6", + "trueBody": { + "id": 2776, + "nodeType": "Block", + "src": "4416:81:6", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2769, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4442:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2770, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4442:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2771, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4454:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2772, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2705, + "src": "4461:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2773, + "name": "issueAmountInUSD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2740, + "src": "4469:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2768, + "name": "Minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10106, + "src": "4435:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,uint256,uint256)" + } + }, + "id": 2774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4435:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2775, + "nodeType": "EmitStatement", + "src": "4430:56:6" + } + ] + } + }, + { + "expression": { + "id": 2788, + "name": "issueDebtInSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2754, + "src": "4611:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2715, + "id": 2789, + "nodeType": "Return", + "src": "4604:23:6" + } + ] + }, + "id": 2791, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2712, + "kind": "modifierInvocation", + "modifierName": { + "id": 2711, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "3910:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "3910:9:6" + } + ], + "name": "_mint", + "nameLocation": "3784:5:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2710, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2703, + "mutability": "mutable", + "name": "stake", + "nameLocation": "3807:5:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3799:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2702, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3799:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2705, + "mutability": "mutable", + "name": "amount", + "nameLocation": "3830:6:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3822:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2704, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3822:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2707, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "3854:8:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3846:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2706, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3846:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2709, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "3880:14:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3872:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2708, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3872:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3789:111:6" + }, + "returnParameters": { + "id": 2715, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2714, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3929:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2713, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3929:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3928:9:6" + }, + "scope": 3368, + "src": "3775:859:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "baseFunctions": [ + 10051 + ], + "body": { + "id": 2875, + "nodeType": "Block", + "src": "4786:527:6", + "statements": [ + { + "assignments": [ + 2812 + ], + "declarations": [ + { + "constant": false, + "id": 2812, + "mutability": "mutable", + "name": "beforeCollateralRate", + "nameLocation": "4804:20:6", + "nodeType": "VariableDeclaration", + "scope": 2875, + "src": "4796:28:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2811, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4796:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2821, + "initialValue": { + "arguments": [ + { + "id": 2816, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "4854:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2817, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4861:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2818, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4861:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2819, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "4873:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2813, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "4827:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2814, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4827:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getCollateralRate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10791, + "src": "4827:26:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 2820, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4827:55:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4796:86:6" + }, + { + "assignments": [ + 2823 + ], + "declarations": [ + { + "constant": false, + "id": 2823, + "mutability": "mutable", + "name": "burnAmount", + "nameLocation": "4900:10:6", + "nodeType": "VariableDeclaration", + "scope": 2875, + "src": "4892:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2822, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4892:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2835, + "initialValue": { + "arguments": [ + { + "id": 2827, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "4931:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2828, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4938:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2829, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4938:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2830, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "4950:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2831, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2797, + "src": "4960:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 2832, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4968:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4968:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2824, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "4913:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2825, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4913:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2826, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "burnDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9812, + "src": "4913:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256,address) external returns (uint256)" + } + }, + "id": 2834, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4913:66:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4892:87:6" + }, + { + "assignments": [ + 2837 + ], + "declarations": [ + { + "constant": false, + "id": 2837, + "mutability": "mutable", + "name": "claimable", + "nameLocation": "4998:9:6", + "nodeType": "VariableDeclaration", + "scope": 2875, + "src": "4990:17:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2836, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4990:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2839, + "initialValue": { + "hexValue": "30", + "id": 2838, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5010:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4990:21:6" + }, + { + "condition": { + "id": 2840, + "name": "withdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2799, + "src": "5025:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2862, + "nodeType": "IfStatement", + "src": "5021:183:6", + "trueBody": { + "id": 2861, + "nodeType": "Block", + "src": "5035:169:6", + "statements": [ + { + "expression": { + "id": 2851, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2841, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2837, + "src": "5049:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 2845, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "5083:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2846, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5090:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2847, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5090:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2848, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "5102:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2849, + "name": "beforeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2812, + "src": "5112:20:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2842, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "5061:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2843, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5061:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getClaimable", + "nodeType": "MemberAccess", + "referencedDeclaration": 10780, + "src": "5061:21:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256) view external returns (uint256)" + } + }, + "id": 2850, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5061:72:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5049:84:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2852, + "nodeType": "ExpressionStatement", + "src": "5049:84:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2854, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "5154:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2855, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "5161:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2856, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2837, + "src": "5171:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 2857, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5182:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2858, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5182:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2853, + "name": "_claim", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3001, + "src": "5147:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_bool_$", + "typeString": "function (bytes32,bytes32,uint256,address) returns (bool)" + } + }, + "id": 2859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5147:46:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2860, + "nodeType": "ExpressionStatement", + "src": "5147:46:6" + } + ] + } + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2864, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5226:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5226:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2866, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "5238:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2867, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "5245:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2868, + "name": "burnAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2823, + "src": "5255:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2863, + "name": "Burned", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10128, + "src": "5219:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256)" + } + }, + "id": 2869, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5219:47:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2870, + "nodeType": "EmitStatement", + "src": "5214:52:6" + }, + { + "expression": { + "components": [ + { + "id": 2871, + "name": "burnAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2823, + "src": "5284:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2872, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2837, + "src": "5296:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2873, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5283:23:6", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 2810, + "id": 2874, + "nodeType": "Return", + "src": "5276:30:6" + } + ] + }, + "functionSelector": "1325188f", + "id": 2876, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2803, + "kind": "modifierInvocation", + "modifierName": { + "id": 2802, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "4736:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "4736:9:6" + }, + { + "id": 2805, + "kind": "modifierInvocation", + "modifierName": { + "id": 2804, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "4746:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "4746:12:6" + } + ], + "name": "burn", + "nameLocation": "4649:4:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2801, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "4727:8:6" + }, + "parameters": { + "id": 2800, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2793, + "mutability": "mutable", + "name": "stake", + "nameLocation": "4662:5:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4654:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2792, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4654:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2795, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "4677:8:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4669:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2794, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4669:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2797, + "mutability": "mutable", + "name": "amount", + "nameLocation": "4695:6:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4687:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2796, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4687:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2799, + "mutability": "mutable", + "name": "withdraw", + "nameLocation": "4708:8:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4703:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2798, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4703:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4653:64:6" + }, + "returnParameters": { + "id": 2810, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2807, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4768:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2806, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4768:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2809, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4777:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2808, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4777:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4767:18:6" + }, + "scope": 3368, + "src": "4640:673:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10062 + ], + "body": { + "id": 2928, + "nodeType": "Block", + "src": "5469:333:6", + "statements": [ + { + "assignments": [ + 2893 + ], + "declarations": [ + { + "constant": false, + "id": 2893, + "mutability": "mutable", + "name": "safeCollateralRate", + "nameLocation": "5487:18:6", + "nodeType": "VariableDeclaration", + "scope": 2928, + "src": "5479:26:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2892, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5479:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2900, + "initialValue": { + "arguments": [ + { + "id": 2897, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2878, + "src": "5536:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2898, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2880, + "src": "5543:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2894, + "name": "Setting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2447, + "src": "5508:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ISetting_$10732_$", + "typeString": "function () view returns (contract ISetting)" + } + }, + "id": 2895, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5508:9:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "id": 2896, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getCollateralRate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10668, + "src": "5508:27:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,bytes32) view external returns (uint256)" + } + }, + "id": 2899, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5508:44:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5479:73:6" + }, + { + "assignments": [ + 2902 + ], + "declarations": [ + { + "constant": false, + "id": 2902, + "mutability": "mutable", + "name": "claimable", + "nameLocation": "5570:9:6", + "nodeType": "VariableDeclaration", + "scope": 2928, + "src": "5562:17:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2901, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5562:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2912, + "initialValue": { + "arguments": [ + { + "id": 2906, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2878, + "src": "5604:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2907, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5611:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2908, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5611:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2909, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2880, + "src": "5623:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2910, + "name": "safeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2893, + "src": "5633:18:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2903, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "5582:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2904, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5582:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2905, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getClaimable", + "nodeType": "MemberAccess", + "referencedDeclaration": 10780, + "src": "5582:21:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256) view external returns (uint256)" + } + }, + "id": 2911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5582:70:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5562:90:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2916, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2914, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2902, + "src": "5670:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 2915, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2882, + "src": "5683:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5670:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a207472616e7366657220616d6f756e74206578636565647320636c61696d61626c65", + "id": 2917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5691:43:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_383a6ebef3f1fab8a147c7052d2fe5baac23a5125ba031a71180eaf1c40ed986", + "typeString": "literal_string \"Mobius: transfer amount exceeds claimable\"" + }, + "value": "Mobius: transfer amount exceeds claimable" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_383a6ebef3f1fab8a147c7052d2fe5baac23a5125ba031a71180eaf1c40ed986", + "typeString": "literal_string \"Mobius: transfer amount exceeds claimable\"" + } + ], + "id": 2913, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "5662:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2918, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5662:73:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2919, + "nodeType": "ExpressionStatement", + "src": "5662:73:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2921, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2878, + "src": "5759:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2922, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2880, + "src": "5766:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2923, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2882, + "src": "5776:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 2924, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5784:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2925, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5784:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2920, + "name": "_claim", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3001, + "src": "5752:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_bool_$", + "typeString": "function (bytes32,bytes32,uint256,address) returns (bool)" + } + }, + "id": 2926, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5752:43:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 2891, + "id": 2927, + "nodeType": "Return", + "src": "5745:50:6" + } + ] + }, + "functionSelector": "2dba4273", + "id": 2929, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2886, + "kind": "modifierInvocation", + "modifierName": { + "id": 2885, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "5431:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "5431:9:6" + }, + { + "id": 2888, + "kind": "modifierInvocation", + "modifierName": { + "id": 2887, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "5441:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "5441:12:6" + } + ], + "name": "claim", + "nameLocation": "5328:5:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2884, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "5422:8:6" + }, + "parameters": { + "id": 2883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2878, + "mutability": "mutable", + "name": "stake", + "nameLocation": "5351:5:6", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5343:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2877, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5343:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2880, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "5374:8:6", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5366:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2879, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5366:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2882, + "mutability": "mutable", + "name": "amount", + "nameLocation": "5400:6:6", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5392:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2881, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5392:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5333:79:6" + }, + "returnParameters": { + "id": 2891, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2890, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5463:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2889, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5463:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "5462:6:6" + }, + "scope": 3368, + "src": "5319:483:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3000, + "nodeType": "Block", + "src": "5957:415:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2945, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "5984:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2946, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "5991:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2947, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2933, + "src": "5997:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2948, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6007:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2942, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "5967:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5967:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2944, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "unstake", + "nodeType": "MemberAccess", + "referencedDeclaration": 10756, + "src": "5967:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 2949, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5967:47:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2950, + "nodeType": "ExpressionStatement", + "src": "5967:47:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2953, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2951, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "6029:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2952, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6038:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "6029:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2988, + "nodeType": "Block", + "src": "6111:175:6", + "statements": [ + { + "assignments": [ + 2965 + ], + "declarations": [ + { + "constant": false, + "id": 2965, + "mutability": "mutable", + "name": "token", + "nameLocation": "6132:5:6", + "nodeType": "VariableDeclaration", + "scope": 2988, + "src": "6125:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 2964, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2963, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "6125:6:6" + }, + "referencedDeclaration": 9727, + "src": "6125:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + } + ], + "id": 2972, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "5374616b65", + "id": 2968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6160:7:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + "value": "Stake" + }, + { + "id": 2969, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "6169:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2967, + "name": "requireAsset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8894, + "src": "6147:12:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 2970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6147:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2966, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9727, + "src": "6140:6:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$9727_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 2971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6140:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6125:51:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2976, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6209:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 2979, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "6233:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 2980, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "6233:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 2981, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6233:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 2982, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2965, + "src": "6257:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 2983, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "6257:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 2984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6257:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 2977, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6215:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "6215:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 2985, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6215:59:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2973, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2965, + "src": "6190:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 2975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 12135, + "src": "6190:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 2986, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6190:85:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2987, + "nodeType": "ExpressionStatement", + "src": "6190:85:6" + } + ] + }, + "id": 2989, + "nodeType": "IfStatement", + "src": "6025:261:6", + "trueBody": { + "id": 2962, + "nodeType": "Block", + "src": "6050:55:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2959, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6087:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 2956, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6072:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2955, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6064:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_payable_$", + "typeString": "type(address payable)" + }, + "typeName": { + "id": 2954, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6064:8:6", + "stateMutability": "payable", + "typeDescriptions": {} + } + }, + "id": 2957, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6064:13:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 2958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "src": "6064:22:6", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 2960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6064:30:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2961, + "nodeType": "ExpressionStatement", + "src": "6064:30:6" + } + ] + } + }, + { + "eventCall": { + "arguments": [ + { + "id": 2991, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6308:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2992, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "6314:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2993, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6321:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2994, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2933, + "src": "6327:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2995, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6337:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2990, + "name": "Claimed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10140, + "src": "6300:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,address,bytes32,uint256)" + } + }, + "id": 2996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6300:44:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2997, + "nodeType": "EmitStatement", + "src": "6295:49:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 2998, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6361:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2941, + "id": 2999, + "nodeType": "Return", + "src": "6354:11:6" + } + ] + }, + "id": 3001, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_claim", + "nameLocation": "5817:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2938, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2931, + "mutability": "mutable", + "name": "stake", + "nameLocation": "5849:5:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5841:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2930, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5841:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2933, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "5872:8:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5864:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2932, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5864:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2935, + "mutability": "mutable", + "name": "amount", + "nameLocation": "5898:6:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5890:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2934, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5890:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2937, + "mutability": "mutable", + "name": "addr", + "nameLocation": "5922:4:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5914:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2936, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5914:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5823:109:6" + }, + "returnParameters": { + "id": 2941, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2940, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5951:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2939, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5951:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "5950:6:6" + }, + "scope": 3368, + "src": "5808:564:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "baseFunctions": [ + 9965 + ], + "body": { + "id": 3043, + "nodeType": "Block", + "src": "6473:259:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3015, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6508:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3016, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6520:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "6520:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3018, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3003, + "src": "6532:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3012, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "6491:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 3013, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6491:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 3014, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9841, + "src": "6491:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 3019, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6491:50:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 3020, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6544:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6491:54:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a2044656274206d7573742062652067726561746572207468616e207a65726f", + "id": 3022, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6547:40:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + }, + "value": "Mobius: Debt must be greater than zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + } + ], + "id": 3011, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "6483:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3023, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6483:105:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3024, + "nodeType": "ExpressionStatement", + "src": "6483:105:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3026, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6606:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3027, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3003, + "src": "6618:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3028, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6628:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "6628:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3025, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "6599:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 3030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6599:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3031, + "nodeType": "ExpressionStatement", + "src": "6599:39:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3033, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6660:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3034, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "6660:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3035, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6672:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3036, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3003, + "src": "6684:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3037, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6694:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "6694:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3032, + "name": "Staked", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10096, + "src": "6653:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256)" + } + }, + "id": 3039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6653:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3040, + "nodeType": "EmitStatement", + "src": "6648:56:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 3041, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6721:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 3010, + "id": 3042, + "nodeType": "Return", + "src": "6714:11:6" + } + ] + }, + "functionSelector": "271cdc68", + "id": 3044, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3007, + "kind": "modifierInvocation", + "modifierName": { + "id": 3006, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "6445:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "6445:12:6" + } + ], + "name": "stakeFromCoin", + "nameLocation": "6387:13:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3005, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "6428:8:6" + }, + "parameters": { + "id": 3004, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3003, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "6409:8:6", + "nodeType": "VariableDeclaration", + "scope": 3044, + "src": "6401:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3002, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6401:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6400:18:6" + }, + "returnParameters": { + "id": 3010, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3009, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3044, + "src": "6467:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3008, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6467:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "6466:6:6" + }, + "scope": 3368, + "src": "6378:354:6", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9976 + ], + "body": { + "id": 3095, + "nodeType": "Block", + "src": "6857:327:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3059, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "6875:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 3060, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6884:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "6875:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f6d436f696e222066756e6374696f6e", + "id": 3062, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6896:49:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + }, + "value": "Mobius: Native Coin use \"mintFromCoin\" function" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + } + ], + "id": 3058, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "6867:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6867:79:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3064, + "nodeType": "ExpressionStatement", + "src": "6867:79:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3075, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3069, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "6981:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3070, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6988:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3071, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "6988:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3072, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3048, + "src": "7000:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3066, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "6964:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 3067, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6964:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 3068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9841, + "src": "6964:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 3073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6964:45:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 3074, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7012:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6964:49:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a2044656274206d7573742062652067726561746572207468616e207a65726f", + "id": 3076, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7015:40:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + }, + "value": "Mobius: Debt must be greater than zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + } + ], + "id": 3065, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "6956:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6956:100:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3078, + "nodeType": "ExpressionStatement", + "src": "6956:100:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3080, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "7074:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3081, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3048, + "src": "7081:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3082, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3050, + "src": "7091:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3079, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "7067:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 3083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7067:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3084, + "nodeType": "ExpressionStatement", + "src": "7067:31:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3086, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "7120:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3087, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "7120:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3088, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "7132:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3089, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3048, + "src": "7139:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3090, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3050, + "src": "7149:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3085, + "name": "Staked", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10096, + "src": "7113:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256)" + } + }, + "id": 3091, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7113:43:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3092, + "nodeType": "EmitStatement", + "src": "7108:48:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 3093, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7173:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 3057, + "id": 3094, + "nodeType": "Return", + "src": "7166:11:6" + } + ] + }, + "functionSelector": "b1636f39", + "id": 3096, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3054, + "kind": "modifierInvocation", + "modifierName": { + "id": 3053, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "6829:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "6829:12:6" + } + ], + "name": "stakeFromToken", + "nameLocation": "6747:14:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3052, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "6820:8:6" + }, + "parameters": { + "id": 3051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3046, + "mutability": "mutable", + "name": "stake", + "nameLocation": "6770:5:6", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6762:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3045, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6762:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3048, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "6785:8:6", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6777:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3047, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6777:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3050, + "mutability": "mutable", + "name": "amount", + "nameLocation": "6803:6:6", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6795:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3049, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6795:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6761:49:6" + }, + "returnParameters": { + "id": 3057, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3056, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6851:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3055, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6851:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "6850:6:6" + }, + "scope": 3368, + "src": "6738:446:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3163, + "nodeType": "Block", + "src": "7303:488:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3110, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3108, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3102, + "src": "7321:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 3109, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7330:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7321:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a20616d6f756e74206d7573742062652067726561746572207468616e207a65726f", + "id": 3111, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7333:42:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8134234dd9fc86052f4bc24ebeefa08d4567de47a47c9d7108b2cd53a31b643c", + "typeString": "literal_string \"Mobius: amount must be greater than zero\"" + }, + "value": "Mobius: amount must be greater than zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_8134234dd9fc86052f4bc24ebeefa08d4567de47a47c9d7108b2cd53a31b643c", + "typeString": "literal_string \"Mobius: amount must be greater than zero\"" + } + ], + "id": 3107, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "7313:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7313:63:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3113, + "nodeType": "ExpressionStatement", + "src": "7313:63:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3116, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3114, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3098, + "src": "7391:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 3115, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "7400:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "7391:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3152, + "nodeType": "IfStatement", + "src": "7387:336:6", + "trueBody": { + "id": 3151, + "nodeType": "Block", + "src": "7412:311:6", + "statements": [ + { + "assignments": [ + 3118 + ], + "declarations": [ + { + "constant": false, + "id": 3118, + "mutability": "mutable", + "name": "stakeAddress", + "nameLocation": "7434:12:6", + "nodeType": "VariableDeclaration", + "scope": 3151, + "src": "7426:20:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3117, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7426:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3123, + "initialValue": { + "arguments": [ + { + "hexValue": "5374616b65", + "id": 3120, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7462:7:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + "value": "Stake" + }, + { + "id": 3121, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3098, + "src": "7471:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3119, + "name": "requireAsset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8894, + "src": "7449:12:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3122, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7449:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7426:51:6" + }, + { + "assignments": [ + 3126 + ], + "declarations": [ + { + "constant": false, + "id": 3126, + "mutability": "mutable", + "name": "token", + "nameLocation": "7498:5:6", + "nodeType": "VariableDeclaration", + "scope": 3151, + "src": "7491:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 3125, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3124, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "7491:6:6" + }, + "referencedDeclaration": 9727, + "src": "7491:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + } + ], + "id": 3130, + "initialValue": { + "arguments": [ + { + "id": 3128, + "name": "stakeAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3118, + "src": "7513:12:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3127, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9727, + "src": "7506:6:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$9727_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 3129, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7506:20:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7491:35:6" + }, + { + "expression": { + "arguments": [ + { + "expression": { + "id": 3134, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "7580:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "7580:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 3138, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967268, + "src": "7616:4:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Mobius_$3368", + "typeString": "contract Mobius" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_Mobius_$3368", + "typeString": "contract Mobius" + } + ], + "id": 3137, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7608:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3136, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7608:7:6", + "typeDescriptions": {} + } + }, + "id": 3139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7608:13:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3142, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "7657:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 3143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "7657:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 3144, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7657:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3145, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3126, + "src": "7681:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "7681:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 3147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7681:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 3140, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3102, + "src": "7639:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "7639:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7639:59:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 3131, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3126, + "src": "7540:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3133, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 12161, + "src": "7540:22:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 3149, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7540:172:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3150, + "nodeType": "ExpressionStatement", + "src": "7540:172:6" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 3156, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3098, + "src": "7748:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3157, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "7755:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "7755:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3159, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3100, + "src": "7767:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3160, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3102, + "src": "7777:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3153, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "7733:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 3154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7733:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 3155, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "stake", + "nodeType": "MemberAccess", + "referencedDeclaration": 10745, + "src": "7733:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 3161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7733:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3162, + "nodeType": "ExpressionStatement", + "src": "7733:51:6" + } + ] + }, + "id": 3164, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3105, + "kind": "modifierInvocation", + "modifierName": { + "id": 3104, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "7293:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "7293:9:6" + } + ], + "name": "_stake", + "nameLocation": "7199:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3098, + "mutability": "mutable", + "name": "stake", + "nameLocation": "7223:5:6", + "nodeType": "VariableDeclaration", + "scope": 3164, + "src": "7215:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3097, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7215:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3100, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "7246:8:6", + "nodeType": "VariableDeclaration", + "scope": 3164, + "src": "7238:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3099, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7238:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3102, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7272:6:6", + "nodeType": "VariableDeclaration", + "scope": 3164, + "src": "7264:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3101, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7264:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7205:79:6" + }, + "returnParameters": { + "id": 3106, + "nodeType": "ParameterList", + "parameters": [], + "src": "7303:0:6" + }, + "scope": 3368, + "src": "7190:601:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "baseFunctions": [ + 10073 + ], + "body": { + "id": 3212, + "nodeType": "Block", + "src": "7957:438:6", + "statements": [ + { + "assignments": [ + 3181, + 3183, + 3185, + 3187 + ], + "declarations": [ + { + "constant": false, + "id": 3181, + "mutability": "mutable", + "name": "tradingAmount", + "nameLocation": "7976:13:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "7968:21:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3180, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7968:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3183, + "mutability": "mutable", + "name": "tradingFee", + "nameLocation": "7999:10:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "7991:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3182, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7991:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3185, + "mutability": "mutable", + "name": "fromSynthPrice", + "nameLocation": "8019:14:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "8011:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3184, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8011:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3187, + "mutability": "mutable", + "name": "toSynthPirce", + "nameLocation": "8043:12:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "8035:20:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3186, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8035:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3197, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 3191, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "8086:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "8086:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3193, + "name": "fromSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3166, + "src": "8098:9:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3194, + "name": "fromAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3168, + "src": "8109:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3195, + "name": "toSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3170, + "src": "8121:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3188, + "name": "Trader", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2473, + "src": "8071:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ITrader_$10913_$", + "typeString": "function () view returns (contract ITrader)" + } + }, + "id": 3189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8071:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + } + }, + "id": 3190, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "trade", + "nodeType": "MemberAccess", + "referencedDeclaration": 10884, + "src": "8071:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_bytes32_$_t_uint256_$_t_bytes32_$returns$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (address,bytes32,uint256,bytes32) external returns (uint256,uint256,uint256,uint256)" + } + }, + "id": 3196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8071:58:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7967:162:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3199, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "8165:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "8165:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3201, + "name": "fromSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3166, + "src": "8189:9:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3202, + "name": "toSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3170, + "src": "8212:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3203, + "name": "fromAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3168, + "src": "8233:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3204, + "name": "tradingAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3181, + "src": "8257:13:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3205, + "name": "tradingFee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3183, + "src": "8284:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3206, + "name": "fromSynthPrice", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3185, + "src": "8308:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3207, + "name": "toSynthPirce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3187, + "src": "8336:12:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3198, + "name": "Traded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10158, + "src": "8145:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256,uint256,uint256,uint256,uint256)" + } + }, + "id": 3208, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8145:213:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3209, + "nodeType": "EmitStatement", + "src": "8140:218:6" + }, + { + "expression": { + "id": 3210, + "name": "tradingAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3181, + "src": "8375:13:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3179, + "id": 3211, + "nodeType": "Return", + "src": "8368:20:6" + } + ] + }, + "functionSelector": "f9df4a6c", + "id": 3213, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3174, + "kind": "modifierInvocation", + "modifierName": { + "id": 3173, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "7916:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "7916:9:6" + }, + { + "id": 3176, + "kind": "modifierInvocation", + "modifierName": { + "id": 3175, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "7926:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "7926:12:6" + } + ], + "name": "trade", + "nameLocation": "7806:5:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3172, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "7907:8:6" + }, + "parameters": { + "id": 3171, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3166, + "mutability": "mutable", + "name": "fromSynth", + "nameLocation": "7829:9:6", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7821:17:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3165, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7821:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3168, + "mutability": "mutable", + "name": "fromAmount", + "nameLocation": "7856:10:6", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7848:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3167, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7848:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3170, + "mutability": "mutable", + "name": "toSynth", + "nameLocation": "7884:7:6", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7876:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3169, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7876:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7811:86:6" + }, + "returnParameters": { + "id": 3179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3178, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7948:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3177, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7948:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7947:9:6" + }, + "scope": 3368, + "src": "7797:598:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10086 + ], + "body": { + "id": 3366, + "nodeType": "Block", + "src": "8583:1064:6", + "statements": [ + { + "assignments": [ + 3232 + ], + "declarations": [ + { + "constant": false, + "id": 3232, + "mutability": "mutable", + "name": "liquidable", + "nameLocation": "8601:10:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8593:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3231, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8593:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3240, + "initialValue": { + "arguments": [ + { + "id": 3236, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8641:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3237, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "8648:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3238, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "8657:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3233, + "name": "Liquidator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2486, + "src": "8614:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ILiquidator_$9912_$", + "typeString": "function () view returns (contract ILiquidator)" + } + }, + "id": 3234, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8614:12:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "id": 3235, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getLiquidable", + "nodeType": "MemberAccess", + "referencedDeclaration": 9898, + "src": "8614:26:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 3239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8614:52:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8593:73:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3244, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3242, + "name": "liquidable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3232, + "src": "8684:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 3243, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "8698:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8684:20:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a206c697175696461746520616d6f756e742065786365656473206c697175696461626c65", + "id": 3245, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8706:45:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_af4d8cdf40d3e8e8e19a2e18f08b4065874ffee61c93af22483503bd9c3145fa", + "typeString": "literal_string \"Mobius: liquidate amount exceeds liquidable\"" + }, + "value": "Mobius: liquidate amount exceeds liquidable" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_af4d8cdf40d3e8e8e19a2e18f08b4065874ffee61c93af22483503bd9c3145fa", + "typeString": "literal_string \"Mobius: liquidate amount exceeds liquidable\"" + } + ], + "id": 3241, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "8676:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3246, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8676:76:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3247, + "nodeType": "ExpressionStatement", + "src": "8676:76:6" + }, + { + "assignments": [ + 3249, + 3251 + ], + "declarations": [ + { + "constant": false, + "id": 3249, + "mutability": "mutable", + "name": "toPayer", + "nameLocation": "8773:7:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8765:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3248, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8765:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3251, + "mutability": "mutable", + "name": "toPlat", + "nameLocation": "8789:6:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8781:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3250, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8781:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3259, + "initialValue": { + "arguments": [ + { + "id": 3255, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8826:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3256, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "8833:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3257, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "8843:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3252, + "name": "Liquidator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2486, + "src": "8799:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ILiquidator_$9912_$", + "typeString": "function () view returns (contract ILiquidator)" + } + }, + "id": 3253, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8799:12:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "id": 3254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getUnstakable", + "nodeType": "MemberAccess", + "referencedDeclaration": 9911, + "src": "8799:26:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32,bytes32,uint256) view external returns (uint256,uint256)" + } + }, + "id": 3258, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8799:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8764:86:6" + }, + { + "assignments": [ + 3261 + ], + "declarations": [ + { + "constant": false, + "id": 3261, + "mutability": "mutable", + "name": "unstakable", + "nameLocation": "8868:10:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8860:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3260, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8860:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3265, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3262, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "8881:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 3263, + "name": "toPlat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3251, + "src": "8891:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8881:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8860:37:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3269, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8925:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3270, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "8932:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3271, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "8941:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3272, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "8951:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 3273, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "8959:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "8959:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3266, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "8907:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 3267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8907:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 3268, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "burnDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9812, + "src": "8907:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256,address) external returns (uint256)" + } + }, + "id": 3275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8907:63:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3276, + "nodeType": "ExpressionStatement", + "src": "8907:63:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3280, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8997:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3281, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "9004:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3282, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "9013:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3283, + "name": "unstakable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3261, + "src": "9023:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3277, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "8980:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 3278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8980:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 3279, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "unstake", + "nodeType": "MemberAccess", + "referencedDeclaration": 10756, + "src": "8980:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 3284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8980:54:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3285, + "nodeType": "ExpressionStatement", + "src": "8980:54:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3288, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3286, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "9049:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 3287, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "9058:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "9049:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3352, + "nodeType": "Block", + "src": "9217:316:6", + "statements": [ + { + "assignments": [ + 3311 + ], + "declarations": [ + { + "constant": false, + "id": 3311, + "mutability": "mutable", + "name": "token", + "nameLocation": "9238:5:6", + "nodeType": "VariableDeclaration", + "scope": 3352, + "src": "9231:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 3310, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3309, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "9231:6:6" + }, + "referencedDeclaration": 9727, + "src": "9231:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + } + ], + "id": 3318, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "5374616b65", + "id": 3314, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9266:7:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + "value": "Stake" + }, + { + "id": 3315, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "9275:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3313, + "name": "requireAsset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8894, + "src": "9253:12:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9253:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3312, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9727, + "src": "9246:6:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$9727_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 3317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9246:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9231:51:6" + }, + { + "expression": { + "arguments": [ + { + "expression": { + "id": 3322, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "9315:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "9315:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3326, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "9346:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 3327, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "9346:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 3328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9346:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3329, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9370:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "9370:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 3331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9370:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 3324, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "9327:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "9327:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9327:60:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 3319, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9296:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 12135, + "src": "9296:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 3333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9296:92:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3334, + "nodeType": "ExpressionStatement", + "src": "9296:92:6" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 3339, + "name": "LIQUIDATION_FEE_ADDRESS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8563, + "src": "9436:23:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3338, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "9421:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9421:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3343, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "9480:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 3344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "9480:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 3345, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9480:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3346, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9504:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "9504:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 3348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9504:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 3341, + "name": "toPlat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3251, + "src": "9462:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "9462:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3349, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9462:59:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 3335, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9402:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 12135, + "src": "9402:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 3350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9402:120:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3351, + "nodeType": "ExpressionStatement", + "src": "9402:120:6" + } + ] + }, + "id": 3353, + "nodeType": "IfStatement", + "src": "9045:488:6", + "trueBody": { + "id": 3308, + "nodeType": "Block", + "src": "9070:141:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3295, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "9113:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 3291, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "9092:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "9092:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3290, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9084:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_payable_$", + "typeString": "type(address payable)" + }, + "typeName": { + "id": 3289, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "9084:8:6", + "stateMutability": "payable", + "typeDescriptions": {} + } + }, + "id": 3293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9084:19:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 3294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "src": "9084:28:6", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 3296, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9084:37:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3297, + "nodeType": "ExpressionStatement", + "src": "9084:37:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3305, + "name": "toPlat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3251, + "src": "9193:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 3301, + "name": "LIQUIDATION_FEE_ADDRESS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8563, + "src": "9158:23:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3300, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "9143:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9143:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9135:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_payable_$", + "typeString": "type(address payable)" + }, + "typeName": { + "id": 3298, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "9135:8:6", + "stateMutability": "payable", + "typeDescriptions": {} + } + }, + "id": 3303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9135:48:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 3304, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "src": "9135:57:6", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 3306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9135:65:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3307, + "nodeType": "ExpressionStatement", + "src": "9135:65:6" + } + ] + } + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3355, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "9559:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3356, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "9559:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3357, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "9571:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3358, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "9578:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3359, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "9587:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3360, + "name": "unstakable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3261, + "src": "9597:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3361, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "9609:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3354, + "name": "Liquidated", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10172, + "src": "9548:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,address,bytes32,uint256,uint256)" + } + }, + "id": 3362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9548:68:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3363, + "nodeType": "EmitStatement", + "src": "9543:73:6" + }, + { + "expression": { + "id": 3364, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "9633:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3230, + "id": 3365, + "nodeType": "Return", + "src": "9626:14:6" + } + ] + }, + "functionSelector": "ea110b7d", + "id": 3367, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3225, + "kind": "modifierInvocation", + "modifierName": { + "id": 3224, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "8542:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "8542:9:6" + }, + { + "id": 3227, + "kind": "modifierInvocation", + "modifierName": { + "id": 3226, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "8552:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "8552:12:6" + } + ], + "name": "liquidate", + "nameLocation": "8410:9:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3223, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "8533:8:6" + }, + "parameters": { + "id": 3222, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3215, + "mutability": "mutable", + "name": "stake", + "nameLocation": "8437:5:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8429:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3214, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8429:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3217, + "mutability": "mutable", + "name": "account", + "nameLocation": "8460:7:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8452:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3216, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8452:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3219, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "8485:8:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8477:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3218, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8477:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3221, + "mutability": "mutable", + "name": "amount", + "nameLocation": "8511:6:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8503:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3220, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8503:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8419:104:6" + }, + "returnParameters": { + "id": 3230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3229, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8574:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3228, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8574:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8573:9:6" + }, + "scope": 3368, + "src": "8401:1246:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 3369, + "src": "506:9143:6", + "usedErrors": [] + } + ], + "src": "32:9618:6" + }, + "legacyAST": { + "absolutePath": "project:/contracts/Mobius.sol", + "exportedSymbols": { + "Address": [ + 11660 + ], + "Constants": [ + 8570 + ], + "IAssetPrice": [ + 9620 + ], + "IERC20": [ + 9727 + ], + "IIssuer": [ + 9873 + ], + "ILiquidator": [ + 9912 + ], + "IMobius": [ + 10173 + ], + "IOwnable": [ + 10242 + ], + "IResolver": [ + 10297 + ], + "ISetting": [ + 10732 + ], + "IStaker": [ + 10792 + ], + "ITrader": [ + 10913 + ], + "Importable": [ + 8972 + ], + "Mobius": [ + 3368 + ], + "Ownable": [ + 9135 + ], + "Pausable": [ + 9196 + ], + "PreciseMath": [ + 12065 + ], + "ReentrancyGuard": [ + 12105 + ], + "SafeERC20": [ + 12241 + ], + "Strings": [ + 12299 + ] + }, + "id": 3369, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 2345, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:6" + }, + { + "absolutePath": "project:/contracts/lib/PreciseMath.sol", + "file": "./lib/PreciseMath.sol", + "id": 2346, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 12066, + "src": "57:31:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/lib/SafeERC20.sol", + "file": "./lib/SafeERC20.sol", + "id": 2347, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 12242, + "src": "89:29:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/base/Pausable.sol", + "file": "./base/Pausable.sol", + "id": 2348, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9197, + "src": "119:29:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/base/Importable.sol", + "file": "./base/Importable.sol", + "id": 2349, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 8973, + "src": "149:31:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IMobius.sol", + "file": "./interfaces/IMobius.sol", + "id": 2350, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10174, + "src": "181:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IStaker.sol", + "file": "./interfaces/IStaker.sol", + "id": 2351, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10793, + "src": "216:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/ITrader.sol", + "file": "./interfaces/ITrader.sol", + "id": 2352, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10914, + "src": "251:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IAssetPrice.sol", + "file": "./interfaces/IAssetPrice.sol", + "id": 2353, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9621, + "src": "286:38:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/ISetting.sol", + "file": "./interfaces/ISetting.sol", + "id": 2354, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 10733, + "src": "325:35:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IIssuer.sol", + "file": "./interfaces/IIssuer.sol", + "id": 2355, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9874, + "src": "361:34:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/ILiquidator.sol", + "file": "./interfaces/ILiquidator.sol", + "id": 2356, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9913, + "src": "396:38:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IERC20.sol", + "file": "./interfaces/IERC20.sol", + "id": 2357, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 9728, + "src": "435:33:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/lib/ReentrancyGuard.sol", + "file": "./lib/ReentrancyGuard.sol", + "id": 2358, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3369, + "sourceUnit": 12106, + "src": "469:35:6", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 2359, + "name": "Pausable", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9196, + "src": "525:8:6" + }, + "id": 2360, + "nodeType": "InheritanceSpecifier", + "src": "525:8:6" + }, + { + "baseName": { + "id": 2361, + "name": "Importable", + "nodeType": "IdentifierPath", + "referencedDeclaration": 8972, + "src": "535:10:6" + }, + "id": 2362, + "nodeType": "InheritanceSpecifier", + "src": "535:10:6" + }, + { + "baseName": { + "id": 2363, + "name": "IMobius", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10173, + "src": "547:7:6" + }, + "id": 2364, + "nodeType": "InheritanceSpecifier", + "src": "547:7:6" + }, + { + "baseName": { + "id": 2365, + "name": "ReentrancyGuard", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12105, + "src": "556:15:6" + }, + "id": 2366, + "nodeType": "InheritanceSpecifier", + "src": "556:15:6" + } + ], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 3368, + "linearizedBaseContracts": [ + 3368, + 12105, + 10173, + 8972, + 9196, + 9135, + 10242, + 8570 + ], + "name": "Mobius", + "nameLocation": "515:6:6", + "nodeType": "ContractDefinition", + "nodes": [ + { + "id": 2369, + "libraryName": { + "id": 2367, + "name": "PreciseMath", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12065, + "src": "583:11:6" + }, + "nodeType": "UsingForDirective", + "src": "577:30:6", + "typeName": { + "id": 2368, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "599:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + }, + { + "id": 2373, + "libraryName": { + "id": 2370, + "name": "SafeERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12241, + "src": "618:9:6" + }, + "nodeType": "UsingForDirective", + "src": "612:27:6", + "typeName": { + "id": 2372, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2371, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "632:6:6" + }, + "referencedDeclaration": 9727, + "src": "632:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + } + }, + { + "baseFunctions": [ + 9958 + ], + "constant": false, + "functionSelector": "167b78cd", + "id": 2376, + "mutability": "mutable", + "name": "nativeCoin", + "nameLocation": "669:10:6", + "nodeType": "VariableDeclaration", + "overrides": { + "id": 2375, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "660:8:6" + }, + "scope": 3368, + "src": "645:34:6", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2374, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "645:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "public" + }, + { + "body": { + "id": 2407, + "nodeType": "Block", + "src": "762:369:6", + "statements": [ + { + "expression": { + "id": 2389, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2387, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "772:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "id": 2388, + "name": "_nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2381, + "src": "785:11:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "772:24:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 2390, + "nodeType": "ExpressionStatement", + "src": "772:24:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2392, + "name": "CONTRACT_MOBIUS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8527, + "src": "822:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2391, + "name": "setContractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9134, + "src": "806:15:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 2393, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "806:32:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2394, + "nodeType": "ExpressionStatement", + "src": "806:32:6" + }, + { + "expression": { + "id": 2405, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2395, + "name": "imports", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8658, + "src": "848:7:6", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "components": [ + { + "id": 2396, + "name": "CONTRACT_STAKER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8536, + "src": "872:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2397, + "name": "CONTRACT_ASSET_PRICE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8521, + "src": "901:20:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2398, + "name": "CONTRACT_SETTING", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8524, + "src": "935:16:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2399, + "name": "CONTRACT_ISSUER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8533, + "src": "965:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2400, + "name": "CONTRACT_TRADER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8539, + "src": "994:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2401, + "name": "CONTRACT_MOBIUS_TOKEN", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8545, + "src": "1023:21:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2402, + "name": "CONTRACT_LIQUIDATOR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8548, + "src": "1058:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2403, + "name": "LIQUIDATION_FEE_ADDRESS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8563, + "src": "1091:23:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 2404, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "858:266:6", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$8_memory_ptr", + "typeString": "bytes32[8] memory" + } + }, + "src": "848:276:6", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + "id": 2406, + "nodeType": "ExpressionStatement", + "src": "848:276:6" + } + ] + }, + "id": 2408, + "implemented": true, + "kind": "constructor", + "modifiers": [ + { + "arguments": [ + { + "id": 2384, + "name": "_resolver", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2379, + "src": "751:9:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IResolver_$10297", + "typeString": "contract IResolver" + } + } + ], + "id": 2385, + "kind": "baseConstructorSpecifier", + "modifierName": { + "id": 2383, + "name": "Importable", + "nodeType": "IdentifierPath", + "referencedDeclaration": 8972, + "src": "740:10:6" + }, + "nodeType": "ModifierInvocation", + "src": "740:21:6" + } + ], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2382, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2379, + "mutability": "mutable", + "name": "_resolver", + "nameLocation": "708:9:6", + "nodeType": "VariableDeclaration", + "scope": 2408, + "src": "698:19:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IResolver_$10297", + "typeString": "contract IResolver" + }, + "typeName": { + "id": 2378, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2377, + "name": "IResolver", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10297, + "src": "698:9:6" + }, + "referencedDeclaration": 10297, + "src": "698:9:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IResolver_$10297", + "typeString": "contract IResolver" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2381, + "mutability": "mutable", + "name": "_nativeCoin", + "nameLocation": "727:11:6", + "nodeType": "VariableDeclaration", + "scope": 2408, + "src": "719:19:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2380, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "719:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "697:42:6" + }, + "returnParameters": { + "id": 2386, + "nodeType": "ParameterList", + "parameters": [], + "src": "762:0:6" + }, + "scope": 3368, + "src": "686:445:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 2420, + "nodeType": "Block", + "src": "1186:64:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2416, + "name": "CONTRACT_STAKER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8536, + "src": "1226:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2415, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1211:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2417, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1211:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2414, + "name": "IStaker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10792, + "src": "1203:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IStaker_$10792_$", + "typeString": "type(contract IStaker)" + } + }, + "id": 2418, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1203:40:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "functionReturnParameters": 2413, + "id": 2419, + "nodeType": "Return", + "src": "1196:47:6" + } + ] + }, + "id": 2421, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Staker", + "nameLocation": "1146:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2409, + "nodeType": "ParameterList", + "parameters": [], + "src": "1152:2:6" + }, + "returnParameters": { + "id": 2413, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2412, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2421, + "src": "1177:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + }, + "typeName": { + "id": 2411, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2410, + "name": "IStaker", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10792, + "src": "1177:7:6" + }, + "referencedDeclaration": 10792, + "src": "1177:7:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "visibility": "internal" + } + ], + "src": "1176:9:6" + }, + "scope": 3368, + "src": "1137:113:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2433, + "nodeType": "Block", + "src": "1313:73:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2429, + "name": "CONTRACT_ASSET_PRICE", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8521, + "src": "1357:20:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2428, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1342:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2430, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1342:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2427, + "name": "IAssetPrice", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9620, + "src": "1330:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IAssetPrice_$9620_$", + "typeString": "type(contract IAssetPrice)" + } + }, + "id": 2431, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1330:49:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + } + }, + "functionReturnParameters": 2426, + "id": 2432, + "nodeType": "Return", + "src": "1323:56:6" + } + ] + }, + "id": 2434, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "AssetPrice", + "nameLocation": "1265:10:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2422, + "nodeType": "ParameterList", + "parameters": [], + "src": "1275:2:6" + }, + "returnParameters": { + "id": 2426, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2425, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2434, + "src": "1300:11:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + }, + "typeName": { + "id": 2424, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2423, + "name": "IAssetPrice", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9620, + "src": "1300:11:6" + }, + "referencedDeclaration": 9620, + "src": "1300:11:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + } + }, + "visibility": "internal" + } + ], + "src": "1299:13:6" + }, + "scope": 3368, + "src": "1256:130:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2446, + "nodeType": "Block", + "src": "1443:66:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2442, + "name": "CONTRACT_SETTING", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8524, + "src": "1484:16:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2441, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1469:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2443, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1469:32:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2440, + "name": "ISetting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10732, + "src": "1460:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ISetting_$10732_$", + "typeString": "type(contract ISetting)" + } + }, + "id": 2444, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1460:42:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "functionReturnParameters": 2439, + "id": 2445, + "nodeType": "Return", + "src": "1453:49:6" + } + ] + }, + "id": 2447, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Setting", + "nameLocation": "1401:7:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2435, + "nodeType": "ParameterList", + "parameters": [], + "src": "1408:2:6" + }, + "returnParameters": { + "id": 2439, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2438, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2447, + "src": "1433:8:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + }, + "typeName": { + "id": 2437, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2436, + "name": "ISetting", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10732, + "src": "1433:8:6" + }, + "referencedDeclaration": 10732, + "src": "1433:8:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "visibility": "internal" + } + ], + "src": "1432:10:6" + }, + "scope": 3368, + "src": "1392:117:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2459, + "nodeType": "Block", + "src": "1564:64:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2455, + "name": "CONTRACT_ISSUER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8533, + "src": "1604:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2454, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1589:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2456, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1589:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2453, + "name": "IIssuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9873, + "src": "1581:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IIssuer_$9873_$", + "typeString": "type(contract IIssuer)" + } + }, + "id": 2457, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1581:40:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "functionReturnParameters": 2452, + "id": 2458, + "nodeType": "Return", + "src": "1574:47:6" + } + ] + }, + "id": 2460, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Issuer", + "nameLocation": "1524:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2448, + "nodeType": "ParameterList", + "parameters": [], + "src": "1530:2:6" + }, + "returnParameters": { + "id": 2452, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2451, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2460, + "src": "1555:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + }, + "typeName": { + "id": 2450, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2449, + "name": "IIssuer", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9873, + "src": "1555:7:6" + }, + "referencedDeclaration": 9873, + "src": "1555:7:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "visibility": "internal" + } + ], + "src": "1554:9:6" + }, + "scope": 3368, + "src": "1515:113:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2472, + "nodeType": "Block", + "src": "1683:64:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2468, + "name": "CONTRACT_TRADER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8539, + "src": "1723:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2467, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1708:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2469, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1708:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2466, + "name": "ITrader", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10913, + "src": "1700:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ITrader_$10913_$", + "typeString": "type(contract ITrader)" + } + }, + "id": 2470, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1700:40:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + } + }, + "functionReturnParameters": 2465, + "id": 2471, + "nodeType": "Return", + "src": "1693:47:6" + } + ] + }, + "id": 2473, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Trader", + "nameLocation": "1643:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2461, + "nodeType": "ParameterList", + "parameters": [], + "src": "1649:2:6" + }, + "returnParameters": { + "id": 2465, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2464, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2473, + "src": "1674:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + }, + "typeName": { + "id": 2463, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2462, + "name": "ITrader", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10913, + "src": "1674:7:6" + }, + "referencedDeclaration": 10913, + "src": "1674:7:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + } + }, + "visibility": "internal" + } + ], + "src": "1673:9:6" + }, + "scope": 3368, + "src": "1634:113:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "body": { + "id": 2485, + "nodeType": "Block", + "src": "1810:72:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 2481, + "name": "CONTRACT_LIQUIDATOR", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8548, + "src": "1854:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2480, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "1839:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 2482, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1839:35:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2479, + "name": "ILiquidator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9912, + "src": "1827:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ILiquidator_$9912_$", + "typeString": "type(contract ILiquidator)" + } + }, + "id": 2483, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1827:48:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "functionReturnParameters": 2478, + "id": 2484, + "nodeType": "Return", + "src": "1820:55:6" + } + ] + }, + "id": 2486, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "Liquidator", + "nameLocation": "1762:10:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2474, + "nodeType": "ParameterList", + "parameters": [], + "src": "1772:2:6" + }, + "returnParameters": { + "id": 2478, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2477, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2486, + "src": "1797:11:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + }, + "typeName": { + "id": 2476, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2475, + "name": "ILiquidator", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9912, + "src": "1797:11:6" + }, + "referencedDeclaration": 9912, + "src": "1797:11:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "visibility": "internal" + } + ], + "src": "1796:13:6" + }, + "scope": 3368, + "src": "1753:129:6", + "stateMutability": "view", + "virtual": false, + "visibility": "private" + }, + { + "baseFunctions": [ + 9983 + ], + "body": { + "id": 2515, + "nodeType": "Block", + "src": "1991:150:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2497, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2008:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2498, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2020:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2499, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2025:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2500, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "2025:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2496, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "2001:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2501, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2001:34:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2502, + "nodeType": "ExpressionStatement", + "src": "2001:34:6" + }, + { + "assignments": [ + 2504 + ], + "declarations": [ + { + "constant": false, + "id": 2504, + "mutability": "mutable", + "name": "minted", + "nameLocation": "2053:6:6", + "nodeType": "VariableDeclaration", + "scope": 2515, + "src": "2045:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2503, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2045:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2512, + "initialValue": { + "arguments": [ + { + "id": 2506, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2068:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2507, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2080:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2508, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "2080:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2509, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2091:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2510, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2488, + "src": "2096:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2505, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "2062:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2511, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2062:49:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2045:66:6" + }, + { + "expression": { + "id": 2513, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2504, + "src": "2128:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2495, + "id": 2514, + "nodeType": "Return", + "src": "2121:13:6" + } + ] + }, + "functionSelector": "768ab0fc", + "id": 2516, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2492, + "kind": "modifierInvocation", + "modifierName": { + "id": 2491, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "1960:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "1960:12:6" + } + ], + "name": "mintFromCoin", + "nameLocation": "1897:12:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2490, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1943:8:6" + }, + "parameters": { + "id": 2489, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2488, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "1918:14:6", + "nodeType": "VariableDeclaration", + "scope": 2516, + "src": "1910:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2487, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1910:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1909:24:6" + }, + "returnParameters": { + "id": 2495, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2494, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2516, + "src": "1982:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2493, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1982:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "1981:9:6" + }, + "scope": 3368, + "src": "1888:253:6", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9994 + ], + "body": { + "id": 2554, + "nodeType": "Block", + "src": "2274:224:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2533, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2531, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2518, + "src": "2292:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2532, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2301:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "2292:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f6d436f696e222066756e6374696f6e", + "id": 2534, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2313:49:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + }, + "value": "Mobius: Native Coin use \"mintFromCoin\" function" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + } + ], + "id": 2530, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "2284:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2535, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2284:79:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2536, + "nodeType": "ExpressionStatement", + "src": "2284:79:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2538, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2518, + "src": "2381:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2539, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2388:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2540, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2520, + "src": "2393:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2537, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "2374:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2541, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2374:26:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2542, + "nodeType": "ExpressionStatement", + "src": "2374:26:6" + }, + { + "assignments": [ + 2544 + ], + "declarations": [ + { + "constant": false, + "id": 2544, + "mutability": "mutable", + "name": "minted", + "nameLocation": "2418:6:6", + "nodeType": "VariableDeclaration", + "scope": 2554, + "src": "2410:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2543, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2410:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2551, + "initialValue": { + "arguments": [ + { + "id": 2546, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2518, + "src": "2433:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2547, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2520, + "src": "2440:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2548, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2448:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2549, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2522, + "src": "2453:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2545, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "2427:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2550, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2427:41:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2410:58:6" + }, + { + "expression": { + "id": 2552, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2544, + "src": "2485:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2529, + "id": 2553, + "nodeType": "Return", + "src": "2478:13:6" + } + ] + }, + "functionSelector": "05635bc4", + "id": 2555, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2526, + "kind": "modifierInvocation", + "modifierName": { + "id": 2525, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "2243:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "2243:12:6" + } + ], + "name": "mintFromToken", + "nameLocation": "2156:13:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2524, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2234:8:6" + }, + "parameters": { + "id": 2523, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2518, + "mutability": "mutable", + "name": "stake", + "nameLocation": "2178:5:6", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2170:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2517, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2170:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2520, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2193:6:6", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2185:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2519, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2185:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2522, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "2209:14:6", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2201:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2521, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2201:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2169:55:6" + }, + "returnParameters": { + "id": 2529, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2528, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2555, + "src": "2265:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2527, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2265:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2264:9:6" + }, + "scope": 3368, + "src": "2147:351:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10003 + ], + "body": { + "id": 2589, + "nodeType": "Block", + "src": "2622:156:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2572, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2557, + "src": "2668:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2573, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2675:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2574, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2675:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2575, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "2687:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2576, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2559, + "src": "2692:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2569, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "2632:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2570, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2632:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2571, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "issueDebtWithPreviousStake", + "nodeType": "MemberAccess", + "referencedDeclaration": 9786, + "src": "2632:35:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 2577, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2632:67:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2578, + "nodeType": "ExpressionStatement", + "src": "2632:67:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2580, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2721:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2581, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "2721:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2582, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2557, + "src": "2733:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "hexValue": "30", + "id": 2583, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2740:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "id": 2584, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2559, + "src": "2743:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2579, + "name": "Minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10106, + "src": "2714:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,uint256,uint256)" + } + }, + "id": 2585, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2714:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2586, + "nodeType": "EmitStatement", + "src": "2709:41:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 2587, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2767:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2568, + "id": 2588, + "nodeType": "Return", + "src": "2760:11:6" + } + ] + }, + "functionSelector": "93709b30", + "id": 2590, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2563, + "kind": "modifierInvocation", + "modifierName": { + "id": 2562, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "2584:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "2584:9:6" + }, + { + "id": 2565, + "kind": "modifierInvocation", + "modifierName": { + "id": 2564, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "2594:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "2594:12:6" + } + ], + "name": "mintFromPreviousStake", + "nameLocation": "2513:21:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2561, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2575:8:6" + }, + "parameters": { + "id": 2560, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2557, + "mutability": "mutable", + "name": "stake", + "nameLocation": "2543:5:6", + "nodeType": "VariableDeclaration", + "scope": 2590, + "src": "2535:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2556, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2535:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2559, + "mutability": "mutable", + "name": "amount", + "nameLocation": "2558:6:6", + "nodeType": "VariableDeclaration", + "scope": 2590, + "src": "2550:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2558, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2550:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2534:31:6" + }, + "returnParameters": { + "id": 2568, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2567, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2590, + "src": "2616:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2566, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "2616:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "2615:6:6" + }, + "scope": 3368, + "src": "2504:274:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10012 + ], + "body": { + "id": 2621, + "nodeType": "Block", + "src": "2906:160:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2603, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2923:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2604, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2592, + "src": "2935:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2605, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "2945:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2606, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "2945:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2602, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "2916:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2607, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2916:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2608, + "nodeType": "ExpressionStatement", + "src": "2916:39:6" + }, + { + "assignments": [ + 2610 + ], + "declarations": [ + { + "constant": false, + "id": 2610, + "mutability": "mutable", + "name": "minted", + "nameLocation": "2973:6:6", + "nodeType": "VariableDeclaration", + "scope": 2621, + "src": "2965:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2609, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2965:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2618, + "initialValue": { + "arguments": [ + { + "id": 2612, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "2988:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2613, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "3000:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2614, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "3000:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2615, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2592, + "src": "3011:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2616, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2594, + "src": "3021:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2611, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "2982:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2617, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2982:54:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2965:71:6" + }, + { + "expression": { + "id": 2619, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2610, + "src": "3053:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2601, + "id": 2620, + "nodeType": "Return", + "src": "3046:13:6" + } + ] + }, + "functionSelector": "946a970e", + "id": 2622, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2598, + "kind": "modifierInvocation", + "modifierName": { + "id": 2597, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "2875:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "2875:12:6" + } + ], + "name": "shortFromCoin", + "nameLocation": "2793:13:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2596, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2858:8:6" + }, + "parameters": { + "id": 2595, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2592, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "2815:8:6", + "nodeType": "VariableDeclaration", + "scope": 2622, + "src": "2807:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2591, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2807:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2594, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "2833:14:6", + "nodeType": "VariableDeclaration", + "scope": 2622, + "src": "2825:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2593, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2825:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2806:42:6" + }, + "returnParameters": { + "id": 2601, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2600, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2622, + "src": "2897:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2599, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2897:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "2896:9:6" + }, + "scope": 3368, + "src": "2784:282:6", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10025 + ], + "body": { + "id": 2662, + "nodeType": "Block", + "src": "3218:236:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2639, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2624, + "src": "3236:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 2640, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "3245:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "3236:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204e617469766520436f696e20757365202273686f727446726f6d546f6b656e222066756e6374696f6e", + "id": 2642, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3257:51:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_ab2fbd74cd1049bf631750db72ab64b9f0ef7c09b83c29c6fcf6e47e3b5cb850", + "typeString": "literal_string \"Mobius: Native Coin use \"shortFromToken\" function\"" + }, + "value": "Mobius: Native Coin use \"shortFromToken\" function" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_ab2fbd74cd1049bf631750db72ab64b9f0ef7c09b83c29c6fcf6e47e3b5cb850", + "typeString": "literal_string \"Mobius: Native Coin use \"shortFromToken\" function\"" + } + ], + "id": 2638, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "3228:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2643, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3228:81:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2644, + "nodeType": "ExpressionStatement", + "src": "3228:81:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2646, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2624, + "src": "3327:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2647, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2628, + "src": "3334:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2648, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2626, + "src": "3344:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2645, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "3320:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 2649, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3320:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2650, + "nodeType": "ExpressionStatement", + "src": "3320:31:6" + }, + { + "assignments": [ + 2652 + ], + "declarations": [ + { + "constant": false, + "id": 2652, + "mutability": "mutable", + "name": "minted", + "nameLocation": "3369:6:6", + "nodeType": "VariableDeclaration", + "scope": 2662, + "src": "3361:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2651, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3361:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2659, + "initialValue": { + "arguments": [ + { + "id": 2654, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2624, + "src": "3384:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2655, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2626, + "src": "3391:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2656, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2628, + "src": "3399:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2657, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2630, + "src": "3409:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2653, + "name": "_mint", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2791, + "src": "3378:5:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_uint256_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,uint256,bytes32,uint256) returns (uint256)" + } + }, + "id": 2658, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3378:46:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3361:63:6" + }, + { + "expression": { + "id": 2660, + "name": "minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2652, + "src": "3441:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2637, + "id": 2661, + "nodeType": "Return", + "src": "3434:13:6" + } + ] + }, + "functionSelector": "612cd04b", + "id": 2663, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2634, + "kind": "modifierInvocation", + "modifierName": { + "id": 2633, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "3187:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "3187:12:6" + } + ], + "name": "shortFromToken", + "nameLocation": "3081:14:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2632, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "3178:8:6" + }, + "parameters": { + "id": 2631, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2624, + "mutability": "mutable", + "name": "stake", + "nameLocation": "3104:5:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3096:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2623, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3096:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2626, + "mutability": "mutable", + "name": "amount", + "nameLocation": "3119:6:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3111:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2625, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3111:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2628, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "3135:8:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3127:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2627, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3127:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2630, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "3153:14:6", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3145:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2629, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3145:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3095:73:6" + }, + "returnParameters": { + "id": 2637, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2636, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2663, + "src": "3209:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2635, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3209:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3208:9:6" + }, + "scope": 3368, + "src": "3072:382:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10036 + ], + "body": { + "id": 2700, + "nodeType": "Block", + "src": "3597:172:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2682, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "3643:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2683, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "3650:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2684, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "3650:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2685, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2667, + "src": "3662:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2686, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2669, + "src": "3672:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2679, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "3607:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2680, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3607:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "issueDebtWithPreviousStake", + "nodeType": "MemberAccess", + "referencedDeclaration": 9786, + "src": "3607:35:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 2687, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3607:72:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2688, + "nodeType": "ExpressionStatement", + "src": "3607:72:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2690, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "3702:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2691, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "3702:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2692, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2665, + "src": "3714:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2693, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2667, + "src": "3721:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "hexValue": "30", + "id": 2694, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3731:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "id": 2695, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2669, + "src": "3734:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2689, + "name": "Shorted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10118, + "src": "3694:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256,uint256)" + } + }, + "id": 2696, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3694:47:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2697, + "nodeType": "EmitStatement", + "src": "3689:52:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 2698, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3758:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2678, + "id": 2699, + "nodeType": "Return", + "src": "3751:11:6" + } + ] + }, + "functionSelector": "dbf1207f", + "id": 2701, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2673, + "kind": "modifierInvocation", + "modifierName": { + "id": 2672, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "3559:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "3559:9:6" + }, + { + "id": 2675, + "kind": "modifierInvocation", + "modifierName": { + "id": 2674, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "3569:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "3569:12:6" + } + ], + "name": "shortFromPreviousStake", + "nameLocation": "3469:22:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2671, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "3550:8:6" + }, + "parameters": { + "id": 2670, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2665, + "mutability": "mutable", + "name": "stake", + "nameLocation": "3500:5:6", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3492:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2664, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3492:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2667, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "3515:8:6", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3507:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2666, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3507:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2669, + "mutability": "mutable", + "name": "amount", + "nameLocation": "3533:6:6", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3525:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2668, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3525:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3491:49:6" + }, + "returnParameters": { + "id": 2678, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2677, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2701, + "src": "3591:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2676, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "3591:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "3590:6:6" + }, + "scope": 3368, + "src": "3460:309:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 2790, + "nodeType": "Block", + "src": "3937:697:6", + "statements": [ + { + "assignments": [ + 2717 + ], + "declarations": [ + { + "constant": false, + "id": 2717, + "mutability": "mutable", + "name": "safeCollateralRate", + "nameLocation": "3955:18:6", + "nodeType": "VariableDeclaration", + "scope": 2790, + "src": "3947:26:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2716, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3947:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2724, + "initialValue": { + "arguments": [ + { + "id": 2721, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4004:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2722, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4011:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2718, + "name": "Setting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2447, + "src": "3976:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ISetting_$10732_$", + "typeString": "function () view returns (contract ISetting)" + } + }, + "id": 2719, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3976:9:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "id": 2720, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getCollateralRate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10668, + "src": "3976:27:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,bytes32) view external returns (uint256)" + } + }, + "id": 2723, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3976:44:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3947:73:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2728, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2726, + "name": "safeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "4038:18:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 2727, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4059:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "4038:22:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204d697373696e6720436f6c6c61746572616c2052617465", + "id": 2729, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4062:33:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_35d35c2448bc779e366373311d91f6adb640e3ec63c6a5f263ced52012750e38", + "typeString": "literal_string \"Mobius: Missing Collateral Rate\"" + }, + "value": "Mobius: Missing Collateral Rate" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_35d35c2448bc779e366373311d91f6adb640e3ec63c6a5f263ced52012750e38", + "typeString": "literal_string \"Mobius: Missing Collateral Rate\"" + } + ], + "id": 2725, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "4030:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2730, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4030:66:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2731, + "nodeType": "ExpressionStatement", + "src": "4030:66:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2735, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2733, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2709, + "src": "4114:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 2734, + "name": "safeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2717, + "src": "4132:18:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4114:36:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a20436f6c6c61746572616c205261746520746f6f206c6f77", + "id": 2736, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "4152:33:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_e30faf94e498eaeeb9198ebcaaa8204b0eea9b85b1c2b6609f6dea00348941b3", + "typeString": "literal_string \"Mobius: Collateral Rate too low\"" + }, + "value": "Mobius: Collateral Rate too low" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_e30faf94e498eaeeb9198ebcaaa8204b0eea9b85b1c2b6609f6dea00348941b3", + "typeString": "literal_string \"Mobius: Collateral Rate too low\"" + } + ], + "id": 2732, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "4106:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2737, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4106:80:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2738, + "nodeType": "ExpressionStatement", + "src": "4106:80:6" + }, + { + "assignments": [ + 2740 + ], + "declarations": [ + { + "constant": false, + "id": 2740, + "mutability": "mutable", + "name": "issueAmountInUSD", + "nameLocation": "4205:16:6", + "nodeType": "VariableDeclaration", + "scope": 2790, + "src": "4197:24:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2739, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4197:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2752, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2751, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2748, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2741, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2705, + "src": "4224:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "*", + "rightExpression": { + "components": [ + { + "arguments": [ + { + "id": 2745, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4256:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2742, + "name": "AssetPrice", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2434, + "src": "4234:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IAssetPrice_$9620_$", + "typeString": "function () view returns (contract IAssetPrice)" + } + }, + "id": 2743, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4234:12:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IAssetPrice_$9620", + "typeString": "contract IAssetPrice" + } + }, + "id": 2744, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getPrice", + "nodeType": "MemberAccess", + "referencedDeclaration": 9558, + "src": "4234:21:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32) view external returns (uint256)" + } + }, + "id": 2746, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4234:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2747, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4233:30:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4224:39:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "/", + "rightExpression": { + "components": [ + { + "id": 2749, + "name": "collateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2709, + "src": "4267:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2750, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "4266:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "4224:58:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4197:85:6" + }, + { + "assignments": [ + 2754 + ], + "declarations": [ + { + "constant": false, + "id": 2754, + "mutability": "mutable", + "name": "issueDebtInSynth", + "nameLocation": "4300:16:6", + "nodeType": "VariableDeclaration", + "scope": 2790, + "src": "4292:24:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2753, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4292:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2764, + "initialValue": { + "arguments": [ + { + "id": 2758, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4338:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2759, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4345:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2760, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4345:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2761, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4357:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2762, + "name": "issueAmountInUSD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2740, + "src": "4367:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2755, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "4319:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2756, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4319:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2757, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "issueDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9775, + "src": "4319:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256) external returns (uint256)" + } + }, + "id": 2763, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4319:65:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4292:92:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2767, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2765, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4399:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2766, + "name": "USD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8515, + "src": "4411:3:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "4399:15:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2786, + "nodeType": "Block", + "src": "4503:92:6", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2778, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4530:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2779, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4530:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2780, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4542:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2781, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2707, + "src": "4549:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2782, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2705, + "src": "4559:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2783, + "name": "issueDebtInSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2754, + "src": "4567:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2777, + "name": "Shorted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10118, + "src": "4522:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256,uint256)" + } + }, + "id": 2784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4522:62:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2785, + "nodeType": "EmitStatement", + "src": "4517:67:6" + } + ] + }, + "id": 2787, + "nodeType": "IfStatement", + "src": "4395:200:6", + "trueBody": { + "id": 2776, + "nodeType": "Block", + "src": "4416:81:6", + "statements": [ + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2769, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4442:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2770, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4442:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2771, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2703, + "src": "4454:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2772, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2705, + "src": "4461:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2773, + "name": "issueAmountInUSD", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2740, + "src": "4469:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2768, + "name": "Minted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10106, + "src": "4435:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,uint256,uint256)" + } + }, + "id": 2774, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4435:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2775, + "nodeType": "EmitStatement", + "src": "4430:56:6" + } + ] + } + }, + { + "expression": { + "id": 2788, + "name": "issueDebtInSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2754, + "src": "4611:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 2715, + "id": 2789, + "nodeType": "Return", + "src": "4604:23:6" + } + ] + }, + "id": 2791, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2712, + "kind": "modifierInvocation", + "modifierName": { + "id": 2711, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "3910:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "3910:9:6" + } + ], + "name": "_mint", + "nameLocation": "3784:5:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2710, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2703, + "mutability": "mutable", + "name": "stake", + "nameLocation": "3807:5:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3799:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2702, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3799:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2705, + "mutability": "mutable", + "name": "amount", + "nameLocation": "3830:6:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3822:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2704, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3822:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2707, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "3854:8:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3846:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2706, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "3846:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2709, + "mutability": "mutable", + "name": "collateralRate", + "nameLocation": "3880:14:6", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3872:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2708, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3872:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3789:111:6" + }, + "returnParameters": { + "id": 2715, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2714, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2791, + "src": "3929:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2713, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "3929:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "3928:9:6" + }, + "scope": 3368, + "src": "3775:859:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "baseFunctions": [ + 10051 + ], + "body": { + "id": 2875, + "nodeType": "Block", + "src": "4786:527:6", + "statements": [ + { + "assignments": [ + 2812 + ], + "declarations": [ + { + "constant": false, + "id": 2812, + "mutability": "mutable", + "name": "beforeCollateralRate", + "nameLocation": "4804:20:6", + "nodeType": "VariableDeclaration", + "scope": 2875, + "src": "4796:28:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2811, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4796:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2821, + "initialValue": { + "arguments": [ + { + "id": 2816, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "4854:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2817, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4861:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2818, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4861:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2819, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "4873:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2813, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "4827:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2814, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4827:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2815, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getCollateralRate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10791, + "src": "4827:26:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 2820, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4827:55:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4796:86:6" + }, + { + "assignments": [ + 2823 + ], + "declarations": [ + { + "constant": false, + "id": 2823, + "mutability": "mutable", + "name": "burnAmount", + "nameLocation": "4900:10:6", + "nodeType": "VariableDeclaration", + "scope": 2875, + "src": "4892:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2822, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4892:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2835, + "initialValue": { + "arguments": [ + { + "id": 2827, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "4931:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2828, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4938:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2829, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4938:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2830, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "4950:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2831, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2797, + "src": "4960:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 2832, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "4968:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2833, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "4968:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2824, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "4913:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 2825, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4913:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 2826, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "burnDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9812, + "src": "4913:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256,address) external returns (uint256)" + } + }, + "id": 2834, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "4913:66:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "4892:87:6" + }, + { + "assignments": [ + 2837 + ], + "declarations": [ + { + "constant": false, + "id": 2837, + "mutability": "mutable", + "name": "claimable", + "nameLocation": "4998:9:6", + "nodeType": "VariableDeclaration", + "scope": 2875, + "src": "4990:17:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2836, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4990:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2839, + "initialValue": { + "hexValue": "30", + "id": 2838, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5010:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "4990:21:6" + }, + { + "condition": { + "id": 2840, + "name": "withdraw", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2799, + "src": "5025:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2862, + "nodeType": "IfStatement", + "src": "5021:183:6", + "trueBody": { + "id": 2861, + "nodeType": "Block", + "src": "5035:169:6", + "statements": [ + { + "expression": { + "id": 2851, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "id": 2841, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2837, + "src": "5049:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "arguments": [ + { + "id": 2845, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "5083:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2846, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5090:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2847, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5090:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2848, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "5102:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2849, + "name": "beforeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2812, + "src": "5112:20:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2842, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "5061:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2843, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5061:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2844, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getClaimable", + "nodeType": "MemberAccess", + "referencedDeclaration": 10780, + "src": "5061:21:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256) view external returns (uint256)" + } + }, + "id": 2850, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5061:72:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5049:84:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2852, + "nodeType": "ExpressionStatement", + "src": "5049:84:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2854, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "5154:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2855, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "5161:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2856, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2837, + "src": "5171:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 2857, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5182:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2858, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5182:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2853, + "name": "_claim", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3001, + "src": "5147:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_bool_$", + "typeString": "function (bytes32,bytes32,uint256,address) returns (bool)" + } + }, + "id": 2859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5147:46:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 2860, + "nodeType": "ExpressionStatement", + "src": "5147:46:6" + } + ] + } + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 2864, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5226:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2865, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5226:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2866, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2793, + "src": "5238:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2867, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2795, + "src": "5245:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2868, + "name": "burnAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2823, + "src": "5255:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2863, + "name": "Burned", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10128, + "src": "5219:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256)" + } + }, + "id": 2869, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5219:47:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2870, + "nodeType": "EmitStatement", + "src": "5214:52:6" + }, + { + "expression": { + "components": [ + { + "id": 2871, + "name": "burnAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2823, + "src": "5284:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 2872, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2837, + "src": "5296:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "id": 2873, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "5283:23:6", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "functionReturnParameters": 2810, + "id": 2874, + "nodeType": "Return", + "src": "5276:30:6" + } + ] + }, + "functionSelector": "1325188f", + "id": 2876, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2803, + "kind": "modifierInvocation", + "modifierName": { + "id": 2802, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "4736:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "4736:9:6" + }, + { + "id": 2805, + "kind": "modifierInvocation", + "modifierName": { + "id": 2804, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "4746:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "4746:12:6" + } + ], + "name": "burn", + "nameLocation": "4649:4:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2801, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "4727:8:6" + }, + "parameters": { + "id": 2800, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2793, + "mutability": "mutable", + "name": "stake", + "nameLocation": "4662:5:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4654:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2792, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4654:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2795, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "4677:8:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4669:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2794, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "4669:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2797, + "mutability": "mutable", + "name": "amount", + "nameLocation": "4695:6:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4687:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2796, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4687:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2799, + "mutability": "mutable", + "name": "withdraw", + "nameLocation": "4708:8:6", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4703:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2798, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "4703:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "4653:64:6" + }, + "returnParameters": { + "id": 2810, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2807, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4768:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2806, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4768:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2809, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2876, + "src": "4777:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2808, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "4777:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "4767:18:6" + }, + "scope": 3368, + "src": "4640:673:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10062 + ], + "body": { + "id": 2928, + "nodeType": "Block", + "src": "5469:333:6", + "statements": [ + { + "assignments": [ + 2893 + ], + "declarations": [ + { + "constant": false, + "id": 2893, + "mutability": "mutable", + "name": "safeCollateralRate", + "nameLocation": "5487:18:6", + "nodeType": "VariableDeclaration", + "scope": 2928, + "src": "5479:26:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2892, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5479:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2900, + "initialValue": { + "arguments": [ + { + "id": 2897, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2878, + "src": "5536:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2898, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2880, + "src": "5543:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2894, + "name": "Setting", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2447, + "src": "5508:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ISetting_$10732_$", + "typeString": "function () view returns (contract ISetting)" + } + }, + "id": 2895, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5508:9:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ISetting_$10732", + "typeString": "contract ISetting" + } + }, + "id": 2896, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getCollateralRate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10668, + "src": "5508:27:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,bytes32) view external returns (uint256)" + } + }, + "id": 2899, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5508:44:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5479:73:6" + }, + { + "assignments": [ + 2902 + ], + "declarations": [ + { + "constant": false, + "id": 2902, + "mutability": "mutable", + "name": "claimable", + "nameLocation": "5570:9:6", + "nodeType": "VariableDeclaration", + "scope": 2928, + "src": "5562:17:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2901, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5562:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 2912, + "initialValue": { + "arguments": [ + { + "id": 2906, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2878, + "src": "5604:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 2907, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5611:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2908, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5611:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2909, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2880, + "src": "5623:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2910, + "name": "safeCollateralRate", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2893, + "src": "5633:18:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2903, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "5582:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2904, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5582:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2905, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getClaimable", + "nodeType": "MemberAccess", + "referencedDeclaration": 10780, + "src": "5582:21:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256) view external returns (uint256)" + } + }, + "id": 2911, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5582:70:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "5562:90:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 2916, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2914, + "name": "claimable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2902, + "src": "5670:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 2915, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2882, + "src": "5683:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "5670:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a207472616e7366657220616d6f756e74206578636565647320636c61696d61626c65", + "id": 2917, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "5691:43:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_383a6ebef3f1fab8a147c7052d2fe5baac23a5125ba031a71180eaf1c40ed986", + "typeString": "literal_string \"Mobius: transfer amount exceeds claimable\"" + }, + "value": "Mobius: transfer amount exceeds claimable" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_383a6ebef3f1fab8a147c7052d2fe5baac23a5125ba031a71180eaf1c40ed986", + "typeString": "literal_string \"Mobius: transfer amount exceeds claimable\"" + } + ], + "id": 2913, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "5662:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 2918, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5662:73:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2919, + "nodeType": "ExpressionStatement", + "src": "5662:73:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2921, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2878, + "src": "5759:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2922, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2880, + "src": "5766:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2923, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2882, + "src": "5776:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 2924, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "5784:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 2925, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "5784:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2920, + "name": "_claim", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3001, + "src": "5752:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_bool_$", + "typeString": "function (bytes32,bytes32,uint256,address) returns (bool)" + } + }, + "id": 2926, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5752:43:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "functionReturnParameters": 2891, + "id": 2927, + "nodeType": "Return", + "src": "5745:50:6" + } + ] + }, + "functionSelector": "2dba4273", + "id": 2929, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 2886, + "kind": "modifierInvocation", + "modifierName": { + "id": 2885, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "5431:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "5431:9:6" + }, + { + "id": 2888, + "kind": "modifierInvocation", + "modifierName": { + "id": 2887, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "5441:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "5441:12:6" + } + ], + "name": "claim", + "nameLocation": "5328:5:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 2884, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "5422:8:6" + }, + "parameters": { + "id": 2883, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2878, + "mutability": "mutable", + "name": "stake", + "nameLocation": "5351:5:6", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5343:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2877, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5343:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2880, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "5374:8:6", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5366:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2879, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5366:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2882, + "mutability": "mutable", + "name": "amount", + "nameLocation": "5400:6:6", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5392:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2881, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5392:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "5333:79:6" + }, + "returnParameters": { + "id": 2891, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2890, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 2929, + "src": "5463:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2889, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5463:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "5462:6:6" + }, + "scope": 3368, + "src": "5319:483:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3000, + "nodeType": "Block", + "src": "5957:415:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2945, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "5984:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2946, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "5991:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2947, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2933, + "src": "5997:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2948, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6007:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 2942, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "5967:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 2943, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5967:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 2944, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "unstake", + "nodeType": "MemberAccess", + "referencedDeclaration": 10756, + "src": "5967:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 2949, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "5967:47:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2950, + "nodeType": "ExpressionStatement", + "src": "5967:47:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 2953, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 2951, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "6029:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 2952, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6038:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "6029:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 2988, + "nodeType": "Block", + "src": "6111:175:6", + "statements": [ + { + "assignments": [ + 2965 + ], + "declarations": [ + { + "constant": false, + "id": 2965, + "mutability": "mutable", + "name": "token", + "nameLocation": "6132:5:6", + "nodeType": "VariableDeclaration", + "scope": 2988, + "src": "6125:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 2964, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 2963, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "6125:6:6" + }, + "referencedDeclaration": 9727, + "src": "6125:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + } + ], + "id": 2972, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "5374616b65", + "id": 2968, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6160:7:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + "value": "Stake" + }, + { + "id": 2969, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "6169:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 2967, + "name": "requireAsset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8894, + "src": "6147:12:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 2970, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6147:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2966, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9727, + "src": "6140:6:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$9727_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 2971, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6140:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "6125:51:6" + }, + { + "expression": { + "arguments": [ + { + "id": 2976, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6209:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 2979, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "6233:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 2980, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "6233:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 2981, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6233:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 2982, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2965, + "src": "6257:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 2983, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "6257:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 2984, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6257:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 2977, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6215:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 2978, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "6215:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 2985, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6215:59:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 2973, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2965, + "src": "6190:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 2975, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 12135, + "src": "6190:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 2986, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6190:85:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2987, + "nodeType": "ExpressionStatement", + "src": "6190:85:6" + } + ] + }, + "id": 2989, + "nodeType": "IfStatement", + "src": "6025:261:6", + "trueBody": { + "id": 2962, + "nodeType": "Block", + "src": "6050:55:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 2959, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6087:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "id": 2956, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6072:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 2955, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "6064:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_payable_$", + "typeString": "type(address payable)" + }, + "typeName": { + "id": 2954, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "6064:8:6", + "stateMutability": "payable", + "typeDescriptions": {} + } + }, + "id": 2957, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6064:13:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 2958, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "src": "6064:22:6", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 2960, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6064:30:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2961, + "nodeType": "ExpressionStatement", + "src": "6064:30:6" + } + ] + } + }, + { + "eventCall": { + "arguments": [ + { + "id": 2991, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6308:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2992, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2931, + "src": "6314:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2993, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2937, + "src": "6321:4:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 2994, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2933, + "src": "6327:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 2995, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2935, + "src": "6337:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 2990, + "name": "Claimed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10140, + "src": "6300:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,address,bytes32,uint256)" + } + }, + "id": 2996, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6300:44:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 2997, + "nodeType": "EmitStatement", + "src": "6295:49:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 2998, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6361:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 2941, + "id": 2999, + "nodeType": "Return", + "src": "6354:11:6" + } + ] + }, + "id": 3001, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_claim", + "nameLocation": "5817:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 2938, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2931, + "mutability": "mutable", + "name": "stake", + "nameLocation": "5849:5:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5841:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2930, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5841:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2933, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "5872:8:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5864:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2932, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "5864:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2935, + "mutability": "mutable", + "name": "amount", + "nameLocation": "5898:6:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5890:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 2934, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "5890:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 2937, + "mutability": "mutable", + "name": "addr", + "nameLocation": "5922:4:6", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5914:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 2936, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "5914:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "5823:109:6" + }, + "returnParameters": { + "id": 2941, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 2940, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3001, + "src": "5951:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 2939, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "5951:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "5950:6:6" + }, + "scope": 3368, + "src": "5808:564:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "internal" + }, + { + "baseFunctions": [ + 9965 + ], + "body": { + "id": 3043, + "nodeType": "Block", + "src": "6473:259:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3021, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3015, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6508:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3016, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6520:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3017, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "6520:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3018, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3003, + "src": "6532:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3012, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "6491:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 3013, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6491:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 3014, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9841, + "src": "6491:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 3019, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6491:50:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 3020, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6544:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6491:54:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a2044656274206d7573742062652067726561746572207468616e207a65726f", + "id": 3022, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6547:40:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + }, + "value": "Mobius: Debt must be greater than zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + } + ], + "id": 3011, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "6483:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3023, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6483:105:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3024, + "nodeType": "ExpressionStatement", + "src": "6483:105:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3026, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6606:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3027, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3003, + "src": "6618:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3028, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6628:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3029, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "6628:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3025, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "6599:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 3030, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6599:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3031, + "nodeType": "ExpressionStatement", + "src": "6599:39:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3033, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6660:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3034, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "6660:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3035, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6672:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3036, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3003, + "src": "6684:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3037, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6694:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3038, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "value", + "nodeType": "MemberAccess", + "src": "6694:9:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3032, + "name": "Staked", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10096, + "src": "6653:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256)" + } + }, + "id": 3039, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6653:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3040, + "nodeType": "EmitStatement", + "src": "6648:56:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 3041, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6721:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 3010, + "id": 3042, + "nodeType": "Return", + "src": "6714:11:6" + } + ] + }, + "functionSelector": "271cdc68", + "id": 3044, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3007, + "kind": "modifierInvocation", + "modifierName": { + "id": 3006, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "6445:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "6445:12:6" + } + ], + "name": "stakeFromCoin", + "nameLocation": "6387:13:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3005, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "6428:8:6" + }, + "parameters": { + "id": 3004, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3003, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "6409:8:6", + "nodeType": "VariableDeclaration", + "scope": 3044, + "src": "6401:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3002, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6401:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "6400:18:6" + }, + "returnParameters": { + "id": 3010, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3009, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3044, + "src": "6467:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3008, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6467:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "6466:6:6" + }, + "scope": 3368, + "src": "6378:354:6", + "stateMutability": "payable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 9976 + ], + "body": { + "id": 3095, + "nodeType": "Block", + "src": "6857:327:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3061, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3059, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "6875:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 3060, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "6884:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "6875:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a204e617469766520436f696e2075736520226d696e7446726f6d436f696e222066756e6374696f6e", + "id": 3062, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "6896:49:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + }, + "value": "Mobius: Native Coin use \"mintFromCoin\" function" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_31ec65b2eeb3c458e70d2bba8e4bd5066b14a8f5027452c2720f146d84443811", + "typeString": "literal_string \"Mobius: Native Coin use \"mintFromCoin\" function\"" + } + ], + "id": 3058, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "6867:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3063, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6867:79:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3064, + "nodeType": "ExpressionStatement", + "src": "6867:79:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3075, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "arguments": [ + { + "id": 3069, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "6981:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3070, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "6988:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3071, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "6988:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3072, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3048, + "src": "7000:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3066, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "6964:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 3067, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6964:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 3068, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9841, + "src": "6964:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 3073, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6964:45:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 3074, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7012:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "6964:49:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a2044656274206d7573742062652067726561746572207468616e207a65726f", + "id": 3076, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7015:40:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + }, + "value": "Mobius: Debt must be greater than zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_b4099404e3b3f499201add7b7e61525600622f9a3ceb3f28220880ac2269cb20", + "typeString": "literal_string \"Mobius: Debt must be greater than zero\"" + } + ], + "id": 3065, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "6956:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3077, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "6956:100:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3078, + "nodeType": "ExpressionStatement", + "src": "6956:100:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3080, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "7074:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3081, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3048, + "src": "7081:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3082, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3050, + "src": "7091:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3079, + "name": "_stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3164, + "src": "7067:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,bytes32,uint256)" + } + }, + "id": 3083, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7067:31:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3084, + "nodeType": "ExpressionStatement", + "src": "7067:31:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3086, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "7120:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3087, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "7120:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3088, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3046, + "src": "7132:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3089, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3048, + "src": "7139:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3090, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3050, + "src": "7149:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3085, + "name": "Staked", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10096, + "src": "7113:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256)" + } + }, + "id": 3091, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7113:43:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3092, + "nodeType": "EmitStatement", + "src": "7108:48:6" + }, + { + "expression": { + "hexValue": "74727565", + "id": 3093, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7173:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "functionReturnParameters": 3057, + "id": 3094, + "nodeType": "Return", + "src": "7166:11:6" + } + ] + }, + "functionSelector": "b1636f39", + "id": 3096, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3054, + "kind": "modifierInvocation", + "modifierName": { + "id": 3053, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "6829:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "6829:12:6" + } + ], + "name": "stakeFromToken", + "nameLocation": "6747:14:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3052, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "6820:8:6" + }, + "parameters": { + "id": 3051, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3046, + "mutability": "mutable", + "name": "stake", + "nameLocation": "6770:5:6", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6762:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3045, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6762:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3048, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "6785:8:6", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6777:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3047, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "6777:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3050, + "mutability": "mutable", + "name": "amount", + "nameLocation": "6803:6:6", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6795:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3049, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "6795:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "6761:49:6" + }, + "returnParameters": { + "id": 3057, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3056, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3096, + "src": "6851:4:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3055, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "6851:4:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + } + ], + "src": "6850:6:6" + }, + "scope": 3368, + "src": "6738:446:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3163, + "nodeType": "Block", + "src": "7303:488:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3110, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3108, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3102, + "src": "7321:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">", + "rightExpression": { + "hexValue": "30", + "id": 3109, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7330:1:6", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "src": "7321:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a20616d6f756e74206d7573742062652067726561746572207468616e207a65726f", + "id": 3111, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7333:42:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_8134234dd9fc86052f4bc24ebeefa08d4567de47a47c9d7108b2cd53a31b643c", + "typeString": "literal_string \"Mobius: amount must be greater than zero\"" + }, + "value": "Mobius: amount must be greater than zero" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_8134234dd9fc86052f4bc24ebeefa08d4567de47a47c9d7108b2cd53a31b643c", + "typeString": "literal_string \"Mobius: amount must be greater than zero\"" + } + ], + "id": 3107, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "7313:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3112, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7313:63:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3113, + "nodeType": "ExpressionStatement", + "src": "7313:63:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3116, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3114, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3098, + "src": "7391:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "id": 3115, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "7400:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "7391:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3152, + "nodeType": "IfStatement", + "src": "7387:336:6", + "trueBody": { + "id": 3151, + "nodeType": "Block", + "src": "7412:311:6", + "statements": [ + { + "assignments": [ + 3118 + ], + "declarations": [ + { + "constant": false, + "id": 3118, + "mutability": "mutable", + "name": "stakeAddress", + "nameLocation": "7434:12:6", + "nodeType": "VariableDeclaration", + "scope": 3151, + "src": "7426:20:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3117, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7426:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3123, + "initialValue": { + "arguments": [ + { + "hexValue": "5374616b65", + "id": 3120, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "7462:7:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + "value": "Stake" + }, + { + "id": 3121, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3098, + "src": "7471:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3119, + "name": "requireAsset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8894, + "src": "7449:12:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3122, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7449:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7426:51:6" + }, + { + "assignments": [ + 3126 + ], + "declarations": [ + { + "constant": false, + "id": 3126, + "mutability": "mutable", + "name": "token", + "nameLocation": "7498:5:6", + "nodeType": "VariableDeclaration", + "scope": 3151, + "src": "7491:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 3125, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3124, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "7491:6:6" + }, + "referencedDeclaration": 9727, + "src": "7491:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + } + ], + "id": 3130, + "initialValue": { + "arguments": [ + { + "id": 3128, + "name": "stakeAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3118, + "src": "7513:12:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3127, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9727, + "src": "7506:6:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$9727_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 3129, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7506:20:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7491:35:6" + }, + { + "expression": { + "arguments": [ + { + "expression": { + "id": 3134, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "7580:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "7580:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "id": 3138, + "name": "this", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967268, + "src": "7616:4:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Mobius_$3368", + "typeString": "contract Mobius" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_contract$_Mobius_$3368", + "typeString": "contract Mobius" + } + ], + "id": 3137, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "7608:7:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3136, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "7608:7:6", + "typeDescriptions": {} + } + }, + "id": 3139, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7608:13:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3142, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "7657:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 3143, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "7657:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 3144, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7657:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3145, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3126, + "src": "7681:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "7681:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 3147, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7681:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 3140, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3102, + "src": "7639:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3141, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "7639:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3148, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7639:59:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 3131, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3126, + "src": "7540:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3133, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransferFrom", + "nodeType": "MemberAccess", + "referencedDeclaration": 12161, + "src": "7540:22:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,address,uint256)" + } + }, + "id": 3149, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7540:172:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3150, + "nodeType": "ExpressionStatement", + "src": "7540:172:6" + } + ] + } + }, + { + "expression": { + "arguments": [ + { + "id": 3156, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3098, + "src": "7748:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "expression": { + "id": 3157, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "7755:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3158, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "7755:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3159, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3100, + "src": "7767:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3160, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3102, + "src": "7777:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3153, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "7733:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 3154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7733:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 3155, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "stake", + "nodeType": "MemberAccess", + "referencedDeclaration": 10745, + "src": "7733:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 3161, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "7733:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3162, + "nodeType": "ExpressionStatement", + "src": "7733:51:6" + } + ] + }, + "id": 3164, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3105, + "kind": "modifierInvocation", + "modifierName": { + "id": 3104, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "7293:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "7293:9:6" + } + ], + "name": "_stake", + "nameLocation": "7199:6:6", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3098, + "mutability": "mutable", + "name": "stake", + "nameLocation": "7223:5:6", + "nodeType": "VariableDeclaration", + "scope": 3164, + "src": "7215:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3097, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7215:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3100, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "7246:8:6", + "nodeType": "VariableDeclaration", + "scope": 3164, + "src": "7238:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3099, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7238:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3102, + "mutability": "mutable", + "name": "amount", + "nameLocation": "7272:6:6", + "nodeType": "VariableDeclaration", + "scope": 3164, + "src": "7264:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3101, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7264:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7205:79:6" + }, + "returnParameters": { + "id": 3106, + "nodeType": "ParameterList", + "parameters": [], + "src": "7303:0:6" + }, + "scope": 3368, + "src": "7190:601:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + }, + { + "baseFunctions": [ + 10073 + ], + "body": { + "id": 3212, + "nodeType": "Block", + "src": "7957:438:6", + "statements": [ + { + "assignments": [ + 3181, + 3183, + 3185, + 3187 + ], + "declarations": [ + { + "constant": false, + "id": 3181, + "mutability": "mutable", + "name": "tradingAmount", + "nameLocation": "7976:13:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "7968:21:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3180, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7968:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3183, + "mutability": "mutable", + "name": "tradingFee", + "nameLocation": "7999:10:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "7991:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3182, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7991:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3185, + "mutability": "mutable", + "name": "fromSynthPrice", + "nameLocation": "8019:14:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "8011:22:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3184, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8011:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3187, + "mutability": "mutable", + "name": "toSynthPirce", + "nameLocation": "8043:12:6", + "nodeType": "VariableDeclaration", + "scope": 3212, + "src": "8035:20:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3186, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8035:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3197, + "initialValue": { + "arguments": [ + { + "expression": { + "id": 3191, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "8086:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3192, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "8086:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3193, + "name": "fromSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3166, + "src": "8098:9:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3194, + "name": "fromAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3168, + "src": "8109:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3195, + "name": "toSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3170, + "src": "8121:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3188, + "name": "Trader", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2473, + "src": "8071:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ITrader_$10913_$", + "typeString": "function () view returns (contract ITrader)" + } + }, + "id": 3189, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8071:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ITrader_$10913", + "typeString": "contract ITrader" + } + }, + "id": 3190, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "trade", + "nodeType": "MemberAccess", + "referencedDeclaration": 10884, + "src": "8071:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_bytes32_$_t_uint256_$_t_bytes32_$returns$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "function (address,bytes32,uint256,bytes32) external returns (uint256,uint256,uint256,uint256)" + } + }, + "id": 3196, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8071:58:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256,uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "7967:162:6" + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3199, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "8165:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3200, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "8165:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3201, + "name": "fromSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3166, + "src": "8189:9:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3202, + "name": "toSynth", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3170, + "src": "8212:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3203, + "name": "fromAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3168, + "src": "8233:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3204, + "name": "tradingAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3181, + "src": "8257:13:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3205, + "name": "tradingFee", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3183, + "src": "8284:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3206, + "name": "fromSynthPrice", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3185, + "src": "8308:14:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3207, + "name": "toSynthPirce", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3187, + "src": "8336:12:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3198, + "name": "Traded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10158, + "src": "8145:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_bytes32_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,bytes32,uint256,uint256,uint256,uint256,uint256)" + } + }, + "id": 3208, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8145:213:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3209, + "nodeType": "EmitStatement", + "src": "8140:218:6" + }, + { + "expression": { + "id": 3210, + "name": "tradingAmount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3181, + "src": "8375:13:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3179, + "id": 3211, + "nodeType": "Return", + "src": "8368:20:6" + } + ] + }, + "functionSelector": "f9df4a6c", + "id": 3213, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3174, + "kind": "modifierInvocation", + "modifierName": { + "id": 3173, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "7916:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "7916:9:6" + }, + { + "id": 3176, + "kind": "modifierInvocation", + "modifierName": { + "id": 3175, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "7926:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "7926:12:6" + } + ], + "name": "trade", + "nameLocation": "7806:5:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3172, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "7907:8:6" + }, + "parameters": { + "id": 3171, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3166, + "mutability": "mutable", + "name": "fromSynth", + "nameLocation": "7829:9:6", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7821:17:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3165, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7821:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3168, + "mutability": "mutable", + "name": "fromAmount", + "nameLocation": "7856:10:6", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7848:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3167, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7848:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3170, + "mutability": "mutable", + "name": "toSynth", + "nameLocation": "7884:7:6", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7876:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3169, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "7876:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "7811:86:6" + }, + "returnParameters": { + "id": 3179, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3178, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3213, + "src": "7948:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3177, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "7948:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "7947:9:6" + }, + "scope": 3368, + "src": "7797:598:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10086 + ], + "body": { + "id": 3366, + "nodeType": "Block", + "src": "8583:1064:6", + "statements": [ + { + "assignments": [ + 3232 + ], + "declarations": [ + { + "constant": false, + "id": 3232, + "mutability": "mutable", + "name": "liquidable", + "nameLocation": "8601:10:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8593:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3231, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8593:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3240, + "initialValue": { + "arguments": [ + { + "id": 3236, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8641:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3237, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "8648:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3238, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "8657:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3233, + "name": "Liquidator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2486, + "src": "8614:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ILiquidator_$9912_$", + "typeString": "function () view returns (contract ILiquidator)" + } + }, + "id": 3234, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8614:12:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "id": 3235, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getLiquidable", + "nodeType": "MemberAccess", + "referencedDeclaration": 9898, + "src": "8614:26:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_address_$_t_bytes32_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32) view external returns (uint256)" + } + }, + "id": 3239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8614:52:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8593:73:6" + }, + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3244, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3242, + "name": "liquidable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3232, + "src": "8684:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": ">=", + "rightExpression": { + "id": 3243, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "8698:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8684:20:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "4d6f626975733a206c697175696461746520616d6f756e742065786365656473206c697175696461626c65", + "id": 3245, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "8706:45:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_af4d8cdf40d3e8e8e19a2e18f08b4065874ffee61c93af22483503bd9c3145fa", + "typeString": "literal_string \"Mobius: liquidate amount exceeds liquidable\"" + }, + "value": "Mobius: liquidate amount exceeds liquidable" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_af4d8cdf40d3e8e8e19a2e18f08b4065874ffee61c93af22483503bd9c3145fa", + "typeString": "literal_string \"Mobius: liquidate amount exceeds liquidable\"" + } + ], + "id": 3241, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "8676:7:6", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3246, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8676:76:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3247, + "nodeType": "ExpressionStatement", + "src": "8676:76:6" + }, + { + "assignments": [ + 3249, + 3251 + ], + "declarations": [ + { + "constant": false, + "id": 3249, + "mutability": "mutable", + "name": "toPayer", + "nameLocation": "8773:7:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8765:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3248, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8765:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3251, + "mutability": "mutable", + "name": "toPlat", + "nameLocation": "8789:6:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8781:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3250, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8781:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3259, + "initialValue": { + "arguments": [ + { + "id": 3255, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8826:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3256, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "8833:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3257, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "8843:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3252, + "name": "Liquidator", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2486, + "src": "8799:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_ILiquidator_$9912_$", + "typeString": "function () view returns (contract ILiquidator)" + } + }, + "id": 3253, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8799:12:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_ILiquidator_$9912", + "typeString": "contract ILiquidator" + } + }, + "id": 3254, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "getUnstakable", + "nodeType": "MemberAccess", + "referencedDeclaration": 9911, + "src": "8799:26:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$_t_bytes32_$_t_bytes32_$_t_uint256_$returns$_t_uint256_$_t_uint256_$", + "typeString": "function (bytes32,bytes32,uint256) view external returns (uint256,uint256)" + } + }, + "id": 3258, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8799:51:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_uint256_$_t_uint256_$", + "typeString": "tuple(uint256,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8764:86:6" + }, + { + "assignments": [ + 3261 + ], + "declarations": [ + { + "constant": false, + "id": 3261, + "mutability": "mutable", + "name": "unstakable", + "nameLocation": "8868:10:6", + "nodeType": "VariableDeclaration", + "scope": 3366, + "src": "8860:18:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3260, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8860:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3265, + "initialValue": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3262, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "8881:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "id": 3263, + "name": "toPlat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3251, + "src": "8891:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "8881:16:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "8860:37:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3269, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8925:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3270, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "8932:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3271, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "8941:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3272, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "8951:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "expression": { + "id": 3273, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "8959:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "8959:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3266, + "name": "Issuer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2460, + "src": "8907:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IIssuer_$9873_$", + "typeString": "function () view returns (contract IIssuer)" + } + }, + "id": 3267, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8907:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IIssuer_$9873", + "typeString": "contract IIssuer" + } + }, + "id": 3268, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "burnDebt", + "nodeType": "MemberAccess", + "referencedDeclaration": 9812, + "src": "8907:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$_t_address_$returns$_t_uint256_$", + "typeString": "function (bytes32,address,bytes32,uint256,address) external returns (uint256)" + } + }, + "id": 3275, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8907:63:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3276, + "nodeType": "ExpressionStatement", + "src": "8907:63:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3280, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "8997:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3281, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "9004:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3282, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "9013:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3283, + "name": "unstakable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3261, + "src": "9023:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [], + "expression": { + "argumentTypes": [], + "id": 3277, + "name": "Staker", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2421, + "src": "8980:6:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$__$returns$_t_contract$_IStaker_$10792_$", + "typeString": "function () view returns (contract IStaker)" + } + }, + "id": 3278, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8980:8:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IStaker_$10792", + "typeString": "contract IStaker" + } + }, + "id": 3279, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "unstake", + "nodeType": "MemberAccess", + "referencedDeclaration": 10756, + "src": "8980:16:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$returns$__$", + "typeString": "function (bytes32,address,bytes32,uint256) external" + } + }, + "id": 3284, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "8980:54:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3285, + "nodeType": "ExpressionStatement", + "src": "8980:54:6" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3288, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3286, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "9049:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "id": 3287, + "name": "nativeCoin", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 2376, + "src": "9058:10:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "9049:19:6", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": { + "id": 3352, + "nodeType": "Block", + "src": "9217:316:6", + "statements": [ + { + "assignments": [ + 3311 + ], + "declarations": [ + { + "constant": false, + "id": 3311, + "mutability": "mutable", + "name": "token", + "nameLocation": "9238:5:6", + "nodeType": "VariableDeclaration", + "scope": 3352, + "src": "9231:12:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + }, + "typeName": { + "id": 3310, + "nodeType": "UserDefinedTypeName", + "pathNode": { + "id": 3309, + "name": "IERC20", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9727, + "src": "9231:6:6" + }, + "referencedDeclaration": 9727, + "src": "9231:6:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "visibility": "internal" + } + ], + "id": 3318, + "initialValue": { + "arguments": [ + { + "arguments": [ + { + "hexValue": "5374616b65", + "id": 3314, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "9266:7:6", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + "value": "Stake" + }, + { + "id": 3315, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "9275:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_stringliteral_46e0152631724883515adf5183d0ad68b0f3fdb4ea59b5bb258492ab0edd5ec7", + "typeString": "literal_string \"Stake\"" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3313, + "name": "requireAsset", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8894, + "src": "9253:12:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3316, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9253:28:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3312, + "name": "IERC20", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9727, + "src": "9246:6:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IERC20_$9727_$", + "typeString": "type(contract IERC20)" + } + }, + "id": 3317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9246:36:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "9231:51:6" + }, + { + "expression": { + "arguments": [ + { + "expression": { + "id": 3322, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "9315:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "9315:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3326, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "9346:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 3327, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "9346:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 3328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9346:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3329, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9370:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3330, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "9370:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 3331, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9370:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 3324, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "9327:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3325, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "9327:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3332, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9327:60:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 3319, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9296:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3321, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 12135, + "src": "9296:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 3333, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9296:92:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3334, + "nodeType": "ExpressionStatement", + "src": "9296:92:6" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 3339, + "name": "LIQUIDATION_FEE_ADDRESS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8563, + "src": "9436:23:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3338, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "9421:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3340, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9421:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3343, + "name": "PreciseMath", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 12065, + "src": "9480:11:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_PreciseMath_$12065_$", + "typeString": "type(library PreciseMath)" + } + }, + "id": 3344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "DECIMALS", + "nodeType": "MemberAccess", + "referencedDeclaration": 11796, + "src": "9480:20:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$__$returns$_t_uint256_$", + "typeString": "function () pure returns (uint256)" + } + }, + "id": 3345, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9480:22:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "arguments": [], + "expression": { + "argumentTypes": [], + "expression": { + "id": 3346, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9504:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3347, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimals", + "nodeType": "MemberAccess", + "referencedDeclaration": 9660, + "src": "9504:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_external_view$__$returns$_t_uint8_$", + "typeString": "function () view external returns (uint8)" + } + }, + "id": 3348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9504:16:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + ], + "expression": { + "id": 3341, + "name": "toPlat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3251, + "src": "9462:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3342, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "decimalsTo", + "nodeType": "MemberAccess", + "referencedDeclaration": 11896, + "src": "9462:17:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_uint256_$_t_uint256_$_t_uint256_$returns$_t_uint256_$bound_to$_t_uint256_$", + "typeString": "function (uint256,uint256,uint256) pure returns (uint256)" + } + }, + "id": 3349, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9462:59:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "id": 3335, + "name": "token", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3311, + "src": "9402:5:6", + "typeDescriptions": { + "typeIdentifier": "t_contract$_IERC20_$9727", + "typeString": "contract IERC20" + } + }, + "id": 3337, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "safeTransfer", + "nodeType": "MemberAccess", + "referencedDeclaration": 12135, + "src": "9402:18:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_contract$_IERC20_$9727_$_t_address_$_t_uint256_$returns$__$bound_to$_t_contract$_IERC20_$9727_$", + "typeString": "function (contract IERC20,address,uint256)" + } + }, + "id": 3350, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9402:120:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3351, + "nodeType": "ExpressionStatement", + "src": "9402:120:6" + } + ] + }, + "id": 3353, + "nodeType": "IfStatement", + "src": "9045:488:6", + "trueBody": { + "id": 3308, + "nodeType": "Block", + "src": "9070:141:6", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3295, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "9113:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "expression": { + "id": 3291, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "9092:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3292, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "9092:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3290, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9084:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_payable_$", + "typeString": "type(address payable)" + }, + "typeName": { + "id": 3289, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "9084:8:6", + "stateMutability": "payable", + "typeDescriptions": {} + } + }, + "id": 3293, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9084:19:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 3294, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "src": "9084:28:6", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 3296, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9084:37:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3297, + "nodeType": "ExpressionStatement", + "src": "9084:37:6" + }, + { + "expression": { + "arguments": [ + { + "id": 3305, + "name": "toPlat", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3251, + "src": "9193:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "arguments": [ + { + "arguments": [ + { + "id": 3301, + "name": "LIQUIDATION_FEE_ADDRESS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8563, + "src": "9158:23:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3300, + "name": "requireAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8959, + "src": "9143:14:6", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3302, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9143:39:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3299, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "9135:8:6", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_payable_$", + "typeString": "type(address payable)" + }, + "typeName": { + "id": 3298, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "9135:8:6", + "stateMutability": "payable", + "typeDescriptions": {} + } + }, + "id": 3303, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9135:48:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address_payable", + "typeString": "address payable" + } + }, + "id": 3304, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "transfer", + "nodeType": "MemberAccess", + "src": "9135:57:6", + "typeDescriptions": { + "typeIdentifier": "t_function_transfer_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256)" + } + }, + "id": 3306, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9135:65:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3307, + "nodeType": "ExpressionStatement", + "src": "9135:65:6" + } + ] + } + }, + { + "eventCall": { + "arguments": [ + { + "expression": { + "id": 3355, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 4294967281, + "src": "9559:3:6", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 3356, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "src": "9559:10:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3357, + "name": "stake", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3215, + "src": "9571:5:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3358, + "name": "account", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3217, + "src": "9578:7:6", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3359, + "name": "debtType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3219, + "src": "9587:8:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3360, + "name": "unstakable", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3261, + "src": "9597:10:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "id": 3361, + "name": "amount", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3221, + "src": "9609:6:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 3354, + "name": "Liquidated", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10172, + "src": "9548:10:6", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$_t_bytes32_$_t_address_$_t_bytes32_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (address,bytes32,address,bytes32,uint256,uint256)" + } + }, + "id": 3362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "9548:68:6", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3363, + "nodeType": "EmitStatement", + "src": "9543:73:6" + }, + { + "expression": { + "id": 3364, + "name": "toPayer", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3249, + "src": "9633:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "functionReturnParameters": 3230, + "id": 3365, + "nodeType": "Return", + "src": "9626:14:6" + } + ] + }, + "functionSelector": "ea110b7d", + "id": 3367, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3225, + "kind": "modifierInvocation", + "modifierName": { + "id": 3224, + "name": "notPaused", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9165, + "src": "8542:9:6" + }, + "nodeType": "ModifierInvocation", + "src": "8542:9:6" + }, + { + "id": 3227, + "kind": "modifierInvocation", + "modifierName": { + "id": 3226, + "name": "nonReentrant", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12104, + "src": "8552:12:6" + }, + "nodeType": "ModifierInvocation", + "src": "8552:12:6" + } + ], + "name": "liquidate", + "nameLocation": "8410:9:6", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3223, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "8533:8:6" + }, + "parameters": { + "id": 3222, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3215, + "mutability": "mutable", + "name": "stake", + "nameLocation": "8437:5:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8429:13:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3214, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8429:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3217, + "mutability": "mutable", + "name": "account", + "nameLocation": "8460:7:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8452:15:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3216, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "8452:7:6", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3219, + "mutability": "mutable", + "name": "debtType", + "nameLocation": "8485:8:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8477:16:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3218, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "8477:7:6", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3221, + "mutability": "mutable", + "name": "amount", + "nameLocation": "8511:6:6", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8503:14:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3220, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8503:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8419:104:6" + }, + "returnParameters": { + "id": 3230, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3229, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3367, + "src": "8574:7:6", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3228, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "8574:7:6", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "src": "8573:9:6" + }, + "scope": 3368, + "src": "8401:1246:6", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + } + ], + "scope": 3369, + "src": "506:9143:6", + "usedErrors": [] + } + ], + "src": "32:9618:6" + }, + "compiler": { + "name": "solc", + "version": "0.8.4+commit.c7e474f2.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.4.3", + "updatedAt": "2021-11-09T08:27:51.699Z", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/projects/mobiusfinance/abis/Resolver.json b/projects/mobiusfinance/abis/Resolver.json new file mode 100644 index 0000000000..38e821a8c6 --- /dev/null +++ b/projects/mobiusfinance/abis/Resolver.json @@ -0,0 +1,13530 @@ +{ + "contractName": "Resolver", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "AddressChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "assetType", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "assetName", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "AssetChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "ManagerChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "MobiusTokenMigrated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousValue", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newValue", + "type": "address" + } + ], + "name": "OwnerChanged", + "type": "event" + }, + { + "inputs": [], + "name": "contractName", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "manager", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_manager", + "type": "address" + } + ], + "name": "setManager", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "name": "setOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "assetType", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "assetName", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "assetAddress", + "type": "address" + } + ], + "name": "addAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "assetType", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "assetName", + "type": "bytes32" + } + ], + "name": "removeAsset", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "assetType", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "assetName", + "type": "bytes32" + } + ], + "name": "getAsset", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "assetType", + "type": "bytes32" + } + ], + "name": "getAssets", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "name", + "type": "bytes32[]" + }, + { + "internalType": "address[]", + "name": "value", + "type": "address[]" + } + ], + "name": "importAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "value", + "type": "address" + } + ], + "name": "setAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "metadata": "{\"compiler\":{\"version\":\"0.8.4+commit.c7e474f2\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"AddressChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"assetType\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"AssetChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"ManagerChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"MobiusTokenMigrated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousValue\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newValue\",\"type\":\"address\"}],\"name\":\"OwnerChanged\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"assetType\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"assetAddress\",\"type\":\"address\"}],\"name\":\"addAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"contractName\",\"outputs\":[{\"internalType\":\"string\",\"name\":\"\",\"type\":\"string\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"getAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"assetType\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"}],\"name\":\"getAsset\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"assetType\",\"type\":\"bytes32\"}],\"name\":\"getAssets\",\"outputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"\",\"type\":\"bytes32[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"name\",\"type\":\"bytes32[]\"},{\"internalType\":\"address[]\",\"name\":\"value\",\"type\":\"address[]\"}],\"name\":\"importAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"manager\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"assetType\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"assetName\",\"type\":\"bytes32\"}],\"name\":\"removeAsset\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"name\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"value\",\"type\":\"address\"}],\"name\":\"setAddress\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_manager\",\"type\":\"address\"}],\"name\":\"setManager\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"project:/contracts/Resolver.sol\":\"Resolver\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":true,\"runs\":4294967295},\"remappings\":[]},\"sources\":{\"project:/contracts/Resolver.sol\":{\"keccak256\":\"0x9f40dc4974a9132c0f6fe3e93294eb8de3ad6b7142ccd57b60e56e9e3ef46187\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4c679c3bea6f018619b75aa790e1ce4707e0fcc0431946163f349926258e24f0\",\"dweb:/ipfs/QmTWZrJRqbRVqTCPoDFnSbCAyTZm6Xq5jrZNPJSdzcxmpL\"]},\"project:/contracts/base/Constants.sol\":{\"keccak256\":\"0xd385eb2024741177af7f0e7a63bec671e75ffced38c5fcdba3323dead24d3f4f\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://68e3ecc6063c5c44c5016634d0039ff8d16fb0164c450e9ffdffc744abe7d12b\",\"dweb:/ipfs/QmcsiDHkYGWtZ4kvxwV1FhmADrw92dCBHbRzusRj4R2F5V\"]},\"project:/contracts/base/Ownable.sol\":{\"keccak256\":\"0xfe1332448b6dd2a5d47fda27141b45000dd9c01dd6efa8dc8b6fd9c0d0a6bef9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://4b81e14d8dcb2661121fc118a1235f7f471c4c98f14676ff409ec4db4009425c\",\"dweb:/ipfs/QmaPdHCQvFPhu1zwSouaCYHLpb5jGMepCHsE5aEWgwpXsX\"]},\"project:/contracts/base/Storage.sol\":{\"keccak256\":\"0x12b5e8ac158169be922e9b2b61efcb0f86312cc91aea18831fcfb54f3c1ae912\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://bff6bdc09b7972576fd6849ea209c59134ccc96bd353febd1540bfe806f03201\",\"dweb:/ipfs/QmQ4JUiq9NqY7XkHknVge7QQmJrkv1eZjmfvNn4dVtivJy\"]},\"project:/contracts/interfaces/IERC20.sol\":{\"keccak256\":\"0x8e49e39018d207233f6170cd9d0c9ae90c832c742212bc0e1950b9351a0010a8\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e5cc135ca761b45aa3f49d121d20029ed2fb7001b19682e851662108b4c2ebb1\",\"dweb:/ipfs/QmVaAtX6kYgA2t15rmZqQZ5LZnAyKpUoUiJPGdJC35BYtL\"]},\"project:/contracts/interfaces/IMobiusToken.sol\":{\"keccak256\":\"0xfaef278d6041f054a0aee73dbe0b61040783bc3e1ae4269ac015ad4a75228d6a\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://ad680a46fb6b79a92d80d9d4a46db8e4e305da0c061caa0452e1a4d0cd580ac2\",\"dweb:/ipfs/QmXmU2xv6N7zT6H9KnSaHjHxtjpLEYHaPf8zyo9GPSfLgW\"]},\"project:/contracts/interfaces/IOwnable.sol\":{\"keccak256\":\"0xea183866d1027f5768a4d255951113131eb740accb17e2b8feee4c682b23c2bb\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://e7cb7b1d50aee53c2734aa3629cb4ea5d809a9ae381a017656a79b7740b40329\",\"dweb:/ipfs/QmZMcDrxXWkNYjAHuqPVvhkRnuFN2A6xs7JYs35k2jRTK8\"]},\"project:/contracts/interfaces/IResolver.sol\":{\"keccak256\":\"0x48c68564c0059469b79155383b438440db48f5151c5dc4e92fbd04e0563a4f60\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://2d13304155a5ef002edb8b2992b0c299f05688cafaf3c0f37adcde9d4bdf7d5c\",\"dweb:/ipfs/QmVh4rn3iqxeR2tm4FQs7xA6bQBoxPjBUVfd2nsKvNiWaP\"]},\"project:/contracts/lib/Arrays.sol\":{\"keccak256\":\"0x6b50838651b62658f11adcc1ed5b0bc1d52a8628ceee4898bcf30999724acdb9\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://b172abd585fd1ae3e5a6c14f76acf27b6e03ff83f93861355660a56805a73190\",\"dweb:/ipfs/QmdBfEHa1ZXsriYn2XviyZtuA22QnYBBxeiDeb8NnPBRzG\"]},\"project:/contracts/lib/Strings.sol\":{\"keccak256\":\"0x0bc282501099b51b91ecb68fa0f40f88cd590a6a8fda8bb455581a8d619f1c97\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://f4461279953516d98257db0c5066294814d592de8f14ea10206449810a5ae60a\",\"dweb:/ipfs/QmbHMCcH9hFgQep2tPq3cX2izkxXnTKVVUsY7bW6RgVsp4\"]},\"project:/contracts/storages/AddressStorage.sol\":{\"keccak256\":\"0x3f5a1524c4a8709a92d9d385e66d9c4b797bec21c205bd25a28472adf84f58b2\",\"license\":\"MIT\",\"urls\":[\"bzz-raw://8ecaa7a1f5358bbbfa44a912c5cab40b82f1c90e15425dd1fa689b2deff706ad\",\"dweb:/ipfs/QmNa5VeTfLHioSS8PwWDe857QHjz9yusxx5tvszmpzFTw9\"]}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060018054336001600160a01b031991821681179092556002805490911690911790556200004a672932b9b7b63b32b960c11b62000050565b62000164565b60408051602080820184905282518083038201815291830190925280516200007d92600092019062000081565b5050565b8280546200008f9062000127565b90600052602060002090601f016020900481019282620000b35760008555620000fe565b82601f10620000ce57805160ff1916838001178555620000fe565b82800160010185558215620000fe579182015b82811115620000fe578251825591602001919060010190620000e1565b506200010c92915062000110565b5090565b5b808211156200010c576000815560010162000111565b600181811c908216806200013c57607f821691505b602082108114156200015e57634e487b7160e01b600052602260045260246000fd5b50919050565b61168780620001746000396000f3fe608060405234801561001057600080fd5b50600436106100d45760003560e01c80638da5cb5b11610081578063a418c84d1161005b578063a418c84d14610247578063ca446dd91461025a578063d0ebdbe71461026d57600080fd5b80638da5cb5b146101f45780639dddb54d146102145780639de567f01461022757600080fd5b8063481c6a75116100b2578063481c6a7514610180578063659b9d70146101a057806375d0c0dc146101df57600080fd5b806313af4035146100d95780631ebd0da2146100ee57806321f8a72114610101575b600080fd5b6100ec6100e7366004611359565b610280565b005b6100ec6100fc366004611446565b6104f1565b61015661010f366004611403565b60009081527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6002546101569073ffffffffffffffffffffffffffffffffffffffff1681565b6101b36101ae366004611446565b610671565b60408051921515835273ffffffffffffffffffffffffffffffffffffffff909116602083015201610177565b6101e76106cc565b604051610177919061150e565b6001546101569073ffffffffffffffffffffffffffffffffffffffff1681565b6100ec61022236600461137a565b61075a565b61023a610235366004611403565b61093c565b60405161017791906114ca565b6100ec610255366004611467565b61099e565b6100ec61026836600461141b565b610b3a565b6100ec61027b366004611359565b610cc8565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926103719291906102e5906115a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610311906115a6565b801561035e5780601f106103335761010080835404028352916020019161035e565b820191906000526020600020905b81548152906001019060200180831161034157829003601f168201915b5050505050610e8790919063ffffffff16565b906103b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561042a6040518060400160405280601f81526020017f3a206e6577206f776e657220697320746865207a65726f206164647265737300815250600080546102e5906115a6565b90610462576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926105569291906102e5906115a6565b9061058e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060008281526004602052604090206105a79082610eb3565b80827ffef1edfd9777499fcd47240a7d925f53dd6d43a4ec647fd5b2e6ff23036f4d3b6106028585600091825260036020908152604080842092845291905290205473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252600060208301520160405180910390a36000918252600360209081526040808420928452919052902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60008281526004602052604081208190819061068d9085610fc1565b50600086815260036020908152604080832088845290915290205490935073ffffffffffffffffffffffffffffffffffffffff169150505b9250929050565b600080546106d9906115a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610705906115a6565b80156107525780601f1061072757610100808354040283529160200191610752565b820191906000526020600020905b81548152906001019060200180831161073557829003601f168201915b505050505081565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926107bf9291906102e5906115a6565b906107f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b50828114610887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f5265736f6c7665723a206e616d6520616e642076616c7565206c656e6774682060448201527f6d69736d6174636800000000000000000000000000000000000000000000000060648201526084016103a9565b60005b83811015610935576109238585838181106108ce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002013584848481811061090e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906102689190611359565b8061092d816115e1565b91505061088a565b5050505050565b60008181526004602090815260409182902080548351818402810184019094528084526060939283018282801561099257602002820191906000526020600020905b81548152602001906001019080831161097e575b50505050509050919050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610a039291906102e5906115a6565b90610a3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b506000838152600460205260409020610a549083611045565b81837ffef1edfd9777499fcd47240a7d925f53dd6d43a4ec647fd5b2e6ff23036f4d3b610aaf8686600091825260036020908152604080842092845291905290205473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291861660208301520160405180910390a36000838152600360209081526040808320858452909152902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316179055505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610b9f9291906102e5906115a6565b90610bd7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060008281527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604080822054905173ffffffffffffffffffffffffffffffffffffffff9182169291841691839186917f59cff797773a13d5269a5bb23cdc636f102c95002a8305e19db9a255211cf82191a4610c58838284611078565b60008381527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610d2d9291906102e5906115a6565b90610d65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610dc060405180606001604052806021815260200161163160219139600080546102e5906115a6565b90610df8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a435090600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60608282604051602001610e9c92919061149b565b604051602081830303815290604052905092915050565b600080610ec08484610fc1565b9150915081610ecf5750505050565b8354600090610ee09060019061155f565b9050848181548110610f1b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154858381548110610f5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555084805480610fa4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600190038181906000526020600020016000905590555050505050565b60008060005b8454811015611038578385828154811061100a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001541415611026576001925090506106c5565b80611030816115e1565b915050610fc7565b5060009485945092505050565b60006110518383610fc1565b509050801561105f57505050565b5081546001810183556000928352602090922090910155565b604080518082019091527f457363726f77000000000000000000000000000000000000000000000000000081527f4d6f626975730000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff83166110ec5750505050565b7f4d6f62697573546f6b656e0000000000000000000000000000000000000000006000527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020527f064210e22ad281689f46a2fdf94bd21585b7a65b5e783612e77cfcc2f38cf1535473ffffffffffffffffffffffffffffffffffffffff1680611178575050505050565b60005b60028110156112e5578281600281106111bd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015186146111cd576112d3565b6040517f1068361f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301528581166024830152831690631068361f90604401602060405180830381600087803b15801561123e57600080fd5b505af1158015611252573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127691906113e3565b508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16877ff61c93288e98f99c50419a21fd4a00cd44b959c239db392b7f9c01fa654b376f60405160405180910390a45b806112dd816115e1565b91505061117b565b505050505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461131157600080fd5b919050565b60008083601f840112611327578182fd5b50813567ffffffffffffffff81111561133e578182fd5b6020830191508360208260051b85010111156106c557600080fd5b60006020828403121561136a578081fd5b611373826112ed565b9392505050565b6000806000806040858703121561138f578283fd5b843567ffffffffffffffff808211156113a6578485fd5b6113b288838901611316565b909650945060208701359150808211156113ca578384fd5b506113d787828801611316565b95989497509550505050565b6000602082840312156113f4578081fd5b81518015158114611373578182fd5b600060208284031215611414578081fd5b5035919050565b6000806040838503121561142d578182fd5b8235915061143d602084016112ed565b90509250929050565b60008060408385031215611458578182fd5b50508035926020909101359150565b60008060006060848603121561147b578283fd5b8335925060208401359150611492604085016112ed565b90509250925092565b600083516114ad818460208801611576565b8351908301906114c1818360208801611576565b01949350505050565b6020808252825182820181905260009190848201906040850190845b81811015611502578351835292840192918401916001016114e6565b50909695505050505050565b602081526000825180602084015261152d816040850160208701611576565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000828210156115715761157161161a565b500390565b60005b83811015611591578181015183820152602001611579565b838111156115a0576000848401525b50505050565b600181811c908216806115ba57607f821691505b602082108114156115db57634e487b7160e01b600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156116135761161361161a565b5060010190565b634e487b7160e01b600052601160045260246000fdfe3a206e6577206d616e6167657220697320746865207a65726f2061646472657373a264697066735822122006e13a7ea13ea2f1dd87efbd0ef0db0b54862a4fa672e53cc916b414f42eded964736f6c63430008040033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80638da5cb5b11610081578063a418c84d1161005b578063a418c84d14610247578063ca446dd91461025a578063d0ebdbe71461026d57600080fd5b80638da5cb5b146101f45780639dddb54d146102145780639de567f01461022757600080fd5b8063481c6a75116100b2578063481c6a7514610180578063659b9d70146101a057806375d0c0dc146101df57600080fd5b806313af4035146100d95780631ebd0da2146100ee57806321f8a72114610101575b600080fd5b6100ec6100e7366004611359565b610280565b005b6100ec6100fc366004611446565b6104f1565b61015661010f366004611403565b60009081527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6002546101569073ffffffffffffffffffffffffffffffffffffffff1681565b6101b36101ae366004611446565b610671565b60408051921515835273ffffffffffffffffffffffffffffffffffffffff909116602083015201610177565b6101e76106cc565b604051610177919061150e565b6001546101569073ffffffffffffffffffffffffffffffffffffffff1681565b6100ec61022236600461137a565b61075a565b61023a610235366004611403565b61093c565b60405161017791906114ca565b6100ec610255366004611467565b61099e565b6100ec61026836600461141b565b610b3a565b6100ec61027b366004611359565b610cc8565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926103719291906102e5906115a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610311906115a6565b801561035e5780601f106103335761010080835404028352916020019161035e565b820191906000526020600020905b81548152906001019060200180831161034157829003601f168201915b5050505050610e8790919063ffffffff16565b906103b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b60405180910390fd5b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561042a6040518060400160405280601f81526020017f3a206e6577206f776e657220697320746865207a65726f206164647265737300815250600080546102e5906115a6565b90610462576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060015460405173ffffffffffffffffffffffffffffffffffffffff8084169216907fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c90600090a3600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926105569291906102e5906115a6565b9061058e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060008281526004602052604090206105a79082610eb3565b80827ffef1edfd9777499fcd47240a7d925f53dd6d43a4ec647fd5b2e6ff23036f4d3b6106028585600091825260036020908152604080842092845291905290205473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252600060208301520160405180910390a36000918252600360209081526040808420928452919052902080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b60008281526004602052604081208190819061068d9085610fc1565b50600086815260036020908152604080832088845290915290205490935073ffffffffffffffffffffffffffffffffffffffff169150505b9250929050565b600080546106d9906115a6565b80601f0160208091040260200160405190810160405280929190818152602001828054610705906115a6565b80156107525780601f1061072757610100808354040283529160200191610752565b820191906000526020600020905b81548152906001019060200180831161073557829003601f168201915b505050505081565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff9093163314926107bf9291906102e5906115a6565b906107f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b50828114610887576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f5265736f6c7665723a206e616d6520616e642076616c7565206c656e6774682060448201527f6d69736d6174636800000000000000000000000000000000000000000000000060648201526084016103a9565b60005b83811015610935576109238585838181106108ce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9050602002013584848481811061090e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906102689190611359565b8061092d816115e1565b91505061088a565b5050505050565b60008181526004602090815260409182902080548351818402810184019094528084526060939283018282801561099257602002820191906000526020600020905b81548152602001906001019080831161097e575b50505050509050919050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610a039291906102e5906115a6565b90610a3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b506000838152600460205260409020610a549083611045565b81837ffef1edfd9777499fcd47240a7d925f53dd6d43a4ec647fd5b2e6ff23036f4d3b610aaf8686600091825260036020908152604080842092845291905290205473ffffffffffffffffffffffffffffffffffffffff1690565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291861660208301520160405180910390a36000838152600360209081526040808320858452909152902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316179055505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610b9f9291906102e5906115a6565b90610bd7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060008281527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c1602052604080822054905173ffffffffffffffffffffffffffffffffffffffff9182169291841691839186917f59cff797773a13d5269a5bb23cdc636f102c95002a8305e19db9a255211cf82191a4610c58838284611078565b60008381527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8416179055505050565b60015460408051808201909152601981527f3a2063616c6c6572206973206e6f7420746865206f776e65720000000000000060208201526000805473ffffffffffffffffffffffffffffffffffffffff909316331492610d2d9291906102e5906115a6565b90610d65576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b50600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610dc060405180606001604052806021815260200161163160219139600080546102e5906115a6565b90610df8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a9919061150e565b5060025460405173ffffffffffffffffffffffffffffffffffffffff8084169216907f605c2dbf762e5f7d60a546d42e7205dcb1b011ebc62a61736a57c9089d3a435090600090a3600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60608282604051602001610e9c92919061149b565b604051602081830303815290604052905092915050565b600080610ec08484610fc1565b9150915081610ecf5750505050565b8354600090610ee09060019061155f565b9050848181548110610f1b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154858381548110610f5f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020018190555084805480610fa4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600190038181906000526020600020016000905590555050505050565b60008060005b8454811015611038578385828154811061100a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002001541415611026576001925090506106c5565b80611030816115e1565b915050610fc7565b5060009485945092505050565b60006110518383610fc1565b509050801561105f57505050565b5081546001810183556000928352602090922090910155565b604080518082019091527f457363726f77000000000000000000000000000000000000000000000000000081527f4d6f626975730000000000000000000000000000000000000000000000000000602082015273ffffffffffffffffffffffffffffffffffffffff83166110ec5750505050565b7f4d6f62697573546f6b656e0000000000000000000000000000000000000000006000527f7d9a42d98474a1d02586a0326a45710951e3684f92c0ff078081324e45c151c16020527f064210e22ad281689f46a2fdf94bd21585b7a65b5e783612e77cfcc2f38cf1535473ffffffffffffffffffffffffffffffffffffffff1680611178575050505050565b60005b60028110156112e5578281600281106111bd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002015186146111cd576112d3565b6040517f1068361f00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86811660048301528581166024830152831690631068361f90604401602060405180830381600087803b15801561123e57600080fd5b505af1158015611252573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127691906113e3565b508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16877ff61c93288e98f99c50419a21fd4a00cd44b959c239db392b7f9c01fa654b376f60405160405180910390a45b806112dd816115e1565b91505061117b565b505050505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461131157600080fd5b919050565b60008083601f840112611327578182fd5b50813567ffffffffffffffff81111561133e578182fd5b6020830191508360208260051b85010111156106c557600080fd5b60006020828403121561136a578081fd5b611373826112ed565b9392505050565b6000806000806040858703121561138f578283fd5b843567ffffffffffffffff808211156113a6578485fd5b6113b288838901611316565b909650945060208701359150808211156113ca578384fd5b506113d787828801611316565b95989497509550505050565b6000602082840312156113f4578081fd5b81518015158114611373578182fd5b600060208284031215611414578081fd5b5035919050565b6000806040838503121561142d578182fd5b8235915061143d602084016112ed565b90509250929050565b60008060408385031215611458578182fd5b50508035926020909101359150565b60008060006060848603121561147b578283fd5b8335925060208401359150611492604085016112ed565b90509250925092565b600083516114ad818460208801611576565b8351908301906114c1818360208801611576565b01949350505050565b6020808252825182820181905260009190848201906040850190845b81811015611502578351835292840192918401916001016114e6565b50909695505050505050565b602081526000825180602084015261152d816040850160208701611576565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b6000828210156115715761157161161a565b500390565b60005b83811015611591578181015183820152602001611579565b838111156115a0576000848401525b50505050565b600181811c908216806115ba57607f821691505b602082108114156115db57634e487b7160e01b600052602260045260246000fd5b50919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156116135761161361161a565b5060010190565b634e487b7160e01b600052601160045260246000fdfe3a206e6577206d616e6167657220697320746865207a65726f2061646472657373a264697066735822122006e13a7ea13ea2f1dd87efbd0ef0db0b54862a4fa672e53cc916b414f42eded964736f6c63430008040033", + "immutableReferences": {}, + "generatedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:583:82", + "statements": [ + { + "nodeType": "YulBlock", + "src": "6:3:82", + "statements": [] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "133:63:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "150:3:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "155:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "143:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "143:19:82" + }, + "nodeType": "YulExpressionStatement", + "src": "143:19:82" + }, + { + "nodeType": "YulAssignment", + "src": "171:19:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "182:3:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "187:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "178:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "178:12:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "171:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_bytes32__to_t_bytes32__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "109:3:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "114:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "125:3:82", + "type": "" + } + ], + "src": "14:182:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "256:325:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "266:22:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "280:1:82", + "type": "", + "value": "1" + }, + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "283:4:82" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "276:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "276:12:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "266:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "297:38:82", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "327:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "333:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "323:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "323:12:82" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "301:18:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "374:31:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "376:27:82", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "390:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "398:4:82", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "386:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "386:17:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "376:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "354:18:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "347:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "347:26:82" + }, + "nodeType": "YulIf", + "src": "344:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "464:111:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "485:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "492:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "497:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "488:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "488:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "478:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "478:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "478:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "529:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "532:4:82", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "522:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "522:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "522:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "557:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "560:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "550:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "550:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "550:15:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "420:18:82" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "443:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "451:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "440:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "440:14:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "417:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "417:38:82" + }, + "nodeType": "YulIf", + "src": "414:2:82" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "236:4:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "245:6:82", + "type": "" + } + ], + "src": "201:380:82" + } + ] + }, + "contents": "{\n { }\n function abi_encode_tuple_packed_t_bytes32__to_t_bytes32__nonPadded_inplace_fromStack_reversed(pos, value0) -> end\n {\n mstore(pos, value0)\n end := add(pos, 32)\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n}", + "id": 82, + "language": "Yul", + "name": "#utility.yul" + } + ], + "deployedGeneratedSources": [ + { + "ast": { + "nodeType": "YulBlock", + "src": "0:6732:82", + "statements": [ + { + "nodeType": "YulBlock", + "src": "6:3:82", + "statements": [] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "63:124:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "73:29:82", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "95:6:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "82:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "82:20:82" + }, + "variableNames": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "73:5:82" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "165:16:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "174:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "177:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "167:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "167:12:82" + }, + "nodeType": "YulExpressionStatement", + "src": "167:12:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "124:5:82" + }, + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "135:5:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "150:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "155:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "146:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "146:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "159:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "142:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "142:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "131:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "131:31:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "121:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "121:42:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "114:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "114:50:82" + }, + "nodeType": "YulIf", + "src": "111:2:82" + } + ] + }, + "name": "abi_decode_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "42:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "53:5:82", + "type": "" + } + ], + "src": "14:173:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "276:311:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "325:30:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "arrayPos", + "nodeType": "YulIdentifier", + "src": "334:8:82" + }, + { + "name": "arrayPos", + "nodeType": "YulIdentifier", + "src": "344:8:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "327:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "327:26:82" + }, + "nodeType": "YulExpressionStatement", + "src": "327:26:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "304:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "312:4:82", + "type": "", + "value": "0x1f" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "300:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "300:17:82" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "319:3:82" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "296:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "296:27:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "289:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "289:35:82" + }, + "nodeType": "YulIf", + "src": "286:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "364:30:82", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "387:6:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "374:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "374:20:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "364:6:82" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "437:30:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "arrayPos", + "nodeType": "YulIdentifier", + "src": "446:8:82" + }, + { + "name": "arrayPos", + "nodeType": "YulIdentifier", + "src": "456:8:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "439:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "439:26:82" + }, + "nodeType": "YulExpressionStatement", + "src": "439:26:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "409:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "425:2:82", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "429:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "421:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "421:10:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "433:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "417:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "417:18:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "406:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "406:30:82" + }, + "nodeType": "YulIf", + "src": "403:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "476:29:82", + "value": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "492:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "500:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "488:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "488:17:82" + }, + "variableNames": [ + { + "name": "arrayPos", + "nodeType": "YulIdentifier", + "src": "476:8:82" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "565:16:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "574:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "577:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "567:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "567:12:82" + }, + "nodeType": "YulExpressionStatement", + "src": "567:12:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "528:6:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "540:1:82", + "type": "", + "value": "5" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "543:6:82" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "536:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "536:14:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "524:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "524:27:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "553:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "520:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "520:38:82" + }, + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "560:3:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "517:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "517:47:82" + }, + "nodeType": "YulIf", + "src": "514:2:82" + } + ] + }, + "name": "abi_decode_array_address_dyn_calldata", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "239:6:82", + "type": "" + }, + { + "name": "end", + "nodeType": "YulTypedName", + "src": "247:3:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "arrayPos", + "nodeType": "YulTypedName", + "src": "255:8:82", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "265:6:82", + "type": "" + } + ], + "src": "192:395:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "662:126:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "708:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "717:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "725:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "710:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "710:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "710:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "683:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "692:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "679:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "679:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "704:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "675:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "675:32:82" + }, + "nodeType": "YulIf", + "src": "672:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "743:39:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "772:9:82" + } + ], + "functionName": { + "name": "abi_decode_address", + "nodeType": "YulIdentifier", + "src": "753:18:82" + }, + "nodeType": "YulFunctionCall", + "src": "753:29:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "743:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "628:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "639:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "651:6:82", + "type": "" + } + ], + "src": "592:196:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "950:646:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "996:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1005:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1013:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "998:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "998:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "998:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "971:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "980:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "967:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "967:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "992:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "963:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "963:32:82" + }, + "nodeType": "YulIf", + "src": "960:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1031:37:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1058:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "1045:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "1045:23:82" + }, + "variables": [ + { + "name": "offset", + "nodeType": "YulTypedName", + "src": "1035:6:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1077:28:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1095:2:82", + "type": "", + "value": "64" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1099:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "1091:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1091:10:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1103:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1087:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1087:18:82" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "1081:2:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1132:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1141:6:82" + }, + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1149:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1134:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1134:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1134:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1120:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "1128:2:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1117:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1117:14:82" + }, + "nodeType": "YulIf", + "src": "1114:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1167:96:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1235:9:82" + }, + { + "name": "offset", + "nodeType": "YulIdentifier", + "src": "1246:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1231:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1231:22:82" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1255:7:82" + } + ], + "functionName": { + "name": "abi_decode_array_address_dyn_calldata", + "nodeType": "YulIdentifier", + "src": "1193:37:82" + }, + "nodeType": "YulFunctionCall", + "src": "1193:70:82" + }, + "variables": [ + { + "name": "value0_1", + "nodeType": "YulTypedName", + "src": "1171:8:82", + "type": "" + }, + { + "name": "value1_1", + "nodeType": "YulTypedName", + "src": "1181:8:82", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1272:18:82", + "value": { + "name": "value0_1", + "nodeType": "YulIdentifier", + "src": "1282:8:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1272:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1299:18:82", + "value": { + "name": "value1_1", + "nodeType": "YulIdentifier", + "src": "1309:8:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "1299:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1326:48:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1359:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1370:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1355:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1355:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "1342:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "1342:32:82" + }, + "variables": [ + { + "name": "offset_1", + "nodeType": "YulTypedName", + "src": "1330:8:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1403:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "1412:6:82" + }, + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "1420:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1405:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1405:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1405:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "offset_1", + "nodeType": "YulIdentifier", + "src": "1389:8:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "1399:2:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "1386:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1386:16:82" + }, + "nodeType": "YulIf", + "src": "1383:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1438:98:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1506:9:82" + }, + { + "name": "offset_1", + "nodeType": "YulIdentifier", + "src": "1517:8:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "1502:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1502:24:82" + }, + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1528:7:82" + } + ], + "functionName": { + "name": "abi_decode_array_address_dyn_calldata", + "nodeType": "YulIdentifier", + "src": "1464:37:82" + }, + "nodeType": "YulFunctionCall", + "src": "1464:72:82" + }, + "variables": [ + { + "name": "value2_1", + "nodeType": "YulTypedName", + "src": "1442:8:82", + "type": "" + }, + { + "name": "value3_1", + "nodeType": "YulTypedName", + "src": "1452:8:82", + "type": "" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1545:18:82", + "value": { + "name": "value2_1", + "nodeType": "YulIdentifier", + "src": "1555:8:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "1545:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "1572:18:82", + "value": { + "name": "value3_1", + "nodeType": "YulIdentifier", + "src": "1582:8:82" + }, + "variableNames": [ + { + "name": "value3", + "nodeType": "YulIdentifier", + "src": "1572:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_array$_t_bytes32_$dyn_calldata_ptrt_array$_t_address_$dyn_calldata_ptr", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "892:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "903:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "915:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "923:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "931:6:82", + "type": "" + }, + { + "name": "value3", + "nodeType": "YulTypedName", + "src": "939:6:82", + "type": "" + } + ], + "src": "793:803:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1679:219:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "1725:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1734:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1742:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1727:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1727:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1727:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1700:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1709:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1696:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1696:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "1721:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1692:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1692:32:82" + }, + "nodeType": "YulIf", + "src": "1689:2:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "1760:29:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "1779:9:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "1773:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "1773:16:82" + }, + "variables": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "1764:5:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1842:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1851:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1859:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "1844:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1844:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "1844:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1811:5:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1832:5:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "1825:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1825:13:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "1818:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1818:21:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "1808:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "1808:32:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "1801:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "1801:40:82" + }, + "nodeType": "YulIf", + "src": "1798:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "1877:15:82", + "value": { + "name": "value", + "nodeType": "YulIdentifier", + "src": "1887:5:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "1877:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bool_fromMemory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1645:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1656:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1668:6:82", + "type": "" + } + ], + "src": "1601:297:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "1973:120:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2019:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2028:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2036:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2021:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2021:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2021:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "1994:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2003:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "1990:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1990:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2015:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "1986:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "1986:32:82" + }, + "nodeType": "YulIf", + "src": "1983:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2054:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2077:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2064:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2064:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2054:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "1939:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "1950:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "1962:6:82", + "type": "" + } + ], + "src": "1903:190:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2185:177:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2231:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2240:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2248:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2233:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2233:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2233:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2206:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2215:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2202:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2202:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2227:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2198:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2198:32:82" + }, + "nodeType": "YulIf", + "src": "2195:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2266:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2289:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2276:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2276:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2266:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2308:48:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2341:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2352:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2337:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2337:18:82" + } + ], + "functionName": { + "name": "abi_decode_address", + "nodeType": "YulIdentifier", + "src": "2318:18:82" + }, + "nodeType": "YulFunctionCall", + "src": "2318:38:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "2308:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2143:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2154:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2166:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2174:6:82", + "type": "" + } + ], + "src": "2098:264:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2454:171:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2500:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2509:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2517:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2502:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2502:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2502:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2475:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2484:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2471:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2471:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2496:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2467:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2467:32:82" + }, + "nodeType": "YulIf", + "src": "2464:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2535:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2558:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2545:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2545:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2535:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2577:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2604:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2615:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2600:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2600:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2587:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2587:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "2577:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_bytes32", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2412:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2423:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2435:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2443:6:82", + "type": "" + } + ], + "src": "2367:258:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "2734:228:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "2780:26:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2789:6:82" + }, + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2797:6:82" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "2782:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "2782:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "2782:22:82" + } + ] + }, + "condition": { + "arguments": [ + { + "arguments": [ + { + "name": "dataEnd", + "nodeType": "YulIdentifier", + "src": "2755:7:82" + }, + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2764:9:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "2751:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2751:23:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2776:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "slt", + "nodeType": "YulIdentifier", + "src": "2747:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2747:32:82" + }, + "nodeType": "YulIf", + "src": "2744:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "2815:33:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2838:9:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2825:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2825:23:82" + }, + "variableNames": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "2815:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2857:42:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2884:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2895:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2880:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2880:18:82" + } + ], + "functionName": { + "name": "calldataload", + "nodeType": "YulIdentifier", + "src": "2867:12:82" + }, + "nodeType": "YulFunctionCall", + "src": "2867:32:82" + }, + "variableNames": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "2857:6:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "2908:48:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "2941:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "2952:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "2937:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "2937:18:82" + } + ], + "functionName": { + "name": "abi_decode_address", + "nodeType": "YulIdentifier", + "src": "2918:18:82" + }, + "nodeType": "YulFunctionCall", + "src": "2918:38:82" + }, + "variableNames": [ + { + "name": "value2", + "nodeType": "YulIdentifier", + "src": "2908:6:82" + } + ] + } + ] + }, + "name": "abi_decode_tuple_t_bytes32t_bytes32t_address", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "2684:9:82", + "type": "" + }, + { + "name": "dataEnd", + "nodeType": "YulTypedName", + "src": "2695:7:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "2707:6:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "2715:6:82", + "type": "" + }, + { + "name": "value2", + "nodeType": "YulTypedName", + "src": "2723:6:82", + "type": "" + } + ], + "src": "2630:332:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3154:283:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "3164:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3184:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3178:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3178:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "3168:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3226:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3234:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3222:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3222:17:82" + }, + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3241:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3246:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "3200:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "3200:53:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3200:53:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3262:29:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "3279:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "3284:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3275:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3275:16:82" + }, + "variables": [ + { + "name": "end_1", + "nodeType": "YulTypedName", + "src": "3266:5:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3300:29:82", + "value": { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "3322:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "3316:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "3316:13:82" + }, + "variables": [ + { + "name": "length_1", + "nodeType": "YulTypedName", + "src": "3304:8:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "3364:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3372:4:82", + "type": "", + "value": "0x20" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3360:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3360:17:82" + }, + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "3379:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "3386:8:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "3338:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "3338:57:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3338:57:82" + }, + { + "nodeType": "YulAssignment", + "src": "3404:27:82", + "value": { + "arguments": [ + { + "name": "end_1", + "nodeType": "YulIdentifier", + "src": "3415:5:82" + }, + { + "name": "length_1", + "nodeType": "YulIdentifier", + "src": "3422:8:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3411:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3411:20:82" + }, + "variableNames": [ + { + "name": "end", + "nodeType": "YulIdentifier", + "src": "3404:3:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr__nonPadded_inplace_fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "3122:3:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "3127:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3135:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "end", + "nodeType": "YulTypedName", + "src": "3146:3:82", + "type": "" + } + ], + "src": "2967:470:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3543:102:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3553:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3565:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3576:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3561:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3561:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "3553:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3595:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3610:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3626:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3631:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "3622:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3622:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3635:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3618:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3618:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "3606:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3606:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3588:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3588:51:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3588:51:82" + } + ] + }, + "name": "abi_encode_tuple_t_address__to_t_address__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3512:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3523:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "3534:4:82", + "type": "" + } + ], + "src": "3442:203:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "3779:175:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "3789:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3801:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3812:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3797:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3797:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "3789:4:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "3824:29:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3842:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3847:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "3838:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3838:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3851:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "3834:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3834:19:82" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "3828:2:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3869:9:82" + }, + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "3884:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "3892:2:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "3880:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3880:15:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3862:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3862:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3862:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "3916:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "3927:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "3912:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3912:18:82" + }, + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "3936:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "3944:2:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "3932:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "3932:15:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "3905:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "3905:43:82" + }, + "nodeType": "YulExpressionStatement", + "src": "3905:43:82" + } + ] + }, + "name": "abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "3740:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "3751:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "3759:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "3770:4:82", + "type": "" + } + ], + "src": "3650:304:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4110:484:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "4120:12:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4130:2:82", + "type": "", + "value": "32" + }, + "variables": [ + { + "name": "_1", + "nodeType": "YulTypedName", + "src": "4124:2:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4141:32:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4159:9:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "4170:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4155:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4155:18:82" + }, + "variables": [ + { + "name": "tail_1", + "nodeType": "YulTypedName", + "src": "4145:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4189:9:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "4200:2:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4182:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4182:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4182:21:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4212:17:82", + "value": { + "name": "tail_1", + "nodeType": "YulIdentifier", + "src": "4223:6:82" + }, + "variables": [ + { + "name": "pos", + "nodeType": "YulTypedName", + "src": "4216:3:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4238:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4258:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4252:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4252:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "4242:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "tail_1", + "nodeType": "YulIdentifier", + "src": "4281:6:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4289:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4274:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4274:22:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4274:22:82" + }, + { + "nodeType": "YulAssignment", + "src": "4305:25:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4316:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4327:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4312:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4312:18:82" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4305:3:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4339:29:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4357:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "4365:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4353:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4353:15:82" + }, + "variables": [ + { + "name": "srcPtr", + "nodeType": "YulTypedName", + "src": "4343:6:82", + "type": "" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "4377:13:82", + "value": { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "4386:4:82" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "4381:1:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4448:120:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4469:3:82" + }, + { + "arguments": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "4480:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "4474:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "4474:13:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4462:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4462:26:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4462:26:82" + }, + { + "nodeType": "YulAssignment", + "src": "4501:19:82", + "value": { + "arguments": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4512:3:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "4517:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4508:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4508:12:82" + }, + "variableNames": [ + { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4501:3:82" + } + ] + }, + { + "nodeType": "YulAssignment", + "src": "4533:25:82", + "value": { + "arguments": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "4547:6:82" + }, + { + "name": "_1", + "nodeType": "YulIdentifier", + "src": "4555:2:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4543:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4543:15:82" + }, + "variableNames": [ + { + "name": "srcPtr", + "nodeType": "YulIdentifier", + "src": "4533:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4410:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "4413:6:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "4407:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "4407:13:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "4421:18:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4423:14:82", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4432:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4435:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4428:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4428:9:82" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "4423:1:82" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "4403:3:82", + "statements": [] + }, + "src": "4399:169:82" + }, + { + "nodeType": "YulAssignment", + "src": "4577:11:82", + "value": { + "name": "pos", + "nodeType": "YulIdentifier", + "src": "4585:3:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "4577:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_array$_t_bytes32_$dyn_memory_ptr__to_t_array$_t_bytes32_$dyn_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4079:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4090:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "4101:4:82", + "type": "" + } + ], + "src": "3959:635:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "4722:161:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "4732:26:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4744:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4755:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4740:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4740:18:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "4732:4:82" + } + ] + }, + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4774:9:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "4799:6:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "4792:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4792:14:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "4785:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4785:22:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4767:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4767:41:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4767:41:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "4828:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4839:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "4824:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4824:18:82" + }, + { + "arguments": [ + { + "name": "value1", + "nodeType": "YulIdentifier", + "src": "4848:6:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4864:3:82", + "type": "", + "value": "160" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4869:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "4860:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4860:11:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "4873:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "4856:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4856:19:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "4844:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "4844:32:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "4817:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "4817:60:82" + }, + "nodeType": "YulExpressionStatement", + "src": "4817:60:82" + } + ] + }, + "name": "abi_encode_tuple_t_bool_t_address__to_t_bool_t_address__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4683:9:82", + "type": "" + }, + { + "name": "value1", + "nodeType": "YulTypedName", + "src": "4694:6:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4702:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "4713:4:82", + "type": "" + } + ], + "src": "4599:284:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5009:262:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5026:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5037:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5019:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5019:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5019:21:82" + }, + { + "nodeType": "YulVariableDeclaration", + "src": "5049:27:82", + "value": { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5069:6:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5063:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5063:13:82" + }, + "variables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "5053:6:82", + "type": "" + } + ] + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5096:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5107:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5092:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5092:18:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "5112:6:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5085:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5085:34:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5085:34:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "value0", + "nodeType": "YulIdentifier", + "src": "5154:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5162:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5150:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5150:15:82" + }, + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5171:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5182:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5167:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5167:18:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "5187:6:82" + } + ], + "functionName": { + "name": "copy_memory_to_memory", + "nodeType": "YulIdentifier", + "src": "5128:21:82" + }, + "nodeType": "YulFunctionCall", + "src": "5128:66:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5128:66:82" + }, + { + "nodeType": "YulAssignment", + "src": "5203:62:82", + "value": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5219:9:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "5238:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5246:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5234:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5234:15:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5255:2:82", + "type": "", + "value": "31" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "5251:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5251:7:82" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "5230:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5230:29:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5215:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5215:45:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5262:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5211:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5211:54:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "5203:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "4978:9:82", + "type": "" + }, + { + "name": "value0", + "nodeType": "YulTypedName", + "src": "4989:6:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "5000:4:82", + "type": "" + } + ], + "src": "4888:383:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5450:230:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5467:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5478:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5460:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5460:21:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5460:21:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5501:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5512:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5497:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5497:18:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5517:2:82", + "type": "", + "value": "40" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5490:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5490:30:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5490:30:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5540:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5551:2:82", + "type": "", + "value": "64" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5536:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5536:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "5556:34:82", + "type": "", + "value": "Resolver: name and value length " + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5529:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5529:62:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5529:62:82" + }, + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5611:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5622:2:82", + "type": "", + "value": "96" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5607:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5607:18:82" + }, + { + "kind": "string", + "nodeType": "YulLiteral", + "src": "5627:10:82", + "type": "", + "value": "mismatch" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5600:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5600:38:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5600:38:82" + }, + { + "nodeType": "YulAssignment", + "src": "5647:27:82", + "value": { + "arguments": [ + { + "name": "headStart", + "nodeType": "YulIdentifier", + "src": "5659:9:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5670:3:82", + "type": "", + "value": "128" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5655:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5655:19:82" + }, + "variableNames": [ + { + "name": "tail", + "nodeType": "YulIdentifier", + "src": "5647:4:82" + } + ] + } + ] + }, + "name": "abi_encode_tuple_t_stringliteral_00927e7e4f2ef158bfc82b3ff72887cf4310d19fab02004d34e5a1def702cfe4__to_t_string_memory_ptr__fromStack_reversed", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "headStart", + "nodeType": "YulTypedName", + "src": "5427:9:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "tail", + "nodeType": "YulTypedName", + "src": "5441:4:82", + "type": "" + } + ], + "src": "5276:404:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5734:76:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "5756:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "5758:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "5758:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5758:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "5750:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "5753:1:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "5747:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "5747:8:82" + }, + "nodeType": "YulIf", + "src": "5744:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "5787:17:82", + "value": { + "arguments": [ + { + "name": "x", + "nodeType": "YulIdentifier", + "src": "5799:1:82" + }, + { + "name": "y", + "nodeType": "YulIdentifier", + "src": "5802:1:82" + } + ], + "functionName": { + "name": "sub", + "nodeType": "YulIdentifier", + "src": "5795:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5795:9:82" + }, + "variableNames": [ + { + "name": "diff", + "nodeType": "YulIdentifier", + "src": "5787:4:82" + } + ] + } + ] + }, + "name": "checked_sub_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "x", + "nodeType": "YulTypedName", + "src": "5716:1:82", + "type": "" + }, + { + "name": "y", + "nodeType": "YulTypedName", + "src": "5719:1:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "diff", + "nodeType": "YulTypedName", + "src": "5725:4:82", + "type": "" + } + ], + "src": "5685:125:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5868:205:82", + "statements": [ + { + "nodeType": "YulVariableDeclaration", + "src": "5878:10:82", + "value": { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5887:1:82", + "type": "", + "value": "0" + }, + "variables": [ + { + "name": "i", + "nodeType": "YulTypedName", + "src": "5882:1:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "5947:63:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "5972:3:82" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "5977:1:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5968:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5968:11:82" + }, + { + "arguments": [ + { + "arguments": [ + { + "name": "src", + "nodeType": "YulIdentifier", + "src": "5991:3:82" + }, + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "5996:1:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5987:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5987:11:82" + } + ], + "functionName": { + "name": "mload", + "nodeType": "YulIdentifier", + "src": "5981:5:82" + }, + "nodeType": "YulFunctionCall", + "src": "5981:18:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "5961:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "5961:39:82" + }, + "nodeType": "YulExpressionStatement", + "src": "5961:39:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "5908:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "5911:6:82" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "5905:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "5905:13:82" + }, + "nodeType": "YulForLoop", + "post": { + "nodeType": "YulBlock", + "src": "5919:19:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "5921:15:82", + "value": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "5930:1:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "5933:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "5926:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "5926:10:82" + }, + "variableNames": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "5921:1:82" + } + ] + } + ] + }, + "pre": { + "nodeType": "YulBlock", + "src": "5901:3:82", + "statements": [] + }, + "src": "5897:113:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6036:31:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "arguments": [ + { + "name": "dst", + "nodeType": "YulIdentifier", + "src": "6049:3:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6054:6:82" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6045:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6045:16:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6063:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6038:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6038:27:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6038:27:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "i", + "nodeType": "YulIdentifier", + "src": "6025:1:82" + }, + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6028:6:82" + } + ], + "functionName": { + "name": "gt", + "nodeType": "YulIdentifier", + "src": "6022:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "6022:13:82" + }, + "nodeType": "YulIf", + "src": "6019:2:82" + } + ] + }, + "name": "copy_memory_to_memory", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "src", + "nodeType": "YulTypedName", + "src": "5846:3:82", + "type": "" + }, + { + "name": "dst", + "nodeType": "YulTypedName", + "src": "5851:3:82", + "type": "" + }, + { + "name": "length", + "nodeType": "YulTypedName", + "src": "5856:6:82", + "type": "" + } + ], + "src": "5815:258:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6133:325:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6143:22:82", + "value": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6157:1:82", + "type": "", + "value": "1" + }, + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "6160:4:82" + } + ], + "functionName": { + "name": "shr", + "nodeType": "YulIdentifier", + "src": "6153:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6153:12:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6143:6:82" + } + ] + }, + { + "nodeType": "YulVariableDeclaration", + "src": "6174:38:82", + "value": { + "arguments": [ + { + "name": "data", + "nodeType": "YulIdentifier", + "src": "6204:4:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6210:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "6200:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6200:12:82" + }, + "variables": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulTypedName", + "src": "6178:18:82", + "type": "" + } + ] + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6251:31:82", + "statements": [ + { + "nodeType": "YulAssignment", + "src": "6253:27:82", + "value": { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6267:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6275:4:82", + "type": "", + "value": "0x7f" + } + ], + "functionName": { + "name": "and", + "nodeType": "YulIdentifier", + "src": "6263:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6263:17:82" + }, + "variableNames": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6253:6:82" + } + ] + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "6231:18:82" + } + ], + "functionName": { + "name": "iszero", + "nodeType": "YulIdentifier", + "src": "6224:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6224:26:82" + }, + "nodeType": "YulIf", + "src": "6221:2:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6341:111:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6362:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6369:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6374:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "6365:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6365:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6355:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6355:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6355:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6406:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6409:4:82", + "type": "", + "value": "0x22" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6399:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6399:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6399:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6434:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6437:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "6427:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6427:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6427:15:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "outOfPlaceEncoding", + "nodeType": "YulIdentifier", + "src": "6297:18:82" + }, + { + "arguments": [ + { + "name": "length", + "nodeType": "YulIdentifier", + "src": "6320:6:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6328:2:82", + "type": "", + "value": "32" + } + ], + "functionName": { + "name": "lt", + "nodeType": "YulIdentifier", + "src": "6317:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "6317:14:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "6294:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "6294:38:82" + }, + "nodeType": "YulIf", + "src": "6291:2:82" + } + ] + }, + "name": "extract_byte_array_length", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "data", + "nodeType": "YulTypedName", + "src": "6113:4:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "length", + "nodeType": "YulTypedName", + "src": "6122:6:82", + "type": "" + } + ], + "src": "6078:380:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6510:88:82", + "statements": [ + { + "body": { + "nodeType": "YulBlock", + "src": "6541:22:82", + "statements": [ + { + "expression": { + "arguments": [], + "functionName": { + "name": "panic_error_0x11", + "nodeType": "YulIdentifier", + "src": "6543:16:82" + }, + "nodeType": "YulFunctionCall", + "src": "6543:18:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6543:18:82" + } + ] + }, + "condition": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "6526:5:82" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6537:1:82", + "type": "", + "value": "0" + } + ], + "functionName": { + "name": "not", + "nodeType": "YulIdentifier", + "src": "6533:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6533:6:82" + } + ], + "functionName": { + "name": "eq", + "nodeType": "YulIdentifier", + "src": "6523:2:82" + }, + "nodeType": "YulFunctionCall", + "src": "6523:17:82" + }, + "nodeType": "YulIf", + "src": "6520:2:82" + }, + { + "nodeType": "YulAssignment", + "src": "6572:20:82", + "value": { + "arguments": [ + { + "name": "value", + "nodeType": "YulIdentifier", + "src": "6583:5:82" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6590:1:82", + "type": "", + "value": "1" + } + ], + "functionName": { + "name": "add", + "nodeType": "YulIdentifier", + "src": "6579:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6579:13:82" + }, + "variableNames": [ + { + "name": "ret", + "nodeType": "YulIdentifier", + "src": "6572:3:82" + } + ] + } + ] + }, + "name": "increment_t_uint256", + "nodeType": "YulFunctionDefinition", + "parameters": [ + { + "name": "value", + "nodeType": "YulTypedName", + "src": "6492:5:82", + "type": "" + } + ], + "returnVariables": [ + { + "name": "ret", + "nodeType": "YulTypedName", + "src": "6502:3:82", + "type": "" + } + ], + "src": "6463:135:82" + }, + { + "body": { + "nodeType": "YulBlock", + "src": "6635:95:82", + "statements": [ + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6652:1:82", + "type": "", + "value": "0" + }, + { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6659:3:82", + "type": "", + "value": "224" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6664:10:82", + "type": "", + "value": "0x4e487b71" + } + ], + "functionName": { + "name": "shl", + "nodeType": "YulIdentifier", + "src": "6655:3:82" + }, + "nodeType": "YulFunctionCall", + "src": "6655:20:82" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6645:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6645:31:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6645:31:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6692:1:82", + "type": "", + "value": "4" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6695:4:82", + "type": "", + "value": "0x11" + } + ], + "functionName": { + "name": "mstore", + "nodeType": "YulIdentifier", + "src": "6685:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6685:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6685:15:82" + }, + { + "expression": { + "arguments": [ + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6716:1:82", + "type": "", + "value": "0" + }, + { + "kind": "number", + "nodeType": "YulLiteral", + "src": "6719:4:82", + "type": "", + "value": "0x24" + } + ], + "functionName": { + "name": "revert", + "nodeType": "YulIdentifier", + "src": "6709:6:82" + }, + "nodeType": "YulFunctionCall", + "src": "6709:15:82" + }, + "nodeType": "YulExpressionStatement", + "src": "6709:15:82" + } + ] + }, + "name": "panic_error_0x11", + "nodeType": "YulFunctionDefinition", + "src": "6603:127:82" + } + ] + }, + "contents": "{\n { }\n function abi_decode_address(offset) -> value\n {\n value := calldataload(offset)\n if iszero(eq(value, and(value, sub(shl(160, 1), 1)))) { revert(0, 0) }\n }\n function abi_decode_array_address_dyn_calldata(offset, end) -> arrayPos, length\n {\n if iszero(slt(add(offset, 0x1f), end)) { revert(arrayPos, arrayPos) }\n length := calldataload(offset)\n if gt(length, sub(shl(64, 1), 1)) { revert(arrayPos, arrayPos) }\n arrayPos := add(offset, 0x20)\n if gt(add(add(offset, shl(5, length)), 0x20), end) { revert(0, 0) }\n }\n function abi_decode_tuple_t_address(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := abi_decode_address(headStart)\n }\n function abi_decode_tuple_t_array$_t_bytes32_$dyn_calldata_ptrt_array$_t_address_$dyn_calldata_ptr(headStart, dataEnd) -> value0, value1, value2, value3\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value1, value1) }\n let offset := calldataload(headStart)\n let _1 := sub(shl(64, 1), 1)\n if gt(offset, _1) { revert(value1, value1) }\n let value0_1, value1_1 := abi_decode_array_address_dyn_calldata(add(headStart, offset), dataEnd)\n value0 := value0_1\n value1 := value1_1\n let offset_1 := calldataload(add(headStart, 32))\n if gt(offset_1, _1) { revert(value2, value2) }\n let value2_1, value3_1 := abi_decode_array_address_dyn_calldata(add(headStart, offset_1), dataEnd)\n value2 := value2_1\n value3 := value3_1\n }\n function abi_decode_tuple_t_bool_fromMemory(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n let value := mload(headStart)\n if iszero(eq(value, iszero(iszero(value)))) { revert(value0, value0) }\n value0 := value\n }\n function abi_decode_tuple_t_bytes32(headStart, dataEnd) -> value0\n {\n if slt(sub(dataEnd, headStart), 32) { revert(value0, value0) }\n value0 := calldataload(headStart)\n }\n function abi_decode_tuple_t_bytes32t_address(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := abi_decode_address(add(headStart, 32))\n }\n function abi_decode_tuple_t_bytes32t_bytes32(headStart, dataEnd) -> value0, value1\n {\n if slt(sub(dataEnd, headStart), 64) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n }\n function abi_decode_tuple_t_bytes32t_bytes32t_address(headStart, dataEnd) -> value0, value1, value2\n {\n if slt(sub(dataEnd, headStart), 96) { revert(value0, value0) }\n value0 := calldataload(headStart)\n value1 := calldataload(add(headStart, 32))\n value2 := abi_decode_address(add(headStart, 64))\n }\n function abi_encode_tuple_packed_t_string_memory_ptr_t_string_memory_ptr__to_t_string_memory_ptr_t_string_memory_ptr__nonPadded_inplace_fromStack_reversed(pos, value1, value0) -> end\n {\n let length := mload(value0)\n copy_memory_to_memory(add(value0, 0x20), pos, length)\n let end_1 := add(pos, length)\n let length_1 := mload(value1)\n copy_memory_to_memory(add(value1, 0x20), end_1, length_1)\n end := add(end_1, length_1)\n }\n function abi_encode_tuple_t_address__to_t_address__fromStack_reversed(headStart, value0) -> tail\n {\n tail := add(headStart, 32)\n mstore(headStart, and(value0, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_address_t_address__to_t_address_t_address__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n let _1 := sub(shl(160, 1), 1)\n mstore(headStart, and(value0, _1))\n mstore(add(headStart, 32), and(value1, _1))\n }\n function abi_encode_tuple_t_array$_t_bytes32_$dyn_memory_ptr__to_t_array$_t_bytes32_$dyn_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n let _1 := 32\n let tail_1 := add(headStart, _1)\n mstore(headStart, _1)\n let pos := tail_1\n let length := mload(value0)\n mstore(tail_1, length)\n pos := add(headStart, 64)\n let srcPtr := add(value0, _1)\n let i := tail\n for { } lt(i, length) { i := add(i, 1) }\n {\n mstore(pos, mload(srcPtr))\n pos := add(pos, _1)\n srcPtr := add(srcPtr, _1)\n }\n tail := pos\n }\n function abi_encode_tuple_t_bool_t_address__to_t_bool_t_address__fromStack_reversed(headStart, value1, value0) -> tail\n {\n tail := add(headStart, 64)\n mstore(headStart, iszero(iszero(value0)))\n mstore(add(headStart, 32), and(value1, sub(shl(160, 1), 1)))\n }\n function abi_encode_tuple_t_string_memory_ptr__to_t_string_memory_ptr__fromStack_reversed(headStart, value0) -> tail\n {\n mstore(headStart, 32)\n let length := mload(value0)\n mstore(add(headStart, 32), length)\n copy_memory_to_memory(add(value0, 32), add(headStart, 64), length)\n tail := add(add(headStart, and(add(length, 31), not(31))), 64)\n }\n function abi_encode_tuple_t_stringliteral_00927e7e4f2ef158bfc82b3ff72887cf4310d19fab02004d34e5a1def702cfe4__to_t_string_memory_ptr__fromStack_reversed(headStart) -> tail\n {\n mstore(headStart, 32)\n mstore(add(headStart, 32), 40)\n mstore(add(headStart, 64), \"Resolver: name and value length \")\n mstore(add(headStart, 96), \"mismatch\")\n tail := add(headStart, 128)\n }\n function checked_sub_t_uint256(x, y) -> diff\n {\n if lt(x, y) { panic_error_0x11() }\n diff := sub(x, y)\n }\n function copy_memory_to_memory(src, dst, length)\n {\n let i := 0\n for { } lt(i, length) { i := add(i, 32) }\n {\n mstore(add(dst, i), mload(add(src, i)))\n }\n if gt(i, length) { mstore(add(dst, length), 0) }\n }\n function extract_byte_array_length(data) -> length\n {\n length := shr(1, data)\n let outOfPlaceEncoding := and(data, 1)\n if iszero(outOfPlaceEncoding) { length := and(length, 0x7f) }\n if eq(outOfPlaceEncoding, lt(length, 32))\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x22)\n revert(0, 0x24)\n }\n }\n function increment_t_uint256(value) -> ret\n {\n if eq(value, not(0)) { panic_error_0x11() }\n ret := add(value, 1)\n }\n function panic_error_0x11()\n {\n mstore(0, shl(224, 0x4e487b71))\n mstore(4, 0x11)\n revert(0, 0x24)\n }\n}", + "id": 82, + "language": "Yul", + "name": "#utility.yul" + } + ], + "sourceMap": "202:2556:8:-:0;;;299:65;;;;;;;;;-1:-1:-1;347:5:21;:18;;355:10;-1:-1:-1;;;;;;347:18:21;;;;;;;;375:7;:20;;;;;;;;;;323:34:8;-1:-1:-1;;;323:15:8;:34::i;:::-;202:2556;;1389:128:21;1478:31;;;;;;;143:19:82;;;1478:31:21;;;;;;;;;178:12:82;;;1478:31:21;;;1456:54;;;;:12;;:54;;;:::i;:::-;;1389:128;:::o;202:2556:8:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;202:2556:8;;;-1:-1:-1;202:2556:8;:::i;:::-;;;:::o;:::-;;;;;;;;;;;;;;;201:380:82;280:1;276:12;;;;323;;;344:2;;398:4;390:6;386:17;376:27;;344:2;451;443:6;440:14;420:18;417:38;414:2;;;497:10;492:3;488:20;485:1;478:31;532:4;529:1;522:15;560:4;557:1;550:15;414:2;;256:325;;;:::o;:::-;202:2556:8;;;;;;", + "deployedSourceMap": "202:2556:8:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;913:219:21;;;;;;:::i;:::-;;:::i;:::-;;725:289:8;;;;;;:::i;:::-;;:::i;1992:120::-;;;;;;:::i;:::-;2058:7;504:22:65;;;:17;;:22;:17;:22;;;;;;1992:120:8;;;;3618:19:82;3606:32;;;3588:51;;3576:2;3561:18;1992:120:8;;;;;;;;294:22:21;;;;;;;;;1020:243:8;;;;;;:::i;:::-;;:::i;:::-;;;;4792:14:82;;4785:22;4767:41;;4856:19;4844:32;;;4839:2;4824:18;;4817:60;4740:18;1020:243:8;4722:161:82;227:35:21;;;:::i;:::-;;;;;;;:::i;268:20::-;;;;;;;;;1405:295:8;;;;;;:::i;:::-;;:::i;1269:130::-;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;370:349::-;;;;;;:::i;:::-;;:::i;1706:280::-;;;;;;:::i;:::-;;:::i;1138:245:21:-;;;;;;:::i;:::-;;:::i;913:219::-;461:5;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:48;;;;:::i;:::-;439:78;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;1000:1:::1;982:20;;:6;:20;;;;1004:54;;;;;;;;;;;;;;;;;::::0;:12:::1;:19;;;;;:::i;:54::-;974:85;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;1087:5:21::1;::::0;1074:27:::1;::::0;::::1;::::0;;::::1;::::0;1087:5:::1;::::0;1074:27:::1;::::0;1087:5:::1;::::0;1074:27:::1;1111:5;:14:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;913:219::o;725:289:8:-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;827:18:8::1;::::0;;;:7:::1;:18;::::0;;;;813:44:::1;::::0;847:9;813:13:::1;:44::i;:::-;896:9;885;872:85;907:37;923:9;934;888:7:65::0;914:13;;;:8;:13;;;;;;;;:20;;;;;;;;;;;;812:129;907:37:8::1;872:85;::::0;;3834:19:82;3880:15;;;3862:34;;954:1:8::1;3927:2:82::0;3912:18;;3905:43;3797:18;872:85:8::1;;;;;;;779:13:65::0;;;;:8;:13;;;;;;;;:20;;;;;;;;772:27;;;;;;725:289:8:o;1020:243::-;1108:4;1163:18;;;:7;:18;;;;;1108:4;;;;1150:43;;1183:9;1150:12;:43::i;:::-;-1:-1:-1;888:7:65;914:13;;;:8;:13;;;;;;;;:20;;;;;;;;;1133:60:8;;-1:-1:-1;914:20:65;;;-1:-1:-1;;1020:243:8;;;;;;:::o;227:35:21:-;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o;1405:295:8:-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;1516:27:8;;::::1;1508:80;;;::::0;::::1;::::0;;5478:2:82;1508:80:8::1;::::0;::::1;5460:21:82::0;5517:2;5497:18;;;5490:30;5556:34;5536:18;;;5529:62;5627:10;5607:18;;;5600:38;5655:19;;1508:80:8::1;5450:230:82::0;1508:80:8::1;1603:9;1598:96;1618:15:::0;;::::1;1598:96;;;1654:29;1665:4;;1670:1;1665:7;;;;;;;;;;;;;;;;;;;;;1674:5;;1680:1;1674:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;1654:29::-;1635:3:::0;::::1;::::0;::::1;:::i;:::-;;;;1598:96;;;;1405:295:::0;;;;:::o;1269:130::-;1374:18;;;;:7;:18;;;;;;;;;1367:25;;;;;;;;;;;;;;;;;1339:16;;1367:25;;;1374:18;1367:25;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1269:130;;;:::o;370:349::-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;519:18:8::1;::::0;;;:7:::1;:18;::::0;;;;507:42:::1;::::0;539:9;507:11:::1;:42::i;:::-;588:9;577;564:87;599:37;615:9;626;888:7:65::0;914:13;;;:8;:13;;;;;;;;:20;;;;;;;;;;;;812:129;599:37:8::1;564:87;::::0;;3834:19:82;3880:15;;;3862:34;;3932:15;;;3927:2;3912:18;;3905:43;3797:18;564:87:8::1;;;;;;;656:13:65::0;;;;:8;:13;;;;;;;;:20;;;;;;;;:28;;;;;;;;;;370:349:8;;;:::o;1706:280::-;461:5:21;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;1782:21:8::1;504:22:65::0;;;:17;;:22;:17;:22;;;;1842:42:8;;504:22:65;;;;;1842:42:8;;::::1;::::0;504:22:65;;;;1842:42:8::1;::::0;::::1;1894:47;1914:4;1920:13;1935:5;1894:19;:47::i;:::-;272:17:65::0;:22;;;:17;;:22;:17;:22;;:30;;;;;;;;;;370:349:8;;;:::o;1138:245:21:-;461:5;;468:48;;;;;;;;;;;;;;;;;-1:-1:-1;468:19:21;;461:5;;;;447:10;:19;;468:48;;;-1:-1:-1;468:19:21;;;:::i;:48::-;439:78;;;;;;;;;;;;;;:::i;:::-;;1239:1:::1;1219:22;;:8;:22;;;;1243:56;;;;;;;;;;;;;;;;;;:12;:19;;;;;:::i;:56::-;1211:89;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1::0;1330:7:21::1;::::0;1315:33:::1;::::0;::::1;::::0;;::::1;::::0;1330:7:::1;::::0;1315:33:::1;::::0;1330:7:::1;::::0;1315:33:::1;1358:7;:18:::0;;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;1138:245::o;261:142:62:-;334:13;390:1;393;373:22;;;;;;;;;:::i;:::-;;;;;;;;;;;;;359:37;;261:142;;;;:::o;260:253:58:-;338:10;350:9;363:21;369:5;376:7;363:5;:21::i;:::-;337:47;;;;399:5;394:19;;406:7;;260:253;;:::o;394:19::-;437:12;;422;;437:16;;452:1;;437:16;:::i;:::-;422:31;;474:5;480:4;474:11;;;;;;;;;;;;;;;;;;;;;;;;463:5;469:1;463:8;;;;;;;;;;;;;;;;;;;;;;;:22;;;;495:5;:11;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;260:253;;;;;:::o;519:247::-;599:4;605:7;629:9;624:109;648:12;;644:16;;624:109;;;697:7;685:5;691:1;685:8;;;;;;;;;;;;;;;;;;;;;;;;:19;681:41;;;714:4;;-1:-1:-1;720:1:58;-1:-1:-1;706:16:58;;681:41;662:3;;;;:::i;:::-;;;;624:109;;;-1:-1:-1;750:5:58;;;;-1:-1:-1;519:247:58;-1:-1:-1;;;519:247:58:o;78:176::-;154:10;170:21;176:5;183:7;170:5;:21::i;:::-;153:38;;;205:5;201:18;;;212:7;78:176;;:::o;201:18::-;-1:-1:-1;228:19:58;;;;;;;-1:-1:-1;228:19:58;;;;;;;;;;;78:176::o;2118:638:8:-;2254:63;;;;;;;;;2285:15;2254:63;;2301:15;2254:63;;;;2331:29;;;2327:42;;2362:7;2118:638;;;:::o;2327:42::-;2416:21;2378:19;504:22:65;:17;;:22;;;;;;2448:38:8;;2479:7;;2118:638;;;:::o;2448:38::-;2500:9;2495:255;2519:16;2515:1;:20;2495:255;;;2568:9;2578:1;2568:12;;;;;;;;;;;;;;;;;;;2560:4;:20;2556:34;;2582:8;;2556:34;2604:62;;;;;:33;3880:15:82;;;2604:62:8;;;3862:34:82;3932:15;;;3912:18;;;3905:43;2604:33:8;;;;;3797:18:82;;2604:62:8;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;2728:10;2685:54;;2711:15;2685:54;;2705:4;2685:54;;;;;;;;;;2495:255;2537:3;;;;:::i;:::-;;;;2495:255;;;;2118:638;;;;;:::o;14:173:82:-;82:20;;142:19;131:31;;121:42;;111:2;;177:1;174;167:12;111:2;63:124;;;:::o;192:395::-;255:8;265:6;319:3;312:4;304:6;300:17;296:27;286:2;;344:8;334;327:26;286:2;-1:-1:-1;374:20:82;;417:18;406:30;;403:2;;;456:8;446;439:26;403:2;500:4;492:6;488:17;476:29;;560:3;553:4;543:6;540:1;536:14;528:6;524:27;520:38;517:47;514:2;;;577:1;574;567:12;592:196;651:6;704:2;692:9;683:7;679:23;675:32;672:2;;;725:6;717;710:22;672:2;753:29;772:9;753:29;:::i;:::-;743:39;662:126;-1:-1:-1;;;662:126:82:o;793:803::-;915:6;923;931;939;992:2;980:9;971:7;967:23;963:32;960:2;;;1013:6;1005;998:22;960:2;1045:23;;1087:18;1117:14;;;1114:2;;;1149:6;1141;1134:22;1114:2;1193:70;1255:7;1246:6;1235:9;1231:22;1193:70;:::i;:::-;1282:8;;-1:-1:-1;1167:96:82;-1:-1:-1;1370:2:82;1355:18;;1342:32;;-1:-1:-1;1386:16:82;;;1383:2;;;1420:6;1412;1405:22;1383:2;;1464:72;1528:7;1517:8;1506:9;1502:24;1464:72;:::i;:::-;950:646;;;;-1:-1:-1;1555:8:82;-1:-1:-1;;;;950:646:82:o;1601:297::-;1668:6;1721:2;1709:9;1700:7;1696:23;1692:32;1689:2;;;1742:6;1734;1727:22;1689:2;1779:9;1773:16;1832:5;1825:13;1818:21;1811:5;1808:32;1798:2;;1859:6;1851;1844:22;1903:190;1962:6;2015:2;2003:9;1994:7;1990:23;1986:32;1983:2;;;2036:6;2028;2021:22;1983:2;-1:-1:-1;2064:23:82;;1973:120;-1:-1:-1;1973:120:82:o;2098:264::-;2166:6;2174;2227:2;2215:9;2206:7;2202:23;2198:32;2195:2;;;2248:6;2240;2233:22;2195:2;2289:9;2276:23;2266:33;;2318:38;2352:2;2341:9;2337:18;2318:38;:::i;:::-;2308:48;;2185:177;;;;;:::o;2367:258::-;2435:6;2443;2496:2;2484:9;2475:7;2471:23;2467:32;2464:2;;;2517:6;2509;2502:22;2464:2;-1:-1:-1;;2545:23:82;;;2615:2;2600:18;;;2587:32;;-1:-1:-1;2454:171:82:o;2630:332::-;2707:6;2715;2723;2776:2;2764:9;2755:7;2751:23;2747:32;2744:2;;;2797:6;2789;2782:22;2744:2;2838:9;2825:23;2815:33;;2895:2;2884:9;2880:18;2867:32;2857:42;;2918:38;2952:2;2941:9;2937:18;2918:38;:::i;:::-;2908:48;;2734:228;;;;;:::o;2967:470::-;3146:3;3184:6;3178:13;3200:53;3246:6;3241:3;3234:4;3226:6;3222:17;3200:53;:::i;:::-;3316:13;;3275:16;;;;3338:57;3316:13;3275:16;3372:4;3360:17;;3338:57;:::i;:::-;3411:20;;3154:283;-1:-1:-1;;;;3154:283:82:o;3959:635::-;4130:2;4182:21;;;4252:13;;4155:18;;;4274:22;;;4101:4;;4130:2;4353:15;;;;4327:2;4312:18;;;4101:4;4399:169;4413:6;4410:1;4407:13;4399:169;;;4474:13;;4462:26;;4543:15;;;;4508:12;;;;4435:1;4428:9;4399:169;;;-1:-1:-1;4585:3:82;;4110:484;-1:-1:-1;;;;;;4110:484:82:o;4888:383::-;5037:2;5026:9;5019:21;5000:4;5069:6;5063:13;5112:6;5107:2;5096:9;5092:18;5085:34;5128:66;5187:6;5182:2;5171:9;5167:18;5162:2;5154:6;5150:15;5128:66;:::i;:::-;5255:2;5234:15;5251:7;5230:29;5215:45;;;;5262:2;5211:54;;5009:262;-1:-1:-1;;5009:262:82:o;5685:125::-;5725:4;5753:1;5750;5747:8;5744:2;;;5758:18;;:::i;:::-;-1:-1:-1;5795:9:82;;5734:76::o;5815:258::-;5887:1;5897:113;5911:6;5908:1;5905:13;5897:113;;;5987:11;;;5981:18;5968:11;;;5961:39;5933:2;5926:10;5897:113;;;6028:6;6025:1;6022:13;6019:2;;;6063:1;6054:6;6049:3;6045:16;6038:27;6019:2;;5868:205;;;:::o;6078:380::-;6157:1;6153:12;;;;6200;;;6221:2;;6275:4;6267:6;6263:17;6253:27;;6221:2;6328;6320:6;6317:14;6297:18;6294:38;6291:2;;;6374:10;6369:3;6365:20;6362:1;6355:31;6409:4;6406:1;6399:15;6437:4;6434:1;6427:15;6291:2;;6133:325;;;:::o;6463:135::-;6502:3;6533:6;6523:17;;6520:2;;;6543:18;;:::i;:::-;-1:-1:-1;6590:1:82;6579:13;;6510:88::o;6603:127::-;6664:10;6659:3;6655:20;6652:1;6645:31;6695:4;6692:1;6685:15;6719:4;6716:1;6709:15", + "source": "// SPDX-License-Identifier: MIT\npragma solidity =0.8.4;\n\nimport './lib/Arrays.sol';\nimport './storages/AddressStorage.sol';\nimport './interfaces/IResolver.sol';\nimport './interfaces/IMobiusToken.sol';\n\ncontract Resolver is AddressStorage, IResolver {\n mapping(bytes32 => bytes32[]) _assets;\n\n constructor() {\n setContractName(CONTRACT_RESOLVER);\n }\n\n function addAsset(\n bytes32 assetType,\n bytes32 assetName,\n address assetAddress\n ) external onlyOwner {\n Arrays.push(_assets[assetType], assetName);\n emit AssetChanged(assetType, assetName, getAddressValue(assetType, assetName), assetAddress);\n setAddressValue(assetType, assetName, assetAddress);\n }\n\n function removeAsset(bytes32 assetType, bytes32 assetName) external onlyOwner {\n Arrays.remove(_assets[assetType], assetName);\n emit AssetChanged(assetType, assetName, getAddressValue(assetType, assetName), address(0));\n removeAddressValue(assetType, assetName);\n }\n\n function getAsset(bytes32 assetType, bytes32 assetName) external override view returns (bool, address) {\n (bool exist, ) = Arrays.index(_assets[assetType], assetName);\n return (exist, getAddressValue(assetType, assetName));\n }\n\n function getAssets(bytes32 assetType) external override view returns (bytes32[] memory) {\n return _assets[assetType];\n }\n\n function importAddress(bytes32[] calldata name, address[] calldata value) external onlyOwner {\n require(name.length == value.length, 'Resolver: name and value length mismatch');\n for (uint256 i = 0; i < name.length; i++) {\n setAddress(name[i], value[i]);\n }\n }\n\n function setAddress(bytes32 name, address value) public onlyOwner {\n address previousValue = getAddressValue(name);\n emit AddressChanged(name, previousValue, value);\n _migrateMobiusToken(name, previousValue, value);\n setAddressValue(name, value);\n }\n\n function getAddress(bytes32 name) external override view returns (address) {\n return getAddressValue(name);\n }\n\n function _migrateMobiusToken(\n bytes32 name,\n address previousAddress,\n address newAddress\n ) private {\n bytes32[2] memory contracts = [CONTRACT_ESCROW,CONTRACT_MOBIUS];\n if (previousAddress == address(0)) return;\n address mobiusToken = getAddressValue(CONTRACT_MOBIUS_TOKEN);\n if (mobiusToken == address(0)) return;\n for (uint256 i = 0; i < contracts.length; i++) {\n if (name != contracts[i]) continue;\n IMobiusToken(mobiusToken).migrate(previousAddress, newAddress);\n emit MobiusTokenMigrated(name, previousAddress, newAddress);\n }\n }\n}\n", + "sourcePath": "/home/colin/Workspace/src/Mobius/contracts/contracts/Resolver.sol", + "ast": { + "absolutePath": "project:/contracts/Resolver.sol", + "exportedSymbols": { + "AddressStorage": [ + 12792 + ], + "Arrays": [ + 11770 + ], + "Constants": [ + 8570 + ], + "IERC20": [ + 9727 + ], + "IMobiusToken": [ + 10197 + ], + "IOwnable": [ + 10242 + ], + "IResolver": [ + 10297 + ], + "Ownable": [ + 9135 + ], + "Resolver": [ + 3912 + ], + "Storage": [ + 9205 + ], + "Strings": [ + 12299 + ] + }, + "id": 3913, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 3607, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:8" + }, + { + "absolutePath": "project:/contracts/lib/Arrays.sol", + "file": "./lib/Arrays.sol", + "id": 3608, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 11771, + "src": "57:26:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/storages/AddressStorage.sol", + "file": "./storages/AddressStorage.sol", + "id": 3609, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 12793, + "src": "84:39:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IResolver.sol", + "file": "./interfaces/IResolver.sol", + "id": 3610, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 10298, + "src": "124:36:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IMobiusToken.sol", + "file": "./interfaces/IMobiusToken.sol", + "id": 3611, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 10198, + "src": "161:39:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 3612, + "name": "AddressStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12792, + "src": "223:14:8" + }, + "id": 3613, + "nodeType": "InheritanceSpecifier", + "src": "223:14:8" + }, + { + "baseName": { + "id": 3614, + "name": "IResolver", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10297, + "src": "239:9:8" + }, + "id": 3615, + "nodeType": "InheritanceSpecifier", + "src": "239:9:8" + } + ], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 3912, + "linearizedBaseContracts": [ + 3912, + 10297, + 12792, + 9205, + 9135, + 10242, + 8570 + ], + "name": "Resolver", + "nameLocation": "211:8:8", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3620, + "mutability": "mutable", + "name": "_assets", + "nameLocation": "285:7:8", + "nodeType": "VariableDeclaration", + "scope": 3912, + "src": "255:37:8", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[])" + }, + "typeName": { + "id": 3619, + "keyType": { + "id": 3616, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "263:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Mapping", + "src": "255:29:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[])" + }, + "valueType": { + "baseType": { + "id": 3617, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "274:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3618, + "nodeType": "ArrayTypeName", + "src": "274:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + } + }, + "visibility": "internal" + }, + { + "body": { + "id": 3627, + "nodeType": "Block", + "src": "313:51:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3624, + "name": "CONTRACT_RESOLVER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8518, + "src": "339:17:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3623, + "name": "setContractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9134, + "src": "323:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 3625, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "323:34:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3626, + "nodeType": "ExpressionStatement", + "src": "323:34:8" + } + ] + }, + "id": 3628, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3621, + "nodeType": "ParameterList", + "parameters": [], + "src": "310:2:8" + }, + "returnParameters": { + "id": 3622, + "nodeType": "ParameterList", + "parameters": [], + "src": "313:0:8" + }, + "scope": 3912, + "src": "299:65:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 3664, + "nodeType": "Block", + "src": "497:222:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "baseExpression": { + "id": 3642, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "519:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3644, + "indexExpression": { + "id": 3643, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "527:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "519:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + { + "id": 3645, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "539:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 3639, + "name": "Arrays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11770, + "src": "507:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Arrays_$11770_$", + "typeString": "type(library Arrays)" + } + }, + "id": 3641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": 11687, + "src": "507:11:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_array$_t_bytes32_$dyn_storage_ptr_$_t_bytes32_$returns$__$", + "typeString": "function (bytes32[] storage pointer,bytes32)" + } + }, + "id": 3646, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "507:42:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3647, + "nodeType": "ExpressionStatement", + "src": "507:42:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3649, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "577:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3650, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "588:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 3652, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "615:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3653, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "626:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3651, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12791, + "src": "599:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "599:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3655, + "name": "assetAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3634, + "src": "638:12:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3648, + "name": "AssetChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10280, + "src": "564:12:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,bytes32,address,address)" + } + }, + "id": 3656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "564:87:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3657, + "nodeType": "EmitStatement", + "src": "559:92:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3659, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "677:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3660, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "688:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3661, + "name": "assetAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3634, + "src": "699:12:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3658, + "name": "setAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12715, + 12760 + ], + "referencedDeclaration": 12760, + "src": "661:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,bytes32,address)" + } + }, + "id": 3662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "661:51:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3663, + "nodeType": "ExpressionStatement", + "src": "661:51:8" + } + ] + }, + "functionSelector": "a418c84d", + "id": 3665, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3637, + "kind": "modifierInvocation", + "modifierName": { + "id": 3636, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "487:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "487:9:8" + } + ], + "name": "addAsset", + "nameLocation": "379:8:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3635, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3630, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "405:9:8", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "397:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3629, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "397:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3632, + "mutability": "mutable", + "name": "assetName", + "nameLocation": "432:9:8", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "424:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3631, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "424:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3634, + "mutability": "mutable", + "name": "assetAddress", + "nameLocation": "459:12:8", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "451:20:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3633, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "451:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "387:90:8" + }, + "returnParameters": { + "id": 3638, + "nodeType": "ParameterList", + "parameters": [], + "src": "497:0:8" + }, + "scope": 3912, + "src": "370:349:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3701, + "nodeType": "Block", + "src": "803:211:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "baseExpression": { + "id": 3677, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "827:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3679, + "indexExpression": { + "id": 3678, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "835:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "827:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + { + "id": 3680, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "847:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 3674, + "name": "Arrays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11770, + "src": "813:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Arrays_$11770_$", + "typeString": "type(library Arrays)" + } + }, + "id": 3676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "remove", + "nodeType": "MemberAccess", + "referencedDeclaration": 11729, + "src": "813:13:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_array$_t_bytes32_$dyn_storage_ptr_$_t_bytes32_$returns$__$", + "typeString": "function (bytes32[] storage pointer,bytes32)" + } + }, + "id": 3681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "813:44:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3682, + "nodeType": "ExpressionStatement", + "src": "813:44:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3684, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "885:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3685, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "896:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 3687, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "923:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3688, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "934:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3686, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12791, + "src": "907:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "907:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "954:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "946:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3690, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "946:7:8", + "typeDescriptions": {} + } + }, + "id": 3693, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "946:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3683, + "name": "AssetChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10280, + "src": "872:12:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,bytes32,address,address)" + } + }, + "id": 3694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "872:85:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3695, + "nodeType": "EmitStatement", + "src": "867:90:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3697, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "986:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3698, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "997:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3696, + "name": "removeAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12728, + 12775 + ], + "referencedDeclaration": 12775, + "src": "967:18:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (bytes32,bytes32)" + } + }, + "id": 3699, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "967:40:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3700, + "nodeType": "ExpressionStatement", + "src": "967:40:8" + } + ] + }, + "functionSelector": "1ebd0da2", + "id": 3702, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3672, + "kind": "modifierInvocation", + "modifierName": { + "id": 3671, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "793:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "793:9:8" + } + ], + "name": "removeAsset", + "nameLocation": "734:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3670, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3667, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "754:9:8", + "nodeType": "VariableDeclaration", + "scope": 3702, + "src": "746:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3666, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "746:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3669, + "mutability": "mutable", + "name": "assetName", + "nameLocation": "773:9:8", + "nodeType": "VariableDeclaration", + "scope": 3702, + "src": "765:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3668, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "765:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "745:38:8" + }, + "returnParameters": { + "id": 3673, + "nodeType": "ParameterList", + "parameters": [], + "src": "803:0:8" + }, + "scope": 3912, + "src": "725:289:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10262 + ], + "body": { + "id": 3731, + "nodeType": "Block", + "src": "1123:140:8", + "statements": [ + { + "assignments": [ + 3715, + null + ], + "declarations": [ + { + "constant": false, + "id": 3715, + "mutability": "mutable", + "name": "exist", + "nameLocation": "1139:5:8", + "nodeType": "VariableDeclaration", + "scope": 3731, + "src": "1134:10:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3714, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1134:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 3723, + "initialValue": { + "arguments": [ + { + "baseExpression": { + "id": 3718, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "1163:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3720, + "indexExpression": { + "id": 3719, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "1171:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1163:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + { + "id": 3721, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3706, + "src": "1183:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 3716, + "name": "Arrays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11770, + "src": "1150:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Arrays_$11770_$", + "typeString": "type(library Arrays)" + } + }, + "id": 3717, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "index", + "nodeType": "MemberAccess", + "referencedDeclaration": 11769, + "src": "1150:12:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_bytes32_$dyn_storage_ptr_$_t_bytes32_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (bytes32[] storage pointer,bytes32) view returns (bool,uint256)" + } + }, + "id": 3722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1150:43:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1133:60:8" + }, + { + "expression": { + "components": [ + { + "id": 3724, + "name": "exist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3715, + "src": "1211:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "id": 3726, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "1234:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3727, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3706, + "src": "1245:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3725, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12791, + "src": "1218:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3728, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1218:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3729, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1210:46:8", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3713, + "id": 3730, + "nodeType": "Return", + "src": "1203:53:8" + } + ] + }, + "functionSelector": "659b9d70", + "id": 3732, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAsset", + "nameLocation": "1029:8:8", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3708, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1085:8:8" + }, + "parameters": { + "id": 3707, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3704, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "1046:9:8", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1038:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3703, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1038:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3706, + "mutability": "mutable", + "name": "assetName", + "nameLocation": "1065:9:8", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1057:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3705, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1057:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1037:38:8" + }, + "returnParameters": { + "id": 3713, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3710, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1108:4:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3709, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1108:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3712, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1114:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3711, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1114:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1107:15:8" + }, + "scope": 3912, + "src": "1020:243:8", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10270 + ], + "body": { + "id": 3745, + "nodeType": "Block", + "src": "1357:42:8", + "statements": [ + { + "expression": { + "baseExpression": { + "id": 3741, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "1374:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3743, + "indexExpression": { + "id": 3742, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3734, + "src": "1382:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1374:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + "functionReturnParameters": 3740, + "id": 3744, + "nodeType": "Return", + "src": "1367:25:8" + } + ] + }, + "functionSelector": "9de567f0", + "id": 3746, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAssets", + "nameLocation": "1278:9:8", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3736, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1316:8:8" + }, + "parameters": { + "id": 3735, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3734, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "1296:9:8", + "nodeType": "VariableDeclaration", + "scope": 3746, + "src": "1288:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3733, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1288:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1287:19:8" + }, + "returnParameters": { + "id": 3740, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3739, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3746, + "src": "1339:16:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 3737, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1339:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3738, + "nodeType": "ArrayTypeName", + "src": "1339:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + } + ], + "src": "1338:18:8" + }, + "scope": 3912, + "src": "1269:130:8", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3788, + "nodeType": "Block", + "src": "1498:202:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3762, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3758, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3749, + "src": "1516:4:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + }, + "id": 3759, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1516:11:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 3760, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3752, + "src": "1531:5:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", + "typeString": "address[] calldata" + } + }, + "id": 3761, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1531:12:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1516:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5265736f6c7665723a206e616d6520616e642076616c7565206c656e677468206d69736d61746368", + "id": 3763, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1545:42:8", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_00927e7e4f2ef158bfc82b3ff72887cf4310d19fab02004d34e5a1def702cfe4", + "typeString": "literal_string \"Resolver: name and value length mismatch\"" + }, + "value": "Resolver: name and value length mismatch" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_00927e7e4f2ef158bfc82b3ff72887cf4310d19fab02004d34e5a1def702cfe4", + "typeString": "literal_string \"Resolver: name and value length mismatch\"" + } + ], + "id": 3757, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1508:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3764, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1508:80:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3765, + "nodeType": "ExpressionStatement", + "src": "1508:80:8" + }, + { + "body": { + "id": 3786, + "nodeType": "Block", + "src": "1640:54:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "baseExpression": { + "id": 3778, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3749, + "src": "1665:4:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + }, + "id": 3780, + "indexExpression": { + "id": 3779, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1670:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1665:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "baseExpression": { + "id": 3781, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3752, + "src": "1674:5:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", + "typeString": "address[] calldata" + } + }, + "id": 3783, + "indexExpression": { + "id": 3782, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1680:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1674:8:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3777, + "name": "setAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3822, + "src": "1654:10:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 3784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1654:29:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3785, + "nodeType": "ExpressionStatement", + "src": "1654:29:8" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3773, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3770, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1618:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 3771, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3749, + "src": "1622:4:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + }, + "id": 3772, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1622:11:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1618:15:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3787, + "initializationExpression": { + "assignments": [ + 3767 + ], + "declarations": [ + { + "constant": false, + "id": 3767, + "mutability": "mutable", + "name": "i", + "nameLocation": "1611:1:8", + "nodeType": "VariableDeclaration", + "scope": 3787, + "src": "1603:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1603:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3769, + "initialValue": { + "hexValue": "30", + "id": 3768, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1615:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "1603:13:8" + }, + "loopExpression": { + "expression": { + "id": 3775, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1635:3:8", + "subExpression": { + "id": 3774, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1635:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3776, + "nodeType": "ExpressionStatement", + "src": "1635:3:8" + }, + "nodeType": "ForStatement", + "src": "1598:96:8" + } + ] + }, + "functionSelector": "9dddb54d", + "id": 3789, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3755, + "kind": "modifierInvocation", + "modifierName": { + "id": 3754, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "1488:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "1488:9:8" + } + ], + "name": "importAddress", + "nameLocation": "1414:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3753, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3749, + "mutability": "mutable", + "name": "name", + "nameLocation": "1447:4:8", + "nodeType": "VariableDeclaration", + "scope": 3789, + "src": "1428:23:8", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 3747, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1428:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3748, + "nodeType": "ArrayTypeName", + "src": "1428:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3752, + "mutability": "mutable", + "name": "value", + "nameLocation": "1472:5:8", + "nodeType": "VariableDeclaration", + "scope": 3789, + "src": "1453:24:8", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 3750, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1453:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 3751, + "nodeType": "ArrayTypeName", + "src": "1453:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "visibility": "internal" + } + ], + "src": "1427:51:8" + }, + "returnParameters": { + "id": 3756, + "nodeType": "ParameterList", + "parameters": [], + "src": "1498:0:8" + }, + "scope": 3912, + "src": "1405:295:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3821, + "nodeType": "Block", + "src": "1772:214:8", + "statements": [ + { + "assignments": [ + 3799 + ], + "declarations": [ + { + "constant": false, + "id": 3799, + "mutability": "mutable", + "name": "previousValue", + "nameLocation": "1790:13:8", + "nodeType": "VariableDeclaration", + "scope": 3821, + "src": "1782:21:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3798, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1782:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3803, + "initialValue": { + "arguments": [ + { + "id": 3801, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1822:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3800, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "1806:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3802, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1806:21:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1782:45:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3805, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1857:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3806, + "name": "previousValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3799, + "src": "1863:13:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3807, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3793, + "src": "1878:5:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3804, + "name": "AddressChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10288, + "src": "1842:14:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 3808, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1842:42:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3809, + "nodeType": "EmitStatement", + "src": "1837:47:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3811, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1914:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3812, + "name": "previousValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3799, + "src": "1920:13:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3813, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3793, + "src": "1935:5:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3810, + "name": "_migrateMobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3911, + "src": "1894:19:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 3814, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1894:47:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3815, + "nodeType": "ExpressionStatement", + "src": "1894:47:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3817, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1967:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3818, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3793, + "src": "1973:5:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3816, + "name": "setAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12715, + 12760 + ], + "referencedDeclaration": 12715, + "src": "1951:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 3819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1951:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3820, + "nodeType": "ExpressionStatement", + "src": "1951:28:8" + } + ] + }, + "functionSelector": "ca446dd9", + "id": 3822, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3796, + "kind": "modifierInvocation", + "modifierName": { + "id": 3795, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "1762:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "1762:9:8" + } + ], + "name": "setAddress", + "nameLocation": "1715:10:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3794, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3791, + "mutability": "mutable", + "name": "name", + "nameLocation": "1734:4:8", + "nodeType": "VariableDeclaration", + "scope": 3822, + "src": "1726:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3790, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1726:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3793, + "mutability": "mutable", + "name": "value", + "nameLocation": "1748:5:8", + "nodeType": "VariableDeclaration", + "scope": 3822, + "src": "1740:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3792, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1740:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1725:29:8" + }, + "returnParameters": { + "id": 3797, + "nodeType": "ParameterList", + "parameters": [], + "src": "1772:0:8" + }, + "scope": 3912, + "src": "1706:280:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 10251 + ], + "body": { + "id": 3834, + "nodeType": "Block", + "src": "2067:45:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3831, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3824, + "src": "2100:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3830, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "2084:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2084:21:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3829, + "id": 3833, + "nodeType": "Return", + "src": "2077:28:8" + } + ] + }, + "functionSelector": "21f8a721", + "id": 3835, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAddress", + "nameLocation": "2001:10:8", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3826, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2035:8:8" + }, + "parameters": { + "id": 3825, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3824, + "mutability": "mutable", + "name": "name", + "nameLocation": "2020:4:8", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "2012:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3823, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2012:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2011:14:8" + }, + "returnParameters": { + "id": 3829, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3828, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "2058:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3827, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2058:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2057:9:8" + }, + "scope": 3912, + "src": "1992:120:8", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3910, + "nodeType": "Block", + "src": "2244:512:8", + "statements": [ + { + "assignments": [ + 3849 + ], + "declarations": [ + { + "constant": false, + "id": 3849, + "mutability": "mutable", + "name": "contracts", + "nameLocation": "2272:9:8", + "nodeType": "VariableDeclaration", + "scope": 3910, + "src": "2254:27:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2]" + }, + "typeName": { + "baseType": { + "id": 3847, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2254:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3848, + "length": { + "hexValue": "32", + "id": 3846, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2262:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2254:10:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_storage_ptr", + "typeString": "bytes32[2]" + } + }, + "visibility": "internal" + } + ], + "id": 3853, + "initialValue": { + "components": [ + { + "id": 3850, + "name": "CONTRACT_ESCROW", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8530, + "src": "2285:15:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3851, + "name": "CONTRACT_MOBIUS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8527, + "src": "2301:15:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3852, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2284:33:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2254:63:8" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 3859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3854, + "name": "previousAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3839, + "src": "2331:15:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 3857, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2358:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3856, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2350:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3855, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2350:7:8", + "typeDescriptions": {} + } + }, + "id": 3858, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2350:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2331:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3861, + "nodeType": "IfStatement", + "src": "2327:42:8", + "trueBody": { + "functionReturnParameters": 3843, + "id": 3860, + "nodeType": "Return", + "src": "2362:7:8" + } + }, + { + "assignments": [ + 3863 + ], + "declarations": [ + { + "constant": false, + "id": 3863, + "mutability": "mutable", + "name": "mobiusToken", + "nameLocation": "2386:11:8", + "nodeType": "VariableDeclaration", + "scope": 3910, + "src": "2378:19:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3862, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2378:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3867, + "initialValue": { + "arguments": [ + { + "id": 3865, + "name": "CONTRACT_MOBIUS_TOKEN", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8545, + "src": "2416:21:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3864, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "2400:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3866, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2400:38:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2378:60:8" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 3873, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3868, + "name": "mobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3863, + "src": "2452:11:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 3871, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2475:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2467:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3869, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2467:7:8", + "typeDescriptions": {} + } + }, + "id": 3872, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2467:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2452:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3875, + "nodeType": "IfStatement", + "src": "2448:38:8", + "trueBody": { + "functionReturnParameters": 3843, + "id": 3874, + "nodeType": "Return", + "src": "2479:7:8" + } + }, + { + "body": { + "id": 3908, + "nodeType": "Block", + "src": "2542:208:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3891, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3887, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3837, + "src": "2560:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "baseExpression": { + "id": 3888, + "name": "contracts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3849, + "src": "2568:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2] memory" + } + }, + "id": 3890, + "indexExpression": { + "id": 3889, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3877, + "src": "2578:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2568:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "2560:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3893, + "nodeType": "IfStatement", + "src": "2556:34:8", + "trueBody": { + "id": 3892, + "nodeType": "Continue", + "src": "2582:8:8" + } + }, + { + "expression": { + "arguments": [ + { + "id": 3898, + "name": "previousAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3839, + "src": "2638:15:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3899, + "name": "newAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3841, + "src": "2655:10:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [ + { + "id": 3895, + "name": "mobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3863, + "src": "2617:11:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3894, + "name": "IMobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10197, + "src": "2604:12:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IMobiusToken_$10197_$", + "typeString": "type(contract IMobiusToken)" + } + }, + "id": 3896, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2604:25:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IMobiusToken_$10197", + "typeString": "contract IMobiusToken" + } + }, + "id": 3897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "migrate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10196, + "src": "2604:33:8", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$returns$_t_bool_$", + "typeString": "function (address,address) external returns (bool)" + } + }, + "id": 3900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2604:62:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3901, + "nodeType": "ExpressionStatement", + "src": "2604:62:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3903, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3837, + "src": "2705:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3904, + "name": "previousAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3839, + "src": "2711:15:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3905, + "name": "newAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3841, + "src": "2728:10:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3902, + "name": "MobiusTokenMigrated", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10296, + "src": "2685:19:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 3906, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2685:54:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3907, + "nodeType": "EmitStatement", + "src": "2680:59:8" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3883, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3880, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3877, + "src": "2515:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 3881, + "name": "contracts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3849, + "src": "2519:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2] memory" + } + }, + "id": 3882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2519:16:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2515:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3909, + "initializationExpression": { + "assignments": [ + 3877 + ], + "declarations": [ + { + "constant": false, + "id": 3877, + "mutability": "mutable", + "name": "i", + "nameLocation": "2508:1:8", + "nodeType": "VariableDeclaration", + "scope": 3909, + "src": "2500:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3876, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2500:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3879, + "initialValue": { + "hexValue": "30", + "id": 3878, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2512:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "2500:13:8" + }, + "loopExpression": { + "expression": { + "id": 3885, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "2537:3:8", + "subExpression": { + "id": 3884, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3877, + "src": "2537:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3886, + "nodeType": "ExpressionStatement", + "src": "2537:3:8" + }, + "nodeType": "ForStatement", + "src": "2495:255:8" + } + ] + }, + "id": 3911, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_migrateMobiusToken", + "nameLocation": "2127:19:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3837, + "mutability": "mutable", + "name": "name", + "nameLocation": "2164:4:8", + "nodeType": "VariableDeclaration", + "scope": 3911, + "src": "2156:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3836, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2156:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3839, + "mutability": "mutable", + "name": "previousAddress", + "nameLocation": "2186:15:8", + "nodeType": "VariableDeclaration", + "scope": 3911, + "src": "2178:23:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3838, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2178:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3841, + "mutability": "mutable", + "name": "newAddress", + "nameLocation": "2219:10:8", + "nodeType": "VariableDeclaration", + "scope": 3911, + "src": "2211:18:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3840, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2211:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2146:89:8" + }, + "returnParameters": { + "id": 3843, + "nodeType": "ParameterList", + "parameters": [], + "src": "2244:0:8" + }, + "scope": 3912, + "src": "2118:638:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + } + ], + "scope": 3913, + "src": "202:2556:8", + "usedErrors": [] + } + ], + "src": "32:2727:8" + }, + "legacyAST": { + "absolutePath": "project:/contracts/Resolver.sol", + "exportedSymbols": { + "AddressStorage": [ + 12792 + ], + "Arrays": [ + 11770 + ], + "Constants": [ + 8570 + ], + "IERC20": [ + 9727 + ], + "IMobiusToken": [ + 10197 + ], + "IOwnable": [ + 10242 + ], + "IResolver": [ + 10297 + ], + "Ownable": [ + 9135 + ], + "Resolver": [ + 3912 + ], + "Storage": [ + 9205 + ], + "Strings": [ + 12299 + ] + }, + "id": 3913, + "license": "MIT", + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 3607, + "literals": [ + "solidity", + "=", + "0.8", + ".4" + ], + "nodeType": "PragmaDirective", + "src": "32:23:8" + }, + { + "absolutePath": "project:/contracts/lib/Arrays.sol", + "file": "./lib/Arrays.sol", + "id": 3608, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 11771, + "src": "57:26:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/storages/AddressStorage.sol", + "file": "./storages/AddressStorage.sol", + "id": 3609, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 12793, + "src": "84:39:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IResolver.sol", + "file": "./interfaces/IResolver.sol", + "id": 3610, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 10298, + "src": "124:36:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "absolutePath": "project:/contracts/interfaces/IMobiusToken.sol", + "file": "./interfaces/IMobiusToken.sol", + "id": 3611, + "nameLocation": "-1:-1:-1", + "nodeType": "ImportDirective", + "scope": 3913, + "sourceUnit": 10198, + "src": "161:39:8", + "symbolAliases": [], + "unitAlias": "" + }, + { + "abstract": false, + "baseContracts": [ + { + "baseName": { + "id": 3612, + "name": "AddressStorage", + "nodeType": "IdentifierPath", + "referencedDeclaration": 12792, + "src": "223:14:8" + }, + "id": 3613, + "nodeType": "InheritanceSpecifier", + "src": "223:14:8" + }, + { + "baseName": { + "id": 3614, + "name": "IResolver", + "nodeType": "IdentifierPath", + "referencedDeclaration": 10297, + "src": "239:9:8" + }, + "id": 3615, + "nodeType": "InheritanceSpecifier", + "src": "239:9:8" + } + ], + "contractDependencies": [], + "contractKind": "contract", + "fullyImplemented": true, + "id": 3912, + "linearizedBaseContracts": [ + 3912, + 10297, + 12792, + 9205, + 9135, + 10242, + 8570 + ], + "name": "Resolver", + "nameLocation": "211:8:8", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 3620, + "mutability": "mutable", + "name": "_assets", + "nameLocation": "285:7:8", + "nodeType": "VariableDeclaration", + "scope": 3912, + "src": "255:37:8", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[])" + }, + "typeName": { + "id": 3619, + "keyType": { + "id": 3616, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "263:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Mapping", + "src": "255:29:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[])" + }, + "valueType": { + "baseType": { + "id": 3617, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "274:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3618, + "nodeType": "ArrayTypeName", + "src": "274:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + } + }, + "visibility": "internal" + }, + { + "body": { + "id": 3627, + "nodeType": "Block", + "src": "313:51:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3624, + "name": "CONTRACT_RESOLVER", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8518, + "src": "339:17:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3623, + "name": "setContractName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 9134, + "src": "323:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 3625, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "323:34:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3626, + "nodeType": "ExpressionStatement", + "src": "323:34:8" + } + ] + }, + "id": 3628, + "implemented": true, + "kind": "constructor", + "modifiers": [], + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3621, + "nodeType": "ParameterList", + "parameters": [], + "src": "310:2:8" + }, + "returnParameters": { + "id": 3622, + "nodeType": "ParameterList", + "parameters": [], + "src": "313:0:8" + }, + "scope": 3912, + "src": "299:65:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "body": { + "id": 3664, + "nodeType": "Block", + "src": "497:222:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "baseExpression": { + "id": 3642, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "519:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3644, + "indexExpression": { + "id": 3643, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "527:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "519:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + { + "id": 3645, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "539:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 3639, + "name": "Arrays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11770, + "src": "507:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Arrays_$11770_$", + "typeString": "type(library Arrays)" + } + }, + "id": 3641, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": 11687, + "src": "507:11:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_array$_t_bytes32_$dyn_storage_ptr_$_t_bytes32_$returns$__$", + "typeString": "function (bytes32[] storage pointer,bytes32)" + } + }, + "id": 3646, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "507:42:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3647, + "nodeType": "ExpressionStatement", + "src": "507:42:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3649, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "577:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3650, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "588:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 3652, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "615:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3653, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "626:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3651, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12791, + "src": "599:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3654, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "599:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3655, + "name": "assetAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3634, + "src": "638:12:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3648, + "name": "AssetChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10280, + "src": "564:12:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,bytes32,address,address)" + } + }, + "id": 3656, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "564:87:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3657, + "nodeType": "EmitStatement", + "src": "559:92:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3659, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3630, + "src": "677:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3660, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3632, + "src": "688:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3661, + "name": "assetAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3634, + "src": "699:12:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3658, + "name": "setAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12715, + 12760 + ], + "referencedDeclaration": 12760, + "src": "661:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,bytes32,address)" + } + }, + "id": 3662, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "661:51:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3663, + "nodeType": "ExpressionStatement", + "src": "661:51:8" + } + ] + }, + "functionSelector": "a418c84d", + "id": 3665, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3637, + "kind": "modifierInvocation", + "modifierName": { + "id": 3636, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "487:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "487:9:8" + } + ], + "name": "addAsset", + "nameLocation": "379:8:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3635, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3630, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "405:9:8", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "397:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3629, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "397:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3632, + "mutability": "mutable", + "name": "assetName", + "nameLocation": "432:9:8", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "424:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3631, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "424:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3634, + "mutability": "mutable", + "name": "assetAddress", + "nameLocation": "459:12:8", + "nodeType": "VariableDeclaration", + "scope": 3665, + "src": "451:20:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3633, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "451:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "387:90:8" + }, + "returnParameters": { + "id": 3638, + "nodeType": "ParameterList", + "parameters": [], + "src": "497:0:8" + }, + "scope": 3912, + "src": "370:349:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3701, + "nodeType": "Block", + "src": "803:211:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "baseExpression": { + "id": 3677, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "827:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3679, + "indexExpression": { + "id": 3678, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "835:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "827:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + { + "id": 3680, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "847:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 3674, + "name": "Arrays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11770, + "src": "813:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Arrays_$11770_$", + "typeString": "type(library Arrays)" + } + }, + "id": 3676, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "remove", + "nodeType": "MemberAccess", + "referencedDeclaration": 11729, + "src": "813:13:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_array$_t_bytes32_$dyn_storage_ptr_$_t_bytes32_$returns$__$", + "typeString": "function (bytes32[] storage pointer,bytes32)" + } + }, + "id": 3681, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "813:44:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3682, + "nodeType": "ExpressionStatement", + "src": "813:44:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3684, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "885:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3685, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "896:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "arguments": [ + { + "id": 3687, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "923:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3688, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "934:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3686, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12791, + "src": "907:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3689, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "907:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "arguments": [ + { + "hexValue": "30", + "id": 3692, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "954:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3691, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "946:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3690, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "946:7:8", + "typeDescriptions": {} + } + }, + "id": 3693, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "946:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3683, + "name": "AssetChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10280, + "src": "872:12:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,bytes32,address,address)" + } + }, + "id": 3694, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "872:85:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3695, + "nodeType": "EmitStatement", + "src": "867:90:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3697, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3667, + "src": "986:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3698, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3669, + "src": "997:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3696, + "name": "removeAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12728, + 12775 + ], + "referencedDeclaration": 12775, + "src": "967:18:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_bytes32_$returns$__$", + "typeString": "function (bytes32,bytes32)" + } + }, + "id": 3699, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "967:40:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3700, + "nodeType": "ExpressionStatement", + "src": "967:40:8" + } + ] + }, + "functionSelector": "1ebd0da2", + "id": 3702, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3672, + "kind": "modifierInvocation", + "modifierName": { + "id": 3671, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "793:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "793:9:8" + } + ], + "name": "removeAsset", + "nameLocation": "734:11:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3670, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3667, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "754:9:8", + "nodeType": "VariableDeclaration", + "scope": 3702, + "src": "746:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3666, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "746:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3669, + "mutability": "mutable", + "name": "assetName", + "nameLocation": "773:9:8", + "nodeType": "VariableDeclaration", + "scope": 3702, + "src": "765:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3668, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "765:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "745:38:8" + }, + "returnParameters": { + "id": 3673, + "nodeType": "ParameterList", + "parameters": [], + "src": "803:0:8" + }, + "scope": 3912, + "src": "725:289:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10262 + ], + "body": { + "id": 3731, + "nodeType": "Block", + "src": "1123:140:8", + "statements": [ + { + "assignments": [ + 3715, + null + ], + "declarations": [ + { + "constant": false, + "id": 3715, + "mutability": "mutable", + "name": "exist", + "nameLocation": "1139:5:8", + "nodeType": "VariableDeclaration", + "scope": 3731, + "src": "1134:10:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3714, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1134:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + null + ], + "id": 3723, + "initialValue": { + "arguments": [ + { + "baseExpression": { + "id": 3718, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "1163:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3720, + "indexExpression": { + "id": 3719, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "1171:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1163:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + { + "id": 3721, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3706, + "src": "1183:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "expression": { + "id": 3716, + "name": "Arrays", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 11770, + "src": "1150:6:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Arrays_$11770_$", + "typeString": "type(library Arrays)" + } + }, + "id": 3717, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "index", + "nodeType": "MemberAccess", + "referencedDeclaration": 11769, + "src": "1150:12:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_array$_t_bytes32_$dyn_storage_ptr_$_t_bytes32_$returns$_t_bool_$_t_uint256_$", + "typeString": "function (bytes32[] storage pointer,bytes32) view returns (bool,uint256)" + } + }, + "id": 3722, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1150:43:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_uint256_$", + "typeString": "tuple(bool,uint256)" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1133:60:8" + }, + { + "expression": { + "components": [ + { + "id": 3724, + "name": "exist", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3715, + "src": "1211:5:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "arguments": [ + { + "id": 3726, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3704, + "src": "1234:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3727, + "name": "assetName", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3706, + "src": "1245:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3725, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12791, + "src": "1218:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,bytes32) view returns (address)" + } + }, + "id": 3728, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1218:37:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "id": 3729, + "isConstant": false, + "isInlineArray": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "1210:46:8", + "typeDescriptions": { + "typeIdentifier": "t_tuple$_t_bool_$_t_address_$", + "typeString": "tuple(bool,address)" + } + }, + "functionReturnParameters": 3713, + "id": 3730, + "nodeType": "Return", + "src": "1203:53:8" + } + ] + }, + "functionSelector": "659b9d70", + "id": 3732, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAsset", + "nameLocation": "1029:8:8", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3708, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1085:8:8" + }, + "parameters": { + "id": 3707, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3704, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "1046:9:8", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1038:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3703, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1038:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3706, + "mutability": "mutable", + "name": "assetName", + "nameLocation": "1065:9:8", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1057:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3705, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1057:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1037:38:8" + }, + "returnParameters": { + "id": 3713, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3710, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1108:4:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 3709, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1108:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3712, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3732, + "src": "1114:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3711, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1114:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1107:15:8" + }, + "scope": 3912, + "src": "1020:243:8", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "baseFunctions": [ + 10270 + ], + "body": { + "id": 3745, + "nodeType": "Block", + "src": "1357:42:8", + "statements": [ + { + "expression": { + "baseExpression": { + "id": 3741, + "name": "_assets", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3620, + "src": "1374:7:8", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_array$_t_bytes32_$dyn_storage_$", + "typeString": "mapping(bytes32 => bytes32[] storage ref)" + } + }, + "id": 3743, + "indexExpression": { + "id": 3742, + "name": "assetType", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3734, + "src": "1382:9:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1374:18:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage", + "typeString": "bytes32[] storage ref" + } + }, + "functionReturnParameters": 3740, + "id": 3744, + "nodeType": "Return", + "src": "1367:25:8" + } + ] + }, + "functionSelector": "9de567f0", + "id": 3746, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAssets", + "nameLocation": "1278:9:8", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3736, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "1316:8:8" + }, + "parameters": { + "id": 3735, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3734, + "mutability": "mutable", + "name": "assetType", + "nameLocation": "1296:9:8", + "nodeType": "VariableDeclaration", + "scope": 3746, + "src": "1288:17:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3733, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1288:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "1287:19:8" + }, + "returnParameters": { + "id": 3740, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3739, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3746, + "src": "1339:16:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 3737, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1339:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3738, + "nodeType": "ArrayTypeName", + "src": "1339:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + } + ], + "src": "1338:18:8" + }, + "scope": 3912, + "src": "1269:130:8", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3788, + "nodeType": "Block", + "src": "1498:202:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3762, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "expression": { + "id": 3758, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3749, + "src": "1516:4:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + }, + "id": 3759, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1516:11:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "expression": { + "id": 3760, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3752, + "src": "1531:5:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", + "typeString": "address[] calldata" + } + }, + "id": 3761, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1531:12:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1516:27:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "hexValue": "5265736f6c7665723a206e616d6520616e642076616c7565206c656e677468206d69736d61746368", + "id": 3763, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1545:42:8", + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_00927e7e4f2ef158bfc82b3ff72887cf4310d19fab02004d34e5a1def702cfe4", + "typeString": "literal_string \"Resolver: name and value length mismatch\"" + }, + "value": "Resolver: name and value length mismatch" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_00927e7e4f2ef158bfc82b3ff72887cf4310d19fab02004d34e5a1def702cfe4", + "typeString": "literal_string \"Resolver: name and value length mismatch\"" + } + ], + "id": 3757, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 4294967278, + 4294967278 + ], + "referencedDeclaration": 4294967278, + "src": "1508:7:8", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 3764, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1508:80:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3765, + "nodeType": "ExpressionStatement", + "src": "1508:80:8" + }, + { + "body": { + "id": 3786, + "nodeType": "Block", + "src": "1640:54:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "baseExpression": { + "id": 3778, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3749, + "src": "1665:4:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + }, + "id": 3780, + "indexExpression": { + "id": 3779, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1670:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1665:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "baseExpression": { + "id": 3781, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3752, + "src": "1674:5:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", + "typeString": "address[] calldata" + } + }, + "id": 3783, + "indexExpression": { + "id": 3782, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1680:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "1674:8:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3777, + "name": "setAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3822, + "src": "1654:10:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 3784, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1654:29:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3785, + "nodeType": "ExpressionStatement", + "src": "1654:29:8" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3773, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3770, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1618:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 3771, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3749, + "src": "1622:4:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[] calldata" + } + }, + "id": 3772, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "1622:11:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "1618:15:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3787, + "initializationExpression": { + "assignments": [ + 3767 + ], + "declarations": [ + { + "constant": false, + "id": 3767, + "mutability": "mutable", + "name": "i", + "nameLocation": "1611:1:8", + "nodeType": "VariableDeclaration", + "scope": 3787, + "src": "1603:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3766, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1603:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3769, + "initialValue": { + "hexValue": "30", + "id": 3768, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1615:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "1603:13:8" + }, + "loopExpression": { + "expression": { + "id": 3775, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "1635:3:8", + "subExpression": { + "id": 3774, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3767, + "src": "1635:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3776, + "nodeType": "ExpressionStatement", + "src": "1635:3:8" + }, + "nodeType": "ForStatement", + "src": "1598:96:8" + } + ] + }, + "functionSelector": "9dddb54d", + "id": 3789, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3755, + "kind": "modifierInvocation", + "modifierName": { + "id": 3754, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "1488:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "1488:9:8" + } + ], + "name": "importAddress", + "nameLocation": "1414:13:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3753, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3749, + "mutability": "mutable", + "name": "name", + "nameLocation": "1447:4:8", + "nodeType": "VariableDeclaration", + "scope": 3789, + "src": "1428:23:8", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_calldata_ptr", + "typeString": "bytes32[]" + }, + "typeName": { + "baseType": { + "id": 3747, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1428:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3748, + "nodeType": "ArrayTypeName", + "src": "1428:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr", + "typeString": "bytes32[]" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3752, + "mutability": "mutable", + "name": "value", + "nameLocation": "1472:5:8", + "nodeType": "VariableDeclaration", + "scope": 3789, + "src": "1453:24:8", + "stateVariable": false, + "storageLocation": "calldata", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_calldata_ptr", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 3750, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1453:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 3751, + "nodeType": "ArrayTypeName", + "src": "1453:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "visibility": "internal" + } + ], + "src": "1427:51:8" + }, + "returnParameters": { + "id": 3756, + "nodeType": "ParameterList", + "parameters": [], + "src": "1498:0:8" + }, + "scope": 3912, + "src": "1405:295:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3821, + "nodeType": "Block", + "src": "1772:214:8", + "statements": [ + { + "assignments": [ + 3799 + ], + "declarations": [ + { + "constant": false, + "id": 3799, + "mutability": "mutable", + "name": "previousValue", + "nameLocation": "1790:13:8", + "nodeType": "VariableDeclaration", + "scope": 3821, + "src": "1782:21:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3798, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1782:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3803, + "initialValue": { + "arguments": [ + { + "id": 3801, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1822:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3800, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "1806:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3802, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1806:21:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1782:45:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3805, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1857:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3806, + "name": "previousValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3799, + "src": "1863:13:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3807, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3793, + "src": "1878:5:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3804, + "name": "AddressChanged", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10288, + "src": "1842:14:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 3808, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1842:42:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3809, + "nodeType": "EmitStatement", + "src": "1837:47:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3811, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1914:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3812, + "name": "previousValue", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3799, + "src": "1920:13:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3813, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3793, + "src": "1935:5:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3810, + "name": "_migrateMobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3911, + "src": "1894:19:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 3814, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1894:47:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3815, + "nodeType": "ExpressionStatement", + "src": "1894:47:8" + }, + { + "expression": { + "arguments": [ + { + "id": 3817, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3791, + "src": "1967:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3818, + "name": "value", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3793, + "src": "1973:5:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3816, + "name": "setAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12715, + 12760 + ], + "referencedDeclaration": 12715, + "src": "1951:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_nonpayable$_t_bytes32_$_t_address_$returns$__$", + "typeString": "function (bytes32,address)" + } + }, + "id": 3819, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1951:28:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3820, + "nodeType": "ExpressionStatement", + "src": "1951:28:8" + } + ] + }, + "functionSelector": "ca446dd9", + "id": 3822, + "implemented": true, + "kind": "function", + "modifiers": [ + { + "id": 3796, + "kind": "modifierInvocation", + "modifierName": { + "id": 3795, + "name": "onlyOwner", + "nodeType": "IdentifierPath", + "referencedDeclaration": 9020, + "src": "1762:9:8" + }, + "nodeType": "ModifierInvocation", + "src": "1762:9:8" + } + ], + "name": "setAddress", + "nameLocation": "1715:10:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3794, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3791, + "mutability": "mutable", + "name": "name", + "nameLocation": "1734:4:8", + "nodeType": "VariableDeclaration", + "scope": 3822, + "src": "1726:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3790, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1726:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3793, + "mutability": "mutable", + "name": "value", + "nameLocation": "1748:5:8", + "nodeType": "VariableDeclaration", + "scope": 3822, + "src": "1740:13:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3792, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1740:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "1725:29:8" + }, + "returnParameters": { + "id": 3797, + "nodeType": "ParameterList", + "parameters": [], + "src": "1772:0:8" + }, + "scope": 3912, + "src": "1706:280:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "public" + }, + { + "baseFunctions": [ + 10251 + ], + "body": { + "id": 3834, + "nodeType": "Block", + "src": "2067:45:8", + "statements": [ + { + "expression": { + "arguments": [ + { + "id": 3831, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3824, + "src": "2100:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3830, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "2084:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3832, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2084:21:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 3829, + "id": 3833, + "nodeType": "Return", + "src": "2077:28:8" + } + ] + }, + "functionSelector": "21f8a721", + "id": 3835, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "getAddress", + "nameLocation": "2001:10:8", + "nodeType": "FunctionDefinition", + "overrides": { + "id": 3826, + "nodeType": "OverrideSpecifier", + "overrides": [], + "src": "2035:8:8" + }, + "parameters": { + "id": 3825, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3824, + "mutability": "mutable", + "name": "name", + "nameLocation": "2020:4:8", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "2012:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3823, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2012:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + } + ], + "src": "2011:14:8" + }, + "returnParameters": { + "id": 3829, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3828, + "mutability": "mutable", + "name": "", + "nameLocation": "-1:-1:-1", + "nodeType": "VariableDeclaration", + "scope": 3835, + "src": "2058:7:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3827, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2058:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2057:9:8" + }, + "scope": 3912, + "src": "1992:120:8", + "stateMutability": "view", + "virtual": false, + "visibility": "external" + }, + { + "body": { + "id": 3910, + "nodeType": "Block", + "src": "2244:512:8", + "statements": [ + { + "assignments": [ + 3849 + ], + "declarations": [ + { + "constant": false, + "id": 3849, + "mutability": "mutable", + "name": "contracts", + "nameLocation": "2272:9:8", + "nodeType": "VariableDeclaration", + "scope": 3910, + "src": "2254:27:8", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2]" + }, + "typeName": { + "baseType": { + "id": 3847, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2254:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "id": 3848, + "length": { + "hexValue": "32", + "id": 3846, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2262:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "nodeType": "ArrayTypeName", + "src": "2254:10:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_storage_ptr", + "typeString": "bytes32[2]" + } + }, + "visibility": "internal" + } + ], + "id": 3853, + "initialValue": { + "components": [ + { + "id": 3850, + "name": "CONTRACT_ESCROW", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8530, + "src": "2285:15:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3851, + "name": "CONTRACT_MOBIUS", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8527, + "src": "2301:15:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "id": 3852, + "isConstant": false, + "isInlineArray": true, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "TupleExpression", + "src": "2284:33:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2] memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2254:63:8" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 3859, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3854, + "name": "previousAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3839, + "src": "2331:15:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 3857, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2358:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3856, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2350:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3855, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2350:7:8", + "typeDescriptions": {} + } + }, + "id": 3858, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2350:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2331:29:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3861, + "nodeType": "IfStatement", + "src": "2327:42:8", + "trueBody": { + "functionReturnParameters": 3843, + "id": 3860, + "nodeType": "Return", + "src": "2362:7:8" + } + }, + { + "assignments": [ + 3863 + ], + "declarations": [ + { + "constant": false, + "id": 3863, + "mutability": "mutable", + "name": "mobiusToken", + "nameLocation": "2386:11:8", + "nodeType": "VariableDeclaration", + "scope": 3910, + "src": "2378:19:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3862, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2378:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "id": 3867, + "initialValue": { + "arguments": [ + { + "id": 3865, + "name": "CONTRACT_MOBIUS_TOKEN", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 8545, + "src": "2416:21:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 3864, + "name": "getAddressValue", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 12742, + 12791 + ], + "referencedDeclaration": 12742, + "src": "2400:15:8", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32) view returns (address)" + } + }, + "id": 3866, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2400:38:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2378:60:8" + }, + { + "condition": { + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 3873, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3868, + "name": "mobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3863, + "src": "2452:11:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "arguments": [ + { + "hexValue": "30", + "id": 3871, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2475:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + } + ], + "id": 3870, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "ElementaryTypeNameExpression", + "src": "2467:7:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_address_$", + "typeString": "type(address)" + }, + "typeName": { + "id": 3869, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2467:7:8", + "typeDescriptions": {} + } + }, + "id": 3872, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2467:10:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "2452:25:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3875, + "nodeType": "IfStatement", + "src": "2448:38:8", + "trueBody": { + "functionReturnParameters": 3843, + "id": 3874, + "nodeType": "Return", + "src": "2479:7:8" + } + }, + { + "body": { + "id": 3908, + "nodeType": "Block", + "src": "2542:208:8", + "statements": [ + { + "condition": { + "commonType": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "id": 3891, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3887, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3837, + "src": "2560:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "BinaryOperation", + "operator": "!=", + "rightExpression": { + "baseExpression": { + "id": 3888, + "name": "contracts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3849, + "src": "2568:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2] memory" + } + }, + "id": 3890, + "indexExpression": { + "id": 3889, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3877, + "src": "2578:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2568:12:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "src": "2560:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3893, + "nodeType": "IfStatement", + "src": "2556:34:8", + "trueBody": { + "id": 3892, + "nodeType": "Continue", + "src": "2582:8:8" + } + }, + { + "expression": { + "arguments": [ + { + "id": 3898, + "name": "previousAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3839, + "src": "2638:15:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3899, + "name": "newAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3841, + "src": "2655:10:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "arguments": [ + { + "id": 3895, + "name": "mobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3863, + "src": "2617:11:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3894, + "name": "IMobiusToken", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10197, + "src": "2604:12:8", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_IMobiusToken_$10197_$", + "typeString": "type(contract IMobiusToken)" + } + }, + "id": 3896, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2604:25:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_contract$_IMobiusToken_$10197", + "typeString": "contract IMobiusToken" + } + }, + "id": 3897, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "migrate", + "nodeType": "MemberAccess", + "referencedDeclaration": 10196, + "src": "2604:33:8", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_address_$_t_address_$returns$_t_bool_$", + "typeString": "function (address,address) external returns (bool)" + } + }, + "id": 3900, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2604:62:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3901, + "nodeType": "ExpressionStatement", + "src": "2604:62:8" + }, + { + "eventCall": { + "arguments": [ + { + "id": 3903, + "name": "name", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3837, + "src": "2705:4:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "id": 3904, + "name": "previousAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3839, + "src": "2711:15:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + { + "id": 3905, + "name": "newAddress", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3841, + "src": "2728:10:8", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + }, + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 3902, + "name": "MobiusTokenMigrated", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 10296, + "src": "2685:19:8", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$_t_address_$_t_address_$returns$__$", + "typeString": "function (bytes32,address,address)" + } + }, + "id": 3906, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2685:54:8", + "tryCall": false, + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 3907, + "nodeType": "EmitStatement", + "src": "2680:59:8" + } + ] + }, + "condition": { + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 3883, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "id": 3880, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3877, + "src": "2515:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "expression": { + "id": 3881, + "name": "contracts", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3849, + "src": "2519:9:8", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_bytes32_$2_memory_ptr", + "typeString": "bytes32[2] memory" + } + }, + "id": 3882, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "src": "2519:16:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2515:20:8", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 3909, + "initializationExpression": { + "assignments": [ + 3877 + ], + "declarations": [ + { + "constant": false, + "id": 3877, + "mutability": "mutable", + "name": "i", + "nameLocation": "2508:1:8", + "nodeType": "VariableDeclaration", + "scope": 3909, + "src": "2500:9:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 3876, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2500:7:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "visibility": "internal" + } + ], + "id": 3879, + "initialValue": { + "hexValue": "30", + "id": 3878, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2512:1:8", + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "2500:13:8" + }, + "loopExpression": { + "expression": { + "id": 3885, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "2537:3:8", + "subExpression": { + "id": 3884, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 3877, + "src": "2537:1:8", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 3886, + "nodeType": "ExpressionStatement", + "src": "2537:3:8" + }, + "nodeType": "ForStatement", + "src": "2495:255:8" + } + ] + }, + "id": 3911, + "implemented": true, + "kind": "function", + "modifiers": [], + "name": "_migrateMobiusToken", + "nameLocation": "2127:19:8", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 3842, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3837, + "mutability": "mutable", + "name": "name", + "nameLocation": "2164:4:8", + "nodeType": "VariableDeclaration", + "scope": 3911, + "src": "2156:12:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 3836, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2156:7:8", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3839, + "mutability": "mutable", + "name": "previousAddress", + "nameLocation": "2186:15:8", + "nodeType": "VariableDeclaration", + "scope": 3911, + "src": "2178:23:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3838, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2178:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + }, + { + "constant": false, + "id": 3841, + "mutability": "mutable", + "name": "newAddress", + "nameLocation": "2219:10:8", + "nodeType": "VariableDeclaration", + "scope": 3911, + "src": "2211:18:8", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 3840, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2211:7:8", + "stateMutability": "nonpayable", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "visibility": "internal" + } + ], + "src": "2146:89:8" + }, + "returnParameters": { + "id": 3843, + "nodeType": "ParameterList", + "parameters": [], + "src": "2244:0:8" + }, + "scope": 3912, + "src": "2118:638:8", + "stateMutability": "nonpayable", + "virtual": false, + "visibility": "private" + } + ], + "scope": 3913, + "src": "202:2556:8", + "usedErrors": [] + } + ], + "src": "32:2727:8" + }, + "compiler": { + "name": "solc", + "version": "0.8.4+commit.c7e474f2.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "3.4.3", + "updatedAt": "2021-11-09T08:27:51.715Z", + "devdoc": { + "kind": "dev", + "methods": {}, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + } +} \ No newline at end of file diff --git a/projects/mobiusfinance/abis/am3CrvmoUSDPool.json b/projects/mobiusfinance/abis/am3CrvmoUSDPool.json new file mode 100644 index 0000000000..761ced3d57 --- /dev/null +++ b/projects/mobiusfinance/abis/am3CrvmoUSDPool.json @@ -0,0 +1,34 @@ +{ + "abi": [{ + "inputs": [], + "name": "get_virtual_price", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }] +} \ No newline at end of file diff --git a/projects/mobiusfinance/index.js b/projects/mobiusfinance/index.js index 077eda9f93..f46d595863 100644 --- a/projects/mobiusfinance/index.js +++ b/projects/mobiusfinance/index.js @@ -1,16 +1,94 @@ const utils = require('../helper/utils'); -async function polygon() { - const tvl = await utils.fetchURL('https://api.mobius.finance/tvl/') - return tvl.data +const ethers = require('ethers'); +const formatBytes32String = require('ethers').utils.formatBytes32String; +const cfg = require('./utilities/cfg'); +const {bigNumberify,expandTo18Decimals, expandTo16Decimals} = require('./utilities/utilities'); + +const ResolverJson = require('./abis/Resolver.json').abi; +const AssetPriceJson = require('./abis/AssetPrice.json').abi; +const IERC20Json = require('./abis/IERC20.json').abi; +const am3CrvmoUSDPoolJson = require('./abis/am3CrvmoUSDPool.json').abi; + +const provider = new ethers.providers.JsonRpcProvider("https://polygon-rpc.com/"); +const Resolver = new ethers.Contract(cfg.ResolverAddr, ResolverJson, provider); + +var http = require("http"); + +let TVL = 0; + + + +async function polygon() { + let TMP = bigNumberify(0); + let AssetPriceAddr = await Resolver.getAddress(formatBytes32String("AssetPrice")); + let AssetPrice = new ethers.Contract(AssetPriceAddr, AssetPriceJson, provider); + + let MobiusAddr = await Resolver.getAddress(formatBytes32String("Mobius")); + let Collaterals = await Resolver.getAssets(formatBytes32String("Stake")); + let MOTAddr; + let MOTPrice; + for (let i = 0;i < Collaterals.length;i++){ + let r = await Resolver.getAsset(formatBytes32String("Stake"),Collaterals[i]); + if (!r[0]) { + continue; + } + + let tokenStaked + if (r[1] == "0x0000000000000000000000000000000000000000") { + tokenStaked = await provider.getBalance(MobiusAddr); + } else { + let token = new ethers.Contract(r[1], IERC20Json, provider); + tokenStaked = await token.balanceOf(MobiusAddr); + } + + let tokenPrice = await AssetPrice.getPrice(Collaterals[i]); + TMP = TMP.add(tokenStaked.mul(tokenPrice).div(expandTo18Decimals(1))); + + + if (Collaterals[i] == formatBytes32String("MOT")) { + MOTAddr = r[1]; + MOTPrice = tokenPrice; + } + } + + //MOT-USDT LP + let MOTUSDTPOOL = new ethers.Contract(cfg.MOTUSDTLPAddr, IERC20Json, provider); + let USDT = new ethers.Contract(cfg.USDTAddr, IERC20Json, provider); + let MOT = new ethers.Contract(MOTAddr, IERC20Json, provider); + + let RewardStakeingAddr = await Resolver.getAddress(formatBytes32String("RewardStaking")); + let TotalLP = await MOTUSDTPOOL.totalSupply(); + let LPStaked = await MOTUSDTPOOL.balanceOf(RewardStakeingAddr); + let MOTStakedValue = (await MOT.balanceOf(cfg.MOTUSDTLPAddr)).mul(MOTPrice).div(expandTo18Decimals(1)); + let USDTStakedValue = (await USDT.balanceOf(cfg.MOTUSDTLPAddr)).mul(bigNumberify(10).pow(12)) + + + TMP = TMP.add( + (MOTStakedValue.add(USDTStakedValue)).mul(LPStaked).div(TotalLP) + ); + + //moUSD-am3CRV LP + let am3CrvmoUSDPool = new ethers.Contract(cfg.am3CRVmoUSDLPAddr,am3CrvmoUSDPoolJson,provider); + LPStaked = await am3CrvmoUSDPool.balanceOf(RewardStakeingAddr); + let LPPrice = await am3CrvmoUSDPool.get_virtual_price(); + + TMP = TMP.add( + LPStaked.mul(LPPrice).div(expandTo18Decimals(1)) + ); + + TVL = TMP.div(expandTo18Decimals(1)).toNumber(); + return TVL; } async function fetch() { - return await polygon() -} + return await polygon() + } + + module.exports = { - polygon:{ +polygon:{ fetch:polygon - }, - fetch -} \ No newline at end of file +}, +fetch +} diff --git a/projects/mobiusfinance/utilities/cfg.js b/projects/mobiusfinance/utilities/cfg.js new file mode 100644 index 0000000000..3db33d157e --- /dev/null +++ b/projects/mobiusfinance/utilities/cfg.js @@ -0,0 +1,7 @@ +module.exports = +{ + ResolverAddr : "0x1E02cdbbA6729B6470de81Ad4D2cCA4c514521b9", + MOTUSDTLPAddr : "0x49d8136336e3feb7128c12172ae5ff78238a88be", + USDTAddr : "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + am3CRVmoUSDLPAddr : "0x162b21ba1a90dd9384c615192fa4053217d2a8db" +} \ No newline at end of file diff --git a/projects/mobiusfinance/utilities/utilities.js b/projects/mobiusfinance/utilities/utilities.js new file mode 100644 index 0000000000..802451bec0 --- /dev/null +++ b/projects/mobiusfinance/utilities/utilities.js @@ -0,0 +1,61 @@ +const https = require('https'); +const BigNumber = require('ethers').BigNumber; + +function bigNumberify(n){ + return BigNumber.from(n); +} + +exports.bigNumberify = bigNumberify; + +exports.expandTo18Decimals = function(n) { + return bigNumberify(n).mul(bigNumberify(10).pow(18)) +} + +exports.expandTo16Decimals = function(n) { + return bigNumberify(n).mul(bigNumberify(10).pow(16)) +} + + +exports.doRequest = function(url) { + return new Promise((resolve, reject) => { + const req = https.request(url, (res) => { + res.setEncoding('utf8'); + let responseBody = ''; + + res.on('data', (chunk) => { + responseBody += chunk; + }); + + res.on('end', () => { + resolve(responseBody); + }); + }); + + req.on('error', (err) => { + reject(err); + }); + req.end(); + }); +} + +exports.doRequestPost = function(host,path,data) { + return new Promise((resolve, reject) => { + const req = https.request({host:host,path:path,method:'post'}, (res) => { + res.setEncoding('utf8'); + let responseBody = ''; + + res.on('data', (chunk) => { + responseBody += chunk; + }); + + res.on('end', () => { + resolve(responseBody); + }); + }); + req.write(data); + req.on('error', (err) => { + reject(err); + }); + req.end(); + }); +} \ No newline at end of file From 6ea2dff3323d6d8d39d90b1fe4f6f907320e5542 Mon Sep 17 00:00:00 2001 From: skyge <1506186404li@gmail.com> Date: Mon, 6 Dec 2021 16:18:07 +0800 Subject: [PATCH 193/393] :fire: Delete: Clean code. --- projects/dforce/index.js | 188 --------------------------------------- 1 file changed, 188 deletions(-) diff --git a/projects/dforce/index.js b/projects/dforce/index.js index 1669d6e3f8..3b18611f7f 100644 --- a/projects/dforce/index.js +++ b/projects/dforce/index.js @@ -11,180 +11,36 @@ /*================================================== Ethereum Settings ==================================================*/ - const BUSD = '0x4Fabb145d64652a948d72533023f6E7A623C7C53'; const DAI = '0x6B175474E89094C44Da98b954EedeAC495271d0F'; - const DF = '0x431ad2ff6a9C365805eBaD47Ee021148d6f7DBe0'; - const ETH = "0x0000000000000000000000000000000000000000"; - const GOLDx= '0x355C665e101B9DA58704A8fDDb5FeeF210eF20c0'; - const HUSD = '0xdF574c24545E5FfEcb9a659c229253D4111d87e1'; - const HBTC = '0x0316EB71485b0Ab14103307bf65a021042c6d380'; const PAX = '0x8E870D67F660D95d5be530380D0eC0bd388289E1'; - const UNI = '0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984'; const TUSD = '0x0000000000085d4780B73119b644AE5ecd22b376'; const USDC = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; const USDT = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; const USDx = '0xeb269732ab75A6fD61Ea60b06fE994cD32a83549'; - const wETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'; - const WBTC = '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599'; - const USX = '0x0a5E677a6A24b2F1A2Bf4F3bFfC443231d2fDEc8'; - const EUX = '0xb986F3a2d91d3704Dc974A24FB735dCc5E3C1E70'; - const xBTC = '0x527Ec46Ac094B399265d1D71Eff7b31700aA655D'; - const xETH = '0x8d2Cb35893C01fa8B564c84Bd540c5109d9D278e'; - const xTSLA = '0x8dc6987F7D8E5aE9c39F767A324C5e46C1f731eB'; - const xAAPL = '0xc4Ba45BeE9004408403b558a26099134282F2185'; - const xAMZN = '0x966E726853Ca97449F458A3B012318a08B508202'; - const xCOIN = '0x32F9063bC2A2A57bCBe26ef662Dc867d5e6446d1'; - const LINK = '0x514910771AF9Ca656af840dff83E8264EcF986CA'; - const MKR = '0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2'; /*================================================== USDx ==================================================*/ - const usdxReservedTokens = [PAX, TUSD, USDC]; const dUSDC = '0x16c9cF62d8daC4a38FB50Ae5fa5d51E9170F3179'; const usdxPool = '0x7FdcDAd3b4a67e00D9fD5F22f4FD89a5fa4f57bA' // USDx Stablecoin Pool - /*================================================== GOLDx Protocol ==================================================*/ goldxReserve = '0x45804880De22913dAFE09f4980848ECE6EcbAf78' // PAXG goldxProtocol = '0x355C665e101B9DA58704A8fDDb5FeeF210eF20c0' // GOLDx -/*================================================== - iToken Lending Protocol - ==================================================*/ - const lendingMarkets = [ - '0x24677e213DeC0Ea53a430404cF4A11a6dc889FCe', // iBUSD - '0x298f243aD592b6027d4717fBe9DeCda668E3c3A8', // iDAI - '0xb3dc7425e63E1855Eb41107134D471DD34d7b239', // iDF - '0x5ACD75f21659a59fFaB9AEBAf350351a8bfaAbc0', // iETH - '0x164315EA59169D46359baa4BcC6479bB421764b6', // iGOLDx - '0x47566acD7af49D2a192132314826ed3c3c5f3698', // iHBTC - '0xbeC9A824D6dA8d0F923FD9fbec4FAA949d396320', // iUNI - '0x2f956b2f801c6dad74E87E7f45c94f6283BF0f45', // iUSDC - '0x1180c114f7fAdCB6957670432a3Cf8Ef08Ab5354', // iUSDT - '0x5812fCF91adc502a765E5707eBB3F36a07f63c02', // iWBTC - '0x1AdC34Af68e970a93062b67344269fD341979eb0', // iUSX - '0x44c324970e5CbC5D4C3F3B7604CbC6640C2dcFbF', // iEUX - '0x4013e6754634ca99aF31b5717Fa803714fA07B35', // ixBTC - '0x237C69E082A94d37EBdc92a84b58455872e425d6', // ixETH - '0x039E7Ef6a674f3EC1D88829B8215ED45385c24bc', // iMKR - '0x6E6a689a5964083dFf9FD7A0f788BAF620ea2DBe', // iTUSD - '0xA3068AA78611eD29d381E640bb2c02abcf3ca7DE', // iLINK - ] - /*================================================== BSC Settings ==================================================*/ - const BSC_ADA = '0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47'; - const BSC_ATOM = '0x0Eb3a705fc54725037CC9e008bDede697f62F335'; - const BSC_BTCB = '0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c'; const BSC_BUSD = '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56'; const BSC_DAI = '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3'; - const BSC_DF = '0x4A9A2b2b04549C3927dd2c9668A5eF3fCA473623'; - const BSC_DOT = '0x7083609fce4d1d8dc0c979aab8c869ea2c873402'; - const BSC_ETH = '0x2170ed0880ac9a755fd29b2688956bd959f933f8'; - const BSC_FIL = '0x0d8ce2a99bb6e3b7db580ed848240e4a0f9ae153'; - const BSC_GOLDx= '0xA05478B34Fad86cC86F07EB6698c69EA60B266E3'; - const BSC_UNI = '0xbf5140a22578168fd562dccf235e5d43a02ce9b1'; const BSC_USDC = '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d'; const BSC_USDT = '0x55d398326f99059fF775485246999027B3197955'; - const BSC_USX = '0xB5102CeE1528Ce2C760893034A4603663495fD72'; - const BSC_EUX = '0x367c17D19fCd0f7746764455497D63c8e8b2BbA3'; - const BSC_xBTC = '0x20Ecc92F0a33e16e8cf0417DFc3F586cf597F3a9'; - const BSC_xETH = '0x463E3D1e01D048FDf872710F7f3745B5CDF50D0E'; - const BSC_xTSLA = '0xf21259B517D307F0dF8Ff3D3F53cF1674EBeAFe8'; - const BSC_xAAPL = '0x70D1d7cDeC24b16942669A5fFEaDA8527B744502'; - const BSC_xAMZN = '0x0326dA9E3fA36F946CFDC87e59D24B45cbe4aaD0'; - const BSC_xCOIN = '0x3D9a9ED8A28A64827A684cEE3aa499da1824BF6c'; - const BSC_XRP = '0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE'; - const BSC_LTC = '0x4338665CBB7B2485A8855A139b75D5e34AB0DB94'; - const BSC_LINK = '0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD'; - const BSC_CAKE = '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82'; - const BSC_BCH = '0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf'; - const BSC_XTZ = '0x16939ef78684453bfDFb47825F8a5F714f12623a'; - -/*================================================== - BSC iToken Lending Protocol - ==================================================*/ - const bscLendingMarkets = [ - '0xFc5Bb1E8C29B100Ef8F12773f972477BCab68862', // iADA - '0x55012aD2f0A50195aEF44f403536DF2465009Ef7', // iATOM - '0xd57E1425837567F74A35d07669B23Bfb67aA4A93', // iBNB - '0x5511b64Ae77452C7130670C79298DEC978204a47', // iBUSD - '0x0b66A250Dadf3237DdB38d485082a7BfE400356e', // iBTC - '0xAD5Ec11426970c32dA48f58c92b1039bC50e5492', // iDAI - '0xeC3FD540A2dEE6F479bE539D64da593a59e12D08', // iDF - '0x9ab060ba568B86848bF19577226184db6192725b', // iDOT - '0x390bf37355e9dF6Ea2e16eEd5686886Da6F47669', // iETH - '0xD739A569Ec254d6a20eCF029F024816bE58Fb810', // iFIL - '0xc35ACAeEdB814F42B2214378d8950F8555B2D670', // iGOLDx - '0xee9099C1318cf960651b3196747640EB84B8806b', // iUNI - '0xAF9c10b341f55465E8785F0F81DBB52a9Bfe005d', // iUSDC - '0x0BF8C72d618B5d46b055165e21d661400008fa0F', // iUSDT - '0x7B933e1c1F44bE9Fb111d87501bAADA7C8518aBe', // iUSX - '0x983A727Aa3491AB251780A13acb5e876D3f2B1d8', // iEUX - '0x219B850993Ade4F44E24E6cac403a9a40F1d3d2E', // ixBTC - '0xF649E651afE5F05ae5bA493fa34f44dFeadFE05d', // ixETH - '0x6D64eFfe3af8697336Fc57efD5A7517Ad526Dd6d', // iXRP - '0xd957BEa67aaDb8a72061ce94D033C631D1C1E6aC', // iLTC - '0x50E894894809F642de1E11B4076451734c963087', // iLINK - '0xeFae8F7AF4BaDa590d4E707D900258fc72194d73', // iCAKE - '0x9747e26c5Ad01D3594eA49ccF00790F564193c15', // iBCH - '0x8be8cd81737b282C909F1911f3f0AdE630c335AA', // iXTZ - ] - - /*================================================== - BSC Synth Markets - ==================================================*/ - const bscAllSynthMarkets = [ - BSC_USX, - BSC_EUX, - BSC_xBTC, - BSC_xETH, - BSC_xTSLA, - BSC_xAAPL, - BSC_xAMZN, - BSC_xCOIN, - ] - -/*================================================== - Arbitrum Settings - ==================================================*/ - const Arbitrum_WBTC = '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f'; - const Arbitrum_ETH = "0x0000000000000000000000000000000000000000"; - const Arbitrum_USDC = '0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8'; - const Arbitrum_USDT = '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9'; - const Arbitrum_UNI = '0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0'; - const Arbitrum_LINK = '0xf97f4df75117a78c1A5a0DBb814Af92458539FB4'; - const Arbitrum_USX = '0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb'; - const Arbitrum_EUX = '0xC2125882318d04D266720B598d620f28222F3ABd'; -/*================================================== - Arbitrum iToken Lending Protocol - ==================================================*/ - const ArbitrumLendingMarkets = [ - '0xEe338313f022caee84034253174FA562495dcC15', // iETH - '0x013ee4934ecbFA5723933c4B08EA5E47449802C8', // iLINK - '0x46Eca1482fffb61934C4abCA62AbEB0b12FEb17A', // iUNI - '0x8dc3312c68125a94916d62B97bb5D925f84d4aE0', // iUSDC - '0xf52f079Af080C9FB5AFCA57DDE0f8B83d49692a9', // iUSDT - '0xD3204E4189BEcD9cD957046A8e4A643437eE0aCC', // iWBTC - '0x5675546Eb94c2c256e6d7c3F7DcAB59bEa3B0B8B', // iEUX - '0x0385F851060c09A552F1A28Ea3f612660256cBAA', // iUSX - ] - -/*================================================== - Arbitrum Synth Markets - ==================================================*/ - const arbitrumAllSynthMarkets = [ - Arbitrum_USX, - Arbitrum_EUX, - ] let oracles = { "ethereum": "0x34BAf46eA5081e3E49c29fccd8671ccc51e61E79", @@ -236,29 +92,6 @@ let yieldUnderlyingTokens = { } } -let allSynthMarkets = { - "ethereum": [ - USX, - EUX, - xBTC, - xETH, - xTSLA, - xAAPL, - xAMZN, - xCOIN, - ], - "bsc": [ - BSC_USX, - BSC_EUX, - BSC_xBTC, - BSC_xETH, - BSC_xTSLA, - BSC_xAAPL, - BSC_xAMZN, - BSC_xCOIN, - ], -} - /*================================================== TVL ==================================================*/ @@ -434,27 +267,6 @@ async function getTVLOfdToken(chain, block) { }; } -async function getTVLOfSynthMarket(chain, block) { - let synthMarketBalances = {}; - let SynthMarketTVL = BigNumber("0"); - - let synthMarkets = allSynthMarkets[chain]; - - await Promise.all( - synthMarkets.map(async synthMarket => { - let { - convertedBalance: synthMarketTotalSupply, - tvl: synthMarketTVL - } = await getTVLByTotalSupply(chain, synthMarket, block); - - synthMarketBalances[synthMarket] = synthMarketTotalSupply; - SynthMarketTVL = SynthMarketTVL.plus(synthMarketTVL); - }) - ); - - return {synthMarketBalances,SynthMarketTVL}; -} - async function getTVLByChain(chain, block) { let balances = {}; let tvl = BigNumber("0"); From 04e5b9ea97634bbcb6a9f4379f13a3b9e6fd32ff Mon Sep 17 00:00:00 2001 From: skyge <1506186404li@gmail.com> Date: Mon, 6 Dec 2021 16:19:09 +0800 Subject: [PATCH 194/393] :sparkles: Add: Add assets on optimism network. --- projects/dforce/index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/projects/dforce/index.js b/projects/dforce/index.js index 3b18611f7f..c5503582e9 100644 --- a/projects/dforce/index.js +++ b/projects/dforce/index.js @@ -46,6 +46,7 @@ let oracles = { "ethereum": "0x34BAf46eA5081e3E49c29fccd8671ccc51e61E79", "bsc": "0x7DC17576200590C4d0D8d46843c41f324da2046C", "arbitrum": "0xc3FeD5f21EB8218394f968c86CDafc66e30e259A", + "optimism": "0x4f9312A21F8853384E0f6141F3F9fB855d860161", } let allControllers = { @@ -60,6 +61,7 @@ let allControllers = { "0x6d290f45A280A688Ff58d095de480364069af110" // liqee general pool ], "arbitrum": ["0x8E7e9eA9023B81457Ae7E6D2a51b003D421E5408"], + "optimism": ["0xA300A84D8970718Dac32f54F61Bd568142d8BCF4"], } let yieldMarkets = { @@ -328,6 +330,10 @@ async function arbitrum(timestamp, ethBlock, chainBlocks) { return getTVLByChain('arbitrum', chainBlocks['arbitrum']); } +async function optimism(timestamp, ethBlock, chainBlocks) { + return getTVLByChain('optimism', chainBlocks['optimism']); +} + module.exports = { ethereum:{ tvl: ethereum @@ -338,6 +344,9 @@ module.exports = { arbitrum:{ tvl: arbitrum }, + optimism: { + tvl: optimism + }, start: 1564165044, // Jul-27-2019 02:17:24 AM +UTC - tvl: sdk.util.sumChainTvls([ethereum, bsc, arbitrum]) + tvl: sdk.util.sumChainTvls([ethereum, bsc, arbitrum, optimism]) } From 208b35bf9fe85442d4f5947fb57530cc2253aff6 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 08:49:40 +0000 Subject: [PATCH 195/393] update wannaswap --- projects/wannaswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/wannaswap/index.js b/projects/wannaswap/index.js index cc26faf944..8dec856b6c 100644 --- a/projects/wannaswap/index.js +++ b/projects/wannaswap/index.js @@ -1,4 +1,4 @@ -const {calculateUsdUniTvl} = require('./helper/getUsdUniTvl'); +const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl'); const { staking } = require('../helper/staking.js'); module.exports = { From a4a650b20bfd0ce9be51c827c9cad9a48040239a Mon Sep 17 00:00:00 2001 From: freelife2010 Date: Mon, 6 Dec 2021 01:27:55 -0800 Subject: [PATCH 196/393] Add Drops adapter --- projects/drops/constants.js | 27 +++ projects/drops/index.js | 122 ++++++++++++-- projects/drops/utils.js | 13 ++ test.js | 322 ++++++++++++++++++++---------------- 4 files changed, 324 insertions(+), 160 deletions(-) create mode 100644 projects/drops/constants.js create mode 100644 projects/drops/utils.js diff --git a/projects/drops/constants.js b/projects/drops/constants.js new file mode 100644 index 0000000000..3bcbcd855b --- /dev/null +++ b/projects/drops/constants.js @@ -0,0 +1,27 @@ +const Pools = [ + { + id: 0, + symbol: "DOP-ETH", + label: "DOP/ETH", + lpToken: "0x00aa1c57e894c4010fe44cb840ae56432d7ea1d1", + type: "LP", + }, + { + id: 1, + symbol: "NDR", + label: "NDR", + lpToken: "0x739763a258640919981F9bA610AE65492455bE53", + type: "SINGLE", + }, +]; + +const tokensAddress = { + masterchef: "0x8A78011bf2c42df82cC05F198109Ea024B554df9", + dop_Ether: "0x00aa1c57e894c4010fe44cb840ae56432d7ea1d1", + NDR: "0x739763a258640919981F9bA610AE65492455bE53", + Comp: "0x6bB61215298F296C55b19Ad842D3Df69021DA2ef", +}; + +const infuraKey = "74d05a47b2814d4da023f4839fafbe9b"; + +module.exports = { Pools, tokensAddress, infuraKey }; diff --git a/projects/drops/index.js b/projects/drops/index.js index 87fae6f340..8364ae62c6 100644 --- a/projects/drops/index.js +++ b/projects/drops/index.js @@ -1,26 +1,120 @@ -// const Web3 = require('web3'); -// const BigNumber = require('bignumber.js'); +const BigNumber = require("bignumber.js"); const utils = require("../helper/utils"); -// const { getContractInstance } = require('../config/eurxb/utils.js'); -const masterchefABI = require("./abis/masterchef.json"); -const dop_Ether = "0x00aa1c57e894c4010fe44cb840ae56432d7ea1d1"; -const NDR = "0x739763a258640919981F9bA610AE65492455bE53"; -const masterchef = "0x8A78011bf2c42df82cC05F198109Ea024B554df9"; +const { Pools, tokensAddress } = require("./constants.js"); +const { getContractInstance } = require("./utils.js"); -// const web3 = new Web3(new Web3.providers.HttpProvider(`https://mainnet.infura.io/v3/${process.env.ETHEREUM_RPC}`)) +const masterchefABI = require("./abis/masterchef.json"); +const lptokenABI = require("./abis/lpToken.json"); +const erc20TokenABI = require("./abis/ERC20.json"); const staking = async () => { - // const masterchefContract = await getContractInstance(masterchefABI, masterchef); - // const poolLength = await masterchefContract.methods.poolLength().call(); - // console.log('poolLength', poolLength) - return 0; + let stakingTVL = new BigNumber(0); + const fromWei = (value, decimals = 18) => + decimals < 18 + ? new BigNumber(value).div(10 ** decimals).toFixed(decimals, 0) + : new BigNumber(value).div(10 ** 18).toString(10); + + const masterchefContract = await getContractInstance( + masterchefABI, + tokensAddress.masterchef + ); + const { poolLength, poolInfo } = masterchefContract.methods; + + const length = await poolLength().call(); + const poolInfos = []; + const res = await utils.getTokenPricesFromString(tokensAddress.Comp); + const dopPrice = res.data + ? res.data[tokensAddress.Comp.toLowerCase()].usd + : 0; + + for (let i = 0; i < length; i += 1) { + let _info = await poolInfo(i).call(); + poolInfos.push({ ..._info, poolId: i }); + } + for (let j = 0; j < poolInfos.length; j += 1) { + let _totalLp; + let _reserves; + let _token0; + let _token1; + let totalLpSupply; + let info = poolInfos[j]; + + const pool = Pools.find( + (pool) => pool.lpToken.toLowerCase() === info.lpToken.toLowerCase() + ); + if (!pool) return resolve(null); + const poolType = pool.type; + let methods; + + if (poolType === "LP") { + const lpTokenContract = await getContractInstance( + lptokenABI, + info.lpToken + ); + methods = lpTokenContract.methods; + _totalLp = await methods.totalSupply().call(); + _reserves = await methods.getReserves().call(); + _token0 = await methods.token0().call(); + _token1 = await methods.token1().call(); + totalLpSupply = await methods.balanceOf(tokensAddress.masterchef).call(); + } else { + const erc20TokenContract = await getContractInstance( + erc20TokenABI, + info.lpToken + ); + methods = erc20TokenContract.methods; + _totalLp = await methods.totalSupply().call(); + _reserves = "0"; + const res = await utils.getTokenPricesFromString(info.lpToken); + _token0 = res.data ? res.data[info.lpToken.toLowerCase()].usd : 0; + _token1 = await methods.decimals().call(); + totalLpSupply = await methods.balanceOf(tokensAddress.masterchef).call(); + } + + let totalLocked = new BigNumber(0); + let isLp = _reserves !== "0"; + const tokenDecimal = isLp ? 18 : _token1; + let tokenPrice = _token0 === "0" ? 1 : Number(_token0); + + if (isLp) { + if (_token0.toLowerCase() === tokensAddress.Comp.toLowerCase()) { + totalLocked = new BigNumber(_reserves._reserve0) + .div(1e18) + .times(2) + .times(dopPrice); + } else { + totalLocked = new BigNumber(_reserves._reserve1) + .div(1e18) + .times(2) + .times(dopPrice); + } + tokenPrice = new BigNumber(totalLocked) + .div(new BigNumber(_totalLp).div(10 ** 18)) + .toNumber(); + } else { + totalLocked = new BigNumber(totalLpSupply) + .div(10 ** tokenDecimal) + .times(tokenPrice); + } + const result = { + ...(Pools.find((pool) => pool.id === info.poolId) || {}), + ...info, + totalLp: fromWei(_totalLp, tokenDecimal), + totalLpSupply: fromWei(totalLpSupply, tokenDecimal), + lpPrice: tokenPrice, + }; + stakingTVL = stakingTVL.plus( + new BigNumber(result.totalLpSupply).times(result.lpPrice) + ); + } + return stakingTVL.toString(10); }; const fetch = async () => { var res = await utils.fetchURL("https://drops.co/status"); - // const stakingTVL = await staking() - return res.data ? res.data.totalSupply : 0; + const stakingTVL = await staking(); + return res.data ? new BigNumber(res.data.totalSupply).plus(stakingTVL) : 0; }; module.exports = { diff --git a/projects/drops/utils.js b/projects/drops/utils.js new file mode 100644 index 0000000000..0513b31150 --- /dev/null +++ b/projects/drops/utils.js @@ -0,0 +1,13 @@ +const Web3 = require("web3"); +const { infuraKey } = require("./constants.js"); +const web3 = new Web3( + new Web3.providers.HttpProvider(`https://mainnet.infura.io/v3/${infuraKey}`) +); + +const getContractInstance = (abi, address) => { + const abiFromJson = JSON.parse(JSON.stringify(abi)); + const instance = new web3.eth.Contract(abiFromJson, address); + return instance; +}; + +module.exports = { getContractInstance }; diff --git a/test.js b/test.js index 808e187d2d..41a7bdc291 100644 --- a/test.js +++ b/test.js @@ -1,189 +1,219 @@ #!/usr/bin/env node const path = require("path"); -require('dotenv').config(); +require("dotenv").config(); const { default: computeTVL } = require("@defillama/sdk/build/computeTVL"); const { chainsForBlocks } = require("@defillama/sdk/build/computeTVL/blocks"); const { getLatestBlock } = require("@defillama/sdk/build/util/index"); -const { humanizeNumber } = require("@defillama/sdk/build/computeTVL/humanizeNumber"); +const { + humanizeNumber, +} = require("@defillama/sdk/build/computeTVL/humanizeNumber"); const { util } = require("@defillama/sdk"); async function getLatestBlockRetry(chain) { - for (let i = 0; i < 5; i++) { - try { - return await getLatestBlock(chain); - } catch (e) { - throw new Error(`Couln't get block heights for chain "${chain}"`, e) - } - } + // for (let i = 0; i < 5; i++) { + // try { + // return await getLatestBlock(chain); + // } catch (e) { + // throw new Error(`Couln't get block heights for chain "${chain}"`, e) + // } + // } + return 100000; } const locks = []; function getCoingeckoLock() { - return new Promise((resolve) => { - locks.push(resolve); - }); + return new Promise((resolve) => { + locks.push(resolve); + }); } function releaseCoingeckoLock() { - const firstLock = locks.shift(); - if (firstLock !== undefined) { - firstLock(null); - } + const firstLock = locks.shift(); + if (firstLock !== undefined) { + firstLock(null); + } } // Rate limit is 50 calls/min for coingecko's API // So we'll release one every 1.2 seconds to match it setInterval(() => { - releaseCoingeckoLock(); + releaseCoingeckoLock(); }, 2000); const maxCoingeckoRetries = 5; - -async function getTvl(unixTimestamp, ethBlock, chainBlocks, - usdTvls, - tokensBalances, - usdTokenBalances, - tvlFunction, - isFetchFunction, - storedKey, - knownTokenPrices +async function getTvl( + unixTimestamp, + ethBlock, + chainBlocks, + usdTvls, + tokensBalances, + usdTokenBalances, + tvlFunction, + isFetchFunction, + storedKey, + knownTokenPrices ) { - if (!isFetchFunction) { - const tvlBalances = await tvlFunction( - unixTimestamp, - ethBlock, - chainBlocks - ); - const tvlResults = await computeTVL( - tvlBalances, - "now", - false, - knownTokenPrices, - getCoingeckoLock, - maxCoingeckoRetries - ); - usdTvls[storedKey] = tvlResults.usdTvl; - tokensBalances[storedKey] = tvlResults.tokenBalances; - usdTokenBalances[storedKey] = tvlResults.usdTokenBalances; - } else { - usdTvls[storedKey] = Number(await tvlFunction( - unixTimestamp, - ethBlock, - chainBlocks - )); - } - if ( - typeof usdTvls[storedKey] !== "number" || - Number.isNaN(usdTvls[storedKey]) - ) { - throw new Error( - `TVL for key ${storedKey} is not a number, instead it is ${usdTvls[storedKey]}` - ); - } + if (!isFetchFunction) { + const tvlBalances = await tvlFunction(unixTimestamp, ethBlock, chainBlocks); + const tvlResults = await computeTVL( + tvlBalances, + "now", + false, + knownTokenPrices, + getCoingeckoLock, + maxCoingeckoRetries + ); + usdTvls[storedKey] = tvlResults.usdTvl; + tokensBalances[storedKey] = tvlResults.tokenBalances; + usdTokenBalances[storedKey] = tvlResults.usdTokenBalances; + } else { + usdTvls[storedKey] = Number( + await tvlFunction(unixTimestamp, ethBlock, chainBlocks) + ); + } + if ( + typeof usdTvls[storedKey] !== "number" || + Number.isNaN(usdTvls[storedKey]) + ) { + throw new Error( + `TVL for key ${storedKey} is not a number, instead it is ${usdTvls[storedKey]}` + ); + } } function mergeBalances(key, storedKeys, balancesObject) { - if (balancesObject[key] === undefined) { - balancesObject[key] = {} - storedKeys.map(keyToMerge => { - Object.entries(balancesObject[keyToMerge]).forEach((balance) => { - util.sumSingleBalance(balancesObject[key], balance[0], balance[1]); - }); - }) - } + if (balancesObject[key] === undefined) { + balancesObject[key] = {}; + storedKeys.map((keyToMerge) => { + Object.entries(balancesObject[keyToMerge]).forEach((balance) => { + util.sumSingleBalance(balancesObject[key], balance[0], balance[1]); + }); + }); + } } if (process.argv.length < 3) { - console.error(`Missing argument, you need to provide the filename of the adapter to test. + console.error(`Missing argument, you need to provide the filename of the adapter to test. Eg: node test.js projects/myadapter.js`); - process.exit(1); + process.exit(1); } const passedFile = path.resolve(process.cwd(), process.argv[2]); (async () => { - const module = require(passedFile); - const unixTimestamp = Math.round(Date.now()/1000) - 60; - const chainBlocks = {} - const chains = Object.keys(module) - if(!chains.includes("ethereum")){ - chains.push("ethereum") + const module = require(passedFile); + const unixTimestamp = Math.round(Date.now() / 1000) - 60; + const chainBlocks = {}; + const chains = Object.keys(module); + if (!chains.includes("ethereum")) { + chains.push("ethereum"); + } + await Promise.all( + chains.map(async (chain) => { + if (chainsForBlocks.includes(chain) || chain === "ethereum") { + chainBlocks[chain] = (await getLatestBlockRetry(chain)).number - 10; + } + }) + ); + const ethBlock = chainBlocks.ethereum; + const usdTvls = {}; + const tokensBalances = {}; + const usdTokenBalances = {}; + const chainTvlsToAdd = {}; + const knownTokenPrices = {}; + + let tvlPromises = Object.entries(module).map(async ([chain, value]) => { + if (typeof value !== "object" || value === null) { + return; } - await Promise.all(chains.map(async chain=>{ - if(chainsForBlocks.includes(chain) || chain === "ethereum"){ - chainBlocks[chain] = (await getLatestBlockRetry(chain)).number - 10 + return Promise.all( + Object.entries(value).map(async ([tvlType, tvlFunction]) => { + if (typeof tvlFunction !== "function") { + return; } - })) - const ethBlock = chainBlocks.ethereum - const usdTvls = {}; - const tokensBalances = {}; - const usdTokenBalances = {}; - const chainTvlsToAdd = {}; - const knownTokenPrices = {}; - - let tvlPromises = Object.entries(module).map(async ([chain, value]) => { - if (typeof value !== "object" || value === null) { - return; + let storedKey = `${chain}-${tvlType}`; + let tvlFunctionIsFetch = false; + if (tvlType === "tvl") { + storedKey = chain; + } else if (tvlType === "fetch") { + storedKey = chain; + tvlFunctionIsFetch = true; } - return Promise.all(Object.entries(value).map(async ([tvlType, tvlFunction]) => { - if (typeof tvlFunction !== "function") { - return - } - let storedKey = `${chain}-${tvlType}` - let tvlFunctionIsFetch = false; - if (tvlType === "tvl") { - storedKey = chain - } else if (tvlType === "fetch") { - storedKey = chain - tvlFunctionIsFetch = true - } - await getTvl(unixTimestamp, ethBlock, chainBlocks, usdTvls, tokensBalances, - usdTokenBalances, tvlFunction, tvlFunctionIsFetch, storedKey, knownTokenPrices) - let keyToAddChainBalances = tvlType; - if (tvlType === "tvl" || tvlType === "fetch") { - keyToAddChainBalances = "tvl" - } - if (chainTvlsToAdd[keyToAddChainBalances] === undefined) { - chainTvlsToAdd[keyToAddChainBalances] = [storedKey] - } else { - chainTvlsToAdd[keyToAddChainBalances].push(storedKey) - } - })) - }) - if (module.tvl || module.fetch) { - let mainTvlIsFetch; - if (module.tvl) { - mainTvlIsFetch = false + await getTvl( + unixTimestamp, + ethBlock, + chainBlocks, + usdTvls, + tokensBalances, + usdTokenBalances, + tvlFunction, + tvlFunctionIsFetch, + storedKey, + knownTokenPrices + ); + let keyToAddChainBalances = tvlType; + if (tvlType === "tvl" || tvlType === "fetch") { + keyToAddChainBalances = "tvl"; + } + if (chainTvlsToAdd[keyToAddChainBalances] === undefined) { + chainTvlsToAdd[keyToAddChainBalances] = [storedKey]; } else { - mainTvlIsFetch = true + chainTvlsToAdd[keyToAddChainBalances].push(storedKey); } - const mainTvlPromise = getTvl(unixTimestamp, ethBlock, chainBlocks, usdTvls, tokensBalances, - usdTokenBalances, mainTvlIsFetch ? module.fetch : module.tvl, mainTvlIsFetch, 'tvl', knownTokenPrices) - tvlPromises.push(mainTvlPromise) + }) + ); + }); + if (module.tvl || module.fetch) { + let mainTvlIsFetch; + if (module.tvl) { + mainTvlIsFetch = false; + } else { + mainTvlIsFetch = true; } - await Promise.all(tvlPromises) - Object.entries(chainTvlsToAdd).map(([tvlType, storedKeys]) => { - if (usdTvls[tvlType] === undefined) { - usdTvls[tvlType] = storedKeys.reduce((total, key) => total + usdTvls[key], 0) - mergeBalances(tvlType, storedKeys, tokensBalances) - mergeBalances(tvlType, storedKeys, usdTokenBalances) - } - }) - if(usdTvls.tvl === undefined){ - throw new Error("Protocol doesn't have total tvl, make sure to export a tvl key either on the main object or in one of the chains") + const mainTvlPromise = getTvl( + unixTimestamp, + ethBlock, + chainBlocks, + usdTvls, + tokensBalances, + usdTokenBalances, + mainTvlIsFetch ? module.fetch : module.tvl, + mainTvlIsFetch, + "tvl", + knownTokenPrices + ); + tvlPromises.push(mainTvlPromise); + } + await Promise.all(tvlPromises); + Object.entries(chainTvlsToAdd).map(([tvlType, storedKeys]) => { + if (usdTvls[tvlType] === undefined) { + usdTvls[tvlType] = storedKeys.reduce( + (total, key) => total + usdTvls[key], + 0 + ); + mergeBalances(tvlType, storedKeys, tokensBalances); + mergeBalances(tvlType, storedKeys, usdTokenBalances); } + }); + if (usdTvls.tvl === undefined) { + throw new Error( + "Protocol doesn't have total tvl, make sure to export a tvl key either on the main object or in one of the chains" + ); + } - Object.entries(usdTokenBalances).forEach(([chain, balances]) => { - console.log(`--- ${chain} ---`) - Object.entries(balances).sort((a, b)=>b[1]-a[1]).forEach(([symbol, balance]) => { - console.log(symbol.padEnd(25, " "), humanizeNumber(balance)) - }) - console.log("Total:", humanizeNumber(usdTvls[chain]), "\n"); - }) - console.log(`------ TVL ------`) - Object.entries(usdTvls).forEach(([chain, usdTvl]) => { - if(chain !== "tvl"){ - console.log(chain.padEnd(25, " "), humanizeNumber(usdTvl)) - } - }) - console.log("\ntotal".padEnd(25, " "), humanizeNumber(usdTvls.tvl), "\n") + Object.entries(usdTokenBalances).forEach(([chain, balances]) => { + console.log(`--- ${chain} ---`); + Object.entries(balances) + .sort((a, b) => b[1] - a[1]) + .forEach(([symbol, balance]) => { + console.log(symbol.padEnd(25, " "), humanizeNumber(balance)); + }); + console.log("Total:", humanizeNumber(usdTvls[chain]), "\n"); + }); + console.log(`------ TVL ------`); + Object.entries(usdTvls).forEach(([chain, usdTvl]) => { + if (chain !== "tvl") { + console.log(chain.padEnd(25, " "), humanizeNumber(usdTvl)); + } + }); + console.log("\ntotal".padEnd(25, " "), humanizeNumber(usdTvls.tvl), "\n"); - process.exit(0); + process.exit(0); })(); From ca865bbcdf6fcf43c677396db07590acf6d3f9f5 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 09:28:18 +0000 Subject: [PATCH 197/393] remove staking code --- projects/wannaswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/wannaswap/index.js b/projects/wannaswap/index.js index 8dec856b6c..788c97c682 100644 --- a/projects/wannaswap/index.js +++ b/projects/wannaswap/index.js @@ -1,10 +1,10 @@ const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl'); -const { staking } = require('../helper/staking.js'); +const { staking, stakingPricedLP, stakingUnknownPricedLP } = require('../helper/staking.js'); module.exports = { misrepresentedTokens: true, aurora: { - staking: staking("0x5205c30bf2E37494F8cF77D2c19C6BA4d2778B9B", "0x7faA64Faf54750a2E3eE621166635fEAF406Ab22", "aurora"), + //staking: stakingPricedLP("0x5205c30bf2E37494F8cF77D2c19C6BA4d2778B9B", "0x7faA64Faf54750a2E3eE621166635fEAF406Ab22", "aurora", "0x7E9EA10E5984a09D19D05F31ca3cB65BB7df359d",), tvl:calculateUsdUniTvl( // factory "0x7928D4FeA7b2c90C732c10aFF59cf403f0C38246", From cde6fc9d4e703a57dfc50728d2d9d71c96312518 Mon Sep 17 00:00:00 2001 From: Alex Gaines Date: Mon, 6 Dec 2021 06:08:33 -0600 Subject: [PATCH 198/393] Update UMA TVL Signed-off-by: Alex Gaines --- projects/uma/index.js | 285 +++++++++++++++++++++++++++++++++++------- 1 file changed, 242 insertions(+), 43 deletions(-) diff --git a/projects/uma/index.js b/projects/uma/index.js index f650b555c9..4659293554 100644 --- a/projects/uma/index.js +++ b/projects/uma/index.js @@ -1,60 +1,259 @@ -const { request, gql } = require("graphql-request"); -const sdk = require('@defillama/sdk'); +const sdk = require("@defillama/sdk"); const { sumTokens } = require("../helper/unwrapLPs"); const { requery } = require("../helper/requery"); +const { transformPolygonAddress } = require("../helper/portedTokens"); +const { getBlock } = require("../helper/getBlock"); -const endpoint = 'https://api.thegraph.com/subgraphs/name/umaprotocol/mainnet-contracts' -const query = gql` -query get_tvl($block: Int) { - financialContracts( - block: { number: $block } - ) { - address - collateralToken{ - address - } +const ethLspCreators = [ + "0x0b8de441B26E36f461b2748919ed71f50593A67b", + "0x60F3f5DDE708D097B7F092EFaB2E085AC0a82F42", + "0x31C893843685f1255A26502eaB5379A3518Aa5a9", + "0x9504b4ab8cd743b06074757d3B1bE3a3aF9cea10", +]; +const polygonLspCreators = [ + "0x3e665D15425fAee14eEF53B9caaa0762b243911a", + "0x62410e96a2ceB4d66824346e3264d1D9107a0aBE", + "0x5Fd7FFF20Ee851cD7bEE72fB3C6d324e4C104c9f", +]; + +// Captures TVL for EMP contracts on Ethereum +async function ethEmp(timestamp, block) { + const abi = { + inputs: [], + name: "collateralCurrency", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }; + + const balances = {}; + const logs = await sdk.api.util.getLogs({ + target: "0x3e532e6222afe9Bcf02DCB87216802c75D5113aE", + topic: "NewContractRegistered(address,address,address[])", + keys: ["topics"], + fromBlock: 9937650, + toBlock: block, + }); + const collaterals = await sdk.api.abi.multiCall({ + calls: logs.output.map((poolLog) => ({ + target: `0x${poolLog[1].slice(26)}`, + })), + block, + abi, + }); + await requery(collaterals, "ethereum", block, abi); + await sumTokens( + balances, + collaterals.output + .filter((t) => t.output !== null) + .map((c) => [c.output, c.input.target]), + block + ); + return balances; +} + +// Captures TVL for LSP contracts on Ethereum +async function ethLsp(timestamp, block) { + const abi = { + inputs: [], + name: "collateralToken", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }; + + const balances = {}; + for (let i = 0; i < ethLspCreators.length; i++) { + const logs = await sdk.api.util.getLogs({ + target: ethLspCreators[i], + topic: "CreatedLongShortPair(address,address,address,address)", + keys: ["topics"], + fromBlock: 12736035, + toBlock: block, + }); + const collaterals = await sdk.api.abi.multiCall({ + calls: logs.output.map((poolLog) => ({ + target: `0x${poolLog[1].slice(26)}`, + })), + block, + abi, + }); + await requery(collaterals, "ethereum", block, abi); + await sumTokens( + balances, + collaterals.output + .filter((t) => t.output !== null) + .map((c) => [c.output, c.input.target]), + block + ); } + return balances; } -`; - -const abi = { - inputs: [], - name: "collateralCurrency", - outputs: [ - { - internalType: "contract IERC20", - name: "", - type: "address", - }, - ], - stateMutability: "view", - type: "function", + +// Captures TVL for LSP contracts on Polygon +async function polygonLsp(timestamp, block, chainBlocks) { + const abi = { + inputs: [], + name: "collateralToken", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }; + + const balances = {}; + for (let i = 0; i < polygonLspCreators.length; i++) { + const transform = await transformPolygonAddress(); + block = await getBlock(timestamp, "polygon", chainBlocks); + const logs = await sdk.api.util.getLogs({ + target: polygonLspCreators[i], + topic: "CreatedLongShortPair(address,address,address,address)", + keys: ["topics"], + fromBlock: 16241492, + toBlock: block, + chain: "polygon", + }); + const collaterals = await sdk.api.abi.multiCall({ + calls: logs.output.map((poolLog) => ({ + target: `0x${poolLog[1].slice(26)}`, + })), + block, + abi, + chain: "polygon", + }); + await requery(collaterals, "polygon", block, abi); + await sumTokens( + balances, + collaterals.output + .filter((t) => t.output !== null) + .map((c) => [c.output, c.input.target]), + block, + "polygon", + transform + ); + } + return balances; } -async function tvl(timestamp, block) { +// Captures TVL for Jarvis LSP contracts on Polygon +async function jarvisLsp(timestamp, block, chainBlocks) { + const abi = { + inputs: [], + name: "collateralCurrency", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }; + const balances = {}; + const transform = await transformPolygonAddress(); + block = await getBlock(timestamp, "polygon", chainBlocks); const logs = await sdk.api.util.getLogs({ - target: '0x3e532e6222afe9Bcf02DCB87216802c75D5113aE', - topic: 'NewContractRegistered(address,address,address[])', - keys: ['topics'], - fromBlock: 9937650, - toBlock: block - }) + target: "0xD5ed74178Fa50EfD7d3E3f30EF5f0ACab56933Bc", + topic: "CreatedPerpetual(address,address)", + keys: ["topics"], + fromBlock: 17618954, + toBlock: block, + chain: "polygon", + }); const collaterals = await sdk.api.abi.multiCall({ - calls: logs.output.map(poolLog=>({ - target:`0x${poolLog[1].slice(26)}` + calls: logs.output.map((poolLog) => ({ + target: `0x${poolLog[1].slice(26)}`, })), block, - abi - }) - await requery(collaterals, 'ethereum', block, abi) - await sumTokens(balances, collaterals.output.filter(t=>t.output !== null).map(c=>[ - c.output, c.input.target - ]), block) + abi, + chain: "polygon", + }); + await requery(collaterals, "polygon", block, abi); + await sumTokens( + balances, + collaterals.output + .filter((t) => t.output !== null) + .map((c) => [c.output, c.input.target]), + block, + "polygon", + transform + ); return balances; } -module.exports = { - tvl +// Captures TVL for Across liquidity pools on L1 +async function across(timestamp, block) { + const abi = { + inputs: [], + name: "l1Token", + outputs: [ + { + internalType: "contract IERC20", + name: "", + type: "address", + }, + ], + stateMutability: "view", + type: "function", + }; + + const balances = {}; + const logs = await sdk.api.util.getLogs({ + target: "0x30B44C676A05F1264d1dE9cC31dB5F2A945186b6", + topic: "WhitelistToken(uint256,address,address,address)", + keys: ["topics"], + fromBlock: 13544988, + toBlock: block, + }); + const bridgePoolAddresses = logs.output.map(function (bridgePool) { + return bridgePool[3]; + }); + const uniquePools = [ + ...new Set(bridgePoolAddresses.map((a) => JSON.stringify(a))), + ].map((a) => JSON.parse(a)); + const collaterals = await sdk.api.abi.multiCall({ + calls: uniquePools.map((poolLog) => ({ + target: `0x${poolLog.slice(26)}`, + })), + block, + abi, + }); + await requery(collaterals, "ethereum", block, abi); + await sumTokens( + balances, + collaterals.output + .filter((t) => t.output !== null) + .map((c) => [c.output, c.input.target]), + block + ); + return balances; } + +module.exports = { + ethereum: { + tvl: sdk.util.sumChainTvls([ethEmp, across, ethLsp]), + }, + polygon: { + tvl: sdk.util.sumChainTvls([polygonLsp, jarvisLsp]), + }, +}; From 21bd8e5d4e2a55c87f95b1e33aab5103040166c8 Mon Sep 17 00:00:00 2001 From: ramverma-oro Date: Mon, 6 Dec 2021 20:27:08 +0530 Subject: [PATCH 199/393] tvl update --- package.json | 6 ++- projects/unifarm/index.js | 109 +++++++++++++++++++++++--------------- 2 files changed, 70 insertions(+), 45 deletions(-) diff --git a/package.json b/package.json index baa46c9a15..d0d87bced1 100644 --- a/package.json +++ b/package.json @@ -20,16 +20,18 @@ "@solana/web3.js": "^1.30.2", "async-retry": "^1.3.1", "atob": "^2.1.2", - "axios": "^0.21.1", + "axios": "^0.21.4", "axios-rate-limit": "^1.3.0", "bignumber.js": "^9.0.1", "caver-js": "^1.6.5", + "cross-fetch": "^3.1.4", "dotenv": "^8.6.0", "graph-results-pager": "^1.0.3", "graphql": "^15.5.0", - "graphql-request": "^3.4.0", + "graphql-request": "^3.6.1", "js-yaml": "^4.1.0", "mysql": "^2.18.1", + "node-fetch": "^3.1.0", "node-html-parser": "^3.3.5", "node-schedule": "^1.3.3", "papaparse": "^5.3.1", diff --git a/projects/unifarm/index.js b/projects/unifarm/index.js index 35f73a636b..b577b3c7e9 100644 --- a/projects/unifarm/index.js +++ b/projects/unifarm/index.js @@ -3,9 +3,8 @@ const erc20Abi = require("./erc20.json"); const BigNumber = require("bignumber.js"); const fetch = require("cross-fetch"); -const fetchPool = (chainId) => { - let pool; - fetch("https://graph.unifarm.co/graphql", { +const fetchPool = async (chainId) => { + return fetch("https://graph.unifarm.co/graphql", { method: "POST", headers: { "Content-Type": "application/json", @@ -30,63 +29,86 @@ const fetchPool = (chainId) => { }, }, }), - }).then((res) => { - if (res.status >= 400) { - throw new Error("Bad response from server"); - } - pool = res.data.allCohorts.cohorts; - }); - return pool; + }) + .then((response) => response.json()) + .then((data) => { + return data; + }) + .catch((e) => { + // console.log(e) + }); }; const _tvl = async (timestamp, ethBlock, chainBlocks, chain) => { const block = chainBlocks[chain]; let pools; - if (chain === "ethereum") { - pools = await fetchPool(1); - } else if (chain === "bsc") { - pools = await fetchPool(56); - } else { - pools = await fetchPool(137); - } - - console.log(pools); + try { + if (chain === "ethereum") { + const pool = await fetchPool(1); + pools = pool.data.allCohorts.cohorts; + } else if (chain === "bsc") { + const pool = await fetchPool(56); + pools = pool.data.allCohorts.cohorts; + } else { + const pool = await fetchPool(137); + pools = pool.data.allCohorts.cohorts; + } - const multiCallResult = await sdk.api.abi.multiCall({ - calls: pools.map( - (data) => ( - { - target: data.cohortAddress, - params: data.tokens, - }, - { - target: data.proxies[0], - params: data.tokens, - } - ) - ), - block, - abi: erc20Abi[5], - chain, - }); + const multiCallResult = await sdk.api.abi.multiCall({ + calls: pools.map((data) => { + return ( + data.tokens.map((token) => ({ + target: data.cohortAddress, + params: token, + })), + data.tokens.map((token) => { + if (!data.proxies) { + return; + } - return multiCallResult; + return { + target: data.proxies[0], + params: token, + }; + }) + ); + }), + block, + abi: erc20Abi[5], + chain, + }); + return multiCallResult; + } catch (e) { + console.log(e); + } }; const ethereum = async (timestamp, ethBlock, chainBlocks) => { - let balance = await _tvl(timestamp, ethBlock, chainBlocks, "ethereum"); - return arrayToObject(balance, "ethereum"); + try { + let balance = await _tvl(timestamp, ethBlock, chainBlocks, "ethereum"); + return balance; + } catch (err) { + console.log(err); + } }; const bsc = async (timestamp, ethBlock, chainBlocks) => { - let balance = await _tvl(timestamp, ethBlock, chainBlocks, "bsc"); - return arrayToObject(balance, "bsc"); + try { + let balance = await _tvl(timestamp, ethBlock, chainBlocks, "bsc"); + return balance; + } catch (err) { + console.log(err); + } }; const polygon = async (timestamp, ethBlock, chainBlocks) => { - let balance = await _tvl(timestamp, ethBlock, chainBlocks, "polygon"); - return arrayToObject(balance, "polygon"); + try { + let balance = await _tvl(timestamp, ethBlock, chainBlocks, "polygon"); + return balance; + } catch (err) { + console.log(err); + } }; module.exports = { @@ -99,4 +121,5 @@ module.exports = { polygon: { tvl: polygon, }, + tvl: sdk.util.sumChainTvls([ethereum, bsc, polygon]), }; From 8e127408080e8dc2c4c5bb927ddbe6280b2add74 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 6 Dec 2021 15:19:50 +0000 Subject: [PATCH 200/393] remove my idledao --- projects/idleDao.js | 61 --------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 projects/idleDao.js diff --git a/projects/idleDao.js b/projects/idleDao.js deleted file mode 100644 index ca9e28281b..0000000000 --- a/projects/idleDao.js +++ /dev/null @@ -1,61 +0,0 @@ - -const sdk = require('@defillama/sdk'); -const { getBlock } = require('./helper/getBlock'); -const { transformPolygonAddress } = require('./helper/portedTokens'); - -const vaults = [ - { - address: '0x8a999F5A3546F8243205b2c0eCb0627cC10003ab', // IdleDAI - tokens: [ - '0x27f8d03b3a2196956ed754badc28d73be8830a6e', // amDAI - '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', // DAI - '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // wMATIC - ] - }, { - address: '0x1ee6470CD75D5686d0b2b90C0305Fa46fb0C89A1', // IdleUSDC - tokens: [ - '0x1a13f4ca1d028320a707d99520abfefca3998b7f', // amUSDC - '0x2791bca1f2de4661ed88a30c99a7a9449aa84174', // USDC - '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // wMATIC - ] - }, { - address: '0xfdA25D931258Df948ffecb66b5518299Df6527C4', // IdleWETH - tokens: [ - '0x28424507fefb6f7f8e9d3860f56504e4e5f5f390', // amWETH - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619', // WETH - '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270', // wMATIC - ] - } -]; - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - block = await getBlock(timestamp, 'polygon', chainBlocks); - const transform = await transformPolygonAddress(); - - for (let vault of vaults) { - const balanceOfs = (await sdk.api.abi.multiCall({ - calls: vault.tokens.map(c => ({ - target: c, - params: [vault.address]})), - abi: 'erc20:balanceOf', - block, - chain: 'polygon' - })).output; - - for (let i = 0; i < vault.tokens.length; i++) { - await sdk.util.sumSingleBalance( - balances, - transform(vault.tokens[i]), - balanceOfs[i].output - ); - }; - }; - return balances; -}; - -module.exports = { - polygon: { - tvl - } -}; \ No newline at end of file From a5744a3a33e4ad14a531dad4a61523e3a66b5a50 Mon Sep 17 00:00:00 2001 From: ramverma-oro Date: Mon, 6 Dec 2021 22:22:00 +0530 Subject: [PATCH 201/393] try-catch-fix --- projects/unifarm/index.js | 94 ++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 55 deletions(-) diff --git a/projects/unifarm/index.js b/projects/unifarm/index.js index b577b3c7e9..2270bdb457 100644 --- a/projects/unifarm/index.js +++ b/projects/unifarm/index.js @@ -43,72 +43,56 @@ const _tvl = async (timestamp, ethBlock, chainBlocks, chain) => { const block = chainBlocks[chain]; let pools; - try { - if (chain === "ethereum") { - const pool = await fetchPool(1); - pools = pool.data.allCohorts.cohorts; - } else if (chain === "bsc") { - const pool = await fetchPool(56); - pools = pool.data.allCohorts.cohorts; - } else { - const pool = await fetchPool(137); - pools = pool.data.allCohorts.cohorts; - } + if (chain === "ethereum") { + const pool = await fetchPool(1); + pools = pool.data.allCohorts.cohorts; + } else if (chain === "bsc") { + const pool = await fetchPool(56); + pools = pool.data.allCohorts.cohorts; + } else { + const pool = await fetchPool(137); + pools = pool.data.allCohorts.cohorts; + } - const multiCallResult = await sdk.api.abi.multiCall({ - calls: pools.map((data) => { - return ( - data.tokens.map((token) => ({ - target: data.cohortAddress, - params: token, - })), - data.tokens.map((token) => { - if (!data.proxies) { - return; - } + const multiCallResult = await sdk.api.abi.multiCall({ + calls: pools.map((data) => { + return ( + data.tokens.map((token) => ({ + target: data.cohortAddress, + params: token, + })), + data.tokens.map((token) => { + if (!data.proxies) { + return; + } - return { - target: data.proxies[0], - params: token, - }; - }) - ); - }), - block, - abi: erc20Abi[5], - chain, - }); - return multiCallResult; - } catch (e) { - console.log(e); - } + return { + target: data.proxies[0], + params: token, + }; + }) + ); + }), + block, + abi: erc20Abi[5], + chain, + }); + return multiCallResult; }; const ethereum = async (timestamp, ethBlock, chainBlocks) => { - try { - let balance = await _tvl(timestamp, ethBlock, chainBlocks, "ethereum"); - return balance; - } catch (err) { - console.log(err); - } + let balance = await _tvl(timestamp, ethBlock, chainBlocks, "ethereum"); + return balance; }; const bsc = async (timestamp, ethBlock, chainBlocks) => { - try { - let balance = await _tvl(timestamp, ethBlock, chainBlocks, "bsc"); - return balance; - } catch (err) { - console.log(err); - } + let balance = await _tvl(timestamp, ethBlock, chainBlocks, "bsc"); + return balance; }; const polygon = async (timestamp, ethBlock, chainBlocks) => { - try { - let balance = await _tvl(timestamp, ethBlock, chainBlocks, "polygon"); - return balance; - } catch (err) { - console.log(err); - } + let balance = await _tvl(timestamp, ethBlock, chainBlocks, "polygon"); + return balance; }; module.exports = { From a61d5a1fdced72b11f3e961b6705cf0c0e36eed9 Mon Sep 17 00:00:00 2001 From: freelife2010 Date: Mon, 6 Dec 2021 09:25:44 -0800 Subject: [PATCH 202/393] reverted test.js code --- test.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test.js b/test.js index 41a7bdc291..6cbce879ea 100644 --- a/test.js +++ b/test.js @@ -10,14 +10,13 @@ const { const { util } = require("@defillama/sdk"); async function getLatestBlockRetry(chain) { - // for (let i = 0; i < 5; i++) { - // try { - // return await getLatestBlock(chain); - // } catch (e) { - // throw new Error(`Couln't get block heights for chain "${chain}"`, e) - // } - // } - return 100000; + for (let i = 0; i < 5; i++) { + try { + return await getLatestBlock(chain); + } catch (e) { + throw new Error(`Couln't get block heights for chain "${chain}"`, e); + } + } } const locks = []; From 5b0b514ade9bc830663e0eccdfec0ad7481712dd Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 18:04:52 +0000 Subject: [PATCH 203/393] borrowed on channels + generalize --- projects/channels/index.js | 143 +++++++----------------------------- projects/helper/compound.js | 6 +- 2 files changed, 30 insertions(+), 119 deletions(-) diff --git a/projects/channels/index.js b/projects/channels/index.js index ab32ce6328..14550cdeb5 100644 --- a/projects/channels/index.js +++ b/projects/channels/index.js @@ -1,131 +1,42 @@ -const _ = require('underscore'); -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); -const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); -const { default: BigNumber } = require('bignumber.js'); +const { compoundExports } = require('../helper/compound'); + const comptroller = { heco: "0x8955aeC67f06875Ee98d69e6fe5BDEA7B60e9770", bsc: "0x8Cd2449Ed0469D90a7C4321DF585e7913dd6E715", arbitrum: "0x3C13b172bf8BE5b873EB38553feC50F78c826284" } -// ask comptroller for all markets array -async function getAllCTokens(block, chain) { - return (await sdk.api.abi.call({ - block, - chain: chain, - target: comptroller[chain], - params: [], - abi: abi['getAllMarkets'], - })).output; -} -async function getUnderlying(block, cToken, chain) { - if (cToken === '0x397c6D1723360CC1c317CdC9B2E926Ae29626Ff3') { - return '0x6f259637dcd74c767781e37bc6133cd6a68aa161';//cHT => HT - } else if (cToken === '0x14E134365F754496FBC70906b8611b8b49f66dd4'){ - return '0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c';//cBNB =>BNB - } else { - const token = (await sdk.api.abi.call({ - block, - chain: chain, - target: cToken, - abi: abi['underlying'], - })).output; - if (token === '0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a') { - return '0x6b175474e89094c44da98b954eedeac495271d0f';//DAI => DAI - } else if (token === '0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B') { - return '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';//USDC => USDC - } else { - return chain + ':' + token - } - } -} -// returns {[underlying]: [cToken]} -async function getMarkets(block, chain) { - let allCTokens = await getAllCTokens(block, chain) - const markets = [] - await ( - Promise.all(allCTokens.map(async (cToken) => { - let underlying = await getUnderlying(block, cToken, chain); - markets.push({ underlying, cToken }) - })) - ); - return markets; -} -const replacements = { - "heco:0xA2F3C2446a3E20049708838a779Ff8782cE6645a": 'bsc:0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe', - "heco:0x843Af718EF25708765a8E0942F89edEae1D88DF0": 'bsc:0x3ee2200efb3400fabb9aacf31297cbdd1d435d47', +const ceth = { + bsc: "0x14E134365F754496FBC70906b8611b8b49f66dd4", + heco: "0x397c6D1723360CC1c317CdC9B2E926Ae29626Ff3", } -async function chainTvl(chain) { - let balances = {}; - let timestamp = Math.round(new Date() / 1000) - let currentBlock = (await sdk.api.util.lookupBlock(timestamp, { chain: chain })) - let markets = await getMarkets(currentBlock.block, chain); - let LockedInfo = await sdk.api.abi.multiCall({ - currentBlock, - calls: _.map(markets, (market) => ({ - target: market.cToken, - })), - chain: chain, - abi: abi['getCash'], - }); - const symbols = await sdk.api.abi.multiCall({ - //block: currentBlock, - calls: _.map(markets, (market) => ({ - target: market.underlying.split(':')[1], - })), - chain: chain, - abi: "erc20:symbol", - }); - const lpPositions = [] - _.each(markets, (market, idx) => { - let getCash = _.find(LockedInfo.output, (result) => result.input.target === market.cToken); - if (getCash.output === null) { - throw new Error("failed") - } - const symbol = symbols.output[idx].output - if (["HMDX", "Cake-LP"].includes(symbol)) { - lpPositions.push({ - token: market.underlying.split(':')[1], - balance: getCash.output - }) - } else if (symbol === "BETH") { - sdk.util.sumSingleBalance(balances, 'binance-eth', Number(getCash.output) / 1e18) - } else if(replacements[market.underlying] !== undefined){ - sdk.util.sumSingleBalance(balances, replacements[market.underlying], BigNumber(getCash.output).times(1e12).toFixed(0)) - } else { - sdk.util.sumSingleBalance(balances, market.underlying, getCash.output) - } - }); - await unwrapUniswapLPs(balances, lpPositions, undefined, chain, addr => { - if (addr === "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f") { - return '0x6f259637dcd74c767781e37bc6133cd6a68aa161' // WHT -> HT - } - return `${chain}:${addr}` - }) - return balances; +const native = { + bsc: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + heco: "0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f", } -async function hecoTvl() { - return await chainTvl('heco'); -} -async function bscTvl() { - return await chainTvl('bsc'); +const replacements = { + "heco:0xA2F3C2446a3E20049708838a779Ff8782cE6645a": 'bsc:0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe', // XRP + "heco:0x843Af718EF25708765a8E0942F89edEae1D88DF0": 'bsc:0x3ee2200efb3400fabb9aacf31297cbdd1d435d47', // ADA + "bsc:0x250632378E573c6Be1AC2f97Fcdf00515d0Aa91B": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // BETH->WETH + "heco:0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a": "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI + "heco:0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC + "heco:0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f": "0x6f259637dcd74c767781e37bc6133cd6a68aa161", // HT + "heco:0xB6F4c418514dd4680F76d5caa3bB42dB4A893aCb": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // HECO-BETH -> BETH + "heco:0x5eE41aB6edd38cDfB9f6B4e6Cf7F75c87E170d98": "0x0000000000085d4780b73119b644ae5ecd22b376", // TUSD } -async function arbitrumTvl() { - return await chainTvl('arbitrum'); + +function transform(chain) { + return addr => { + const taddr= `${chain}:${addr}` + return replacements[taddr] ?? taddr + } } module.exports = { - heco: { - tvl: hecoTvl - }, - bsc: { - tvl: bscTvl - }, - arbitrum: { - tvl: arbitrumTvl - }, - tvl: sdk.util.sumChainTvls([hecoTvl, bscTvl, arbitrumTvl]) + ...Object.keys(comptroller).reduce((exp, chain) => { + exp[chain] = compoundExports(comptroller[chain], chain, ceth[chain], native[chain], transform(chain), symbol => ["MLP", "CLP", "SLP"].some(c => symbol.includes(c))) + return exp + }, {}) }; diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 299373d5cb..daed179bb0 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -198,14 +198,14 @@ function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis={ } } -function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw){ +function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens){ const transformAddress = transformAdressRaw === undefined? addr=>`${chain}:${addr}`:transformAdressRaw if(cether !== undefined && cetheEquivalent === undefined){ throw new Error("You need to define the underlying for native cAsset") } return { - tvl: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, false), - borrowed: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true) + tvl: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, false, checkForLPTokens), + borrowed: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true, checkForLPTokens) } } From 91c3e98965c7f4c8bb59f4ff2e9c64adacf7e032 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 18:05:32 +0000 Subject: [PATCH 204/393] add borrowed to lendhub --- projects/lendhub/abi.json | 51 ++++++++++++++++++++++++--------------- projects/lendhub/index.js | 20 +++++++++------ 2 files changed, 44 insertions(+), 27 deletions(-) diff --git a/projects/lendhub/abi.json b/projects/lendhub/abi.json index 5921f9ba91..f3445a6301 100644 --- a/projects/lendhub/abi.json +++ b/projects/lendhub/abi.json @@ -1,21 +1,20 @@ - { - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "underlying": { + "getAllMarkets": { + "constant": true, + "inputs": [], + "name": "getAllMarkets", + "outputs": [ + { + "internalType": "contract CToken[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "underlying": { "constant": true, "inputs": [], "name": "underlying", @@ -30,7 +29,7 @@ "stateMutability": "view", "type": "function" }, - "getCash": { + "getCash": { "constant": true, "inputs": [], "name": "getCash", @@ -45,7 +44,7 @@ "stateMutability": "view", "type": "function" }, - "valtToken": { + "valtToken": { "inputs": [], "name": "token", "outputs": [ @@ -57,5 +56,19 @@ ], "stateMutability": "view", "type": "function" + }, + "totalBorrows": { + "constant": true, + "inputs": [], + "name": "totalBorrows", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" } } \ No newline at end of file diff --git a/projects/lendhub/index.js b/projects/lendhub/index.js index 8834aaa389..40b9a31168 100644 --- a/projects/lendhub/index.js +++ b/projects/lendhub/index.js @@ -71,7 +71,9 @@ const coingeckoPrice = { decimals: 1e8 } } -async function tvl() { + +function tvl(borrowed){ +return async () => { let balances = {}; let markets = await getMarkets(); let lpPositions = []; @@ -80,7 +82,7 @@ async function tvl() { target: market.cToken, })), chain: chain, - abi: cAbis['getCash'], + abi: borrowed?cAbis.totalBorrows: cAbis['getCash'], }); const symbols = await sdk.api.abi.multiCall({ @@ -91,8 +93,7 @@ async function tvl() { abi: "erc20:symbol", }); _.each(markets, async (market, idx) => { - let getCash = _.find(cashInfo.output, (result) => result.input.target === market.cToken); - if (getCash) { + const getCash = _.find(cashInfo.output, (result) => result.input.target === market.cToken); if (getCash.output === null) { throw new Error("failed") } @@ -114,7 +115,6 @@ async function tvl() { } else { sdk.util.sumSingleBalance(balances, tokenToCoinGecko.coingecko, Number(getCash.output)/tokenToCoinGecko.decimals) } - } }); await unwrapUniswapLPs(balances, lpPositions, undefined, 'heco', addr=>{ @@ -125,8 +125,12 @@ async function tvl() { }) return balances; } +} module.exports = { - tvl, - }; - \ No newline at end of file + timetravel: false, + heco:{ + tvl: tvl(false), + borrowed: tvl(true) + } +}; \ No newline at end of file From 66f7117d489e9ec883f183164d74f6f651542f3e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 18:05:59 +0000 Subject: [PATCH 205/393] add simple uniswap helper --- projects/helper/calculateUniTvl.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/helper/calculateUniTvl.js b/projects/helper/calculateUniTvl.js index 5a4d9ac0a7..bceceb1b10 100644 --- a/projects/helper/calculateUniTvl.js +++ b/projects/helper/calculateUniTvl.js @@ -182,7 +182,14 @@ function uniTvlExport(factory, chain, transformAddressOriginal=undefined){ } } +async function simpleAddUniTvl(balances, factory, chain, timestamp, chainBlocks){ + const transformAddress = addr=>`${chain}:${addr}`; + const block = await getBlock(timestamp, chain , chainBlocks); + return calculateUniTvl(transformAddress, block, chain, factory, 0, true) +} + module.exports = { calculateUniTvl, - uniTvlExport + uniTvlExport, + simpleAddUniTvl }; From 787c2a36322dde8c98f5ba998537c9e1979fd688 Mon Sep 17 00:00:00 2001 From: Define101 Date: Mon, 6 Dec 2021 18:32:23 +0000 Subject: [PATCH 206/393] change vikings stake address --- projects/vikings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vikings/index.js b/projects/vikings/index.js index d09bc803e4..311550ca82 100644 --- a/projects/vikings/index.js +++ b/projects/vikings/index.js @@ -4,4 +4,4 @@ const treasuryAddress = "0x04b611A65A5cfEFC1C449F725b1948eeaadEB231"; module.exports = ohmTvl(treasuryAddress, [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], ["0x1E2D68196AcF7EB9e345c531e476E726D60a5C4b", true], -], "avax", "0x743DE042c7be8C415effa75b960A2A7bB5fc0704", "0x91D680545a1ff4411C1ff4C927f86CD34ADB932a", undefined, undefined, false) +], "avax", "0xE0474c15BC7f8213eE5bfB42f9E68B2d6BE2e136", "0x91D680545a1ff4411C1ff4C927f86CD34ADB932a", undefined, undefined, true) From 5d9b772b688935fa5382ba780ed261bde81478bf Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 21:09:28 +0000 Subject: [PATCH 207/393] update dopex --- projects/dopex/index.js | 145 ++++++++++++---------------------------- 1 file changed, 43 insertions(+), 102 deletions(-) diff --git a/projects/dopex/index.js b/projects/dopex/index.js index e1cb31119e..ca948b72e3 100644 --- a/projects/dopex/index.js +++ b/projects/dopex/index.js @@ -1,8 +1,8 @@ const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const abi = require("./abi"); +const { getBlock } = require("../helper/getBlock"); const { pool2s } = require("../helper/pool2"); const { staking } = require("../helper/staking"); +const { sumTokensSharedOwners } = require("../helper/unwrapLPs"); const DPX = "0xeec2be5c91ae7f8a338e1e5f3b5de49d07afdc81"; const RDPX = "0x0ff5A8451A839f5F0BB3562689D9A44089738D11"; @@ -11,114 +11,45 @@ const SSOVDpx = "0x818ceD3D446292061913f1f74B2EAeE6341a76Ec"; const stakingRewardsRDPX = "0x8d481245801907b45823Fb032E6848d0D3c29AE5"; const SSOVRdpx = "0x6607c5e39a43cce1760288Dc33f20eAd51b14D7B"; -function transformArbitrum(addr) { - if (addr.toLowerCase() === "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55") { - return DPX; - } else if ( - addr.toLowerCase() === "0x32eb7902d4134bf98a28b963d26de779af92a212" - ) { - return RDPX; - } - return `arbitrum:${addr}`; +const arbiDPX = "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55" +const arbiRDPX = "0x32eb7902d4134bf98a28b963d26de779af92a212" + +const replacements = { + [arbiRDPX.toLowerCase()]: RDPX, + [arbiDPX.toLowerCase()]: DPX, + [stakingRewardsDPX.toLowerCase()]: DPX, + [stakingRewardsRDPX.toLowerCase()]: RDPX } -async function arbitrumTvl(timestamp, block) { - let balances = {}; - const ssovBalance = await sdk.api.abi.call({ - target: stakingRewardsDPX, - abi: abi["balanceOf"], - params: [SSOVDpx], - block: block, - chain: "arbitrum", - }); - const ssovDpxBalance = await sdk.api.abi.call({ - target: "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", - abi: "erc20:balanceOf", - params: [SSOVDpx], - block: block, - chain: "arbitrum", - }); - const ssovEarntRewards = await sdk.api.abi.call({ - target: stakingRewardsDPX, - abi: abi["earned"], - params: [SSOVDpx], - block: block, - chain: "arbitrum", - }); - const ssovRdpxBalance = await sdk.api.abi.call({ - target: "0x32eb7902d4134bf98a28b963d26de779af92a212", - abi: "erc20:balanceOf", - params: [SSOVDpx], - block: block, - chain: "arbitrum", - }); +function transformArbitrum(addr) { + return replacements[addr.toLowerCase()] ?? `arbitrum:${addr}`; +} - balances[DPX] = new BigNumber(ssovBalance.output) - .plus(new BigNumber(ssovEarntRewards.output.DPXtokensEarned)) - .plus(new BigNumber(ssovDpxBalance.output)) - .toFixed(); - balances[RDPX] = new BigNumber(ssovEarntRewards.output.RDPXtokensEarned) - .plus(new BigNumber(ssovRdpxBalance.output)) - .toFixed(); +const tokensInPools = [ + stakingRewardsDPX, stakingRewardsRDPX, arbiDPX, arbiRDPX, +] - const ssovRDPXBalance = await sdk.api.abi.call({ - target: stakingRewardsRDPX, - abi: abi["balanceOf"], - params: [SSOVRdpx], - block: block, - chain: "arbitrum", - }); - const ssovRDPXDpxBalance = await sdk.api.abi.call({ - target: "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", - abi: "erc20:balanceOf", - params: [SSOVRdpx], - block: block, - chain: "arbitrum", - }); - const ssovRDPXEarntRewards = await sdk.api.abi.call({ - target: stakingRewardsRDPX, - abi: abi["earned"], - params: [SSOVRdpx], - block: block, - chain: "arbitrum", - }); - const ssovRDPXRdpxBalance = await sdk.api.abi.call({ - target: "0x32eb7902d4134bf98a28b963d26de779af92a212", - abi: "erc20:balanceOf", - params: [SSOVRdpx], - block: block, - chain: "arbitrum", - }); +const ethPool = "0x3154B747C4bFd35C67607d860b884D28F32Ed00F" +const weth = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - balances[DPX] = new BigNumber(balances[DPX]) - .plus(new BigNumber(ssovRDPXEarntRewards.output.DPXtokensEarned)) - .plus(new BigNumber(ssovRDPXDpxBalance.output)) - .toFixed(); - balances[RDPX] = new BigNumber(balances[RDPX]) - .plus(new BigNumber(ssovRDPXBalance.output)) - .plus(new BigNumber(ssovRDPXEarntRewards.output.RDPXtokensEarned)) - .plus(new BigNumber(ssovRDPXRdpxBalance.output)) - .toFixed(); +const pools = [ + //Old pools + SSOVDpx, SSOVRdpx, + // New pools + "0x0359B4dcd2412ff0dafa8B020bcb57aA8Bd13A33", + "0xfE351e85eb6B4292088Dc28B66E9E92aB62fB663" +] +async function arbitrumTvl(timestamp, ethBlock, chainBlocks) { + const chain = "arbitrum" + const block = await getBlock(timestamp, chain, chainBlocks) + const balances = {}; + await sumTokensSharedOwners(balances, tokensInPools, pools, block, chain, transformArbitrum) + const wethInPool = await sdk.api.eth.getBalance({target: ethPool, block, chain}) + sdk.util.sumSingleBalance(balances, weth, wethInPool.output) return balances; } -async function dopexStakings(timestamp, _ethBlock, chainBlocks) { - const stakingDpx = await staking( - stakingRewardsDPX, - "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", - "arbitrum", - DPX - )(timestamp, _ethBlock, chainBlocks); - const stakingRdpx = await staking( - stakingRewardsRDPX, - "0x32Eb7902D4134bf98A28b963D26de779AF92A212", - "arbitrum", - RDPX - )(timestamp, _ethBlock, chainBlocks); - return { ...stakingDpx, ...stakingRdpx }; -} - module.exports = { ethereum: { staking: staking( @@ -140,7 +71,17 @@ module.exports = { tvl: async () => ({}), }, arbitrum: { - staking: dopexStakings, + staking: sdk.util.sumChainTvls([staking( + stakingRewardsDPX, + "0x6c2c06790b3e3e3c38e12ee22f8183b37a13ee55", + "arbitrum", + DPX + ), staking( + stakingRewardsRDPX, + "0x32Eb7902D4134bf98A28b963D26de779AF92A212", + "arbitrum", + RDPX + )]), pool2: pool2s( [ "0x96B0d9c85415C69F4b2FAC6ee9e9CE37717335B4", From 142d4ea365dc73029cdd1745a19f1b72f6ff8487 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 21:36:26 +0000 Subject: [PATCH 208/393] update cbridge contracts --- projects/celerbridge/index.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index c062a6ff66..e871374cda 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -1,17 +1,18 @@ const { getBlock } = require("../helper/getBlock") const { chainExports } = require("../helper/exports") const sdk = require('@defillama/sdk') +const { sumTokens } = require("../helper/unwrapLPs") const bridgeContractV1 = "0x841ce48F9446C8E281D3F1444cB859b4A6D0738C" const bridgeContractsV2 = { - ethereum: "0xc578Cbaf5a411dFa9F0D227F97DaDAa4074aD062", - bsc: "0x5d96d4287D1ff115eE50faC0526cf43eCf79bFc6", - arbitrum: "0xdd90E5E87A2081Dcf0391920868eBc2FFB81a1aF", - polygon: "0xa251c4691C1ffd7d9b128874C023427513D8Ac5C", - avax: "0xBB7684Cc5408F4DD0921E5c2Cadd547b8f1AD573", - fantom: "0x3795C36e7D12A8c252A20C5a7B455f7c57b60283", - optimism: "0x6De33698e9e9b787e09d3Bd7771ef63557E148bb" + ethereum: ["0xc578Cbaf5a411dFa9F0D227F97DaDAa4074aD062", "0x5427FEFA711Eff984124bFBB1AB6fbf5E3DA1820"], + bsc: ["0x5d96d4287D1ff115eE50faC0526cf43eCf79bFc6", "0xdd90E5E87A2081Dcf0391920868eBc2FFB81a1aF"], + arbitrum: ["0xdd90E5E87A2081Dcf0391920868eBc2FFB81a1aF", "0x1619DE6B6B20eD217a58d00f37B9d47C7663feca"], + polygon: ["0xa251c4691C1ffd7d9b128874C023427513D8Ac5C", "0x88DCDC47D2f83a99CF0000FDF667A468bB958a78"], + avax: ["0xBB7684Cc5408F4DD0921E5c2Cadd547b8f1AD573", "0xef3c714c9425a8F3697A9C969Dc1af30ba82e5d4"], + fantom: ["0x3795C36e7D12A8c252A20C5a7B455f7c57b60283", "0x374B8a9f3eC5eB2D97ECA84Ea27aCa45aa1C57EF"], + optimism: ["0x6De33698e9e9b787e09d3Bd7771ef63557E148bb", "0x9D39Fc627A6d9d9F8C831c16995b209548cc3401"] } // From https://cbridge-docs.celer.network/#/FAQ?id=what-are-the-token-addresses-on-each-chain @@ -92,13 +93,7 @@ function chainTvl(chain) { const tokenAddress = chainsWithDifferentDecimals.includes(chain) ? chain + ':' + token[chain] : token.ethereum sdk.util.sumSingleBalance(balances, tokenAddress, balanceV1.output) if (bridgeContractsV2[chain] !== undefined) { - const balanceV2 = await sdk.api.erc20.balanceOf({ - chain, - block, - target: token[chain], - owner: bridgeContractsV2[chain] - }) - sdk.util.sumSingleBalance(balances, tokenAddress, balanceV2.output) + await sumTokens(balances, bridgeContractsV2[chain].map(b=>[token[chain], b]), block, chain, ()=>tokenAddress) } })) return balances From 043e8902b4725e8083b094fed555b662fecfd816 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 6 Dec 2021 21:47:47 +0000 Subject: [PATCH 209/393] fix maiar --- projects/maiar/index.js | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/projects/maiar/index.js b/projects/maiar/index.js index 4ebd493ba7..a3bf526692 100644 --- a/projects/maiar/index.js +++ b/projects/maiar/index.js @@ -3,51 +3,26 @@ const {toUSDTBalances} = require('../helper/balances') const LiquidityQuery= gql` { - totalLockedValueUSDFarms - totalValueLockedUSD farms { - address - APR farmingToken { - name identifier - decimals - __typename } farmTokenPriceUSD - farmedTokenPriceUSD - farmingTokenPriceUSD farmingTokenReserve - perBlockRewards - penaltyPercent - __typename } pairs { - address firstToken { - name - identifier decimals - __typename } secondToken { - name - identifier decimals - __typename } - firstTokenPrice firstTokenPriceUSD - secondTokenPrice secondTokenPriceUSD - liquidityPoolTokenPriceUSD info { reserves0 reserves1 - totalSupply - __typename } - __typename } } @@ -74,6 +49,8 @@ async function staking(){ module.exports={ + misrepresentedTokens: true, + timetravel: false, elrond:{ tvl, staking From 8e1deae9583caa0862007372d6faa972298730e6 Mon Sep 17 00:00:00 2001 From: Alex Gaines Date: Mon, 6 Dec 2021 16:22:04 -0600 Subject: [PATCH 210/393] Review Changes Signed-off-by: Alex Gaines --- projects/uma/index.js | 51 ++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/projects/uma/index.js b/projects/uma/index.js index 4659293554..eda540147a 100644 --- a/projects/uma/index.js +++ b/projects/uma/index.js @@ -15,6 +15,11 @@ const polygonLspCreators = [ "0x62410e96a2ceB4d66824346e3264d1D9107a0aBE", "0x5Fd7FFF20Ee851cD7bEE72fB3C6d324e4C104c9f", ]; +const ethEmpCreators = [ + "0xad8fD1f418FB860A383c9D4647880af7f043Ef39", + "0x9A077D4fCf7B26a0514Baa4cff0B481e9c35CE87", + "0xddfC7E3B4531158acf4C7a5d2c3cB0eE81d018A5", +]; // Captures TVL for EMP contracts on Ethereum async function ethEmp(timestamp, block) { @@ -33,28 +38,30 @@ async function ethEmp(timestamp, block) { }; const balances = {}; - const logs = await sdk.api.util.getLogs({ - target: "0x3e532e6222afe9Bcf02DCB87216802c75D5113aE", - topic: "NewContractRegistered(address,address,address[])", - keys: ["topics"], - fromBlock: 9937650, - toBlock: block, - }); - const collaterals = await sdk.api.abi.multiCall({ - calls: logs.output.map((poolLog) => ({ - target: `0x${poolLog[1].slice(26)}`, - })), - block, - abi, - }); - await requery(collaterals, "ethereum", block, abi); - await sumTokens( - balances, - collaterals.output - .filter((t) => t.output !== null) - .map((c) => [c.output, c.input.target]), - block - ); + for (let i = 0; i < ethEmpCreators.length; i++) { + const logs = await sdk.api.util.getLogs({ + target: ethEmpCreators[i], + topic: "CreatedExpiringMultiParty(address,address)", + keys: ["topics"], + fromBlock: 9937650, + toBlock: block, + }); + const collaterals = await sdk.api.abi.multiCall({ + calls: logs.output.map((poolLog) => ({ + target: `0x${poolLog[1].slice(26)}`, + })), + block, + abi, + }); + await requery(collaterals, "ethereum", block, abi); + await sumTokens( + balances, + collaterals.output + .filter((t) => t.output !== null) + .map((c) => [c.output, c.input.target]), + block + ); + } return balances; } From 4c77ed073a0449342f7b3a2450a9215151498ea5 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:11:10 +0000 Subject: [PATCH 211/393] timetravel: false, timetravel: false, --- projects/terraswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/terraswap/index.js b/projects/terraswap/index.js index a5583d001a..c7ca11c292 100644 --- a/projects/terraswap/index.js +++ b/projects/terraswap/index.js @@ -45,6 +45,7 @@ async function tvl(timestamp){ } module.exports={ + timetravel: false, misrepresentedTokens: true, methodology: "Liquidity on the DEX", tvl @@ -98,4 +99,4 @@ const pairs = { terra10l7zllh9hduam4tugygj9x3f6976auj2xeyegp: 'DAN-LUNA', terra1wrwf3um5vm30vpwnlpvjzgwpf5fjknt68nah05: 'LUNAHODL', terra1etdkg9p0fkl8zal6ecp98kypd32q8k3ryced9d: 'TWD-UST' - } \ No newline at end of file + } From d9c5559a84e51bdc683343f39806176c9d146972 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:12:12 +0000 Subject: [PATCH 212/393] timetravel: false, timetravel: false, --- projects/pylon/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/pylon/index.js b/projects/pylon/index.js index 1e171d876b..bece83ee5a 100644 --- a/projects/pylon/index.js +++ b/projects/pylon/index.js @@ -28,6 +28,7 @@ async function staking(){ } module.exports = { + timetravel: false, methodology: 'TVL counts the UST that has been deposted to the Protocol. Data is pulled from the Pylon API:"https://api.pylon.money/api/launchpad/v1/projects/mine".', historical: false, pool2:{ @@ -37,4 +38,4 @@ module.exports = { tvl: staking }, tvl -} \ No newline at end of file +} From c9387e1e989ce45f3227a67c9cabac9ddc362fec Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:12:53 +0000 Subject: [PATCH 213/393] timetravel: false, timetravel: false, --- projects/specfinance.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/specfinance.js b/projects/specfinance.js index 560e5bb297..f93018a459 100644 --- a/projects/specfinance.js +++ b/projects/specfinance.js @@ -6,8 +6,9 @@ async function fetch(){ } module.exports = { + timetravel: false, terra:{ fetch }, fetch -} \ No newline at end of file +} From 46464d0632ae4032255983b510e83af28fb6a1ff Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:13:28 +0000 Subject: [PATCH 214/393] timetravel: false, timetravel: false, --- projects/nexus-protocol/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/nexus-protocol/index.js b/projects/nexus-protocol/index.js index c1f170c971..8eca7b7428 100644 --- a/projects/nexus-protocol/index.js +++ b/projects/nexus-protocol/index.js @@ -25,9 +25,10 @@ async function staking() { } module.exports = { + timetravel: false, terra: { // Token not on coingecko yet //staking, tvl } -} \ No newline at end of file +} From eeacbabd4afff4c8b1b8ce35a2ad7f7626d10f08 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:15:04 +0000 Subject: [PATCH 215/393] timetravel: false, timetravel: false, --- projects/loopmarkets/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/loopmarkets/index.js b/projects/loopmarkets/index.js index 8ee9830b1a..25afb66297 100644 --- a/projects/loopmarkets/index.js +++ b/projects/loopmarkets/index.js @@ -47,5 +47,6 @@ async function fetch() { } module.exports = { + timetravel: false, fetch, }; From af4a215bd58db7e7d35d29997dee1fb1e1859a5c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:34:33 +0000 Subject: [PATCH 216/393] timetravel: false, timetravel: false, --- projects/mirror/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/mirror/index.js b/projects/mirror/index.js index 3aadbee82c..9a3b4d2d0d 100644 --- a/projects/mirror/index.js +++ b/projects/mirror/index.js @@ -91,6 +91,7 @@ async function tvl(timestamp, block) { module.exports = { + timetravel: false, misrepresentedTokens: true, tvl, ethereum: { From 4103c25ba63ec9f82201ef3e1dd67e4e2bdbecb9 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:35:13 +0000 Subject: [PATCH 217/393] timetravel: false, timetravel: false, --- projects/apollodao/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/apollodao/index.js b/projects/apollodao/index.js index 10c97d3071..59c9d97e06 100644 --- a/projects/apollodao/index.js +++ b/projects/apollodao/index.js @@ -30,6 +30,7 @@ async function tvl(timestamp, ethBlock, chainBlocks) { } module.exports = { + timetravel: false, methodology: "Total TVL on vaults", tvl -} \ No newline at end of file +} From e9ff1f04484ec489ac5a2fd361a2084ec2e60bf0 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:36:58 +0000 Subject: [PATCH 218/393] timetravel: false, timetravel: false, --- projects/zigzag/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/zigzag/index.js b/projects/zigzag/index.js index ad18064ce0..5f87367c16 100644 --- a/projects/zigzag/index.js +++ b/projects/zigzag/index.js @@ -31,8 +31,9 @@ function offers() { } module.exports = { + timetravel: false, zksync:{ offers, tvl: async()=>({}) } -} \ No newline at end of file +} From 7f680d95d16a1fe6fd233fd4cc17421650998732 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:59:17 +0000 Subject: [PATCH 219/393] timetravel: true, timetravel: true, --- projects/hpdex/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/hpdex/index.js b/projects/hpdex/index.js index dc10fac08f..7a7db0ffe1 100644 --- a/projects/hpdex/index.js +++ b/projects/hpdex/index.js @@ -1,9 +1,10 @@ const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') module.exports={ + timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0xE1d563BcFD4E2a5A9ce355CC8631421186521aAA) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", hpb: { tvl:calculateUsdUniTvl("0xE1d563BcFD4E2a5A9ce355CC8631421186521aAA", "hpb", "0xBE05Ac1FB417c9EA435b37a9Cecd39Bc70359d31", ["0xe78984541A634C52C760fbF97ca3f8E7d8f04C85","0x0F63352dF611350201c419dE9399a67e50D4B820","0x6383f770f1eec68e80ac0c5527be71a11b4d182c"], "high-performance-blockchain") } -} \ No newline at end of file +} From 9916f0e20a71faa942f34e80af85059bfcea65f6 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Mon, 6 Dec 2021 23:59:49 +0000 Subject: [PATCH 220/393] timetravel: true, timetravel: true, --- projects/GoSwap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/GoSwap/index.js b/projects/GoSwap/index.js index 1065f36a91..a5a66bc648 100644 --- a/projects/GoSwap/index.js +++ b/projects/GoSwap/index.js @@ -1,10 +1,11 @@ const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') module.exports={ + timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0xe93c2cD333902d8dd65bF9420B68fC7B1be94bB3) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", gochain: { tvl:calculateUsdUniTvl("0xe93c2cD333902d8dd65bF9420B68fC7B1be94bB3", "gochain", "0xcC237fa0A4B80bA47992d102352572Db7b96A6B5", ["0x97a19aD887262d7Eca45515814cdeF75AcC4f713", "0xe8D71132Cd78146fbeD8c085f6c06CdeDF74E3Be","0x67bBB47f6942486184f08a671155FCFA6cAd8d71", "0x331357dDD79F4E8da3f972E4Af30a8B726790a56", "0x5347FDeA6AA4d7770B31734408Da6d34a8a07BdF"], "gochain") } -} \ No newline at end of file +} From dd9b226205831c3459a5334017bf5e3aa350259e Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:00:29 +0000 Subject: [PATCH 221/393] timetravel: true, timetravel: true, --- projects/standard-tech/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/standard-tech/index.js b/projects/standard-tech/index.js index d1ef21d42f..17216a8c0e 100644 --- a/projects/standard-tech/index.js +++ b/projects/standard-tech/index.js @@ -1,6 +1,7 @@ const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') module.exports={ + timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0x073386AE3292299a5814B00bC1ceB8f2bfC92c51) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", shiden: { @@ -43,4 +44,4 @@ module.exports={ "0x31021e0b1cc6f89e04586a0e3cf5c46d5498a5e9", ], "metis-token"), } -} \ No newline at end of file +} From 30e69d9a52c88c4d236cfae1df78ce621be34dff Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:00:56 +0000 Subject: [PATCH 222/393] timetravel: true, timetravel: true, --- projects/zyxswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/zyxswap/index.js b/projects/zyxswap/index.js index 3b90d8bb26..69c2bee837 100644 --- a/projects/zyxswap/index.js +++ b/projects/zyxswap/index.js @@ -1,9 +1,10 @@ const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') module.exports={ + timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0x26e13874ad1cd512b29795dafe3937e1c6f6d507) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", zyx: { tvl:calculateUsdUniTvl("0x26e13874ad1cd512b29795dafe3937e1c6f6d507", "zyx", "0xc9e1aea009b0bae9141f3dc7523fb42fd48c8656", ["0xefcaa73145b5e29eefc47bcbaeff9e870fa6a610", "0xb99c32a2da6766158b4ccf29b26e75dc22606ebd"], "zyx") } -} \ No newline at end of file +} From 81ea10bac2090da4ba9ba9710b039866a37b3fac Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:01:44 +0000 Subject: [PATCH 223/393] timetravel: true, timetravel: true, --- projects/Kwikswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/Kwikswap/index.js b/projects/Kwikswap/index.js index 79ecde7b99..317711b03b 100644 --- a/projects/Kwikswap/index.js +++ b/projects/Kwikswap/index.js @@ -23,6 +23,7 @@ const STAKING_CONTRACTS = { }; module.exports = { + timetravel: true, misrepresentedTokens: true, ethereum: { tvl: v1graph("ethereum"), From 831344a37caed79f7e12911418af06c68ec2b336 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:02:13 +0000 Subject: [PATCH 224/393] timetravel: true, timetravel: true, --- projects/shinobi/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/shinobi/index.js b/projects/shinobi/index.js index cbfb1b8386..8b07e41fdb 100644 --- a/projects/shinobi/index.js +++ b/projects/shinobi/index.js @@ -1,6 +1,7 @@ const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); module.exports = { + timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0xba831e62ac14d8500cef0367b14f383d7b1b1b0a) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", @@ -20,4 +21,4 @@ module.exports = { "ubiq" ), }, -}; \ No newline at end of file +}; From 68d54ea7bde0ba3eccb8a7c7af1c304eb649739c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:02:41 +0000 Subject: [PATCH 225/393] timetravel: true, timetravel: true, --- projects/hadesswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/hadesswap/index.js b/projects/hadesswap/index.js index 052a621fd0..165d128f1c 100644 --- a/projects/hadesswap/index.js +++ b/projects/hadesswap/index.js @@ -6,9 +6,10 @@ const chainTvl = getChainTvl({ }, "factories", "liquidityUSD") module.exports = { + timetravel: true, misrepresentedTokens: true, polis: { tvl: chainTvl('polis') }, tvl: sdk.util.sumChainTvls([chainTvl('polis')]) -} \ No newline at end of file +} From 86a9491a96a9040bcfade5ae1464116a70034017 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:03:47 +0000 Subject: [PATCH 226/393] timetravel: true, timetravel: true, --- projects/flux/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/flux/index.js b/projects/flux/index.js index c82435dba7..8274bd9724 100644 --- a/projects/flux/index.js +++ b/projects/flux/index.js @@ -62,6 +62,7 @@ async function fetch() { } module.exports = { + timetravel: true, bsc: { fetch: bsc, }, From 514187f5b099539c956a5af8fdb54094c0f920bd Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:04:42 +0000 Subject: [PATCH 227/393] timetravel: false, timetravel: false, --- projects/rocketswap.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/rocketswap.js b/projects/rocketswap.js index 3d86d9ad46..a92fa3a33d 100644 --- a/projects/rocketswap.js +++ b/projects/rocketswap.js @@ -14,5 +14,6 @@ async function tvl(){ } module.exports={ + timetravel: false, tvl -} \ No newline at end of file +} From 860ae6bf002dd557468b418d610b265145b32505 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:05:38 +0000 Subject: [PATCH 228/393] timetravel: true, timetravel: true, --- projects/fusefi/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/fusefi/index.js b/projects/fusefi/index.js index 9280cc3147..c4a7afc9a8 100644 --- a/projects/fusefi/index.js +++ b/projects/fusefi/index.js @@ -3,8 +3,9 @@ const swap = require('./swap') const olalending = require('./olalending') module.exports = { + timetravel: true, fuse:{ tvl: sdk.util.sumChainTvls([swap.tvl, olalending.tvl]), borrowed: olalending.borrowed } -} \ No newline at end of file +} From 66cba8272736ffedb46bc8a676bb54fd9c392d2d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:06:48 +0000 Subject: [PATCH 229/393] timetravel: false, timetravel: false, --- projects/telos-swap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/telos-swap/index.js b/projects/telos-swap/index.js index 5102e98add..1513e80de7 100644 --- a/projects/telos-swap/index.js +++ b/projects/telos-swap/index.js @@ -18,6 +18,7 @@ async function tvl(){ } module.exports={ + timetravel: false, methodology: 'TVL is the liquidity on the AMM.', tvl } From 2edad7be62a79b8614dc914bf30050f06c8592db Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:07:45 +0000 Subject: [PATCH 230/393] timetravel: true, timetravel: true, --- projects/pnetwork.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/pnetwork.js b/projects/pnetwork.js index a9377bbaef..589e6d6813 100644 --- a/projects/pnetwork.js +++ b/projects/pnetwork.js @@ -37,6 +37,7 @@ const chainTvls = Object.fromEntries(Object.entries(chains).map(c=>[c[0], { }])) module.exports = { + timetravel: true, ...chainTvls, tvl: sdk.util.sumChainTvls(Object.values(chains).map(getChainTvl)), methodology: 'Queries the pNetwork database, using the same API endpoint as their own UI. TVL is based on the amount of assets “locked” in the system and that therefore has a 1:1 tokenisation on a host blockchain, including all of the assets and all of the blockchains supported by pNetwork.' From 3ac0652e470bf7f3d8a5f70dfeab628b87e9b129 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:09:04 +0000 Subject: [PATCH 231/393] timetravel: true, timetravel: true, --- projects/genshiro/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/genshiro/index.js b/projects/genshiro/index.js index fab6b1edaf..7149912bf8 100644 --- a/projects/genshiro/index.js +++ b/projects/genshiro/index.js @@ -283,6 +283,7 @@ async function tvl() { } module.exports = { + timetravel: true, methodology: 'Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield as well as the deposits of the Bailsman. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted.', tvl, }; From 6690f92932209f5d0ae305803866299164740a6c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:10:07 +0000 Subject: [PATCH 232/393] timetravel: true, timetravel: true, --- projects/luaswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/luaswap/index.js b/projects/luaswap/index.js index 349ed6e924..09489c93f5 100644 --- a/projects/luaswap/index.js +++ b/projects/luaswap/index.js @@ -1,6 +1,7 @@ const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); module.exports = { + timetravel: true, misrepresentedTokens: true, methodology: "Factory address on tomochain (0x0eAC91966b12b81db18f59D8e893b9ccef7e2c30) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", From fe1b1353afd56c1e50561f2d7be3724c0d2eb9ff Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:10:53 +0000 Subject: [PATCH 233/393] timetravel: true, timetravel: true, --- projects/tomofinance.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/tomofinance.js b/projects/tomofinance.js index b45240dd19..ac8a7ffc7d 100644 --- a/projects/tomofinance.js +++ b/projects/tomofinance.js @@ -16,8 +16,9 @@ async function taiSupply(timestamp, ethBlock, chainBlocks) { }; module.exports = { + timetravel: true, misrepresentedTokens: true, tomochain: { tvl: taiSupply } -}; \ No newline at end of file +}; From 9c7eefa78804737e0e49e7cb3e393985e0e131c1 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:11:35 +0000 Subject: [PATCH 234/393] timetravel: true, timetravel: true, --- projects/glide-finance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/glide-finance/index.js b/projects/glide-finance/index.js index 5b0573a7b1..72b8f3f7c0 100644 --- a/projects/glide-finance/index.js +++ b/projects/glide-finance/index.js @@ -2,10 +2,11 @@ const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') const { stakingPricedLP } = require('../helper/staking') module.exports={ + timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0xaAbe38153b25f0d4b2bDa620f67059B3a45334e5) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", elastos: { tvl:calculateUsdUniTvl("0xaAbe38153b25f0d4b2bDa620f67059B3a45334e5", "elastos", "0x517E9e5d46C1EA8aB6f78677d6114Ef47F71f6c4", ["0x802c3e839E4fDb10aF583E3E759239ec7703501e", "0xA06be0F5950781cE28D965E5EFc6996e88a8C141"], "elastos"), staking: stakingPricedLP("0x7F5489f77Bb8515DE4e0582B60Eb63A7D9959821", "0xd39eC832FF1CaaFAb2729c76dDeac967ABcA8F27", "elastos", "0xbeeAAb15628329C2C89Bc9F403d34b31fbCb3085", "elastos") } -} \ No newline at end of file +} From e17d9c85dffe1005a11deeb1ce12fb7f2e08f68d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:13:58 +0000 Subject: [PATCH 235/393] timetravel: true, timetravel: true, --- projects/elkfinance/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/elkfinance/index.js b/projects/elkfinance/index.js index ef7e6de9dc..7719fc149a 100644 --- a/projects/elkfinance/index.js +++ b/projects/elkfinance/index.js @@ -69,10 +69,11 @@ function chainTvl(chain){ const chainExports = getChainExports(chainTvl, Object.keys(factories)) chainExports.misrepresentedTokens= true; +chainExports.timetravel= true, /* Object.entries(stakingContracts).forEach(contract=>{ chainExports[contract[0] === "avax"?"avalanche":contract[0]].staking = chainStaking(contract[0], contract[1]) }) */ -module.exports = chainExports \ No newline at end of file +module.exports = chainExports From 0a3f0b059081ad5eaec9a11e064443c4b3604913 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:14:52 +0000 Subject: [PATCH 236/393] timetravel: true, timetravel: true, --- projects/carbonswap/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/carbonswap/index.js b/projects/carbonswap/index.js index b25745568f..b893677929 100644 --- a/projects/carbonswap/index.js +++ b/projects/carbonswap/index.js @@ -1,9 +1,10 @@ const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') module.exports={ + timetravel: true, misrepresentedTokens: true, methodology: "Factory address (0x17854c8d5a41d5A89B275386E24B2F38FD0AfbDd) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", energyweb: { tvl:calculateUsdUniTvl("0x17854c8d5a41d5A89B275386E24B2F38FD0AfbDd", "energyweb", "0x6b3bd0478DF0eC4984b168Db0E12A539Cc0c83cd", ["0xe1BCdcd419Eb96d67D3eAb707FC108eD9172aDc7", "0x593122AAE80A6Fc3183b2AC0c4ab3336dEbeE528", "0x3862F260e94904aaAe628DdF427b1F662652BBD2"], "energy-web-token") } -} \ No newline at end of file +} From e593cb1ed5d0efb30f20bc5fce2cc1760537d017 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:16:42 +0000 Subject: [PATCH 237/393] timetravel: false, timetravel: false, --- projects/ttswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/ttswap/index.js b/projects/ttswap/index.js index b9ef276502..8e0ce91de2 100644 --- a/projects/ttswap/index.js +++ b/projects/ttswap/index.js @@ -10,6 +10,7 @@ const thundercoreTvl = async () => { }; module.exports = { + timetravel: false, ThunderCore: { tvl: thundercoreTvl, }, From b737de8e4fb7e068d10d469779580bd53327fcb3 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:19:07 +0000 Subject: [PATCH 238/393] timetravel: true, timetravel: true, --- projects/magicland/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/magicland/index.js b/projects/magicland/index.js index 1ca5c5bb3f..01ad48626d 100644 --- a/projects/magicland/index.js +++ b/projects/magicland/index.js @@ -52,6 +52,7 @@ const iotexTvl = async (timestamp, ethBlock, chainBlocks) => { }; module.exports={ + timetravel: true, //no archive node arbitrum: { tvl: arbitrumTvl }, @@ -59,4 +60,4 @@ module.exports={ tvl: iotexTvl }, tvl: sdk.util.sumChainTvls([arbitrumTvl, iotexTvl]), -} \ No newline at end of file +} From 3d618f9753abcc3ccb00845558468e9fab6a10ec Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:20:01 +0000 Subject: [PATCH 239/393] timetravel: false, timetravel: false, --- projects/cyclone/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/cyclone/index.js b/projects/cyclone/index.js index 05eb7b123d..5b65c8fd40 100644 --- a/projects/cyclone/index.js +++ b/projects/cyclone/index.js @@ -41,6 +41,7 @@ async function fetch() { } module.exports = { + timetravel: false, ...fetchChainExports(fetchChain, Object.keys(gqls)), pool2:{ fetch:pool2 From 6fa61e13aa536c8ed57a4ffc9495c6263a0665aa Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:21:57 +0000 Subject: [PATCH 240/393] timetravel: true, timetravel: true, --- projects/zoomswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/zoomswap/index.js b/projects/zoomswap/index.js index 234b4589f7..22422d7efb 100644 --- a/projects/zoomswap/index.js +++ b/projects/zoomswap/index.js @@ -18,6 +18,7 @@ async function staking(timestamp, ethBlock, chainBlocks) { } module.exports = { + timetravel: true, iotex: { tvl: staking } From c7d276811428dfbd547c5442617b1652831cb557 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:22:44 +0000 Subject: [PATCH 241/393] timetravel: true, timetravel: true, --- projects/parrotegg/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/parrotegg/index.js b/projects/parrotegg/index.js index 7aee77aef7..7e2ce90dc6 100644 --- a/projects/parrotegg/index.js +++ b/projects/parrotegg/index.js @@ -80,6 +80,7 @@ const iotexTvl = async (timestamp, ethBlock, chainBlocks) => { }; module.exports={ + timetravel: true, arbitrum: { tvl: arbitrumTvl }, @@ -93,4 +94,4 @@ module.exports={ tvl: harmonyTvl }, tvl: sdk.util.sumChainTvls([arbitrumTvl, iotexTvl, polygonTvl, harmonyTvl]), -} \ No newline at end of file +} From 4b1c0e2e4cc92aa7003e1a0f05ac12e4aad6b0e2 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:23:50 +0000 Subject: [PATCH 242/393] timetravel: true, timetravel: true, --- projects/minmax-finance/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/minmax-finance/index.js b/projects/minmax-finance/index.js index ab7727f0cf..4f867f727a 100644 --- a/projects/minmax-finance/index.js +++ b/projects/minmax-finance/index.js @@ -105,6 +105,7 @@ async function tvl(block) { } module.exports = { + timetravel: true, methodology: "All the assets in the pool.", iotex:{ tvl, From e057eaedcc2ad80b5fc51cb7819d40b19d5d2956 Mon Sep 17 00:00:00 2001 From: nemusona Date: Mon, 6 Dec 2021 18:37:50 -0600 Subject: [PATCH 243/393] uses onchain data and added perp tvl for sakeperp --- projects/sakeperp/abi.json | 45 +++++++++++++ projects/sakeperp/index.js | 129 ++++++++++++++++++++++++++++++++++--- 2 files changed, 164 insertions(+), 10 deletions(-) create mode 100644 projects/sakeperp/abi.json diff --git a/projects/sakeperp/abi.json b/projects/sakeperp/abi.json new file mode 100644 index 0000000000..8bb166eb46 --- /dev/null +++ b/projects/sakeperp/abi.json @@ -0,0 +1,45 @@ +{ + "allPairs": { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "allPairs", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + "allPairsLength": { + "inputs": [], + "name": "allPairsLength", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + "getReserves": { + "inputs": [], + "name": "getReserves", + "outputs": [ + { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, + { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, + { + "internalType": "uint32", + "name": "_blockTimestampLast", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + "token0": { + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + }, + "token1": { + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/sakeperp/index.js b/projects/sakeperp/index.js index ac499e3565..91660ead3a 100644 --- a/projects/sakeperp/index.js +++ b/projects/sakeperp/index.js @@ -1,16 +1,125 @@ -const { getChainTvl } = require('../helper/getUniSubgraphTvl'); -const sdk = require('@defillama/sdk') +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); -const graphUrls = { - ethereum: 'https://api.thegraph.com/subgraphs/name/therealsakeswap/sakeswap-subgraph-v2', +const ethSake = "0x066798d9ef0833ccc719076Dab77199eCbd178b0"; +const ethFactory = "0x75e48C954594d64ef9613AeEF97Ad85370F13807"; +const ethSakebar = "0x5fe808a4889b714496E7b821c8542e26be2f8f67"; +const bscSake = "0x8BD778B12b15416359A227F0533Ce2D91844e1eD"; +const bscFactory = "0xA534cf041Dcd2C95B4220254A0dCb4B905307Fd8"; +const bscSakebar = "0xbC83FAdA7D0881F772daaB2B4295F949FA309B59"; +const perpVault = "0xa34dA41edB2b15A20893d2208377E24D8dcdeB6e"; +const bUsd = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; + +async function tvl(factory, block, chain) { + let balances = {}; + let poolsLength = ( + await sdk.api.abi.call({ + target: factory, + abi: abi.allPairsLength, + block, + chain, + }) + ).output; + let allPools = ( + await sdk.api.abi.multiCall({ + calls: Array.from({ length: Number(poolsLength) }, (_, k) => ({ + target: factory, + params: k, + })), + abi: abi.allPairs, + block, + chain, + }) + ).output; + let reserves = ( + await sdk.api.abi.multiCall({ + calls: allPools.map((p) => ({ + target: p.output, + })), + abi: abi.getReserves, + block, + chain, + }) + ).output; + let token0s = ( + await sdk.api.abi.multiCall({ + calls: allPools.map((p) => ({ + target: p.output, + })), + abi: abi.token0, + block, + chain, + }) + ).output; + let token1s = ( + await sdk.api.abi.multiCall({ + calls: allPools.map((p) => ({ + target: p.output, + })), + abi: abi.token1, + block, + chain, + }) + ).output; + for (let i = 0; i < reserves.length; i++) { + sdk.util.sumSingleBalance( + balances, + `${chain}:${token0s[i].output}`, + reserves[i].output._reserve0 + ); + sdk.util.sumSingleBalance( + balances, + `${chain}:${token1s[i].output}`, + reserves[i].output._reserve1 + ); + } + return balances; +} + +async function staking(sake, sakebar, block, chain) { + let balances = {}; + let balance = ( + await sdk.api.erc20.balanceOf({ + target: sake, + owner: sakebar, + block, + chain, + }) + ).output; + sdk.util.sumSingleBalance(balances, `${chain}:${sake}`, balance); + return balances; +} + +async function ethTvl(timestamp, block) { + return await tvl(ethFactory, block, "ethereum"); +} + +async function bscTvl(timestamp, block, chainBlocks) { + return await tvl(bscFactory, chainBlocks.bsc, "bsc"); +} + +async function ethStaking(timestamp, block) { + return await staking(ethSake, ethSakebar, block, "ethereum"); +} + +async function bscStaking(timestamp, block, chainBlocks) { + return await staking(bscSake, bscSakebar, chainBlocks.bsc, "bsc"); +} + +async function perpVaultTvl(timestamp, block, chainBlocks) { + return await staking(bUsd, perpVault, chainBlocks.bsc, "bsc"); } -const chainTvl = getChainTvl(graphUrls) module.exports = { - misrepresentedTokens: true, - methodology: "Liquidity on the DEX, data comes from their subgraph", + methodology: + "TVL consists of pools in the factory contract and the BUSD in the PerpVault contract. Staking consists of SAKE in SakeBar.", ethereum: { - tvl: chainTvl('ethereum'), + tvl: ethTvl, + staking: ethStaking, + }, + bsc: { + tvl: sdk.util.sumChainTvls([bscTvl, perpVaultTvl]), + staking: bscStaking, }, - tvl: sdk.util.sumChainTvls(['ethereum'].map(chainTvl)) -} \ No newline at end of file + tvl: sdk.util.sumChainTvls([ethTvl, bscTvl, perpVaultTvl]), +}; From 846c125e3fe3e418e6ad0354171ea62d06909d1e Mon Sep 17 00:00:00 2001 From: PolyDex Date: Tue, 7 Dec 2021 09:33:52 +0700 Subject: [PATCH 244/393] add kryptodex --- projects/kryptodex/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/kryptodex/index.js diff --git a/projects/kryptodex/index.js b/projects/kryptodex/index.js new file mode 100644 index 0000000000..c8e007b6aa --- /dev/null +++ b/projects/kryptodex/index.js @@ -0,0 +1,22 @@ +const { calculateUsdUniTvl } = require('../helper/getUsdUniTvl') +const { stakingPricedLP } = require('../helper/staking') +module.exports = { + misrepresentedTokens: true, + methodology: "Factory address (0x33c04bD4Ae93336BbD1024D709f4A313cC858EBe) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + cronos: { + tvl: calculateUsdUniTvl("0x33c04bD4Ae93336BbD1024D709f4A313cC858EBe", "cronos", "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", [ + //KRX + "0xF0681BB7088Ac68A62909929554Aa22ad89a21fB", + //CRONA + "0xadbd1231fb360047525BEdF962581F3eee7b49fe", + //USDC + "0xc21223249CA28397B4B6541dfFaEcC539BfF0c59", + //BUSD + "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8", + //USDT + "0x66e428c3f67a68878562e79A0234c1F83c208770", + //DAI + "0xF2001B145b43032AAF5Ee2884e456CCd805F677D"], "crypto-com-chain"), + staking: stakingPricedLP("0x53cE820Ed109D67746a86b55713E30252275c127", "0xF0681BB7088Ac68A62909929554Aa22ad89a21fB", "cronos", "0xD2219106310E46D7FD308c0eC9d9FCc2d2c8a9B5", "crypto-com-chain") + } +} \ No newline at end of file From 64925adda5e83123e620e376abd3f0461d1a2854 Mon Sep 17 00:00:00 2001 From: Jack Lee Date: Tue, 7 Dec 2021 10:55:19 +0800 Subject: [PATCH 245/393] add bsc tvl --- projects/naos/index.js | 285 ++++++++++++++++++++++++++++++++++------- 1 file changed, 239 insertions(+), 46 deletions(-) diff --git a/projects/naos/index.js b/projects/naos/index.js index d668cf60b5..e19fd75b34 100644 --- a/projects/naos/index.js +++ b/projects/naos/index.js @@ -1,30 +1,65 @@ -const sdk = require('@defillama/sdk'); -const abis = require('../config/abis'); -const BigNumber = require('bignumber.js'); - -const STAKING_POOL_ADDRESS = '0x99E4eA9eF6bf396C49B35FF9478EbB8890aEF581'; -const UNI_ETH_NAOS_LP_ADDRESS = '0x9b577e849b128ee1a69144b218e809b8bb98c35d'; -const NAOS_ADDRESS = '0x4a615bb7166210cce20e6642a6f8fb5d4d044496'; -const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'; -const NUSD_3CRV_LP_ADDRESS = '0x67d9eAe741944D4402eB0D1cB3bC3a168EC1764c'; -const CRV_ADDRESS = '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490'; - -const DAI_CONTRACT_ADDRESS = '0x6b175474e89094c44da98b954eedeac495271d0f'; +const sdk = require("@defillama/sdk"); +const abis = require("../config/abis"); +const BigNumber = require("bignumber.js"); + +const alpacaAdapterAbi = [ + { + inputs: [], + name: "totalValue", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + +// BSC address +const BSC_NAOS_ADDRESS = "0x758d08864fb6cce3062667225ca10b8f00496cc2"; +const BSC_BNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; +const CAKE_BNB_NAOS_LP_ADDRESS = "0xcaa662ad41a662b81be2aea5d59ec0697628665f"; +const BSC_BOOST_POOL = "0x3dcd32dd2b225749aa830ca3b4f2411bfeb03db4"; +const BUSD_CONTRACT_ADDRESS = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const BUSD_CONTRACT_HOLDER = [ + "0x9591ff9c5070107000155ff6c5ce049aa1443dd3", // Formation + "0xb9ece39b356d5c0842301b42a716e4385617c871", // Transmuter +]; +const BSC_ALPACA_ADAPTERS = [ + "0x640848400fc1cbaf9e4a1ed18d1bd3e2b16d1de2", // Formation adapter + "0x4ca1a19d108b84f6f671ffe3555e7743c5ed6a2c", // Transmuter adapter +]; + +const BSC_STAKING_POOL_WITH_TRANSFER = + "0x6ebc2c41c1e29a5506b86b758b6c16dd5bbcf7d1"; + +// ETH address +const STAKING_POOL_ADDRESS = "0x99E4eA9eF6bf396C49B35FF9478EbB8890aEF581"; +const UNI_ETH_NAOS_LP_ADDRESS = "0x9b577e849b128ee1a69144b218e809b8bb98c35d"; +const NAOS_ADDRESS = "0x4a615bb7166210cce20e6642a6f8fb5d4d044496"; +const WETH_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; +const NUSD_3CRV_LP_ADDRESS = "0x67d9eAe741944D4402eB0D1cB3bC3a168EC1764c"; +const CRV_ADDRESS = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"; + +const DAI_CONTRACT_ADDRESS = "0x6b175474e89094c44da98b954eedeac495271d0f"; const DAI_CONTRACT_HOLDER = [ - '0x9Ddceb30515eD297C1B72Ff8F848F254104b7A12', // Formation - '0x3ED6355Ad74605c0b09415d6B0b29a294Fd31265', // Transmuter + "0x9Ddceb30515eD297C1B72Ff8F848F254104b7A12", // Formation + "0x3ED6355Ad74605c0b09415d6B0b29a294Fd31265", // Transmuter ]; // yearn vault version/address const YEARN_VAULT = { - v1: '0x19d3364a399d251e894ac732651be8b0e4e85001', - v2: '0xda816459f1ab5631232fe5e97a05bbbb94970c95', + v1: "0x19d3364a399d251e894ac732651be8b0e4e85001", + v2: "0xda816459f1ab5631232fe5e97a05bbbb94970c95", }; // yearn adapter version/address const YEARN_ADAPTER = { - v1: '0xC1802cccc61e671f7c547E9326523edD2f55E84D', - v2: '0x8394BB87481046C1ec84C39689D402c00189df43', + v1: "0xC1802cccc61e671f7c547E9326523edD2f55E84D", + v2: "0x8394BB87481046C1ec84C39689D402c00189df43", }; function weiToFloat(wei, decimal = 18) { @@ -47,8 +82,8 @@ function sumTwoNumber(token1, token2) { async function tvl(timestamp, block) { let balances = {}; - let YEARN_VAULT_ADDRESS = ''; - let YEARN_ADAPTER_ADDRESS = ''; + let YEARN_VAULT_ADDRESS = ""; + let YEARN_ADAPTER_ADDRESS = ""; if (block < 12983023) { YEARN_VAULT_ADDRESS = YEARN_VAULT.v1; YEARN_ADAPTER_ADDRESS = YEARN_ADAPTER.v1; @@ -65,7 +100,7 @@ async function tvl(timestamp, block) { params: holder, // formation and transmuter }; }), - abi: 'erc20:balanceOf', + abi: "erc20:balanceOf", block: block, }); @@ -79,10 +114,19 @@ async function tvl(timestamp, block) { abi: abis.abis.minYvV2[1], // pricePerShare block, }); - const { output: yVDaiDecimal } = await sdk.api.erc20.decimals(YEARN_VAULT_ADDRESS); - const yvDaiTVL = tokenAmountMultiplyPricePerShare(yVDaiTotalAmount, yVDaiPricePerShare, yVDaiDecimal); // parse yvdai value to dai + const { output: yVDaiDecimal } = await sdk.api.erc20.decimals( + YEARN_VAULT_ADDRESS + ); + const yvDaiTVL = tokenAmountMultiplyPricePerShare( + yVDaiTotalAmount, + yVDaiPricePerShare, + yVDaiDecimal + ); // parse yvdai value to dai sdk.util.sumMultiBalanceOf(balances, daiStakeTotalAmount, true); // for formation, transmuter dai tvl - balances[DAI_CONTRACT_ADDRESS] = sumTwoNumber(balances[DAI_CONTRACT_ADDRESS], yvDaiTVL).toFixed(0); // add yvdai tvl with dai + balances[DAI_CONTRACT_ADDRESS] = sumTwoNumber( + balances[DAI_CONTRACT_ADDRESS], + yvDaiTVL + ).toFixed(0); // add yvdai tvl with dai // ---- End DAI and yvDai // ---- Start nUSD-3CRV staking @@ -97,6 +141,72 @@ async function tvl(timestamp, block) { return balances; } +async function bscTvl(timestamp, ethBlock, chainBlocks) { + let block = chainBlocks["bsc"]; + let balances = {}; + // ---- Start BUSD + // formation + let { output: formationBUSDAmount } = await sdk.api.erc20.balanceOf({ + target: BUSD_CONTRACT_ADDRESS, + owner: BUSD_CONTRACT_HOLDER[0], // formation address + block: block, + chain: "bsc", + }); + + sdk.util.sumSingleBalance( + balances, + `bsc:${BUSD_CONTRACT_ADDRESS}`, + formationBUSDAmount + ); + // transmuter + let { output: transmuterBUSDAmount } = await sdk.api.erc20.balanceOf({ + target: BUSD_CONTRACT_ADDRESS, + owner: BUSD_CONTRACT_HOLDER[1], // transmuter address + block: block, + chain: "bsc", + }); + + sdk.util.sumSingleBalance( + balances, + `bsc:${BUSD_CONTRACT_ADDRESS}`, + transmuterBUSDAmount + ); + // ---- End BUSD + + // ---- Start ibBUSD (map ibBUSD value to BUSD) + const ibBUSDAlpacaFormationAdapterValue = ( + await sdk.api.abi.call({ + target: BSC_ALPACA_ADAPTERS[0], + abi: alpacaAdapterAbi[0], + block: block, + chain: "bsc", + }) + ).output; + + const ibBUSDAlpacaTransmuterAdapterValue = ( + await sdk.api.abi.call({ + target: BSC_ALPACA_ADAPTERS[1], + abi: alpacaAdapterAbi[0], + block: block, + chain: "bsc", + }) + ).output; + + sdk.util.sumSingleBalance( + balances, + `bsc:${BUSD_CONTRACT_ADDRESS}`, + ibBUSDAlpacaFormationAdapterValue + ); + sdk.util.sumSingleBalance( + balances, + `bsc:${BUSD_CONTRACT_ADDRESS}`, + ibBUSDAlpacaTransmuterAdapterValue + ); + // ---- End ibBUSD + + return balances; +} + async function pool2(timestamp, block) { const balances = {}; // ---- Start uniswap eth-naos lp @@ -105,19 +215,19 @@ async function pool2(timestamp, block) { abi: { constant: true, inputs: [], - name: 'getReserves', + name: "getReserves", outputs: [ - { internalType: 'uint112', name: '_reserve0', type: 'uint112' }, - { internalType: 'uint112', name: '_reserve1', type: 'uint112' }, + { internalType: "uint112", name: "_reserve0", type: "uint112" }, + { internalType: "uint112", name: "_reserve1", type: "uint112" }, { - internalType: 'uint32', - name: '_blockTimestampLast', - type: 'uint32', + internalType: "uint32", + name: "_blockTimestampLast", + type: "uint32", }, ], payable: false, - stateMutability: 'view', - type: 'function', + stateMutability: "view", + type: "function", }, block, }); @@ -133,14 +243,19 @@ async function pool2(timestamp, block) { uni_NAOS_WETH_LpTotalSupply = new BigNumber(uni_NAOS_WETH_LpTotalSupply); - let { output: stakingPoolHoldWethNaosLpTotalAmount } = await sdk.api.erc20.balanceOf({ - target: UNI_ETH_NAOS_LP_ADDRESS, - owner: STAKING_POOL_ADDRESS, - block: block, - }); + let { output: stakingPoolHoldWethNaosLpTotalAmount } = + await sdk.api.erc20.balanceOf({ + target: UNI_ETH_NAOS_LP_ADDRESS, + owner: STAKING_POOL_ADDRESS, + block: block, + }); - stakingPoolHoldWethNaosLpTotalAmount = new BigNumber(stakingPoolHoldWethNaosLpTotalAmount); - const stakedPercentage = stakingPoolHoldWethNaosLpTotalAmount.div(uni_NAOS_WETH_LpTotalSupply); + stakingPoolHoldWethNaosLpTotalAmount = new BigNumber( + stakingPoolHoldWethNaosLpTotalAmount + ); + const stakedPercentage = stakingPoolHoldWethNaosLpTotalAmount.div( + uni_NAOS_WETH_LpTotalSupply + ); const naosStakedAmount = uniNAOSTokenAmount.multipliedBy(stakedPercentage); const wethStakedAmount = uniWETHTokenAmount.multipliedBy(stakedPercentage); balances[NAOS_ADDRESS] = naosStakedAmount.toFixed(0); @@ -150,6 +265,69 @@ async function pool2(timestamp, block) { return balances; } +async function BSCPool2(timestamp, ethblock, chainBlocks) { + let block = chainBlocks["bsc"]; + const balances = {}; + + // ---- Start pancake bnb-naos lp + const { output: cakeBnbNaosLP } = await sdk.api.abi.call({ + target: CAKE_BNB_NAOS_LP_ADDRESS, + abi: { + 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", + }, + block, + chain: "bsc", + }); + + let cakeNAOSTokenAmount = new BigNumber(cakeBnbNaosLP._reserve0); + let cakeBNBTokenAmount = new BigNumber(cakeBnbNaosLP._reserve1); + + let { output: cake_NAOS_BNB_LpTotalSupply } = await sdk.api.abi.call({ + target: CAKE_BNB_NAOS_LP_ADDRESS, + abi: abis.abis.minABI[2], // totalSupply + block, + chain: "bsc", + }); + + cake_NAOS_BNB_LpTotalSupply = new BigNumber(cake_NAOS_BNB_LpTotalSupply); + + let { output: stakingPoolHoldBNBNaosLpTotalAmount } = + await sdk.api.erc20.balanceOf({ + target: CAKE_BNB_NAOS_LP_ADDRESS, + owner: BSC_STAKING_POOL_WITH_TRANSFER, + block: block, + chain: "bsc", + }); + + stakingPoolHoldBNBNaosLpTotalAmount = new BigNumber( + stakingPoolHoldBNBNaosLpTotalAmount + ); + const stakedPercentage = stakingPoolHoldBNBNaosLpTotalAmount.div( + cake_NAOS_BNB_LpTotalSupply + ); + const naosStakedAmount = cakeNAOSTokenAmount.multipliedBy(stakedPercentage); + const bnbStakedAmount = cakeBNBTokenAmount.multipliedBy(stakedPercentage); + balances[`bsc:${BSC_NAOS_ADDRESS}`] = naosStakedAmount.toFixed(0); + balances[`bsc:${BSC_BNB_ADDRESS}`] = bnbStakedAmount.toFixed(0); + + // ---- End pancake bnb-naos lp + return balances; +} + async function staking(timestamp, block) { const balances = {}; // ---- Start naos staking @@ -163,15 +341,30 @@ async function staking(timestamp, block) { return balances; } +async function bscStaking(timestamp, ethBlock, chainBlocks) { + let block = chainBlocks["bsc"]; + const balances = {}; + // Start naos staking + let { output: naosAmount } = await sdk.api.erc20.balanceOf({ + target: BSC_NAOS_ADDRESS, + owner: BSC_BOOST_POOL, + block: block, + chain: "bsc", + }); + sdk.util.sumSingleBalance(balances, `bsc:${BSC_NAOS_ADDRESS}`, naosAmount); + // ---- End naos staking + return balances; +} + module.exports = { ethereum: { - tvl, - }, - staking: { - tvl: staking, + tvl: tvl, + staking: staking, + pool2: pool2, }, - pool2: { - tvl: pool2, + bsc: { + tvl: bscTvl, + staking: bscStaking, + pool2: BSCPool2, }, - tvl, }; From f48d1467f7dbd376e3396d27c0ce1711c8506718 Mon Sep 17 00:00:00 2001 From: Jack Lee Date: Tue, 7 Dec 2021 11:45:56 +0800 Subject: [PATCH 246/393] boost pool update --- projects/naos/index.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/projects/naos/index.js b/projects/naos/index.js index e19fd75b34..942af6699d 100644 --- a/projects/naos/index.js +++ b/projects/naos/index.js @@ -18,6 +18,22 @@ const alpacaAdapterAbi = [ }, ]; +const boostPoolAbi = [ + { + inputs: [], + name: "getPoolTotalDeposited", + outputs: [ + { + internalType: "uint256", + name: "", + type: "uint256", + }, + ], + stateMutability: "view", + type: "function", + }, +]; + // BSC address const BSC_NAOS_ADDRESS = "0x758d08864fb6cce3062667225ca10b8f00496cc2"; const BSC_BNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; @@ -345,10 +361,10 @@ async function bscStaking(timestamp, ethBlock, chainBlocks) { let block = chainBlocks["bsc"]; const balances = {}; // Start naos staking - let { output: naosAmount } = await sdk.api.erc20.balanceOf({ - target: BSC_NAOS_ADDRESS, - owner: BSC_BOOST_POOL, - block: block, + let { output: naosAmount } = await sdk.api.abi.call({ + target: BSC_BOOST_POOL, + abi: boostPoolAbi[0], // getPoolTotalDeposited + block, chain: "bsc", }); sdk.util.sumSingleBalance(balances, `bsc:${BSC_NAOS_ADDRESS}`, naosAmount); From d72280f7692a25479284f6e225e1244b2d57c459 Mon Sep 17 00:00:00 2001 From: Ss5h Date: Tue, 7 Dec 2021 15:13:39 +0900 Subject: [PATCH 247/393] Update bifi tvl --- projects/bifi/abi/oracle.json | 21 ++++++++++ projects/bifi/abi/token.json | 1 + projects/bifi/index.js | 76 ++++++++++++++++++++++++++++++++++- 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 projects/bifi/abi/oracle.json create mode 100644 projects/bifi/abi/token.json diff --git a/projects/bifi/abi/oracle.json b/projects/bifi/abi/oracle.json new file mode 100644 index 0000000000..6b4343f71c --- /dev/null +++ b/projects/bifi/abi/oracle.json @@ -0,0 +1,21 @@ +[ + { + "inputs":[ + { + "internalType":"uint256", + "name":"tokenID", + "type":"uint256" + } + ], + "name":"getTokenPrice", + "outputs":[ + { + "internalType":"uint256", + "name":"", + "type":"uint256" + } + ], + "stateMutability":"view", + "type":"function" + } +] \ No newline at end of file diff --git a/projects/bifi/abi/token.json b/projects/bifi/abi/token.json new file mode 100644 index 0000000000..777ef79c47 --- /dev/null +++ b/projects/bifi/abi/token.json @@ -0,0 +1 @@ +[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_upgradedAddress","type":"address"}],"name":"deprecate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"deprecated","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_evilUser","type":"address"}],"name":"addBlackList","outputs":[],"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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"upgradedAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balances","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maximumFee","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"_totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_maker","type":"address"}],"name":"getBlackListStatus","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowed","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"who","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"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":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"newBasisPoints","type":"uint256"},{"name":"newMaxFee","type":"uint256"}],"name":"setParams","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"issue","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"basisPointsRate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"isBlackListed","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_clearedUser","type":"address"}],"name":"removeBlackList","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"MAX_UINT","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_blackListedUser","type":"address"}],"name":"destroyBlackFunds","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"},{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_decimals","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Issue","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"newAddress","type":"address"}],"name":"Deprecate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"feeBasisPoints","type":"uint256"},{"indexed":false,"name":"maxFee","type":"uint256"}],"name":"Params","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_blackListedUser","type":"address"},{"indexed":false,"name":"_balance","type":"uint256"}],"name":"DestroyedBlackFunds","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_user","type":"address"}],"name":"AddedBlackList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_user","type":"address"}],"name":"RemovedBlackList","type":"event"},{"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"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"}] \ No newline at end of file diff --git a/projects/bifi/index.js b/projects/bifi/index.js index 28ae73b25d..9b2f05bed6 100644 --- a/projects/bifi/index.js +++ b/projects/bifi/index.js @@ -1,5 +1,8 @@ const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); +const Caver = require('caver-js'); +const OracleAbi = require('./abi/oracle.json'); +const TokenAbi = require('./abi/token.json'); const stakingPool = '0x488933457E89656D7eF7E69C10F2f80C7acA19b5'; const bfcAddr = '0x0c7D5ae016f806603CB1782bEa29AC69471CAb9c'; @@ -73,6 +76,39 @@ const avaxTokenPools = { } } +const klayOracleContract = '0xCD4F7C7451FFD8628b7F3D5c1b68a3A207ab1125'; +const klayPool = '0x829fCFb6A6EeA9d14eb4C14FaC5B29874BdBaD13'; +const klaytnTokenPools = { + 'keth': { + 'pool': '0x07970F9D979D8594B394fE12345211C376aDfF89', + 'token': '0x34d21b1e550d73cee41151c77f3c73359527a396' + }, + 'kusdt': { + 'pool': '0xe0e67b991d6b5CF73d8A17A10c3DE74616C1ec11', + 'token': '0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167' + }, + 'kusdt': { + 'pool': '0xe0e67b991d6b5CF73d8A17A10c3DE74616C1ec11', + 'token': '0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167' + }, + 'kdai': { + 'pool': '0xE03487927e137526a2dB796A9B3b4048ab615043', + 'token': '0x5c74070fdea071359b86082bd9f9b3deaafbe32b' + }, + 'usdc': { + 'pool': '0x808c707c53c3D30d0247e4b8D78AA0D8b75CAAE1', + 'token': '0x754288077d0ff82af7a5317c7cb8c444d421d103' + }, + 'kwbtc': { + 'pool': '0xa6aDE2e6c6F50a2d9b9C4b819e84b367F88C1598', + 'token': '0x16d0e1fbd024c600ca0380a4c5d57ee7a2ecbf9c' + }, + 'kxrp': { + 'pool': '0x4800577A71F68eD7ef4C09cFBe7fd6E066D5F0dA', + 'token': '0x9eaefb09fe4aabfbe6b1ca316a3c36afc83a393f' + }, +} + function getAVAXAddress(address) { return `avax:${address}` } @@ -177,10 +213,44 @@ async function avax(timestamp, block, chainBlocks) { return balances } +async function klaytn() { + const provider = new Caver.providers.HttpProvider("https://cypress.chain.thebifrost.io/"); + const caver = new Caver(provider); + let klaytnTVL = 0; + + const oracleContract = new caver.klay.Contract(OracleAbi, klayOracleContract); + + const klayPrice = await oracleContract.methods.getTokenPrice(0).call(); + const klayBalance = await caver.rpc.klay.getBalance(klayPool); + + klaytnTVL += klayPrice * klayBalance / (10 ** 36); + + let oracleID = 0 + for (token in klaytnTokenPools) { + oracleID += 1; + + const tokenAddress = klaytnTokenPools[token].token; + const tokenPoolAddress = klaytnTokenPools[token].pool; + + const tokenPrice = await oracleContract.methods.getTokenPrice(oracleID).call(); + + const tokenContract = new caver.klay.Contract(TokenAbi, tokenAddress); + const balance = await tokenContract.methods.balanceOf(tokenPoolAddress).call(); + const decimals = await tokenContract.methods.decimals().call(); + + const div = 18 + parseInt(decimals, 10); + + klaytnTVL += balance * tokenPrice / 10 ** div; + } + + console.log(klaytnTVL); + return klaytnTVL; +} + module.exports = { ethereum: { tvl: eth, - staking: staking(stakingPool, bfcAddr, "ethereum") + staking: staking(stakingPool, bfcAddr) }, bsc: { tvl: bsc @@ -191,5 +261,7 @@ module.exports = { avax: { tvl: avax }, - tvl: sdk.util.sumChainTvls([eth, bsc, bitcoin, avax]), + klaytn: { + tvl: klaytn + } } \ No newline at end of file From d717a55f7c6082f6e25b65fc521e22c475719675 Mon Sep 17 00:00:00 2001 From: VWAVE Date: Tue, 7 Dec 2021 15:54:50 +0900 Subject: [PATCH 248/393] Create vaporwave.js --- projects/vaporwave.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/vaporwave.js diff --git a/projects/vaporwave.js b/projects/vaporwave.js new file mode 100644 index 0000000000..02d01c80b4 --- /dev/null +++ b/projects/vaporwave.js @@ -0,0 +1,24 @@ +const utils = require("./helper/utils"); +var chainId; +var vault; + +async function fetch() { + const response = await utils.fetchURL("https://api.vaporwave.farm/tvl"); + + let tvl = 0; + for (chainId in response.data) { + const chain = response.data[chainId]; + + for (vault in chain) { + tvl += chain[vault]; + } + } + + return tvl; +} + +module.exports = { + methodology: + 'TVL data is pulled from the Vaporwave Finance API "https://api.vaporwave.farm/tvl".', + fetch, +}; From 7846a7d8f95a7ae1fb398b7aa404ad17a63fbbf9 Mon Sep 17 00:00:00 2001 From: 0xCactus Date: Mon, 6 Dec 2021 23:55:53 -0800 Subject: [PATCH 249/393] add weWETH for solend --- projects/solend/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/solend/index.js b/projects/solend/index.js index d5e8d412fc..e11957cf08 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -11,7 +11,8 @@ async function tvl() { sbrAmount, merAmount, solAmount, - msolAmount, ] = await Promise.all([ + msolAmount, + wewethAmount, ] = await Promise.all([ getTokenBalance("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), getTokenBalance("9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), @@ -24,9 +25,7 @@ async function tvl() { getTokenBalance("MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), getTokenBalance("So11111111111111111111111111111111111111112", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), getTokenBalance("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - - - + getTokenBalance("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), ]) return { 'bitcoin': btcAmount, @@ -40,6 +39,7 @@ async function tvl() { 'mercurial': merAmount, 'solana': solAmount, 'msol': msolAmount, + 'weweth': wewethAmount, } } From 330acad7688dbb8d5ecc0d206de2cc155732fe6b Mon Sep 17 00:00:00 2001 From: iHux3 <35241224+iHux3@users.noreply.github.com> Date: Tue, 7 Dec 2021 11:32:32 +0100 Subject: [PATCH 250/393] Update index.js Added 2 DAO staking farms. Get also DAO staked in vaultsFarmsPool2Addresses, not only DAO-USDC LP --- projects/daomaker/index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/daomaker/index.js b/projects/daomaker/index.js index 511728f1eb..14ca03b62f 100644 --- a/projects/daomaker/index.js +++ b/projects/daomaker/index.js @@ -1,8 +1,7 @@ -const { staking } = require("../helper/staking"); +const { stakings } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const daoMakerStakingContract = "0xEfEE3763000Afbffb8551dF16800e571b9B66188"; const DAO = "0x0f51bb10119727a7e5ea3538074fb341f56b09ad"; const vaultsFarmsPool2Addresses = [ @@ -15,7 +14,11 @@ const vaultsFarmsPool2Addresses = [ //openocean "0x329420649604a57c616692c51106196a4712ea24", //yield protocol - "0x2909122ea182368A4ba7bC5Eed2D2D536B3e25Ae" + "0x2909122ea182368A4ba7bC5Eed2D2D536B3e25Ae", + //yield protocol v1 + "0xe33b15629739770a27c4726a22be61128aa1c781", + //dao maker v3 + "0xd07e86f68C7B9f9B215A3ca3E79E74Bf94D6A847", ]; const DAO_USDC_UNIV2 = "0x4cd36d6F32586177e36179a810595a33163a20BF"; @@ -54,7 +57,7 @@ async function ethTvl(block) { module.exports = { ethereum: { - staking: staking(daoMakerStakingContract, DAO), + staking: stakings(vaultsFarmsPool2Addresses, DAO), pool2: pool2s(vaultsFarmsPool2Addresses, [DAO_USDC_UNIV2]), tvl: ethTvl, }, From 78705739a93f70d82ad17ba3b53f8a0472c1ae75 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 11:10:19 +0000 Subject: [PATCH 251/393] update vikings with correct staking contract --- projects/vikings/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vikings/index.js b/projects/vikings/index.js index 311550ca82..00da7ca1e1 100644 --- a/projects/vikings/index.js +++ b/projects/vikings/index.js @@ -4,4 +4,4 @@ const treasuryAddress = "0x04b611A65A5cfEFC1C449F725b1948eeaadEB231"; module.exports = ohmTvl(treasuryAddress, [ ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], ["0x1E2D68196AcF7EB9e345c531e476E726D60a5C4b", true], -], "avax", "0xE0474c15BC7f8213eE5bfB42f9E68B2d6BE2e136", "0x91D680545a1ff4411C1ff4C927f86CD34ADB932a", undefined, undefined, true) +], "avax", "0x743DE042c7be8C415effa75b960A2A7bB5fc0704", "0xe0474c15bc7f8213ee5bfb42f9e68b2d6be2e136") From f9b6488e5660cbf07bdddded4b567b6b1c7e98df Mon Sep 17 00:00:00 2001 From: Serg Ilchuk Date: Tue, 7 Dec 2021 17:19:14 +0200 Subject: [PATCH 252/393] Add Thorstarter XRUNE --- projects/xrune/abi.json | 53 ++++++++++++++++++++++++++++++ projects/xrune/index.js | 72 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 projects/xrune/abi.json create mode 100644 projects/xrune/index.js diff --git a/projects/xrune/abi.json b/projects/xrune/abi.json new file mode 100644 index 0000000000..0ea9aac049 --- /dev/null +++ b/projects/xrune/abi.json @@ -0,0 +1,53 @@ +{ + "getPrice": { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getPrice", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getTotal": { + "constant": true, + "inputs": [], + "name": "getTotal", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getPoolAddress": { + "constant": true, + "inputs": [], + "name": "getPoolAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/xrune/index.js b/projects/xrune/index.js new file mode 100644 index 0000000000..cfcd08cf88 --- /dev/null +++ b/projects/xrune/index.js @@ -0,0 +1,72 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const BN = require("bignumber.js"); + +async function getTotal(pools, chain, block) { + const balances = {}; + // Need to be called separately because BUSDT rejects when multicalled on BSC + await Promise.all( + pools.map((pool) => + sdk.api.erc20 + .balanceOf({ + target: pool[1], + owner: pool[0], + chain, + block, + }) + .then((result) => + sdk.util.sumSingleBalance(balances, pool[2], result.output) + ) + ) + ); + return balances; +} + +const ethPools = [ + // pool, currency + [ + "0x2a092e401507dD4877cCd0b4Ee70B769452DbB7a", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + ], //2-Month Vault + [ + "0xc20434f595c32B5297A737Cb173382Dd2485C2cC", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + ], //4-Month Vault + [ + "0x8ba0C510Da4507D1F5f73ff9E1FcD14Edc819EB2", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + ], //6-Month Vault + [ + "0x817ba0ecafD58460bC215316a7831220BFF11C80", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", + ], //Tiers +]; + +async function eth(_timestamp, block, chainBlocks) { + return getTotal(ethPools, "ethereum", block); +} + +function mergeBalances(balances, balancesToMerge) { + Object.entries(balancesToMerge).forEach((balance) => { + sdk.util.sumSingleBalance(balances, balance[0], balance[1]); + }); +} + +async function tvl(timestamp, block, chainBlocks) { + const balances = {}; + await Promise.all([eth(timestamp, block, chainBlocks)]).then((poolBalances) => + poolBalances.forEach((pool) => mergeBalances(balances, pool)) + ); + return balances; +} + +module.exports = { + ethereum: { + tvl: eth, + }, + tvl, +}; From b5da17124e55403d151d4e9ffd02d58b8e4d4793 Mon Sep 17 00:00:00 2001 From: mainnet-pat Date: Tue, 7 Dec 2021 15:27:22 +0000 Subject: [PATCH 253/393] mistswap: add xmist staking --- projects/mistswap/index.js | 40 +++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/projects/mistswap/index.js b/projects/mistswap/index.js index 485019c5e9..ffd781e4c5 100644 --- a/projects/mistswap/index.js +++ b/projects/mistswap/index.js @@ -1,16 +1,28 @@ -const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') -const { staking } = require("../helper/staking"); +const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); +const { stakingPricedLP } = require("../helper/staking"); -const mistToken = "0x5fA664f69c2A4A3ec94FaC3cBf7049BD9CA73129" -const masterChef = "0x3A7B9D0ed49a90712da4E087b17eE4Ac1375a5D4" +const xMIST = "0xC41C680c60309d4646379eD62020c534eB67b6f4"; +const MIST = "0x5fA664f69c2A4A3ec94FaC3cBf7049BD9CA73129"; +const xMIST_WBCH_PAIR = "0xa331430473aba2337698fd95a7c2fcf376debfb1"; - - -module.exports={ - misrepresentedTokens: true, - methodology: "Factory address (0x6008247F53395E7be698249770aa1D2bfE265Ca0) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", - smartbch: { - tvl:calculateUsdUniTvl("0x6008247F53395E7be698249770aa1D2bfE265Ca0", "smartbch", "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04", ["0x5fA664f69c2A4A3ec94FaC3cBf7049BD9CA73129"], "bitcoin-cash"), - //staking: staking(masterChef, mistToken, "smartbch", "", 18), MIST token still not on coingecko - } -} \ No newline at end of file +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0x6008247F53395E7be698249770aa1D2bfE265Ca0) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + smartbch: { + tvl: calculateUsdUniTvl( + "0x6008247F53395E7be698249770aa1D2bfE265Ca0", + "smartbch", + "0x3743eC0673453E5009310C727Ba4eaF7b3a1cc04", + ["0x5fA664f69c2A4A3ec94FaC3cBf7049BD9CA73129"], + "bitcoin-cash" + ), + staking: stakingPricedLP( + xMIST, + MIST, + "smartbch", + xMIST_WBCH_PAIR, + "bitcoin-cash" + ), + }, +}; From 8583d1a1750d3f6107d902cfebf7110073b22d98 Mon Sep 17 00:00:00 2001 From: MidasDAO <94060670+Midas-DAO@users.noreply.github.com> Date: Tue, 7 Dec 2021 16:43:12 +0100 Subject: [PATCH 254/393] midasdao.js --- projects/midasdao.js | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 projects/midasdao.js diff --git a/projects/midasdao.js b/projects/midasdao.js new file mode 100644 index 0000000000..02f541ee8e --- /dev/null +++ b/projects/midasdao.js @@ -0,0 +1,53 @@ +const { sumTokensAndLPsSharedOwners } = require("./helper/unwrapLPs"); +const sdk = require('@defillama/sdk'); + +const TimeStaking = "0x5B92738B2De8331Bee366378f27d146DcBaD85c5"; +const CROWN = "0xed46443C18E38064523180Fc364C6180b35803d3"; + +const JoePair = "0x3f0DE4Ec592e4376aA6925C3B3dc33D5ffBCDcc3"; +const TREASURY = "0x820885fCA68fB49d29D40AbF920362FC3e9865C6"; +const MIM = "0x130966628846BFd36ff31a822705796e8cb8C18D"; +const WAVAX = "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" + +const staking = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + + const stakingBalance = await sdk.api.abi.call({ + abi: 'erc20:balanceOf', + target: CROWN, + params: TimeStaking, + block: chainBlocks.avax, + chain: 'avax' + }); + + sdk.util.sumSingleBalance(balances, 'avax:'+CROWN, stakingBalance.output); + + return balances; +}; + +async function tvl(timestamp, block, chainBlocks) { + const balances = {}; + + await sumTokensAndLPsSharedOwners( + balances, + [ + [MIM, false], + [WAVAX, false], + [JoePair, true], + ], + [TREASURY], + chainBlocks.avax, + 'avax', + addr=>`avax:${addr}` + ); + + return balances; +}; + +module.exports = { + avalanche: { + tvl, + staking + }, + methodology: "Counts tokens on the treasury for tvl and staked CROWN for staking", +}; From 7aecbbc730064b93c9d2f53c1de44644a6756637 Mon Sep 17 00:00:00 2001 From: inti25 Date: Tue, 7 Dec 2021 23:24:16 +0700 Subject: [PATCH 255/393] add upfi --- projects/upfi.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/upfi.js diff --git a/projects/upfi.js b/projects/upfi.js new file mode 100644 index 0000000000..2779d04b60 --- /dev/null +++ b/projects/upfi.js @@ -0,0 +1,17 @@ +const { getTokenAccountBalance } = require("./helper/solana"); +const axios = require("axios"); +const retry = require("./helper/retry"); + +async function fetch() { + const response = ( + await retry(async (bail) => await axios.get("https://api.upfi.network/tvl")) + ).data; + return response.tvl || 0; +} + +module.exports = { + timetravel: false, + methodology: + 'TVL data is pulled from the UPFI API "https://api.upfi.network/tvl".', + fetch, +}; From 2f7acb51735a086d999aec8f19ec5b494c4372eb Mon Sep 17 00:00:00 2001 From: freelife2010 Date: Tue, 7 Dec 2021 08:27:08 -0800 Subject: [PATCH 256/393] Updated TVL --- projects/drops/index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/projects/drops/index.js b/projects/drops/index.js index 8364ae62c6..b39017e90c 100644 --- a/projects/drops/index.js +++ b/projects/drops/index.js @@ -8,11 +8,11 @@ const masterchefABI = require("./abis/masterchef.json"); const lptokenABI = require("./abis/lpToken.json"); const erc20TokenABI = require("./abis/ERC20.json"); -const staking = async () => { +const stakedTVL = async () => { let stakingTVL = new BigNumber(0); const fromWei = (value, decimals = 18) => decimals < 18 - ? new BigNumber(value).div(10 ** decimals).toFixed(decimals, 0) + ? new BigNumber(value).div(10 ** decimals).toString(10) : new BigNumber(value).div(10 ** 18).toString(10); const masterchefContract = await getContractInstance( @@ -113,12 +113,19 @@ const staking = async () => { const fetch = async () => { var res = await utils.fetchURL("https://drops.co/status"); - const stakingTVL = await staking(); - return res.data ? new BigNumber(res.data.totalSupply).plus(stakingTVL) : 0; + return res.data ? new BigNumber(res.data.TVL) : 0; +}; + +const staking = async () => { + const stakingTVL = await stakedTVL(); + return stakingTVL; }; module.exports = { methodology: "TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", - fetch, + ethereum: { + tvl: fetch, + staking, + }, }; From 220223da61c75ecca0c3f9efd62a3dc9e893f44c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 7 Dec 2021 16:38:08 +0000 Subject: [PATCH 257/393] add lp contract to wannaswap --- projects/wannaswap/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/wannaswap/index.js b/projects/wannaswap/index.js index 788c97c682..cba1f4e170 100644 --- a/projects/wannaswap/index.js +++ b/projects/wannaswap/index.js @@ -4,7 +4,7 @@ const { staking, stakingPricedLP, stakingUnknownPricedLP } = require('../helper/ module.exports = { misrepresentedTokens: true, aurora: { - //staking: stakingPricedLP("0x5205c30bf2E37494F8cF77D2c19C6BA4d2778B9B", "0x7faA64Faf54750a2E3eE621166635fEAF406Ab22", "aurora", "0x7E9EA10E5984a09D19D05F31ca3cB65BB7df359d",), + //staking: stakingPricedLP("0x5205c30bf2E37494F8cF77D2c19C6BA4d2778B9B", "0x7faA64Faf54750a2E3eE621166635fEAF406Ab22", "aurora", "0xbf9Eef63139b67fd0ABf22bD5504ACB0519a4212", "wrapped-near", true, ), tvl:calculateUsdUniTvl( // factory "0x7928D4FeA7b2c90C732c10aFF59cf403f0C38246", From b15ed2b5fa37a9fe2abd83193dace5835ced0c72 Mon Sep 17 00:00:00 2001 From: Jonathan Chemla Date: Tue, 7 Dec 2021 17:48:42 +0100 Subject: [PATCH 258/393] CAUTION - Add UNI-v3 staking (harvest position) BABL_WETH can be LP'ed on harvest finance and the LP can be staked on harvest. A wrapper has been added to retrieve the amount of uni_v3 LP staked in the vault. --- projects/babylon-finance/index.js | 19 +++- projects/helper/unwrapLPs.js | 158 ++++++++++++++++++++++++++++++ 2 files changed, 175 insertions(+), 2 deletions(-) diff --git a/projects/babylon-finance/index.js b/projects/babylon-finance/index.js index 3e4e526c28..a53e19fff9 100644 --- a/projects/babylon-finance/index.js +++ b/projects/babylon-finance/index.js @@ -1,6 +1,7 @@ const sdk = require("@defillama/sdk") const BigNumber = require("bignumber.js") const abi = require('./abi.json'); +const { unwrapUniswapV3LPs } = require("../helper/unwrapLPs"); const babController = '0xd4a5b5fcb561daf3adf86f8477555b92fba43b5f' const babylonViewer = '0x740913FEF40720E82498D5b73A4E8C3a5D9b9d79' @@ -58,11 +59,25 @@ async function tvl(timestamp, ethBlock, chainBlocks) { return balances } +const harvest_vault = '0xadB16dF01b9474347E8fffD6032360D3B54627fB' +const harvest_pool = '0x3e6397E309f68805FA8Ef66A6216bD2010DdAF19' +// const harvest_position_id = 158516 +async function staking(timestamp, ethBlock, chainBlocks) { + const balances = {} + const univ3_Positions = [{ + vault: harvest_vault, + pool: harvest_pool + }] + await unwrapUniswapV3LPs(balances, univ3_Positions, ethBlock, chain='ethereum') + console.log('balances:', balances) + return balances +} + module.exports = { methodology: "TVL of Babylon corresponds to capital locked into each garden (idle capital waiting to be deployed) as well as capital deployed to each strategy of these gardens", ethereum: { - staking: () => ({}), - tvl, + staking, // : () => ({}) + tvl // : () => ({}), } } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index 230a4c76dc..e97cffd548 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -5,6 +5,7 @@ const {getPoolTokens, getPoolId} = require('./abis/balancer.json') const getPricePerShare = require('./abis/getPricePerShare.json') const {requery} = require('./requery') const creamAbi = require('./abis/cream.json') +const { request, gql } = require("graphql-request"); const crvPools = { '0x6c3f90f043a72fa612cbac8115ee7e52bde6e490': { @@ -438,6 +439,162 @@ async function unwrapUniswapLPs(balances, lpPositions, block, chain='ethereum', })) } +// pool will give you the amount of fUniV3_WETH_ABC held by the pool of the position token against that token total supply +const uniV3_nft_contract = '0xc36442b4a4522e871399cd717abdd847ab11fe88' +const abi_staking = { + 'univ3_positions': {"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"positions","outputs":[{"internalType":"uint96","name":"nonce","type":"uint96"},{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"feeGrowthInside0LastX128","type":"uint256"},{"internalType":"uint256","name":"feeGrowthInside1LastX128","type":"uint256"},{"internalType":"uint128","name":"tokensOwed0","type":"uint128"},{"internalType":"uint128","name":"tokensOwed1","type":"uint128"}],"stateMutability":"view","type":"function"}, + + 'erc721_tokenOfOwnerByIndex': {"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, + + 'token0': {"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, + 'token1': {"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, +} +// Convert Uniswap v3 tick to a price (i.e. the ratio between the amounts of tokens: token1/token0) +const tickBase = 1.0001 +function tick_to_price(tick) { + return tickBase ** tick +} +// GraphQL query to get the pool information +const univ3_graph_url = "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3" +const univ3_graph_query = gql` +query position($block: Int, $position_id: ID!) { + position ( + id: $position_id + block: { number: $block } + ) { + id + owner + tickLower {tickIdx} + tickUpper {tickIdx} + liquidity + pool { + tick + liquidity + feeTier + token0 { symbol decimals id } + token1 { symbol decimals id } + } + } +}` + +async function getUniv3PositionBalances(position_id, block) { + // Retrieve aTokens and reserves from graphql API endpoint + const { position } = await request( + univ3_graph_url, + univ3_graph_query, { + block: block, + position_id: position_id + }) + + // Extract pool parameters + const pool = position['pool'] + const tick = pool['tick'] + const token0 = pool['token0']['id'] + const token1 = pool['token1']['id'] + // Retrieve these from the graphql query instead of onchain call + const bottom_tick = position['tickLower']['tickIdx'] + const top_tick = position['tickUpper']['tickIdx'] + const liquidity = position['liquidity'] + + // Compute square roots of prices corresponding to the bottom and top ticks + const sa = tick_to_price(Math.floor(bottom_tick / 2)) + const sb = tick_to_price(Math.floor(top_tick / 2)) + const price = tick_to_price(tick) + const sp = price ** 0.5 + // const decimals0 = pool['token0']['decimals'] + // const decimals1 = pool['token1']['decimals'] + // const adjusted_price = price / (10 ** (decimals1 - decimals0)) + + // Compute real amounts of the two assets + const amount0 = liquidity * (sb - sp) / (sp * sb) + const amount1 = liquidity * (sp - sa) + + console.log(`Whole pool: amount0: ${(amount0 / 1e18).toFixed(1)} / amount1: ${(amount1 / 1e18).toFixed(1)}`) + return { + [token0]: amount0, + [token1]: amount1, + } +} +/* +// Could get some props of the position itself onchain rather than using uni-v3 graphql endpoint, but some information needed is missing like whole pool liq/tick etc +const {output: position_props} = await sdk.api.abi.call({ + block, + abi: abi_staking['univ3_positions'], + target: uniV3_nft_contract, + params: position_id, // get the last one for demonstration + chain: 'ethereum' +}) +const bottom_tick = position_props['tickLower'] +const top_tick = position_props['tickUpper'] +const L = position_props['liquidity'] +const token0 = position_props['token0'] +const token1 = position_props['token1'] +*/ + +/* +univ3_Positions:{ + vault, + pool +}[] +*/ +async function unwrapUniswapV3LPs(balances, univ3_Positions, block, chain='ethereum', transformAddress=(addr)=>addr, excludeTokensRaw = [], retry = false) { + const excludeTokens = excludeTokensRaw.map(addr=>addr.toLowerCase()) + await Promise.all(univ3_Positions.map(async univ3_Position => { + try{ + // Get share of that LP NFT inside the vault as balanceOf / totalSupply + const {output: totalSupply} = await sdk.api.abi.call({ + block, + abi: 'erc20:totalSupply', + target: univ3_Position.vault, + chain: 'ethereum' + }) + const {output: heldLPshares} = await sdk.api.abi.call({ + block, + abi: 'erc20:balanceOf', + target: univ3_Position.vault, + params: univ3_Position.pool, + chain: 'ethereum' + }) + const sharesRatio = heldLPshares / totalSupply + + /* + const {output: uniV3_nft_count} = await sdk.api.abi.call({ + block, + abi: 'erc20:balanceOf', + target: uniV3_nft_contract, + params: univ3_Position.vault, + chain: 'ethereum' + }) + */ + // Here we assume only the first nft position is retrieved + // could look for more using uniV3_nft_count + const {output: position_id} = await sdk.api.abi.call({ + block, + abi: abi_staking['erc721_tokenOfOwnerByIndex'], + target: uniV3_nft_contract, + params: [univ3_Position.vault, 0], + chain: 'ethereum' + }) + + const positionBalances = await getUniv3PositionBalances(position_id, block) + + // Add balances while multiplying amount by ratio of shares + Object.entries(positionBalances).forEach(async entry => { + const [key, value] = entry; + if(!excludeTokens.includes(key)){ + // balances[key] = BigNumber( balances[key] || 0 ).plus(sharesRatio * value); + sdk.util.sumSingleBalance(balances, await transformAddress(key), sharesRatio * value) + } + }); + console.log(`ratio of the pool: ${(100 * sharesRatio).toFixed(1)}% of position_id ${position_id}`) + + } catch(e) { + console.log(`Failed to get data for LP token vault at ${univ3_Position.vault} on chain ${chain}`) + throw e + } + })) +} + async function addBalanceOfTokensAndLPs(balances, balanceResult, block){ await addTokensAndLPs(balances, { output: balanceResult.output.map(t=>({output:t.input.target})) @@ -704,6 +861,7 @@ module.exports = { unwrapYearn, unwrapCrv, unwrapUniswapLPs, + unwrapUniswapV3LPs, addTokensAndLPs, sumTokensAndLPsSharedOwners, addBalanceOfTokensAndLPs, From 7068357ba0adb3f791afd3c7088060e21c45a80e Mon Sep 17 00:00:00 2001 From: nemusona Date: Tue, 7 Dec 2021 12:40:25 -0600 Subject: [PATCH 259/393] ubiquitydao adapter --- projects/ubiquitydao/index.js | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/ubiquitydao/index.js diff --git a/projects/ubiquitydao/index.js b/projects/ubiquitydao/index.js new file mode 100644 index 0000000000..15ab3fb7b2 --- /dev/null +++ b/projects/ubiquitydao/index.js @@ -0,0 +1,42 @@ +const sdk = require("@defillama/sdk"); + +const crvPool = "0x20955CB69Ae1515962177D164dfC9522feef567E"; +const uad = "0x0F644658510c95CB46955e55D7BA9DDa9E9fBEc6"; +const tricrv = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"; + +async function tvl(timestamp, block) { + let balances = {}; + let poolBalances = ( + await sdk.api.abi.multiCall({ + calls: [ + { + target: uad, + params: crvPool, + }, + { + target: tricrv, + params: crvPool, + }, + ], + abi: "erc20:balanceOf", + block, + }) + ).output; + poolBalances.forEach((p) => { + let token = p.input.target; + if (token === "0x0F644658510c95CB46955e55D7BA9DDa9E9fBEc6") { + token = "0x6b175474e89094c44da98b954eedeac495271d0f"; + } + sdk.util.sumSingleBalance(balances, token, p.output); + }); + return balances; +} + +module.exports = { + misrepresentedTokens: true, + methodology: "Tokens locked in the Curve Metapool", + ethereum: { + tvl, + }, + tvl, +}; From 1339aa709001d0eadc148ce3f2fe4b7c84e6d9e4 Mon Sep 17 00:00:00 2001 From: 0xngmi <80541789+0xngmi@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:15:30 +0000 Subject: [PATCH 260/393] fix undefined variables --- projects/bifi/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/bifi/index.js b/projects/bifi/index.js index 9faaf25bd4..3659c1c563 100644 --- a/projects/bifi/index.js +++ b/projects/bifi/index.js @@ -198,8 +198,8 @@ async function avax(timestamp, block, chainBlocks) { })).output) // avax tokens - for (token in avaxTokenPools) { - tokenPool = avaxTokenPools[token]; + for (const token in avaxTokenPools) { + const tokenPool = avaxTokenPools[token]; let tokenLocked = await sdk.api.erc20.balanceOf({ owner: tokenPool.pool, target: tokenPool.token, @@ -226,7 +226,7 @@ async function klaytn() { klaytnTVL += klayPrice * klayBalance / (10 ** 36); let oracleID = 0 - for (token in klaytnTokenPools) { + for (const token in klaytnTokenPools) { oracleID += 1; const tokenAddress = klaytnTokenPools[token].token; @@ -264,4 +264,4 @@ module.exports = { klaytn: { tvl: klaytn } -} \ No newline at end of file +} From 0e53d9be8e14131688be4727bf364583dc55b34a Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 7 Dec 2021 20:59:35 +0000 Subject: [PATCH 261/393] ovnstable --- projects/ovnstable.js | 137 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 projects/ovnstable.js diff --git a/projects/ovnstable.js b/projects/ovnstable.js new file mode 100644 index 0000000000..33ea38878e --- /dev/null +++ b/projects/ovnstable.js @@ -0,0 +1,137 @@ +const sdk = require("@defillama/sdk"); +const { getBlock } = require("./helper/getBlock"); +const { transformPolygonAddress } = require("./helper/portedTokens"); + +const holder = "0x5413e22E6cb029c0C4b289600c97960D0aeF940c"; + +const crvTokens = [ + "0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171", // lp + "0x19793B454D3AfC7b454F206Ffe95aDE26cA6912c", // reward + "0x445FE580eF8d70FF569aB36e80c647af338db351", // holder +]; + +const underlying = [ + "0x1a13f4ca1d028320a707d99520abfefca3998b7f", // amUSDC + "0x27f8d03b3a2196956ed754badc28d73be8830a6e", // DAI + "0x60d55f02a771d515e077c9c2403a1ef324885cec", // USDT + "0x172370d5cd63279efa6d502dab29171933a610af", // CRV + "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", // wMATIC + "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", // USDC +]; + +async function tvl(timestamp, block, chainBlocks) { + block = await getBlock(timestamp, "polygon", chainBlocks); + let balances = {}; + const transformAddress = await transformPolygonAddress(); + + const holderBalances = ( + await sdk.api.abi.multiCall({ + calls: crvTokens.map((token) => ({ + target: token, + params: [holder], + })), + abi: "erc20:balanceOf", + block, + chain: "polygon", + }) + ).output; + + const totalSupplies = ( + await sdk.api.abi.multiCall({ + calls: crvTokens.map((token) => ({ + target: token, + })), + abi: "erc20:totalSupply", + block, + chain: "polygon", + }) + ).output; + + const underlyingBalances = ( + await sdk.api.abi.multiCall({ + calls: underlying.map((token) => ({ + target: token, + params: [crvTokens[2]], + })), + abi: "erc20:balanceOf", + block, + chain: "polygon", + }) + ).output; + + const rewardBalances = ( + await sdk.api.abi.multiCall({ + calls: underlying.map((token) => ({ + target: token, + params: [crvTokens[1]], + })), + abi: "erc20:balanceOf", + block, + chain: "polygon", + }) + ).output; + + for (let i = 0; i < underlying.length; i++) { + if (underlyingBalances[i].output > 0) { + const holderBalance = + underlyingBalances[i].output * + (holderBalances[0].output / totalSupplies[0].output + + holderBalances[1].output / totalSupplies[1].output); + sdk.util.sumSingleBalance( + balances, + transformAddress(underlying[i]), + holderBalance + ); + } + + if (rewardBalances[i].output > 0) { + const rewardBalance = + rewardBalances[i].output * + (holderBalances[1].output / totalSupplies[1].output); + sdk.util.sumSingleBalance( + balances, + transformAddress(underlying[i]), + rewardBalance + ); + } + } + + const usdcBalance = ( + await sdk.api.abi.call({ + target: underlying[5], + params: [holder], + abi: "erc20:balanceOf", + chain: "polygon", + block, + }) + ).output; + sdk.util.sumSingleBalance( + balances, + transformAddress(underlying[5]), + Number(usdcBalance) + ); + + const amUsdcBalance = ( + await sdk.api.abi.call({ + target: underlying[0], + params: [holder], + abi: "erc20:balanceOf", + chain: "polygon", + block, + }) + ).output; + + sdk.util.sumSingleBalance( + balances, + transformAddress(underlying[0]), + Number(amUsdcBalance) + ); + + return balances; +} + +module.exports = { + polygon: { + tvl, + }, +}; From 0888cbd87a119292dca365e3004b9c27ae37c17f Mon Sep 17 00:00:00 2001 From: Define101 Date: Tue, 7 Dec 2021 22:09:08 +0000 Subject: [PATCH 262/393] o2-dao adapter --- projects/o2-dao/index.js | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 projects/o2-dao/index.js diff --git a/projects/o2-dao/index.js b/projects/o2-dao/index.js new file mode 100644 index 0000000000..df10d1f199 --- /dev/null +++ b/projects/o2-dao/index.js @@ -0,0 +1,46 @@ +const { sumTokensAndLPsSharedOwners, sumLPWithOnlyOneTokenOtherThanKnown } = require("../helper/unwrapLPs"); +const { stakingUnknownPricedLP } = require("../helper/staking"); +const sdk = require('@defillama/sdk') + +const transform = addr=>`avax:${addr}` +const chain = "avax" + +const wMEMO = "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b" +const time = "avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3" +const treasuryAddress = "0x10C12B7322Ac2c5a26bD9929ABc6e6b7997570ba"; +const joeLP = "0x7bc2561d69b56fae9760df394a9fa9202c5f1f11" +const treasuryTokens = [ + // gOHM + ["0x321E7092a180BB43555132ec53AaA65a5bF84251", false], + // Joe LP + [joeLP, true], + //wMEMO + [wMEMO, false] +] +const stakingToken = "0xAA2439DBAd718c9329a5893A51a708C015F76346" + +async function tvl(timestamp, ethBlock, chainBlocks) { + const block = chainBlocks[chain] + const balances = {} + await sumTokensAndLPsSharedOwners(balances, treasuryTokens.filter(t => t[1] === false), [treasuryAddress], block, chain, transform) + await Promise.all(treasuryTokens.filter(t => t[1] === true).map(t => + sumLPWithOnlyOneTokenOtherThanKnown(balances, t[0], treasuryAddress, stakingToken, block, chain, transform) + )) + const wmemoAddress = transform(wMEMO) + const memo = await sdk.api.abi.call({ + target: wMEMO, + abi:{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"wMEMOToMEMO","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}, block, + chain, + params: [balances[wmemoAddress]] + }) + balances[time] = memo.output + delete balances[wmemoAddress] + return balances +} + +module.exports={ + avalanche:{ + tvl, + staking: stakingUnknownPricedLP("0x50971d6B5a3CCd79C516f914208C67C8104977dF", stakingToken, chain, joeLP, transform) + } +} \ No newline at end of file From 5fd81ff1efd0965b8d1ac759e74581a5965f99e9 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Wed, 8 Dec 2021 05:06:33 +0000 Subject: [PATCH 263/393] add lifedao adapter --- projects/lifedao/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/lifedao/index.js diff --git a/projects/lifedao/index.js b/projects/lifedao/index.js new file mode 100644 index 0000000000..f0ab0d04b5 --- /dev/null +++ b/projects/lifedao/index.js @@ -0,0 +1,13 @@ +const { ohmTvl } = require('../helper/ohm') + +const treasury = "0x1e63a2eB2827db56d3CB1e1FF17ef1040B2d3D3f" +module.exports = ohmTvl(treasury, [ + //MIM + ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], + //wAVAX + ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], + //joe LP + ["0xd7cdc2e47ab29a6b651704e39374bb9857f02e02", true], + //joe LP + ["0xdf9abadd06101e4e52128db30b055a7aa78b3537", true], + ], "avax", "0x3C09c500829D09AfEA7575005fcAFBacFcde6902", "0x5684a087C739A2e845F4AaAaBf4FBd261edc2bE8") \ No newline at end of file From 8b8020b0323a0f973d68ce9cd5a63f3033e66922 Mon Sep 17 00:00:00 2001 From: ssstacey Date: Wed, 8 Dec 2021 02:58:45 +0000 Subject: [PATCH 264/393] add Linear Finance adapter --- projects/linear/abis.json | 41 +++++++++++++++ projects/linear/index.js | 102 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+) create mode 100644 projects/linear/abis.json create mode 100644 projects/linear/index.js diff --git a/projects/linear/abis.json b/projects/linear/abis.json new file mode 100644 index 0000000000..2bb83113e3 --- /dev/null +++ b/projects/linear/abis.json @@ -0,0 +1,41 @@ +{ + "totalLockedAmount": { + "inputs": [], + "name": "totalLockedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "totalStakeAmount": { + "inputs": [], + "name": "totalStakeAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "totalSubscribedAmount": { + "inputs": [], + "name": "totalSubscribedAmount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/linear/index.js b/projects/linear/index.js new file mode 100644 index 0000000000..4aa9a32b90 --- /dev/null +++ b/projects/linear/index.js @@ -0,0 +1,102 @@ +const sdk = require("@defillama/sdk"); +const BigNumber = require("bignumber.js"); + +const abis = require("./abis.json"); +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); + +const LnCollateralSystemAddress = "0xcE2c94d40e289915d4401c3802D75f6cA5FEf57E"; +const LnRewardLockerAddress = "0x66D60EDc3876b8aFefD324d4edf105fd5c4aBeDc"; + +const tokens = { + lUSD: "0x23e8a70534308a4aaf76fb8c32ec13d17a3bd89e", + LINA: "0x762539b45A1dCcE3D36d080F74d1AED37844b878", + bUSD: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + LPTOKEN: "0x392f351fc02a3b74f7900de81a9aaac13ec28e95", +}; + +const vaultpools = { + bUSD: "0x072F11c46146Ce636691d387BFbF8fD28e818EE8", + lUSD: "0xD36b669491ADFB5cDE87C281dF417148674f88B4", + LP: "0x12efdFF85f717ac1738CF50Be5f4Cdc916b0B8B1", +}; + +function getBSCAddress(address) { + return `bsc:${address}`; +} + +async function tvl(timestamp, blockETH, chainBlocks) { + const block = chainBlocks["bsc"]; + const balances = {}; + + const stakedLina = await sdk.api.abi.call({ + block, + chain: "bsc", + target: tokens["LINA"], + params: LnCollateralSystemAddress, + abi: "erc20:balanceOf", + }); + + const lockedLina = await sdk.api.abi.call({ + block, + chain: "bsc", + target: LnRewardLockerAddress, + abi: abis["totalLockedAmount"], + }); + + const bUSDPoolLockedlUSD = await sdk.api.abi.call({ + block, + chain: "bsc", + target: tokens["lUSD"], + params: vaultpools["lUSD"], + abi: "erc20:balanceOf", + }); + + const lUSDPoolLockedlUSD = await sdk.api.abi.call({ + block, + chain: "bsc", + target: tokens["lUSD"], + params: vaultpools["bUSD"], + abi: "erc20:balanceOf", + }); + + const vaultsLockedLpToken = await sdk.api.abi.call({ + block, + chain: "bsc", + target: vaultpools["LP"], + abi: abis["totalStakeAmount"], + }); + + balances[getBSCAddress(tokens["LINA"])] = BigNumber(stakedLina.output) + .plus(lockedLina.output) + .toFixed(0); + + await unwrapUniswapLPs( + balances, + [ + { + balance: vaultsLockedLpToken.output, + token: tokens["LPTOKEN"], + }, + ], + chainBlocks.bsc, + "bsc", + getBSCAddress + ); + + // use bUSD to represent lUSD as it is not listed on coingecko + delete balances[getBSCAddress(tokens["lUSD"])]; + + balances[getBSCAddress(tokens["bUSD"])] = BigNumber( + balances[getBSCAddress(tokens["bUSD"])] * 2 + ) + .plus(bUSDPoolLockedlUSD.output) + .plus(lUSDPoolLockedlUSD.output); + + return balances; +} + +module.exports = { + bsc: { + tvl, + }, +}; From 885ae165b83136ab3c49aadecc9e3d1be996cc38 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 8 Dec 2021 10:48:53 +0000 Subject: [PATCH 265/393] remove bsc from connext pending update --- projects/connext/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/connext/index.js b/projects/connext/index.js index 854832bd95..41dfc79473 100644 --- a/projects/connext/index.js +++ b/projects/connext/index.js @@ -89,7 +89,7 @@ function chainTvl(chain) { const chains = [ "ethereum", - "bsc", + //"bsc", "polygon", "moonriver", "fantom", From 331edc4ee28c4ec744dd1112a88682610ddae22e Mon Sep 17 00:00:00 2001 From: Serg Ilchuk Date: Wed, 8 Dec 2021 12:53:37 +0200 Subject: [PATCH 266/393] XRUNE staking exported as 'staking' instead of TVL. Similar to the avalaunch adapter --- projects/xrune/index.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/projects/xrune/index.js b/projects/xrune/index.js index cfcd08cf88..ed93e36cdf 100644 --- a/projects/xrune/index.js +++ b/projects/xrune/index.js @@ -1,10 +1,10 @@ const sdk = require("@defillama/sdk"); +const { stakings } = require("../helper/staking.js"); const abi = require("./abi.json"); const BN = require("bignumber.js"); async function getTotal(pools, chain, block) { const balances = {}; - // Need to be called separately because BUSDT rejects when multicalled on BSC await Promise.all( pools.map((pool) => sdk.api.erc20 @@ -22,28 +22,29 @@ async function getTotal(pools, chain, block) { return balances; } +const token = "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c"; +const ethStaking = [ + "0x93f5dc8bc383bb5381a67a67516a163d1e56012a", //Staking + "0x2a092e401507dD4877cCd0b4Ee70B769452DbB7a", //2-Month Vault + "0xc20434f595c32B5297A737Cb173382Dd2485C2cC", //4-Month Vault + "0x8ba0C510Da4507D1F5f73ff9E1FcD14Edc819EB2", //6-Month Vault +]; const ethPools = [ - // pool, currency - [ - "0x2a092e401507dD4877cCd0b4Ee70B769452DbB7a", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - ], //2-Month Vault [ - "0xc20434f595c32B5297A737Cb173382Dd2485C2cC", + "0x817ba0ecafD58460bC215316a7831220BFF11C80", "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - ], //4-Month Vault + ], //Tiers [ - "0x8ba0C510Da4507D1F5f73ff9E1FcD14Edc819EB2", + "0xebcd3922a199cd1358277c6458439c13a93531ed", "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - ], //6-Month Vault + ], //DAO [ - "0x817ba0ecafD58460bC215316a7831220BFF11C80", + "0x5b1b8bdbcc534b17e9f8e03a3308172c7657f4a3", "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - ], //Tiers + ], //DAO ]; async function eth(_timestamp, block, chainBlocks) { @@ -67,6 +68,7 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { ethereum: { tvl: eth, + staking: stakings(ethStaking, token, "ethereum"), }, tvl, }; From 4c91e699a58cb65c860175b5cf5c94643a55d4a6 Mon Sep 17 00:00:00 2001 From: cryptoethic Date: Wed, 8 Dec 2021 11:54:19 +0100 Subject: [PATCH 267/393] feat: pool2 tokens --- projects/starterra.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/projects/starterra.js b/projects/starterra.js index 09fba2ed42..6448ff17b7 100644 --- a/projects/starterra.js +++ b/projects/starterra.js @@ -1,6 +1,15 @@ const retry = require("./helper/retry"); const axios = require("axios"); +async function pool2() { + var res = await retry( + async () => + await axios.get("https://api.starterra.io/cmc?q=tvl&onlyPool=true") + ); + + return parseFloat(res.data); +} + async function fetch() { var res = await retry( async () => await axios.get("https://api.starterra.io/cmc?q=tvl") @@ -11,4 +20,5 @@ async function fetch() { module.exports = { fetch, + pool2, }; From 14a74b3c0cb615fcb886da5094b5141e776d9a0e Mon Sep 17 00:00:00 2001 From: haodi <82733821@qq.com> Date: Thu, 9 Dec 2021 00:35:45 +0800 Subject: [PATCH 268/393] add stake amunt for flux --- projects/flux/index.js | 84 ++++++++---------------------------------- 1 file changed, 16 insertions(+), 68 deletions(-) diff --git a/projects/flux/index.js b/projects/flux/index.js index 8274bd9724..ccb5756d51 100644 --- a/projects/flux/index.js +++ b/projects/flux/index.js @@ -2,85 +2,33 @@ const axios = require("axios"); const url = "https://gateway.api.01defi.com/base/fluxTvl/get"; -// bsc -async function bsc() { - const data = await axios.get(url); - const info = (data?.data?.data?.detail || []).find( - (item) => item.chain === "bsc" - ); - return Number(info.lendingTVL); -} -// heco -async function heco() { - const data = await axios.get(url); - const info = (data?.data?.data?.detail || []).find( - (item) => item.chain === "heco" - ); - return Number(info.lendingTVL); -} - -//okex -async function okex() { - const data = await axios.get(url); - const info = (data?.data?.data?.detail || []).find( - (item) => item.chain === "okexchain" - ); - return Number(info.lendingTVL); -} - -//conflux -async function conflux() { - const data = await axios.get(url); - const info = (data?.data?.data?.detail || []).find( - (item) => item.chain === "conflux" - ); - return Number(info.lendingTVL); -} - -//arbitrum -async function arbitrum() { +//total +async function fetch() { const data = await axios.get(url); - const info = (data?.data?.data?.detail || []).find( - (item) => item.chain === "arbitrum" - ); - return Number(info.lendingTVL); + return Number(data?.data?.data?.lendingTVL); } -//polygon -async function polygon() { +// tvl and staking amount +async function getChainData(chain) { const data = await axios.get(url); const info = (data?.data?.data?.detail || []).find( - (item) => item.chain === "polygon" + (item) => item.chain === chain ); - return Number(info.lendingTVL); -} -//total -async function fetch() { - const data = await axios.get(url); - return Number(data?.data?.data?.lendingTVL); + return { + fetch: Number(info.lendingTVL), + staking: Number(info.stakedTVL), + }; } module.exports = { timetravel: true, - bsc: { - fetch: bsc, - }, - okexchain: { - fetch: okex, - }, - heco: { - fetch: heco, - }, - arbitrum: { - fetch: arbitrum, - }, - polygon: { - fetch: polygon, - }, - conflux: { - fetch: conflux, - }, + bsc: getChainData('bsc'), + okexchain: getChainData('okexchain'), + heco: getChainData('heco'), + arbitrum: getChainData('arbitrum'), + polygon: getChainData('polygon'), + conflux: getChainData('conflux'), fetch, name: "Flux Project", }; From e496cb278a63876d38631acd8aaeab5b3b36c873 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 8 Dec 2021 16:39:41 +0000 Subject: [PATCH 269/393] gro --- projects/groprotocol/index.js | 117 ++++++++++++++++++++++++---------- 1 file changed, 83 insertions(+), 34 deletions(-) diff --git a/projects/groprotocol/index.js b/projects/groprotocol/index.js index 9f76ed651a..73fc2d3269 100644 --- a/projects/groprotocol/index.js +++ b/projects/groprotocol/index.js @@ -3,6 +3,8 @@ const sdk = require("@defillama/sdk"); const { sumBalancerLps } = require("../helper/unwrapLPs"); const { unwrapUniswapLPs, unwrapCrvLPs } = require("./helpers"); +const { getBlock } = require("../helper/getBlock"); +const { transformAvaxAddress } = require("../helper/portedTokens"); const groTokenAbi = require("./abi.json"); const { staking } = require("../helper/staking"); @@ -81,7 +83,6 @@ async function tvl(timestamp, ethBlock) { undefined, [PWRD] ); // Excludes already counted PWRD amount - } return balances; @@ -91,34 +92,34 @@ async function pool2(timestamp, ethBlock) { let balances = {}; const uniLpPositions = []; const balLpPositions = []; - // P1_UNI_GRO_GVT - // P2_UNI_GRO_USDC - const p1 = ( - await sdk.api.erc20.balanceOf({ - target: P1_UNI_GRO_GVT, - owner: GROTokenStaker, - block: ethBlock, - }) - ).output; - uniLpPositions.push({ token: P1_UNI_GRO_GVT, balance: p1 }); - - const p2 = ( - await sdk.api.erc20.balanceOf({ - target: P2_UNI_GRO_USDC, - owner: GROTokenStaker, - block: ethBlock, - }) - ).output; - uniLpPositions.push({ token: P2_UNI_GRO_USDC, balance: p2 }); + // P1_UNI_GRO_GVT + // P2_UNI_GRO_USDC + const p1 = ( + await sdk.api.erc20.balanceOf({ + target: P1_UNI_GRO_GVT, + owner: GROTokenStaker, + block: ethBlock, + }) + ).output; + uniLpPositions.push({ token: P1_UNI_GRO_GVT, balance: p1 }); - await unwrapUniswapLPs( - balances, - uniLpPositions, - ethBlock, - "ethereum", - undefined, - [GVT] - ); // Excludes already counted GVT amount + const p2 = ( + await sdk.api.erc20.balanceOf({ + target: P2_UNI_GRO_USDC, + owner: GROTokenStaker, + block: ethBlock, + }) + ).output; + uniLpPositions.push({ token: P2_UNI_GRO_USDC, balance: p2 }); + + await unwrapUniswapLPs( + balances, + uniLpPositions, + ethBlock, + "ethereum", + undefined, + [GVT] + ); // Excludes already counted GVT amount // P5_BAL_GRO_WETH if (timestamp > 1633392000) { // On or after 05-10-2021, P5 pool available @@ -137,16 +138,64 @@ async function pool2(timestamp, ethBlock) { (addr) => addr.toLowerCase(addr) ); } - return balances + return balances; +} + +const labs = [ + { + // USDC + groToken: "0x57daed1ee021be9991f5d30cf494b6b09b5b449e", + vault: "0x57DaED1ee021BE9991F5d30CF494b6B09B5B449E", + baseToken: "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664", + }, + { + // DAI + groToken: "0x5e57e11483a3f60a76af3045303604522059da2a", + vault: "0x5E57E11483A3F60A76af3045303604522059dA2a", + baseToken: "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70", + }, + { + // USDT + groToken: "0x471f4b4b9a97f82c3a25b034b33a8e306ee9beb5", + vault: "0x471F4B4b9A97F82C3a25b034B33A8E306eE9Beb5", + baseToken: "0xc7198437980c041c805A1EDcbA50c1Ce5db95118", + }, +]; + +async function avaxTvl(timestamp, block, chainBlocks) { + let balances = {}; + block = await getBlock(timestamp, "avax", chainBlocks); + const transform = await transformAvaxAddress(); + const totalAssets = ( + await sdk.api.abi.multiCall({ + calls: labs.map((l) => ({ target: l.vault })), + abi: groTokenAbi.totalAssets, + block, + chain: "avax", + }) + ).output; + + for (let i = 0; i < labs.length; i++) { + sdk.util.sumSingleBalance( + balances, + transform(labs[i].baseToken), + totalAssets[i].output + ); + } + return balances; } +// node test.js projects/groprotocol/index.js module.exports = { - ethereum: { - pool2, - staking: staking(GROTokenStaker, GRO), - tvl, + // ethereum: { + // pool2, + // staking: staking(GROTokenStaker, GRO), + // tvl, + // }, + avalanche: { + tvl: avaxTvl, }, start: 1622204347, // 28-05-2021 12:19:07 (UTC) methodology: - "Assets held within the GRO Protocol - either within the PWRD or Vault (GVT) products, or staked in the Gro Protocol pools.", + "Assets held within the GRO Protocol - either within the PWRD or Vault (GVT) products, or staked in the Gro Protocol pools. Avax TVL is the sum of tokens locked in Gro Labs.", }; From 63a21ba0a83e8546adb84a37038c78aa63fe146f Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Wed, 8 Dec 2021 18:29:29 +0000 Subject: [PATCH 270/393] add avax market to float capital --- projects/float-capital/index.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/projects/float-capital/index.js b/projects/float-capital/index.js index 7c912a893e..f34c6c4c60 100644 --- a/projects/float-capital/index.js +++ b/projects/float-capital/index.js @@ -2,14 +2,34 @@ const { sumTokens} = require('../helper/unwrapLPs') const vaults = ["0xce5da4bebBA980BeC39da5b118750A47a23D4B85", "0x595b1408C9c2BF121c7674E270Ca7aCc0bBf100C", "0x694c240e63CF60a2cD2d38d84D902744640AcCDA"] const amDAI = "0x27f8d03b3a2196956ed754badc28d73be8830a6e" +const avaults = ["0xefE423827b87751f9EB91A90a78edc624601565b"] +const avDAI = "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a" -async function tvl(time, ethBlock, chainBlocks){ +const transforms = { + "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a": "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI + +} + +async function polyTvl(time, ethBlock, chainBlocks){ const balances = {} await sumTokens(balances, vaults.map(v=>[amDAI, v]), chainBlocks.polygon, "polygon", addr=>`polygon:${addr}`) return balances } +async function avaxTvl(time, ethBlock, chainBlocks){ + const balances = {} + await sumTokens(balances, avaults.map(v=>[avDAI, v]), chainBlocks.avax, "avax", addr=>{ + return transforms[addr.toLowerCase()] ?? `avax:${addr}` + }) + return balances +} + module.exports={ - tvl, + polygon: { + tvl: polyTvl, + }, + avax: { + tvl: avaxTvl, + }, methodology: `Gets the tokens on markets` } \ No newline at end of file From fec70363489765cd986cef018cc80309228d8a8b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 7 Dec 2021 02:50:40 +0000 Subject: [PATCH 271/393] simplify aave code --- projects/aave/index.js | 20 +--- projects/helper/aave.js | 201 +++++++++++++--------------------------- 2 files changed, 64 insertions(+), 157 deletions(-) diff --git a/projects/aave/index.js b/projects/aave/index.js index 7e1d8044b3..e848f3a04b 100644 --- a/projects/aave/index.js +++ b/projects/aave/index.js @@ -258,20 +258,8 @@ const {getV2Reserves, getV2Tvl, aaveChainTvl} = require('../helper/aave') // V2 TVLs if (block >= 11360925) { - let v2Atokens = []; - let v2ReserveTokens = []; - let addressSymbolMapping = {}; - [v2Atokens, v2ReserveTokens, addressSymbolMapping] = await getV2Reserves(block, addressesProviderRegistryETH, 'ethereum', v2Atokens, v2ReserveTokens, addressSymbolMapping) - const v2Tvl = await getV2Tvl(block, 'ethereum', v2Atokens, v2ReserveTokens, addressSymbolMapping); - v2Tvl.map(data => { - if (balances[data.underlying]) { - balances[data.underlying] = BigNumber(balances[data.underlying]) - .plus(data.balance) - .toFixed(); - } else { - balances[data.underlying] = data.balance; - } - }) + const [v2Atokens, v2ReserveTokens] = await getV2Reserves(block, addressesProviderRegistryETH, 'ethereum') + await getV2Tvl(balances, block, 'ethereum', v2Atokens, v2ReserveTokens, id=>id); } if(block >= 11998773){ @@ -319,8 +307,4 @@ const {getV2Reserves, getV2Tvl, aaveChainTvl} = require('../helper/aave') polygon:{ tvl: polygon }, - staking:{ - tvl: staking - }, - tvl: sdk.util.sumChainTvls([ethereum, polygon, avax]) }; diff --git a/projects/helper/aave.js b/projects/helper/aave.js index f74859309a..eea885353e 100644 --- a/projects/helper/aave.js +++ b/projects/helper/aave.js @@ -1,14 +1,10 @@ const sdk = require('@defillama/sdk'); -const _ = require('underscore'); -const BigNumber = require("bignumber.js"); const abi = require('../helper/abis/aave.json'); +const { getBlock } = require('./getBlock'); -async function getV2Reserves(block, addressesProviderRegistry, chain, v2Atokens, v2ReserveTokens, addressSymbolMapping, dataHelperAddress) { - if (v2Atokens.length !== 0 && v2ReserveTokens.length !== 0) return - - let validProtocolDataHelpers - if(dataHelperAddress === undefined){ - +async function getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress) { + let validProtocolDataHelpers + if (dataHelperAddress === undefined) { const addressesProviders = ( await sdk.api.abi.call({ target: addressesProviderRegistry, @@ -20,7 +16,7 @@ async function getV2Reserves(block, addressesProviderRegistry, chain, v2Atokens, const protocolDataHelpers = ( await sdk.api.abi.multiCall({ - calls: _.map(addressesProviders, (provider) => ({ + calls: addressesProviders.map((provider) => ({ target: provider, params: "0x0100000000000000000000000000000000000000000000000000000000000000", })), @@ -33,144 +29,71 @@ async function getV2Reserves(block, addressesProviderRegistry, chain, v2Atokens, validProtocolDataHelpers = protocolDataHelpers.filter( (helper) => helper.output !== "0x0000000000000000000000000000000000000000" - ).map(p=>p.output); - } else { - validProtocolDataHelpers = dataHelperAddress - } - - const aTokenMarketData = ( - await sdk.api.abi.multiCall({ - calls: _.map(validProtocolDataHelpers, (dataHelper) => ({ - target: dataHelper, - })), - abi: abi["getAllATokens"], - block, - chain - }) - ).output; - - let aTokenAddresses = []; - aTokenMarketData.map((aTokensData) => { - aTokenAddresses = [ - ...aTokenAddresses, - ...aTokensData.output.map((aToken) => aToken[1]), - ]; - }); - - const underlyingAddressesData = ( - await sdk.api.abi.multiCall({ - calls: _.map(aTokenAddresses, (aToken) => ({ - target: aToken, - })), - abi: abi["getUnderlying"], - block, - chain - }) - ).output; - - let reserveAddresses = []; - underlyingAddressesData.map((reserveData) => { - reserveAddresses.push(reserveData.output) - }); - - v2Atokens = aTokenAddresses - v2ReserveTokens = reserveAddresses; - - // Fetch associated token info - const symbolsOfReserves = ( - await sdk.api.abi.multiCall({ - calls: _.map(v2ReserveTokens, (underlying) => ({ - target: underlying, - })), - abi: "erc20:symbol", - block, - chain - }) - ).output; - - const decimalsOfReserves = ( - await sdk.api.abi.multiCall({ - calls: _.map(v2ReserveTokens, (underlying) => ({ - target: underlying, - })), - abi: "erc20:decimals", - block, - chain - }) - ).output - - symbolsOfReserves.map((r) => { - const address = r.input.target; - let symbol; - - if (address == "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2") { - symbol = "MKR"; - } else { - symbol = r.output; - } - - addressSymbolMapping[address] = { symbol }; - }); - - decimalsOfReserves.map((r) => { - const address = r.input.target; - const existingAddress = addressSymbolMapping[address]; - addressSymbolMapping[address] = { - ...existingAddress, - decimals: r.output, - }; - }); - return [v2Atokens, v2ReserveTokens, addressSymbolMapping] + ).map(p => p.output); + } else { + validProtocolDataHelpers = dataHelperAddress } - async function getV2Tvl(block, chain, v2Atokens, v2ReserveTokens, addressSymbolMapping) { - const underlyingAddressesDict = Object.keys(v2ReserveTokens).map( - (key) => v2ReserveTokens[key] - ); + const aTokenMarketData = ( + await sdk.api.abi.multiCall({ + calls: validProtocolDataHelpers.map((dataHelper) => ({ + target: dataHelper, + })), + abi: abi["getAllATokens"], + block, + chain + }) + ).output; + + let aTokenAddresses = []; + aTokenMarketData.map((aTokensData) => { + aTokenAddresses = [ + ...aTokenAddresses, + ...aTokensData.output.map((aToken) => aToken[1]), + ]; + }); + + const underlyingAddressesData = ( + await sdk.api.abi.multiCall({ + calls: aTokenAddresses.map((aToken) => ({ + target: aToken, + })), + abi: abi["getUnderlying"], + block, + chain + }) + ).output; - const balanceOfUnderlying = ( - await sdk.api.abi.multiCall({ - calls: _.map(v2Atokens, (aToken, index) => ({ - target: underlyingAddressesDict[index], - params: aToken, - })), - abi: "erc20:balanceOf", - block, - chain - }) - ).output; + const reserveAddresses = underlyingAddressesData.map((reserveData) => reserveData.output); - const v2Data = balanceOfUnderlying.map((underlying, index) => { - const address = underlying.input.target - return { - aToken: v2Atokens[index], - underlying: address, - symbol: addressSymbolMapping[address].symbol, - decimals: addressSymbolMapping[address].decimals, - balance: underlying.output, - }; - }) + return [aTokenAddresses, reserveAddresses] +} - return v2Data - } +async function getV2Tvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddress) { + const balanceOfUnderlying = await sdk.api.abi.multiCall({ + calls: v2Atokens.map((aToken, index) => ({ + target: v2ReserveTokens[index], + params: aToken, + })), + abi: "erc20:balanceOf", + block, + chain + }); + sdk.util.sumMultiBalanceOf(balances, balanceOfUnderlying, true, transformAddress) +} - function aaveChainTvl(chain, addressesProviderRegistry, transformAddress, dataHelperAddress){ - return async (timestamp, ethBlock, chainBlocks)=>{ +function aaveChainTvl(chain, addressesProviderRegistry, transformAddress, dataHelperAddress) { + return async (timestamp, ethBlock, chainBlocks) => { const balances = {} - const block = chainBlocks[chain] - let v2Atokens = []; - let v2ReserveTokens = []; - let addressSymbolMapping = {}; - [v2Atokens, v2ReserveTokens, addressSymbolMapping] = await getV2Reserves(block, addressesProviderRegistry, chain, v2Atokens, v2ReserveTokens, addressSymbolMapping, dataHelperAddress) - const v2Tvl = await getV2Tvl(block, chain, v2Atokens, v2ReserveTokens, addressSymbolMapping); - v2Tvl.map(data => { - sdk.util.sumSingleBalance(balances, transformAddress?transformAddress(data.underlying):`${chain}:${data.underlying}`, data.balance); - }) + const block = await getBlock(timestamp, chain, chainBlocks, true); + const [v2Atokens, v2ReserveTokens] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress) + const transformAddressFinal = transformAddress ? transformAddress : addr=>`${chain}:${addr}` + await getV2Tvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddressFinal); return balances } } -module.exports={ - aaveChainTvl, - getV2Reserves, - getV2Tvl +module.exports = { + aaveChainTvl, + getV2Reserves, + getV2Tvl } \ No newline at end of file From af076fe51ebdf54f688151bf8fd05cb3e630a85d Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 7 Dec 2021 19:32:30 +0000 Subject: [PATCH 272/393] exodia fix exports --- projects/exodia/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/projects/exodia/index.js b/projects/exodia/index.js index 5a7df85ac6..c253ae8fcc 100644 --- a/projects/exodia/index.js +++ b/projects/exodia/index.js @@ -74,11 +74,8 @@ module.exports = { misrepresentedTokens: true, fantom: { tvl, + staking }, - staking: { - tvl: staking, - }, - tvl, methodology: "Counts tokens on the treasury for TVL and staked EXOD for staking", }; \ No newline at end of file From 3d99add7b2b7f7b94a5d7f0c32ea0779381f18b5 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Tue, 7 Dec 2021 22:14:34 +0000 Subject: [PATCH 273/393] borrowed for aave forks --- projects/blizzfinance/index.js | 11 +- projects/geist/index.js | 14 +- projects/helper/aave.js | 41 +- projects/helper/abis/aave.json | 777 ++++++++++++++++++++------------- 4 files changed, 524 insertions(+), 319 deletions(-) diff --git a/projects/blizzfinance/index.js b/projects/blizzfinance/index.js index eb6734ccdd..1c2cd911c3 100644 --- a/projects/blizzfinance/index.js +++ b/projects/blizzfinance/index.js @@ -1,12 +1,7 @@ -const { aaveChainTvl} = require('../helper/aave') -const { transformAvaxAddress } = require('../helper/portedTokens') - -async function tvl(timestamp, ethBlock, chainBlocks) { - const transform = await transformAvaxAddress() - return aaveChainTvl("avax", "0xfF50b540c9152F1841edF47b49dA69696Be59783", transform)(timestamp, ethBlock, chainBlocks) -} +const { aaveExports } = require('../helper/aave') module.exports={ + timetravel: true, methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", - tvl + avax:aaveExports("avax", "0xfF50b540c9152F1841edF47b49dA69696Be59783") } diff --git a/projects/geist/index.js b/projects/geist/index.js index 9dd51465e5..ac1a5a9ba7 100644 --- a/projects/geist/index.js +++ b/projects/geist/index.js @@ -1,12 +1,18 @@ -const { aaveChainTvl} = require('../helper/aave') +const { aaveChainTvl } = require('../helper/aave') const { transformFantomAddress} = require('../helper/portedTokens') -async function tvl(timestamp, ethBlock, chainBlocks) { +function lending(borrowed){ +return async (timestamp, ethBlock, chainBlocks) => { const transform = await transformFantomAddress() - return aaveChainTvl("fantom", "0x4CF8E50A5ac16731FA2D8D9591E195A285eCaA82", transform)(timestamp, ethBlock, chainBlocks) + return aaveChainTvl("fantom", "0x4CF8E50A5ac16731FA2D8D9591E195A285eCaA82", transform, undefined, borrowed)(timestamp, ethBlock, chainBlocks) +} } module.exports={ + timetravel: true, methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending", - tvl + fantom:{ + tvl: lending(false), + borrowed: lending(true), + } } diff --git a/projects/helper/aave.js b/projects/helper/aave.js index eea885353e..355b6f4849 100644 --- a/projects/helper/aave.js +++ b/projects/helper/aave.js @@ -1,5 +1,6 @@ const sdk = require('@defillama/sdk'); -const abi = require('../helper/abis/aave.json'); +const { default: BigNumber } = require('bignumber.js'); +const abi = require('./abis/aave.json'); const { getBlock } = require('./getBlock'); async function getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress) { @@ -66,7 +67,7 @@ async function getV2Reserves(block, addressesProviderRegistry, chain, dataHelper const reserveAddresses = underlyingAddressesData.map((reserveData) => reserveData.output); - return [aTokenAddresses, reserveAddresses] + return [aTokenAddresses, reserveAddresses, validProtocolDataHelpers[0]] } async function getV2Tvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddress) { @@ -82,18 +83,44 @@ async function getV2Tvl(balances, block, chain, v2Atokens, v2ReserveTokens, tran sdk.util.sumMultiBalanceOf(balances, balanceOfUnderlying, true, transformAddress) } -function aaveChainTvl(chain, addressesProviderRegistry, transformAddress, dataHelperAddress) { +async function getV2Borrowed(balances, block, chain, v2ReserveTokens, dataHelper, transformAddress) { + const reserveData = await sdk.api.abi.multiCall({ + calls: v2ReserveTokens.map((token) => ({ + target: dataHelper, + params: [token], + })), + abi: abi.getHelperReserveData, + block, + chain + }); + reserveData.output.forEach((data, idx)=>{ + sdk.util.sumSingleBalance(balances, transformAddress(data.input.params[0]), BigNumber(data.output.totalVariableDebt).plus(data.output.totalStableDebt).toFixed(0)) + }) +} + +function aaveChainTvl(chain, addressesProviderRegistry, transformAddressRaw, dataHelperAddress, borrowed) { + const transformAddress = transformAddressRaw ? transformAddressRaw : addr=>`${chain}:${addr}` return async (timestamp, ethBlock, chainBlocks) => { const balances = {} const block = await getBlock(timestamp, chain, chainBlocks, true); - const [v2Atokens, v2ReserveTokens] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress) - const transformAddressFinal = transformAddress ? transformAddress : addr=>`${chain}:${addr}` - await getV2Tvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddressFinal); + const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress) + if(borrowed){ + await getV2Borrowed(balances, block, chain, v2ReserveTokens, dataHelper, transformAddress); + } else { + await getV2Tvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddress); + } return balances } } +function aaveExports(chain, addressesProviderRegistry){ + return { + tvl: aaveChainTvl(chain, addressesProviderRegistry, undefined, undefined, false), + borrowed: aaveChainTvl(chain, addressesProviderRegistry, undefined, undefined, true) + } +} module.exports = { aaveChainTvl, getV2Reserves, - getV2Tvl + getV2Tvl, + aaveExports } \ No newline at end of file diff --git a/projects/helper/abis/aave.json b/projects/helper/abis/aave.json index 98488dd15b..dc40fd34d0 100644 --- a/projects/helper/abis/aave.json +++ b/projects/helper/abis/aave.json @@ -1,304 +1,481 @@ { - "getReservesList":{"inputs":[],"name":"getReservesList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, - "getAMMReserveData":{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getReserveData","outputs":[{"components":[{"components":[{"internalType":"uint256","name":"data","type":"uint256"}],"internalType":"struct DataTypes.ReserveConfigurationMap","name":"configuration","type":"tuple"},{"internalType":"uint128","name":"liquidityIndex","type":"uint128"},{"internalType":"uint128","name":"variableBorrowIndex","type":"uint128"},{"internalType":"uint128","name":"currentLiquidityRate","type":"uint128"},{"internalType":"uint128","name":"currentVariableBorrowRate","type":"uint128"},{"internalType":"uint128","name":"currentStableBorrowRate","type":"uint128"},{"internalType":"uint40","name":"lastUpdateTimestamp","type":"uint40"},{"internalType":"address","name":"aTokenAddress","type":"address"},{"internalType":"address","name":"stableDebtTokenAddress","type":"address"},{"internalType":"address","name":"variableDebtTokenAddress","type":"address"},{"internalType":"address","name":"interestRateStrategyAddress","type":"address"},{"internalType":"uint8","name":"id","type":"uint8"}],"internalType":"struct DataTypes.ReserveData","name":"","type":"tuple"}],"stateMutability":"view","type":"function"}, - "getCurrentTokens":{"constant":true,"inputs":[],"name":"getCurrentTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"}, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveConfigurationData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveConfigurationData", - "outputs": [ - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAddressesProvidersList": { - "inputs": [], - "name": "getAddressesProvidersList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddress": { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllATokens": { - "inputs": [], - "name": "getAllATokens", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct AaveProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveDataV2": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { + "getReservesList": { + "inputs": [], + "name": "getReservesList", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getAMMReserveData": { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getReserveData", + "outputs": [ + { + "components": [ + { + "components": [ + { "internalType": "uint256", - "name": "variableBorrowRate", + "name": "data", "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } + } + ], + "internalType": "struct DataTypes.ReserveConfigurationMap", + "name": "configuration", + "type": "tuple" + }, + { + "internalType": "uint128", + "name": "liquidityIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "variableBorrowIndex", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentLiquidityRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentVariableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "currentStableBorrowRate", + "type": "uint128" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "variableDebtTokenAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + }, + { + "internalType": "uint8", + "name": "id", + "type": "uint8" + } + ], + "internalType": "struct DataTypes.ReserveData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getCurrentTokens": { + "constant": true, + "inputs": [], + "name": "getCurrentTokens", + "outputs": [ + { + "internalType": "address[]", + "name": "tokens", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getReserveData": { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_reserve", + "type": "address" + } + ], + "name": "getReserveData", + "outputs": [ + { + "internalType": "uint256", + "name": "totalLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "availableLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowsStable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalBorrowsVariable", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "variableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "averageStableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "utilizationRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "variableBorrowIndex", + "type": "uint256" + }, + { + "internalType": "address", + "name": "aTokenAddress", + "type": "address" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getReserveConfigurationData": { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_reserve", + "type": "address" + } + ], + "name": "getReserveConfigurationData", + "outputs": [ + { + "internalType": "uint256", + "name": "ltv", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationThreshold", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidationBonus", + "type": "uint256" + }, + { + "internalType": "address", + "name": "interestRateStrategyAddress", + "type": "address" + }, + { + "internalType": "bool", + "name": "usageAsCollateralEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "borrowingEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "stableBorrowRateEnabled", + "type": "bool" + }, + { + "internalType": "bool", + "name": "isActive", + "type": "bool" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getReserves": { + "constant": true, + "inputs": [], + "name": "getReserves", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "getAddressesProvidersList": { + "inputs": [], + "name": "getAddressesProvidersList", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getAddress": { + "inputs": [ + { + "internalType": "bytes32", + "name": "id", + "type": "bytes32" + } + ], + "name": "getAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getAllATokens": { + "inputs": [], + "name": "getAllATokens", + "outputs": [ + { + "components": [ + { + "internalType": "string", + "name": "symbol", + "type": "string" + }, + { + "internalType": "address", + "name": "tokenAddress", + "type": "address" + } ], - "stateMutability": "view", - "type": "function" - }, - "getBPool": { - "inputs": [], - "name": "bPool", - "outputs": [ - { - "internalType": "contract IBPool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - } \ No newline at end of file + "internalType": "struct AaveProtocolDataProvider.TokenData[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getUnderlying": { + "inputs": [], + "name": "UNDERLYING_ASSET_ADDRESS", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getReserveDataV2": { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getReserveData", + "outputs": [ + { + "internalType": "uint256", + "name": "availableLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalStableDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalVariableDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "variableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "averageStableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "variableBorrowIndex", + "type": "uint256" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getBPool": { + "inputs": [], + "name": "bPool", + "outputs": [ + { + "internalType": "contract IBPool", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getHelperReserveData": { + "inputs": [ + { + "internalType": "address", + "name": "asset", + "type": "address" + } + ], + "name": "getReserveData", + "outputs": [ + { + "internalType": "uint256", + "name": "availableLiquidity", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalStableDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalVariableDebt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "variableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "stableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "averageStableBorrowRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "liquidityIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "variableBorrowIndex", + "type": "uint256" + }, + { + "internalType": "uint40", + "name": "lastUpdateTimestamp", + "type": "uint40" + } + ], + "stateMutability": "view", + "type": "function" + } +} \ No newline at end of file From 46b12881c8caee2dabe892835d8e46496b91e046 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 07:48:50 +0000 Subject: [PATCH 274/393] borrowed on aave & simplify agave --- projects/aave/index.js | 352 ++++++--------------------------- projects/agave.js | 226 +-------------------- projects/helper/aave.js | 7 +- projects/helper/abis/aave.json | 21 ++ 4 files changed, 90 insertions(+), 516 deletions(-) diff --git a/projects/aave/index.js b/projects/aave/index.js index e848f3a04b..f3993bf0ce 100644 --- a/projects/aave/index.js +++ b/projects/aave/index.js @@ -1,310 +1,76 @@ - const sdk = require('@defillama/sdk'); - const _ = require('underscore'); - const BigNumber = require("bignumber.js"); - const abi = require('../helper/abis/aave.json'); -const { addBalanceOfTokensAndLPs } = require('../helper/unwrapLPs'); -const {getV2Reserves, getV2Tvl, aaveChainTvl} = require('../helper/aave') +const sdk = require('@defillama/sdk'); +const { getV2Reserves, getV2Tvl, aaveExports, getV2Borrowed } = require('../helper/aave'); +const { staking } = require('../helper/staking'); +const { singleAssetV1Market,uniswapV1Market } = require('./v1'); +const { ammMarket } = require('./amm'); - const aaveLendingPoolCore = "0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3"; - const aaveLendingPool = "0x398eC7346DcD622eDc5ae82352F02bE94C62d119"; - let aaveReserves = [] - const uniswapLendingPoolCore = "0x1012cfF81A1582ddD0616517eFB97D02c5c17E25"; - const uniswapLendingPool = "0x2F60C3EB259D63dcCa81fDE7Eaa216D9983D7C60"; - let uniswapReserves = [] +const addressesProviderRegistryETH = "0x52D306e36E3B6B02c153d0266ff0f85d18BCD413"; - const aaveStakingContract = "0x4da27a545c0c5b758a6ba100e3a049001de870f5"; - const aaveBalancerContractImp = "0xC697051d1C6296C24aE3bceF39acA743861D9A81"; - const aaveTokenAddress = "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9"; - const wethTokenAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; - const eth = "0x0000000000000000000000000000000000000000" - - const addressesProviderRegistryETH = "0x52D306e36E3B6B02c153d0266ff0f85d18BCD413"; - - async function _stakingTvl(block) { - return ( - await sdk.api.abi.call({ - target: aaveTokenAddress, - params: aaveStakingContract, - abi: "erc20:balanceOf", - block - }) - ).output; - } - - async function _stakingBalancerTvl(block) { - const aaveBal = ( - await sdk.api.abi.call({ - target: aaveTokenAddress, - params: aaveBalancerContractImp, - abi: "erc20:balanceOf", - block, - }) - ).output; - - const wethBal = ( - await sdk.api.abi.call({ - target: wethTokenAddress, - params: aaveBalancerContractImp, - abi: "erc20:balanceOf", - block, - }) - ).output; - - return { - [aaveTokenAddress]: aaveBal, - [wethTokenAddress]: wethBal, - }; - } - - async function _getV1Assets(lendingPoolCore, block) { - const reserves = ( - await sdk.api.abi.call({ - target: lendingPoolCore, - abi: abi["getReserves"], - block - }) - ).output; - - const decimalsOfReserve = ( - await sdk.api.abi.multiCall({ - calls: _.map(reserves, (reserve) => ({ - target: reserve - })), - abi: "erc20:decimals" - }) - ).output; - - const symbolsOfReserve = ( - await sdk.api.abi.multiCall({ - calls: _.map(reserves, reserve => ({ - target: reserve - })), - abi: "erc20:symbol" - }) - ).output; - - let assets = [] - - reserves.map((reserve, i) => { - if (reserve === '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE') return; - - let symbol; - switch(reserve) { - case "0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2": // MKR doesn't include symbol in contract 🤷‍♂️ - symbol = { output: 'MKR' }; break - default: - symbol = symbolsOfReserve[i] - } - - const decimals = decimalsOfReserve[i] - if (decimals.success) { - assets.push({ address: reserve, symbol: symbol.output, decimals: decimals.output }) - }else { - throw new Error("Call failed") - } - }) - - return assets - } - - async function _multiMarketV1Tvl(lendingPoolCore, reserves, block) { - let balances = { - "0x0000000000000000000000000000000000000000": ( - await sdk.api.eth.getBalance({ target: lendingPoolCore, block }) - ).output, - }; - - const balanceOfResults = await sdk.api.abi.multiCall({ - block, - calls: _.map(reserves, (reserve) => ({ - target: reserve.address, - params: lendingPoolCore, - })), - abi: "erc20:balanceOf", - }); - - sdk.util.sumMultiBalanceOf(balances, balanceOfResults, true); - - return balances; - } - - async function getV1Reserves(block) { - if (aaveReserves.length === 0) { - aaveReserves = await _getV1Assets(aaveLendingPoolCore, block); - } - - if (uniswapReserves.length === 0) { - // Does not take into account Uniswap LP assets (not yet supported on DeFiPulse) - uniswapReserves = await _getV1Assets(uniswapLendingPoolCore, block); - } - } - - - - async function ammMarket(balances, block){ - const lendingPool = "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB" - const reservesList = (await sdk.api.abi.call({ - target: lendingPool, - abi: abi.getReservesList, - block - })).output - const reservesData = await sdk.api.abi.multiCall({ - abi: abi.getAMMReserveData, - calls: reservesList.map(r=>({ - target: lendingPool, - params: r - })), - block - }) - const [balanceOfTokens, balancerTokens] = await Promise.all([ - sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: reservesData.output.map((r, idx)=>({ - target: reservesList[idx], - params: r.output.aTokenAddress - })), - block - }), - sdk.api.abi.multiCall({ - abi: abi.getCurrentTokens, - calls: reservesData.output.map((r, idx)=>({ - target: reservesList[idx], - })), - block - }), - ]) - const balanceOfTokensWithoutBalancerPairs = (await Promise.all(balanceOfTokens.output.map(async (balanceOf, idx)=>{ - if(!balancerTokens.output[idx].success){ - return balanceOf - } - const [amountsOnPair, totalSupply] = await Promise.all([ - sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: balancerTokens.output[idx].output.map((r)=>({ - target: r, - params: balanceOf.input.target - })), - block - }), - sdk.api.erc20.totalSupply({ - target: balanceOf.input.target, - block - }) - ]); - balancerTokens.output[idx].output.forEach((token, ydx)=>{ - const tokenBalance = BigNumber(amountsOnPair.output[ydx].output).times(balanceOf.output).div(totalSupply.output) - sdk.util.sumSingleBalance(balances, token, tokenBalance.toFixed(0)) - }) - - return null - }))).filter(b=>b!==null) - await addBalanceOfTokensAndLPs(balances, { - output: balanceOfTokensWithoutBalancerPairs - }, block) - } - - async function ethereum(timestamp, block) { - // V1 TVLs - await getV1Reserves(block) - let balances = await _multiMarketV1Tvl(aaveLendingPoolCore, aaveReserves, block); - - const uniswapMarketTvlBalances = await _multiMarketV1Tvl( - uniswapLendingPoolCore, - uniswapReserves, - block - ); - - const uniswapv1Calls = Object.keys(uniswapMarketTvlBalances).map(t=>({target:t})); - const [uniswapV1Tokens, uniswapV1EthBalance, uniswapV1Supplies] = await Promise.all([ - sdk.api.abi.multiCall({ - abi: {"name": "tokenAddress", "outputs": [{"type": "address", "name": "out"}], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1413}, - calls:uniswapv1Calls, - block - }), - sdk.api.eth.getBalances({ - targets: Object.keys(uniswapMarketTvlBalances), - block - }), - sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls:uniswapv1Calls, - block - }), - ]) - - const uniswapV1TokenBalance = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: uniswapV1Tokens.output.map(t=>({ - target: t.output, - params: t.input.target - })), - block - }) +function ethereum(borrowed) { + return async (timestamp, block)=> { + const balances = {} - // ...add v1 uniswap market TVL - Object.keys(uniswapMarketTvlBalances).forEach((address, idx) => { - const balance = uniswapMarketTvlBalances[address]; - if(uniswapV1Tokens.output[idx].success === false){ - sdk.util.sumSingleBalance(balances, address, balance) - } else { - const tokenBalance = BigNumber(uniswapV1TokenBalance.output[idx].output).times(balance).div(uniswapV1Supplies.output[idx].output) - const ethBalance = BigNumber(uniswapV1EthBalance.output[idx].balance).times(balance).div(uniswapV1Supplies.output[idx].output) - const token = uniswapV1Tokens.output[idx].output - sdk.util.sumSingleBalance(balances, token, tokenBalance.toFixed(0)) - sdk.util.sumSingleBalance(balances, eth, ethBalance.toFixed(0)) - } - }); + await singleAssetV1Market(balances, block, borrowed) + await uniswapV1Market(balances, block, borrowed) // V2 TVLs if (block >= 11360925) { - const [v2Atokens, v2ReserveTokens] = await getV2Reserves(block, addressesProviderRegistryETH, 'ethereum') - await getV2Tvl(balances, block, 'ethereum', v2Atokens, v2ReserveTokens, id=>id); + const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistryETH, 'ethereum') + if(borrowed){ + await getV2Borrowed(balances, block, "ethereum", v2ReserveTokens, dataHelper, id=>id); + } else { + await getV2Tvl(balances, block, 'ethereum', v2Atokens, v2ReserveTokens, id => id); + } } - - if(block >= 11998773){ - await ammMarket(balances, block) + if (block >= 11998773) { + await ammMarket(balances, block, borrowed) } return balances; } +} - const polygon = aaveChainTvl("polygon", "0x3ac4e9aa29940770aeC38fe853a4bbabb2dA9C19"); +const aaveBalancerContractImp = "0xC697051d1C6296C24aE3bceF39acA743861D9A81"; +const aaveTokenAddress = "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9"; +const wethTokenAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; - const avax = aaveChainTvl("avax", "0x4235E22d9C3f28DCDA82b58276cb6370B01265C2") +async function stakingBalancerTvl(timestamp, block) { + const aaveBal = ( + await sdk.api.abi.call({ + target: aaveTokenAddress, + params: aaveBalancerContractImp, + abi: "erc20:balanceOf", + block, + }) + ).output; - async function staking(timestamp, block){ - const balances = {} - // Staking TVLs - if (block >= 10926829) { - const stakedAaveAmount = await _stakingTvl(block); - balances[aaveTokenAddress] = balances[aaveTokenAddress] - ? BigNumber(balances[aaveTokenAddress]).plus(stakedAaveAmount).toFixed() - : BigNumber(stakedAaveAmount).toFixed() - - const stakedBalancerAmounts = await _stakingBalancerTvl(block); - Object.keys(stakedBalancerAmounts).forEach((address) => { - balances[address] = balances[address] - ? BigNumber(balances[address]) - .plus(stakedBalancerAmounts[address]) - .toFixed() - : BigNumber(stakedBalancerAmounts[address]).toFixed(); - }); - } - return balances; - } + const wethBal = ( + await sdk.api.abi.call({ + target: wethTokenAddress, + params: aaveBalancerContractImp, + abi: "erc20:balanceOf", + block, + }) + ).output; - module.exports = { - timetravel: true, - methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, - ethereum:{ - staking, - tvl: ethereum - }, - avalanche:{ - tvl: avax - }, - polygon:{ - tvl: polygon - }, + return { + [aaveTokenAddress]: aaveBal, + [wethTokenAddress]: wethBal, }; +} + +const aaveStakingContract = "0x4da27a545c0c5b758a6ba100e3a049001de870f5"; + +module.exports = { + timetravel: true, + methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, + ethereum: { + staking: staking(aaveStakingContract, aaveTokenAddress), + pool2: stakingBalancerTvl, + tvl: ethereum(false), + borrowed: ethereum(true), + }, + avalanche: aaveExports("avax", "0x4235E22d9C3f28DCDA82b58276cb6370B01265C2"), + polygon: aaveExports("polygon", "0x3ac4e9aa29940770aeC38fe853a4bbabb2dA9C19"), +}; diff --git a/projects/agave.js b/projects/agave.js index 0da714e968..a43026810e 100644 --- a/projects/agave.js +++ b/projects/agave.js @@ -1,232 +1,18 @@ -const sdk = require('@defillama/sdk'); -const { request, gql } = require("graphql-request"); -const BigNumber = require("bignumber.js"); const { staking } = require("./helper/staking.js"); - -// Retrieve aTokens Deposited on AGAVE (v2 aave tokens) and not borrowed against -const graphUrl = 'https://api.thegraph.com/subgraphs/name/agave-dao/agave-xdai' -const graphQuery = gql` -query GET_AGAVE($block: Int) { - atokens ( - block: { number: $block } - ){ - id - underlyingAssetAddress - underlyingAssetDecimals - } - reserves ( - block: { number: $block } - ) { - id - symbol - decimals - name - underlyingAsset - totalDeposits - totalATokenSupply - totalLiquidity - } -} -`; - -// Retrieves aTokens left to borrow (and does not account for atokens already borrowed to avoid cycled lending). Otherwise, could have a look at the aTokens erc20:totalSupply -async function getV2Reserves_graphql(block, addressesProviderRegistry, chain, v2Atokens, v2ReserveTokens, addressSymbolMapping) { - if (v2Atokens.length !== 0 && v2ReserveTokens.length !== 0) return - - // Retrieve aTokens and reserves from graphql API endpoint - const { atokens, reserves } = await request( - graphUrl, - graphQuery,{ - block, - } - ); - - // Parse aTokens, underlying reserveTokens, symbols and decimals - // v2ReserveTokens = atokens.map(atoken => atoken.underlyingAssetAddress); - // v2Atokens = atokens.map(atoken => atoken.id) - v2ReserveTokens = [] - v2Atokens = atokens.map(atoken => { - const underlyingAssetAddress = atoken.underlyingAssetAddress - v2ReserveTokens.push(underlyingAssetAddress) - const reserve = reserves.find(r => r.underlyingAsset === underlyingAssetAddress) - - addressSymbolMapping[underlyingAssetAddress] = { - symbol: reserve.symbol, - decimals: reserve.decimals - } - return atoken.id - }) - - return [v2Atokens, v2ReserveTokens, addressSymbolMapping] -} - - -// getV2Tvl and aaveChainTvl are exactly identical to ./helper/aave.js, but aaveChainTvl is here needed since we are using a custom agave getV2Reserves -const {getV2Tvl} = require('./helper/aave.js'); -function aaveChainTvl_graphql(chain, addressesProviderRegistry, transformAddress){ - return async (timestamp, ethBlock, chainBlocks)=>{ - const balances = {} - let v2Atokens = []; - let v2ReserveTokens = []; - let addressSymbolMapping = {}; - [v2Atokens, v2ReserveTokens, addressSymbolMapping] = await getV2Reserves_graphql(chainBlocks[chain], addressesProviderRegistry, chain, v2Atokens, v2ReserveTokens, addressSymbolMapping) - const v2Tvl = await getV2Tvl(chainBlocks[chain], chain, v2Atokens, v2ReserveTokens, addressSymbolMapping); - v2Tvl.map(data => { - sdk.util.sumSingleBalance(balances, transformAddress?transformAddress(data.underlying):`${chain}:${data.underlying}`, data.balance); - }) - return balances - } -} - -// aaveChainTvl returns a function which uses our agave getV2Reserves and then aave.js default getV2Tvl -const xdai_graphql = aaveChainTvl_graphql("xdai", "not-needed-but-left-for-compatibility-with-helper/aave.js"); - +const { aaveChainTvl} = require('./helper/aave.js'); // Staking TVLs const agaveTokenAddress = '0x3a97704a1b25F08aa230ae53B352e2e72ef52843' const agaveStakingContract = '0x610525b415c1BFAeAB1a3fc3d85D87b92f048221' - -// getAddressesProvidersList executed on https://blockscout.com/xdai/mainnet/address/0xa5E80AEAa020Ae41b1cBEe75dE7826297F7D803E/read-contract returns [0x24604cc6a929e10878534f9e7bf8083d98aba0a2, 0xa91b9095efa6c0568467562032202108e49c9ef8] -// however, cannot find the correct parameter to getAddress(param) on these two contracts -// Can instead use directly the ProtocolDataProvider 0xa874f66342a04c24b213BF0715dFf18818D24014 -const abi = require('./helper/abis/aave.json') -const addressesProviderRegistryXDAI = "0xa5E80AEAa020Ae41b1cBEe75dE7826297F7D803E" -// const {getV2Reserves} = require('./helper/aave') - -async function xdai_registry(timestamp, ethBlock, chainBlocks) { - // Had to explode getV2Reserves because cannot find the correct parameter to getAddress(param) on addressProvider - // V2 TVLs - let balances = {} - let v2Atokens = [] - let v2ReserveTokens = [] - let addressSymbolMapping = {} - - const chain = 'xdai' - const block = chainBlocks[chain] - const validProtocolDataHelpers = '0xa874f66342a04c24b213BF0715dFf18818D24014' - - const aTokenMarketData = ( - await sdk.api.abi.multiCall({ - calls: [{target: validProtocolDataHelpers}], - abi: abi["getAllATokens"], - block, - chain - }) - ).output; - - let aTokenAddresses = []; - aTokenMarketData.map((aTokensData) => { - aTokenAddresses = [ - ...aTokenAddresses, - ...aTokensData.output.map((aToken) => aToken[1]), - ]; - }); - - const underlyingAddressesData = ( - await sdk.api.abi.multiCall({ - calls: aTokenAddresses.map((aToken) => ({ - target: aToken, - })), - abi: abi["getUnderlying"], - block, - chain - }) - ).output; - - let reserveAddresses = []; - underlyingAddressesData.map((reserveData) => { - reserveAddresses.push(reserveData.output) - }); - - v2Atokens = aTokenAddresses - v2ReserveTokens = reserveAddresses; - - // Fetch associated token info - const symbolsOfReserves = ( - await sdk.api.abi.multiCall({ - calls: v2ReserveTokens.map((underlying) => ({ - target: underlying, - })), - abi: "erc20:symbol", - block, - chain - }) - ).output; - - const decimalsOfReserves = ( - await sdk.api.abi.multiCall({ - calls: v2ReserveTokens.map((underlying) => ({ - target: underlying, - })), - abi: "erc20:decimals", - block, - chain - }) - ).output - - symbolsOfReserves.map((r) => { - let symbol = r.output - addressSymbolMapping[r.input.target] = { symbol }; - }); - - decimalsOfReserves.map((r) => { - const address = r.input.target; - const existingAddress = addressSymbolMapping[address]; - addressSymbolMapping[address] = { - ...existingAddress, - decimals: r.output, - }; - }); - // {v2Atokens, v2ReserveTokens, addressSymbolMapping} = await getV2Reserves(chainBlocks['xdai'], addressesProviderRegistryXDAI, 'xdai', v2Atokens, v2ReserveTokens, addressSymbolMapping_, protocolDataHelperParam="0x0000000000000000000000000000000000000000000000000000000000001 ") - - const v2Tvl = await getV2Tvl(chainBlocks['xdai'], 'xdai', v2Atokens, v2ReserveTokens, addressSymbolMapping) - v2Tvl.map(data => { - if (balances['xdai:' + data.underlying]) { - balances['xdai:' + data.underlying] = BigNumber(balances[data.underlying]) - .plus(data.balance) - .toFixed() - } else { - balances['xdai:' + data.underlying] = data.balance - } - }) - return balances; -} - +const addressesProviderRegistryXDAI = "0xa5E80AEAa020Ae41b1cBEe75dE7826297F7D803E" +const protocolDataHelper = '0xa874f66342a04c24b213BF0715dFf18818D24014' module.exports = { methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, xdai:{ - tvl: xdai_registry, + tvl: aaveChainTvl("xdai", addressesProviderRegistryXDAI, addr=>`xdai:${addr}`, [protocolDataHelper], false), + borrowed: aaveChainTvl("xdai", addressesProviderRegistryXDAI, addr=>`xdai:${addr}`, [protocolDataHelper], true), staking: staking(agaveStakingContract, agaveTokenAddress, chain="xdai") } -}; - - -/* -addressesProviderRegistry = '0xa5E80AEAa020Ae41b1cBEe75dE7826297F7D803E' -const addressesProviders = ( - await sdk.api.abi.call({ - target: addressesProviderRegistry, - abi: abi["getAddressesProvidersList"], - block, - chain - }) -).output; -// returns ['0x24604Cc6a929E10878534F9E7bf8083D98ABA0A2', '0xa91b9095efa6c0568467562032202108e49c9ef8'] - -let protocolDataHelpers = ( - await sdk.api.abi.multiCall({ - calls:[{ - target: "0x24604Cc6a929E10878534F9E7bf8083D98ABA0A2", - params: "0x0000000000000000000000000000000000000000000000000000000000001", - }], - abi: abi['getAddress'], - block: chainBlocks['xdai'], - chain: 'xdai' - }) -) -protocolDataHelpers = protocolDataHelpers.output; -console.log('protocolDataHelpers', protocolDataHelpers) -// Or parameter 0x0000000000000000000000000000000000000000000000000000000000000001 not working either -*/ \ No newline at end of file +}; \ No newline at end of file diff --git a/projects/helper/aave.js b/projects/helper/aave.js index 355b6f4849..2ad95121b6 100644 --- a/projects/helper/aave.js +++ b/projects/helper/aave.js @@ -98,12 +98,12 @@ async function getV2Borrowed(balances, block, chain, v2ReserveTokens, dataHelper }) } -function aaveChainTvl(chain, addressesProviderRegistry, transformAddressRaw, dataHelperAddress, borrowed) { +function aaveChainTvl(chain, addressesProviderRegistry, transformAddressRaw, dataHelperAddresses, borrowed) { const transformAddress = transformAddressRaw ? transformAddressRaw : addr=>`${chain}:${addr}` return async (timestamp, ethBlock, chainBlocks) => { const balances = {} const block = await getBlock(timestamp, chain, chainBlocks, true); - const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress) + const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddresses) if(borrowed){ await getV2Borrowed(balances, block, chain, v2ReserveTokens, dataHelper, transformAddress); } else { @@ -122,5 +122,6 @@ module.exports = { aaveChainTvl, getV2Reserves, getV2Tvl, - aaveExports + aaveExports, + getV2Borrowed, } \ No newline at end of file diff --git a/projects/helper/abis/aave.json b/projects/helper/abis/aave.json index dc40fd34d0..ebc0d66dc6 100644 --- a/projects/helper/abis/aave.json +++ b/projects/helper/abis/aave.json @@ -477,5 +477,26 @@ ], "stateMutability": "view", "type": "function" + }, + "getReserveTotalBorrows": { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "_reserve", + "type": "address" + } + ], + "name": "getReserveTotalBorrows", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" } } \ No newline at end of file From 4f7fa6c9bfd99f568f730243fb5e4fb937c3cf6e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 07:49:20 +0000 Subject: [PATCH 275/393] add new aave modules --- projects/aave/amm.js | 107 ++++++++++++++++++++++++++++++++++++ projects/aave/v1.js | 125 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 232 insertions(+) create mode 100644 projects/aave/amm.js create mode 100644 projects/aave/v1.js diff --git a/projects/aave/amm.js b/projects/aave/amm.js new file mode 100644 index 0000000000..4b6a0ea13d --- /dev/null +++ b/projects/aave/amm.js @@ -0,0 +1,107 @@ +const sdk = require('@defillama/sdk'); +const BigNumber = require("bignumber.js"); +const abi = require('../helper/abis/aave.json'); +const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); + +async function ammMarket(balances, block, borrowed) { + const lendingPool = "0x7937D4799803FbBe595ed57278Bc4cA21f3bFfCB" + const reservesList = (await sdk.api.abi.call({ + target: lendingPool, + abi: abi.getReservesList, + block + })).output + const reservesData = await sdk.api.abi.multiCall({ + abi: abi.getAMMReserveData, + calls: reservesList.map(r => ({ + target: lendingPool, + params: r + })), + block + }) + const [balanceOfTokens, symbols] = await Promise.all([ + sdk.api.abi.multiCall({ + abi: "erc20:balanceOf", + calls: reservesData.output.map((r, idx) => ({ + target: reservesList[idx], + params: r.output.aTokenAddress + })), + block + }), + sdk.api.abi.multiCall({ + abi: "erc20:symbol", + calls: reservesData.output.map((r, idx) => ({ + target: reservesList[idx], + })), + block + }), + ]); + + if (borrowed) { + const [supplyStabledebt, supplyVariableDebt] = await Promise.all(["stableDebtTokenAddress", "variableDebtTokenAddress"].map(prop => + sdk.api.abi.multiCall({ + abi: "erc20:totalSupply", + calls: reservesData.output.map((r, idx) => ({ + target: r.output[prop], + })), + block + }) + )); + supplyStabledebt.output.map((ssd, i) => { + balanceOfTokens.output[i].output = BigNumber(ssd.output).plus(supplyVariableDebt.output[i].output).toFixed(0) + }) + } + + const balancerLps = [] + const uniLps = [] + symbols.output.forEach((symbol, i) => { + const token = symbol.input.target + const balance = balanceOfTokens.output[i].output + if (symbol.output === "BPT") { + balancerLps.push({ + token, + balance, + }) + } else if (symbol.output === "UNI-V2") { + uniLps.push({ + token, + balance, + }) + } else { + sdk.util.sumSingleBalance(balances, token, balance); + } + }) + + const balancerTokens = await sdk.api.abi.multiCall({ + abi: abi.getCurrentTokens, + calls: balancerLps.map(r => ({ + target: r.token, + })), + block + }); + + await Promise.all(balancerLps.map(async (bal, idx) => { + const [amountsOnPair, totalSupply] = await Promise.all([ + sdk.api.abi.multiCall({ + abi: "erc20:balanceOf", + calls: balancerTokens.output[idx].output.map((r) => ({ + target: r, + params: bal.token + })), + block + }), + sdk.api.erc20.totalSupply({ + target: bal.token, + block + }) + ]); + balancerTokens.output[idx].output.forEach((token, ydx) => { + const tokenBalance = BigNumber(amountsOnPair.output[ydx].output).times(bal.balance).div(totalSupply.output) + sdk.util.sumSingleBalance(balances, token, tokenBalance.toFixed(0)) + }) + })) + await unwrapUniswapLPs(balances, uniLps, block) +} + +module.exports = { + ammMarket +} \ No newline at end of file diff --git a/projects/aave/v1.js b/projects/aave/v1.js new file mode 100644 index 0000000000..4de74b1782 --- /dev/null +++ b/projects/aave/v1.js @@ -0,0 +1,125 @@ +const sdk = require('@defillama/sdk'); +const BigNumber = require("bignumber.js"); +const abi = require('../helper/abis/aave.json'); + +async function getV1Assets(lendingPoolCore, block) { + const reserves = ( + await sdk.api.abi.call({ + target: lendingPoolCore, + abi: abi["getReserves"], + block + }) + ).output; + + return reserves +} + +const ethReplacement = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' + +async function multiMarketV1TvlBorrowed(balances, lendingPoolCore, block) { + const reserves = await getV1Assets(lendingPoolCore, block); + const totalBorrowed = await sdk.api.abi.multiCall({ + block, + calls: reserves.map((reserve) => ({ + target: lendingPoolCore, + params: reserve, + })), + abi: abi.getReserveTotalBorrows, + }); + totalBorrowed.output.forEach(borrowed=>{ + const token = borrowed.input.params[0] + sdk.util.sumSingleBalance(balances, token === ethReplacement?eth:token, borrowed.output) + }) + + return balances; +} + +function multiMarketV1Tvl(balances, lendingPoolCore, block, borrowed) { + return (borrowed?multiMarketV1TvlBorrowed:depositMultiMarketV1Tvl)(balances, lendingPoolCore, block) +} + +async function depositMultiMarketV1Tvl(balances, lendingPoolCore, block) { + const reserves = (await getV1Assets(lendingPoolCore, block)).filter(reserve => reserve !== ethReplacement); + + sdk.util.sumSingleBalance(balances, eth, (await sdk.api.eth.getBalance({ target: lendingPoolCore, block })).output) + + const balanceOfResults = await sdk.api.abi.multiCall({ + block, + calls: reserves.map((reserve) => ({ + target: reserve, + params: lendingPoolCore, + })), + abi: "erc20:balanceOf", + }); + + sdk.util.sumMultiBalanceOf(balances, balanceOfResults, true); + + return balances; +} + +const uniswapLendingPoolCore = "0x1012cfF81A1582ddD0616517eFB97D02c5c17E25"; +const eth = "0x0000000000000000000000000000000000000000" + +async function uniswapV1Market(balances, block, borrowed){ + const uniswapMarketTvlBalances = {} + await multiMarketV1Tvl( + uniswapMarketTvlBalances, + uniswapLendingPoolCore, + block, + borrowed + ); + + const uniswapv1Calls = Object.keys(uniswapMarketTvlBalances).map(t => ({ target: t })); + const [uniswapV1Tokens, uniswapV1EthBalance, uniswapV1Supplies] = await Promise.all([ + sdk.api.abi.multiCall({ + abi: { "name": "tokenAddress", "outputs": [{ "type": "address", "name": "out" }], "inputs": [], "constant": true, "payable": false, "type": "function", "gas": 1413 }, + calls: uniswapv1Calls, + block + }), + sdk.api.eth.getBalances({ + targets: Object.keys(uniswapMarketTvlBalances), + block + }), + sdk.api.abi.multiCall({ + abi: 'erc20:totalSupply', + calls: uniswapv1Calls, + block + }), + ]) + + const uniswapV1TokenBalance = await sdk.api.abi.multiCall({ + abi: 'erc20:balanceOf', + calls: uniswapV1Tokens.output.map(t => ({ + target: t.output, + params: t.input.target + })), + block + }) + + // ...add v1 uniswap market TVL + Object.keys(uniswapMarketTvlBalances).forEach((address, idx) => { + const balance = uniswapMarketTvlBalances[address]; + if (uniswapV1Tokens.output[idx].success === false) { + sdk.util.sumSingleBalance(balances, address, balance) + } else { + const tokenBalance = BigNumber(uniswapV1TokenBalance.output[idx].output).times(balance).div(uniswapV1Supplies.output[idx].output) + const ethBalance = BigNumber(uniswapV1EthBalance.output[idx].balance).times(balance).div(uniswapV1Supplies.output[idx].output) + const token = uniswapV1Tokens.output[idx].output + sdk.util.sumSingleBalance(balances, token, tokenBalance.toFixed(0)) + sdk.util.sumSingleBalance(balances, eth, ethBalance.toFixed(0)) + } + }); + + return balances +} + +const aaveLendingPoolCore = "0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3"; + +async function singleAssetV1Market(balances, block, borrowed) { + return multiMarketV1Tvl(balances, aaveLendingPoolCore, block, borrowed); +} + +module.exports={ + singleAssetV1Market, + uniswapV1Market +} \ No newline at end of file From 9444f9fe5a7ad2464a1fac4e964042584eea3756 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 19:43:17 +0000 Subject: [PATCH 276/393] add borrowed to moola --- projects/aave/index.js | 8 +++-- projects/aave/v1.js | 38 ++++++++++++------------ projects/moola/index.js | 65 +++++++++++++---------------------------- 3 files changed, 45 insertions(+), 66 deletions(-) diff --git a/projects/aave/index.js b/projects/aave/index.js index f3993bf0ce..757578d874 100644 --- a/projects/aave/index.js +++ b/projects/aave/index.js @@ -7,12 +7,16 @@ const { ammMarket } = require('./amm'); const addressesProviderRegistryETH = "0x52D306e36E3B6B02c153d0266ff0f85d18BCD413"; +// v1 +const aaveLendingPoolCore = "0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3"; +const uniswapLendingPoolCore = "0x1012cfF81A1582ddD0616517eFB97D02c5c17E25"; + function ethereum(borrowed) { return async (timestamp, block)=> { const balances = {} - await singleAssetV1Market(balances, block, borrowed) - await uniswapV1Market(balances, block, borrowed) + await singleAssetV1Market(balances, aaveLendingPoolCore, block, borrowed) + await uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed) // V2 TVLs if (block >= 11360925) { diff --git a/projects/aave/v1.js b/projects/aave/v1.js index 4de74b1782..00979d92b9 100644 --- a/projects/aave/v1.js +++ b/projects/aave/v1.js @@ -2,12 +2,13 @@ const sdk = require('@defillama/sdk'); const BigNumber = require("bignumber.js"); const abi = require('../helper/abis/aave.json'); -async function getV1Assets(lendingPoolCore, block) { +async function getV1Assets(lendingPoolCore, block, chain) { const reserves = ( await sdk.api.abi.call({ target: lendingPoolCore, abi: abi["getReserves"], - block + block, + chain }) ).output; @@ -16,8 +17,8 @@ async function getV1Assets(lendingPoolCore, block) { const ethReplacement = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' -async function multiMarketV1TvlBorrowed(balances, lendingPoolCore, block) { - const reserves = await getV1Assets(lendingPoolCore, block); +async function multiMarketV1TvlBorrowed(balances, lendingPoolCore, block, chain, eth) { + const reserves = await getV1Assets(lendingPoolCore, block, chain); const totalBorrowed = await sdk.api.abi.multiCall({ block, calls: reserves.map((reserve) => ({ @@ -25,6 +26,7 @@ async function multiMarketV1TvlBorrowed(balances, lendingPoolCore, block) { params: reserve, })), abi: abi.getReserveTotalBorrows, + chain }); totalBorrowed.output.forEach(borrowed=>{ const token = borrowed.input.params[0] @@ -34,14 +36,10 @@ async function multiMarketV1TvlBorrowed(balances, lendingPoolCore, block) { return balances; } -function multiMarketV1Tvl(balances, lendingPoolCore, block, borrowed) { - return (borrowed?multiMarketV1TvlBorrowed:depositMultiMarketV1Tvl)(balances, lendingPoolCore, block) -} - -async function depositMultiMarketV1Tvl(balances, lendingPoolCore, block) { - const reserves = (await getV1Assets(lendingPoolCore, block)).filter(reserve => reserve !== ethReplacement); +async function depositMultiMarketV1Tvl(balances, lendingPoolCore, block, chain, eth) { + const reserves = (await getV1Assets(lendingPoolCore, block, chain)).filter(reserve => reserve !== ethReplacement); - sdk.util.sumSingleBalance(balances, eth, (await sdk.api.eth.getBalance({ target: lendingPoolCore, block })).output) + sdk.util.sumSingleBalance(balances, eth, (await sdk.api.eth.getBalance({ target: lendingPoolCore, block, chain })).output) const balanceOfResults = await sdk.api.abi.multiCall({ block, @@ -50,6 +48,7 @@ async function depositMultiMarketV1Tvl(balances, lendingPoolCore, block) { params: lendingPoolCore, })), abi: "erc20:balanceOf", + chain, }); sdk.util.sumMultiBalanceOf(balances, balanceOfResults, true); @@ -57,10 +56,15 @@ async function depositMultiMarketV1Tvl(balances, lendingPoolCore, block) { return balances; } -const uniswapLendingPoolCore = "0x1012cfF81A1582ddD0616517eFB97D02c5c17E25"; -const eth = "0x0000000000000000000000000000000000000000" +function multiMarketV1Tvl(balances, lendingPoolCore, block, borrowed, chain="ethereum", eth = "0x0000000000000000000000000000000000000000") { + return (borrowed?multiMarketV1TvlBorrowed:depositMultiMarketV1Tvl)(balances, lendingPoolCore, block, chain, eth) +} -async function uniswapV1Market(balances, block, borrowed){ +async function singleAssetV1Market(balances, lendingPoolCore, block, borrowed, chain, eth) { + return multiMarketV1Tvl(balances, lendingPoolCore, block, borrowed, chain, eth); +} + +async function uniswapV1Market(balances, uniswapLendingPoolCore, block, borrowed, eth = "0x0000000000000000000000000000000000000000"){ const uniswapMarketTvlBalances = {} await multiMarketV1Tvl( uniswapMarketTvlBalances, @@ -113,12 +117,6 @@ async function uniswapV1Market(balances, block, borrowed){ return balances } -const aaveLendingPoolCore = "0x3dfd23A6c5E8BbcFc9581d2E864a68feb6a076d3"; - -async function singleAssetV1Market(balances, block, borrowed) { - return multiMarketV1Tvl(balances, aaveLendingPoolCore, block, borrowed); -} - module.exports={ singleAssetV1Market, uniswapV1Market diff --git a/projects/moola/index.js b/projects/moola/index.js index 40b547f940..f12bae5fbd 100644 --- a/projects/moola/index.js +++ b/projects/moola/index.js @@ -1,55 +1,32 @@ -const {getBlock} = require('../helper/getBlock') -const {aaveChainTvl} = require('../helper/aave') +const { getBlock } = require('../helper/getBlock') +const { aaveChainTvl } = require('../helper/aave') +const { singleAssetV1Market } = require('../aave/v1') const sdk = require('@defillama/sdk') -const { any } = require('underscore') -const tokens = [ - ["0x765DE816845861e75A25fCA122bb6898B8B1282a", "celo-dollar"], - ["0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73", "celo-euro"] -] +const v1PoolCore = "0xAF106F8D4756490E7069027315F4886cc94A8F73" +const gasAsset = "0x471ece3750da237f93b8e339c536989b8978a438" -const tokenToName={ - "0x471EcE3750Da237f93B8E339c536989b8978a438": "celo", - "0x765DE816845861e75A25fCA122bb6898B8B1282a": "celo-dollar", - "0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73": "celo-euro", -} - -const holder = "0xAF106F8D4756490E7069027315F4886cc94A8F73" - -const toNumber = n=>Number(n)/1e18 +function lending(borrowed) { + return async (timestamp, ethBlock, chainBlocks) => { + const chain = 'celo' + const block = await getBlock(timestamp, chain, chainBlocks, true); + const v1Balances = {}; + await singleAssetV1Market(v1Balances, v1PoolCore, block, borrowed, chain, gasAsset); -async function tvl(timestamp, ethBlock, chainBlocks) { - const chain = 'celo' - const block = await getBlock(timestamp, chain, chainBlocks, true); - const balances = { - "celo": toNumber((await sdk.api.eth.getBalance({ - block, - chain, - target: holder - })).output) - } - for(token of tokens){ - var token - const bal = await sdk.api.erc20.balanceOf({ - block, - chain, - target: token[0], - owner: holder + const balances = await aaveChainTvl(chain, "0xF03982910d17d11670Dc3734DD73292cC4Ab7491", addr => `celo:${addr}`, ["0x43d067ed784D9DD2ffEda73775e2CC4c560103A1"], borrowed)(timestamp, ethBlock, { + ...chainBlocks, + celo: block }) - sdk.util.sumSingleBalance(balances, token[1], toNumber(bal.output)) + Object.entries(v1Balances).map(entry => sdk.util.sumSingleBalance(balances, "celo:" + entry[0], entry[1])) + return balances } - const bal2 = await aaveChainTvl(chain, "0xF03982910d17d11670Dc3734DD73292cC4Ab7491", addr=>addr, ["0x43d067ed784D9DD2ffEda73775e2CC4c560103A1"])(timestamp, ethBlock, { - ...chainBlocks, - celo: block - }) - Object.entries(bal2).map(entry=> sdk.util.sumSingleBalance(balances, tokenToName[entry[0]], toNumber(entry[1]))) - return balances } // v2 addresses on https://github.com/moolamarket/moola-v2/commit/ab273248af81aa743310b4fd48533462aefe39e9 -module.exports={ +module.exports = { methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", - celo:{ - tvl + celo: { + tvl: lending(false), + borrowed: lending(true), } -} +} \ No newline at end of file From 64c4b425a0df2ef53e0f23765ab829ce8b3cdc49 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 8 Dec 2021 20:00:54 +0000 Subject: [PATCH 277/393] reverted comments on gro oops --- projects/groprotocol/index.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/projects/groprotocol/index.js b/projects/groprotocol/index.js index 73fc2d3269..fed695cf84 100644 --- a/projects/groprotocol/index.js +++ b/projects/groprotocol/index.js @@ -185,13 +185,12 @@ async function avaxTvl(timestamp, block, chainBlocks) { return balances; } -// node test.js projects/groprotocol/index.js module.exports = { - // ethereum: { - // pool2, - // staking: staking(GROTokenStaker, GRO), - // tvl, - // }, + ethereum: { + pool2, + staking: staking(GROTokenStaker, GRO), + tvl, + }, avalanche: { tvl: avaxTvl, }, From 0640391d5e38f1d5a7acb0f6e6700435761eadc4 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 20:44:36 +0000 Subject: [PATCH 278/393] use on-chain for eth univ3 --- projects/uniswap/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index c509989d68..54e68cf1dc 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -1,6 +1,6 @@ const { getChainTvl } = require('../helper/getUniSubgraphTvl'); const sdk = require('@defillama/sdk') -const {optimism} = require('../uniswapv3/index') +const {optimism, ethereum:v3Ethereum} = require('../uniswapv3/index') const v1graph = getChainTvl({ ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap' @@ -12,7 +12,7 @@ const v2graph = getChainTvl({ }) const v3Graphs = getChainTvl({ - ethereum: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-subgraph", + ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3", optimism: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-optimism-dev", arbitrum: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-minimal', }, "factories", "totalValueLockedUSD") @@ -22,7 +22,7 @@ module.exports = { misrepresentedTokens: true, methodology: `Counts the tokens locked on AMM pools, pulling the data from the 'ianlapham/uniswapv2' subgraph`, ethereum:{ - tvl: sdk.util.sumChainTvls([v1graph("ethereum"), v2graph('ethereum'), v3Graphs('ethereum')]), + tvl: sdk.util.sumChainTvls([v1graph("ethereum"), v2graph('ethereum'), v3Ethereum.tvl]), }, arbitrum:{ tvl: v3Graphs('arbitrum') From 25548e85fe8b8c1546d3b62892d13d05cc535fc5 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 21:03:12 +0000 Subject: [PATCH 279/393] fix borrowed tvl on vires --- projects/vires/index.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/projects/vires/index.js b/projects/vires/index.js index de997c44bd..24c8f4ff18 100644 --- a/projects/vires/index.js +++ b/projects/vires/index.js @@ -1,17 +1,19 @@ -const {wavesAdapter} = require('../helper/wavesAdapter') +const { wavesAdapter } = require('../helper/wavesAdapter') const endpoint = "http://51.158.191.108:8002/api/v1/history/vires" -module.exports={ +module.exports = { methodology: `Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending`, - tvl: wavesAdapter(endpoint, item => { - let tvl = 0; - item.meta.forEach(market=> tvl += market.currentTotalDepositUsd - market.currentTotalDebtUsd) - return tvl - }), - borrowed: wavesAdapter(endpoint, item => { - let tvl = 0; - item.meta.forEach(market=> tvl += market.currentTotalDebtUsd) - return tvl - }), + waves: { + tvl: wavesAdapter(endpoint, item => { + let tvl = 0; + item.meta.forEach(market => tvl += market.currentTotalDepositUsd - market.currentTotalDebtUsd) + return tvl + }), + borrowed: wavesAdapter(endpoint, item => { + let tvl = 0; + item.meta.forEach(market => tvl += market.currentTotalDebtUsd) + return tvl + }), + } } From e887e9294ed96264c0841b306a9297f638419058 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 21:19:21 +0000 Subject: [PATCH 280/393] fix vires borrowed --- projects/vires/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/vires/index.js b/projects/vires/index.js index 24c8f4ff18..391c7c2010 100644 --- a/projects/vires/index.js +++ b/projects/vires/index.js @@ -12,7 +12,7 @@ module.exports = { }), borrowed: wavesAdapter(endpoint, item => { let tvl = 0; - item.meta.forEach(market => tvl += market.currentTotalDebtUsd) + item.meta.forEach(market => tvl += Number(market.currentTotalDebtUsd)) return tvl }), } From f58d7a2bb8747213d91b879041e02296b219f501 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 8 Dec 2021 21:34:02 +0000 Subject: [PATCH 281/393] arkadiko hardcoded DIKO to 1 --- projects/arkadiko.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/arkadiko.js diff --git a/projects/arkadiko.js b/projects/arkadiko.js new file mode 100644 index 0000000000..5f7a8c35b0 --- /dev/null +++ b/projects/arkadiko.js @@ -0,0 +1,42 @@ +const retry = require("./helper/retry"); +const axios = require("axios"); + +async function tvl() { + let balances = {}; + const dikoPrice = 1; + + const response = ( + await retry( + async (bail) => + await axios.get("https://arkadiko-api.herokuapp.com/api/v1/pools") + ) + ).data; + + for (pool of response.pools) { + balances[pool.token_y_name] = + pool.token_y_name in balances + ? Number(balances[pool.token_y_name]) + Number(pool.tvl_token_y) + : Number(pool.tvl_token_y); + balances[pool.token_x_name] = + pool.token_x_name in balances + ? Number(balances[pool.token_x_name]) + Number(pool.tvl_token_x) + : Number(pool.tvl_token_x); + } + + balances["blockstack"] = balances["wrapped-stx-token"] / 10 ** 6; + delete balances["wrapped-stx-token"]; + balances["usd-coin"] = balances["usda-token"] / 10 ** 6; + delete balances["usda-token"]; + balances["usd-coin"] = + Number(balances["usd-coin"]) + + Number(balances["arkadiko-token"] / 10 ** 6) * dikoPrice; + delete balances["arkadiko-token"]; + + return balances; +} + +module.exports = { + misrepresentedTokens: true, + tvl, +}; +// node test.js projects/arkadiko.js From 6d8bee7f24d33edf8c0ab81460fd142951370d2a Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 21:59:27 +0000 Subject: [PATCH 282/393] remove unused adapters --- projects/CRETH2abi.json | 364 ------------------ projects/aave.js | 26 -- projects/compound/index.js | 60 --- projects/{curve-old => curve}/abi.json | 0 .../index.js => curve/historical.js} | 0 projects/{curve.js => curve/index.js} | 0 projects/demex.js | 18 - projects/ellipsis.js | 31 -- projects/ellipsis/index.js | 145 ++----- projects/ellipsis/onchain.js | 129 +++++++ projects/incognito.js | 15 - projects/indexed.js | 92 ----- projects/moonpot-onchain/index.js | 5 - projects/scrtBridge/index.js | 21 - 14 files changed, 153 insertions(+), 753 deletions(-) delete mode 100644 projects/CRETH2abi.json delete mode 100644 projects/aave.js delete mode 100644 projects/compound/index.js rename projects/{curve-old => curve}/abi.json (100%) rename projects/{curve-old/index.js => curve/historical.js} (100%) rename projects/{curve.js => curve/index.js} (100%) delete mode 100644 projects/demex.js delete mode 100644 projects/ellipsis.js create mode 100644 projects/ellipsis/onchain.js delete mode 100644 projects/incognito.js delete mode 100644 projects/indexed.js delete mode 100644 projects/moonpot-onchain/index.js delete mode 100644 projects/scrtBridge/index.js diff --git a/projects/CRETH2abi.json b/projects/CRETH2abi.json deleted file mode 100644 index 90dad35034..0000000000 --- a/projects/CRETH2abi.json +++ /dev/null @@ -1,364 +0,0 @@ -[ - { - "inputs": [ - { "internalType": "address", "name": "_oracle", "type": "address" }, - { "internalType": "uint256", "name": "_cap", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ethAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "creth2Amount", - "type": "uint256" - } - ], - "name": "DepositEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "withdrawal_credentials", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "name": "StakeEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "ethAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "creth2Amount", - "type": "uint256" - } - ], - "name": "WithdrawEvent", - "type": "event" - }, - { - "inputs": [], - "name": "VALIDATOR_AMOUNT", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "accumulated", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "admin", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "breaker", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "cap", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deposit", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "eth2DepositContract", - "outputs": [ - { - "internalType": "contract IDepositContract", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "_cap", "type": "uint256" } - ], - "name": "increaseCap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "oracle", - "outputs": [ - { "internalType": "contract IOracle", "name": "", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_admin", "type": "address" } - ], - "name": "setAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "bool", "name": "_breaker", "type": "bool" }], - "name": "setBreaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_oracle", "type": "address" } - ], - "name": "setOracle", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "bytes[]", "name": "pubkeys", "type": "bytes[]" }, - { - "internalType": "bytes[]", - "name": "withdrawal_credentials", - "type": "bytes[]" - }, - { "internalType": "bytes[]", "name": "signatures", "type": "bytes[]" }, - { - "internalType": "bytes32[]", - "name": "deposit_data_roots", - "type": "bytes32[]" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "creth2Amount", "type": "uint256" } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/projects/aave.js b/projects/aave.js deleted file mode 100644 index 73602da108..0000000000 --- a/projects/aave.js +++ /dev/null @@ -1,26 +0,0 @@ -const utils = require('./helper/utils'); - -async function fetch() { - var totalTvl = await utils.fetchURL('https://aave-api-v2.aave.com/data/tvl') - return totalTvl.data.totalTvl.tvlInUsd; -} - -async function eth() { - var totalTvl = await utils.fetchURL('https://aave-api-v2.aave.com/data/tvl') - return totalTvl.data.totalTvl.tvlInUsd - totalTvl.data.marketTvls.matic.tvlInUsd; -} - -async function polygon() { - var totalTvl = await utils.fetchURL('https://aave-api-v2.aave.com/data/tvl') - return totalTvl.data.marketTvls.matic.tvlInUsd; -} - -module.exports = { - ethereum: { - fetch: eth - }, - polygon: { - fetch: polygon - }, - fetch -} diff --git a/projects/compound/index.js b/projects/compound/index.js deleted file mode 100644 index b2c9b5be8a..0000000000 --- a/projects/compound/index.js +++ /dev/null @@ -1,60 +0,0 @@ -const { GraphQLClient, gql } = require('graphql-request') -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js') -const endpoint ='https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2'; -const {lendingMarket} = require('../helper/methodologies') - -async function tvl(timestamp, block) { - const graphQLClient = new GraphQLClient(endpoint) - - var query = gql` - query get_tvl($block: Int) { - markets( - first: 100, - block: { number: $block } - ) { - borrowRate - cash - collateralFactor - exchangeRate - interestRateModelAddress - name - reserves - supplyRate - symbol - id - totalBorrows - totalSupply - underlyingAddress - underlyingName - underlyingPrice - underlyingSymbol - reserveFactor - underlyingPriceUSD - } - } - `; - const results = await graphQLClient.request(query, { - block - }) - const balances = {} - const decimals = (await sdk.api.abi.multiCall({ - block, - abi: 'erc20:decimals', - calls: results.markets.map(item=>({ - target: item.underlyingAddress - })) - })).output - results.markets.map(async (item, index) => { - sdk.util.sumSingleBalance(balances, item.underlyingAddress, BigNumber(item.cash).times(10**Number(decimals[index].output || 18)).toFixed(0)) - }) - return balances; -} - -module.exports = { - ethereum:{ - tvl, - }, - methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from the 'graphprotocol/compound-v2' subgraph and calling the balanceOf() on-chain method to get the amount of tokens locked in each of these addresses, then we get the price of each token from coingecko.`, - tvl -} diff --git a/projects/curve-old/abi.json b/projects/curve/abi.json similarity index 100% rename from projects/curve-old/abi.json rename to projects/curve/abi.json diff --git a/projects/curve-old/index.js b/projects/curve/historical.js similarity index 100% rename from projects/curve-old/index.js rename to projects/curve/historical.js diff --git a/projects/curve.js b/projects/curve/index.js similarity index 100% rename from projects/curve.js rename to projects/curve/index.js diff --git a/projects/demex.js b/projects/demex.js deleted file mode 100644 index 3f3cc34a6d..0000000000 --- a/projects/demex.js +++ /dev/null @@ -1,18 +0,0 @@ -const retry = require('./helper/retry') -const axios = require("axios") - -async function fetch() { - let tvl = '1' - // - // const response = await retry(async bail => await axios.get('https://tradescan.switcheo.org/liquidityPoolYields')) - // const { data } = response - // - // for (var key of Object.keys(data)) { - // tvl += parseFloat(data[key].liquidityValueUSD) - // } - return tvl -} - -module.exports = { - fetch -} diff --git a/projects/ellipsis.js b/projects/ellipsis.js deleted file mode 100644 index b5c7be900c..0000000000 --- a/projects/ellipsis.js +++ /dev/null @@ -1,31 +0,0 @@ -const utils = require('./helper/utils'); -const {toUSDTBalances} = require('./helper/balances'); -const sdk = require('@defillama/sdk') - -async function tvl() { - var totalTvl = await utils.fetchURL('https://api.ellipsis.finance/api/getTVL') - return toUSDTBalances(totalTvl.data.data.total); -} - -const lockedSupply = {"inputs":[],"name":"lockedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} -const stakingContract = "0x4076cc26efee47825917d0fec3a79d0bb9a6bb5c" -const eps = "0xa7f552078dcc247c2684336020c03648500c6d9f" -async function staking(time, ethBlock, chainBlocks){ - const locked = await sdk.api.abi.call({ - target: stakingContract, - block: chainBlocks.bsc, - chain: 'bsc', - abi: lockedSupply - }) - return { - ["bsc:"+eps]: locked.output - } -} - -module.exports = { - misrepresentedTokens: true, - bsc:{ - tvl, - staking - } -} diff --git a/projects/ellipsis/index.js b/projects/ellipsis/index.js index 96d2583617..1465ac6d5b 100644 --- a/projects/ellipsis/index.js +++ b/projects/ellipsis/index.js @@ -1,129 +1,32 @@ -const sdk = require("@defillama/sdk"); -const axios = require('axios'); -const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); -const abi = require('./abi.json'); +const utils = require('./helper/utils'); +const {toUSDTBalances} = require('./helper/balances'); +const sdk = require('@defillama/sdk') - -function getBSCAddress(address) { - return `bsc:${address}` -} - -// list of missing tokens -const replaceable = { - "0x049d68029688eAbF473097a2fC38ef61633A3C7A": "0xdac17f958d2ee523a2206206994597c13d831ec7", //fUSDT -> USDT - '0xeD28A457A5A76596ac48d87C0f577020F6Ea1c4C': '0x5228a22e72ccc52d415ecfd199f99d0665e7733b', //pBTC -> pBTC on ETH - '0x54261774905f3e6E9718f2ABb10ed6555cae308a': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', //anyBTC -> WBTC - '0x03ab98f5dc94996f8c33e15cd4468794d12d41f9': '0x674c6ad92fd080e4004b2312b45f796a192d27a0', //USDN -> USDN on ETH -}; - -const endpoint = 'https://api.ellipsis.finance/api/getPools' - -const epsPool = '0x4076CC26EFeE47825917D0feC3A79d0bB9a6bB5c'; -const epsContract = '0xa7f552078dcc247c2684336020c03648500c6d9f'; -const epsBnbLP = '0xf9045866e7b372def1eff3712ce55fac1a98daf0'; - - -async function tvl(timestamp, block, chainBlocks) { - - let balances = {}; - - let allPools = (await axios.get(endpoint)).data.data - const basePools = allPools.basePools - const metaPools = allPools.metaPools - - await Promise.all(basePools.map(async (element) => { - - await Promise.all(element.tokens.map(async (token) => { - const balance = await sdk.api.abi.call({ - abi: abi.balancesBasePool, - target: element.address, - params: token.index, - block: chainBlocks['bsc'], - chain: 'bsc' - }); - balances[getBSCAddress(token.erc20address)] = balance.output - })); - })); - - await Promise.all(metaPools.map(async (element) => { - - const balance = await sdk.api.abi.call({ - abi: abi.balancesMetaPool, - target: element.address, - params: 0, - block: chainBlocks['bsc'], - chain: 'bsc' - }); - if (Object.keys(replaceable).includes(element.token.address)) { - sdk.util.sumSingleBalance(balances, replaceable[element.token.address], balance.output) - } else { - balances[getBSCAddress(element.token.address)] = balance.output - } - })); - return balances; +async function tvl() { + var totalTvl = await utils.fetchURL('https://api.ellipsis.finance/api/getTVL') + return toUSDTBalances(totalTvl.data.data.total); } - -async function pool2(timestamp, block, chainBlocks) { - let balances = {} - - //Staked and locked EPS - const staked = await sdk.api.abi.call({ - abi: abi.totalSupply, - target: epsPool, - block: chainBlocks['bsc'], - chain: 'bsc' - }); +const lockedSupply = {"inputs":[],"name":"lockedSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"} +const stakingContract = "0x4076cc26efee47825917d0fec3a79d0bb9a6bb5c" +const eps = "0xa7f552078dcc247c2684336020c03648500c6d9f" +async function staking(time, ethBlock, chainBlocks){ const locked = await sdk.api.abi.call({ - abi: abi.lockedSupply, - target: epsPool, - block: chainBlocks['bsc'], - chain: 'bsc' - }); - const epsStakedTotal = parseInt(staked.output) + parseInt(locked.output); - - balances[getBSCAddress(epsContract)] = + epsStakedTotal; - return balances -} - -async function staking(timestamp, block, chainBlocks) { - let balances = {} - - //EPS/BNB LP - const transformAdress = addr=>'bsc:'+addr; - - const lpBalance = await sdk.api.abi.call({ - abi: abi.totalSupplyLP, - target: epsBnbLP, - block: chainBlocks['bsc'], - chain: 'bsc' - }); - - await unwrapUniswapLPs( - balances, - [{ - token: epsBnbLP, - balance: parseInt(lpBalance.output), - }], - chainBlocks['bsc'], - 'bsc', - transformAdress - ); - - return balances + target: stakingContract, + block: chainBlocks.bsc, + chain: 'bsc', + abi: lockedSupply + }) + return { + ["bsc:"+eps]: locked.output + } } - module.exports = { - methodology: "pool2 is where eps is and eps/bnb staked. ffUSDT and anyBTC has been replaced with USDT and WBTC in the TVL calculation respectively", - bsc: { - tvl - }, - tvl, - pool2: { - tvl: pool2 - }, - staking: { - tvl: staking + timetravel: false, + misrepresentedTokens: true, + bsc:{ + tvl, + staking } -}; +} diff --git a/projects/ellipsis/onchain.js b/projects/ellipsis/onchain.js new file mode 100644 index 0000000000..96d2583617 --- /dev/null +++ b/projects/ellipsis/onchain.js @@ -0,0 +1,129 @@ +const sdk = require("@defillama/sdk"); +const axios = require('axios'); +const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); +const abi = require('./abi.json'); + + +function getBSCAddress(address) { + return `bsc:${address}` +} + +// list of missing tokens +const replaceable = { + "0x049d68029688eAbF473097a2fC38ef61633A3C7A": "0xdac17f958d2ee523a2206206994597c13d831ec7", //fUSDT -> USDT + '0xeD28A457A5A76596ac48d87C0f577020F6Ea1c4C': '0x5228a22e72ccc52d415ecfd199f99d0665e7733b', //pBTC -> pBTC on ETH + '0x54261774905f3e6E9718f2ABb10ed6555cae308a': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', //anyBTC -> WBTC + '0x03ab98f5dc94996f8c33e15cd4468794d12d41f9': '0x674c6ad92fd080e4004b2312b45f796a192d27a0', //USDN -> USDN on ETH +}; + +const endpoint = 'https://api.ellipsis.finance/api/getPools' + +const epsPool = '0x4076CC26EFeE47825917D0feC3A79d0bB9a6bB5c'; +const epsContract = '0xa7f552078dcc247c2684336020c03648500c6d9f'; +const epsBnbLP = '0xf9045866e7b372def1eff3712ce55fac1a98daf0'; + + +async function tvl(timestamp, block, chainBlocks) { + + let balances = {}; + + let allPools = (await axios.get(endpoint)).data.data + const basePools = allPools.basePools + const metaPools = allPools.metaPools + + await Promise.all(basePools.map(async (element) => { + + await Promise.all(element.tokens.map(async (token) => { + const balance = await sdk.api.abi.call({ + abi: abi.balancesBasePool, + target: element.address, + params: token.index, + block: chainBlocks['bsc'], + chain: 'bsc' + }); + balances[getBSCAddress(token.erc20address)] = balance.output + })); + })); + + await Promise.all(metaPools.map(async (element) => { + + const balance = await sdk.api.abi.call({ + abi: abi.balancesMetaPool, + target: element.address, + params: 0, + block: chainBlocks['bsc'], + chain: 'bsc' + }); + if (Object.keys(replaceable).includes(element.token.address)) { + sdk.util.sumSingleBalance(balances, replaceable[element.token.address], balance.output) + } else { + balances[getBSCAddress(element.token.address)] = balance.output + } + })); + return balances; +} + + +async function pool2(timestamp, block, chainBlocks) { + let balances = {} + + //Staked and locked EPS + const staked = await sdk.api.abi.call({ + abi: abi.totalSupply, + target: epsPool, + block: chainBlocks['bsc'], + chain: 'bsc' + }); + const locked = await sdk.api.abi.call({ + abi: abi.lockedSupply, + target: epsPool, + block: chainBlocks['bsc'], + chain: 'bsc' + }); + const epsStakedTotal = parseInt(staked.output) + parseInt(locked.output); + + balances[getBSCAddress(epsContract)] = + epsStakedTotal; + return balances +} + +async function staking(timestamp, block, chainBlocks) { + let balances = {} + + //EPS/BNB LP + const transformAdress = addr=>'bsc:'+addr; + + const lpBalance = await sdk.api.abi.call({ + abi: abi.totalSupplyLP, + target: epsBnbLP, + block: chainBlocks['bsc'], + chain: 'bsc' + }); + + await unwrapUniswapLPs( + balances, + [{ + token: epsBnbLP, + balance: parseInt(lpBalance.output), + }], + chainBlocks['bsc'], + 'bsc', + transformAdress + ); + + return balances +} + + +module.exports = { + methodology: "pool2 is where eps is and eps/bnb staked. ffUSDT and anyBTC has been replaced with USDT and WBTC in the TVL calculation respectively", + bsc: { + tvl + }, + tvl, + pool2: { + tvl: pool2 + }, + staking: { + tvl: staking + } +}; diff --git a/projects/incognito.js b/projects/incognito.js deleted file mode 100644 index e9bcf8adf6..0000000000 --- a/projects/incognito.js +++ /dev/null @@ -1,15 +0,0 @@ -const retry = require('./helper/retry') -const axios = require("axios"); -const BigNumber = require("bignumber.js"); - -async function fetch() { - // let shielded_coins = await retry(async bail => await axios.get('https://api.incscan.io/shielded-coins/overview')) - // let tvl = new BigNumber(shielded_coins.data.currentAmount).toFixed(2); - let tvl = '1' - return tvl; -} - - -module.exports = { - fetch -} diff --git a/projects/indexed.js b/projects/indexed.js deleted file mode 100644 index 5da28d314e..0000000000 --- a/projects/indexed.js +++ /dev/null @@ -1,92 +0,0 @@ -const utils = require('./helper/utils'); -const web3 = require('./config/web3.js'); - -const retry = require('./helper/retry') -const axios = require("axios"); - -const BigNumber = require('bignumber.js'); -const abis = require('./config/indexed/abis.js'); - - -let keys = [ - { - - '0x514910771af9ca656af840dff83e8264ecf986ca': 'chainlink', - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599': 'bitcoin', - '0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9': 'aave', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48': 'stable', - '0x0000000000085d4780B73119b644AE5ecd22b376': 'stable', - '0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e': 'yearn-finance', //yfi - '0x408e41876cccdc0f92210600ef50372656052a38': 'republic-protocol', //ren - '0x80fB784B7eD66730e8b1DBd9820aFD29931aab03': 'ethlend', //lend - '0x4fabb145d64652a948d72533023f6e7a623c7c53': 'stable', //busd - '0xdac17f958d2ee523a2206206994597c13d831ec7': 'stable', //USDT - '0x6b175474e89094c44da98b954eedeac495271d0f': 'stable', //DAI - '0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2': 'maker', //makerdao - '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f': 'havven', //SNX - '0x0f5d2fb29fb7d3cfee444a200298f468908cc942': 'decentraland', //MANA - '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984': 'uniswap', //uni - '0xdd974d5c2e2928dea5f71b9825b8b646686bd200': 'kyber-network', //knc - '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c': 'enjincoin', //ENJ - '0x0d8775f648430679a709e98d2b0cb6250d2887ef': 'basic-attention-token', //BAT - '0x57ab1ec28d129707052df4df418d58a2d46d5f51': 'stable', //susd - '0xe41d2489571d322189246dafa5ebde1f4699f498': '0x', //0x - '0xd533a949740bb3306d119cc777fa900ba034cd52': 'curve-dao-token', - '0xc00e94cb662c3520282e6f5717214004a7f26888': 'compound-governance-token', - '0x04fa0d235c4abf4bcf4787af4cf447de572ef828': 'uma', - '0xd26114cd6ee289accf82350c8d8487fedb8a0c07': 'omisego', - - } -] - -async function fetch() { - let tvlPool1 = 0; - let tvlPool2 = 0; - - let pool = '0xfa6de2697d59e88ed7fc4dfe5a33dac43565ea41'; - let pool2 = '0x17ac188e09a7890a1844e5e65471fe8b0ccfadf3'; - let contract = new web3.eth.Contract(abis.abis.main, pool); - - let price_feed = await utils.getPricesfromString('compound-governance-token,curve-dao-token,havven,maker,yearn-finance,aave,uniswap,chainlink,omisego,uma,0x,chainlink'); - - let tokens = await contract.methods.getCurrentTokens().call(); - - await Promise.all( - tokens.map(async (token) => { - let balance = await utils.returnBalance(token, pool); - if (keys[0][token.toLowerCase()]) { - tvlPool1 += parseFloat(balance) * price_feed.data[keys[0][token.toLowerCase()]].usd - } else { - console.log('Indexed Could not find token', token) - } - }) - ) - - let contract2 = new web3.eth.Contract(abis.abis.main, pool2); - let tokens2 = await contract2.methods.getCurrentTokens().call(); - await Promise.all( - tokens2.map(async (token) => { - let balance = await utils.returnBalance(token, pool2); - if (keys[0][token.toLowerCase()]) { - tvlPool2 += parseFloat(balance) * price_feed.data[keys[0][token.toLowerCase()]].usd - } else { - console.log('Indexed Could not find token', token) - } - }) - ) - - - let tvl = tvlPool1 + tvlPool2 - // - // let pool - // let tvl = 0; - // let price_feed = await utils.getPricesfromString('ethereum,bitcoin'); - // let tokenBalance = await utils.returnBalance('0xdac17f958d2ee523a2206206994597c13d831ec7', pool); - - return tvl; - -} - -module.exports = { - fetch -} diff --git a/projects/moonpot-onchain/index.js b/projects/moonpot-onchain/index.js deleted file mode 100644 index fbe01e0642..0000000000 --- a/projects/moonpot-onchain/index.js +++ /dev/null @@ -1,5 +0,0 @@ - - -const pots = [ - "0x679136C668a0478c4465Fc0744d050779E011269", "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82" -] \ No newline at end of file diff --git a/projects/scrtBridge/index.js b/projects/scrtBridge/index.js deleted file mode 100644 index 7b0523b841..0000000000 --- a/projects/scrtBridge/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const sdk = require("@defillama/sdk"); - -const wSCRT = '0x2b89bf8ba858cd2fcee1fada378d5cd6936968be' - -async function tvl(timestamp, block) { - const wscrtSupply = await sdk.api.erc20.totalSupply({ - target: wSCRT, - block - }) - return { - [wSCRT]: wscrtSupply.output - } -} - -module.exports = { - name: 'Secret Network Bridge', - token: 'WSCRT', - category: 'Assets', - start: 0, // WRONG! - tvl -} \ No newline at end of file From db30f2dde33ec559924425b8b818b3067ec2ea7a Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 22:00:33 +0000 Subject: [PATCH 283/393] timetravel tag --- projects/curve/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/curve/index.js b/projects/curve/index.js index 40208250a7..1035708db7 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -44,6 +44,7 @@ async function fetch() { module.exports = { + timetravel: false, misrepresentedTokens: true, fantom:{ fetch: fantom From 3d90d1c20556f3465604eee2653efbb15d5d6391 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Wed, 8 Dec 2021 22:03:46 +0000 Subject: [PATCH 284/393] add methodology --- projects/kokoswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/kokoswap/index.js b/projects/kokoswap/index.js index ef762198cc..25cb9aeed6 100644 --- a/projects/kokoswap/index.js +++ b/projects/kokoswap/index.js @@ -12,6 +12,7 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { }; module.exports = { + methodology: "TVL could the liquidity on the DEX, pairs are found using the Factory address: '0x971A5f6Ef792bA565cdF61C904982419AA77989f'.", bsc: { tvl: bscTvl, }, From 629e1f97aade56635bfe427cfed6d5421106197d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Wed, 8 Dec 2021 22:08:08 +0000 Subject: [PATCH 285/393] remove yvs --- projects/yvs/abi.json | 28 --------- projects/yvs/index.js | 141 ------------------------------------------ 2 files changed, 169 deletions(-) delete mode 100644 projects/yvs/abi.json delete mode 100644 projects/yvs/index.js diff --git a/projects/yvs/abi.json b/projects/yvs/abi.json deleted file mode 100644 index f4f1d023b7..0000000000 --- a/projects/yvs/abi.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/yvs/index.js b/projects/yvs/index.js deleted file mode 100644 index 9977d7a664..0000000000 --- a/projects/yvs/index.js +++ /dev/null @@ -1,141 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { staking } = require("../helper/staking"); -const { pool2, pool2s } = require("../helper/pool2"); - -/*** Ethereum Addresses ***/ -// Pools Part -const poolStakingContract = "0x5a055f79981C8338230E5199BA7e477cFE35D14f"; -const YVS = "0xec681f28f4561c2a9534799aa38e0d36a83cf478"; - -const poolLiquidityContract = "0x613f654C7BBB948219f3952173518DEBCD963718"; -const YVS_WETH_UNIV2 = "0x182885Fa47B63C02D06A8D65db3Bf3871BE9F998"; - -// Vaults Part -const vaultContracts = [ - "0x981cc277841f06401B750a3c7dd42492ff962B9C", - "0x0B1b5C66B519BF7B586FFf0A7bacE89227aC5EAF" -]; - -/*** BSC Addresses ***/ -// Pools Part -const poolStakingContractBSC = "0xf44672da873f662AB8e1Fc904f8d053DAd9353DF"; -const YVS_BSC = "0x47c1c7b9d7941a7265d123dcfb100d8fb5348213"; -const poolLiquidityContractBSC = [ - //BUSD-YVS SLP closed - "0xfbdf2bEdE50948754295F33FA4704Fd69E6d4C43", - //BUSD-YVS PanCake Closed - "0xBcbd2a48B6279C2a2d4609282aA80d8e856bFeBB", - //WBNB-YVS PanCake Closed - "0x7f644abFb4dD8d39c781411Bc3e7D70479E3a546", - //WBNB-YVS PanCake V2 - "0x08559533a0671Ae685048C3B28980226Fb185209", - //WBNB-YVS SLP - "0x371CCe38B26f6a06Dd61Fabd50bA9D74eA2D58cC", - //WBNB-YVS SLP - "0x2f002F05bd3609E1151360476d5142bCdb11307B", - //vaultWBNB_YVS - "0x2d94d8b9301cDe1fDeCdF8B30EBdDD81e2E632bb" -]; -const lpPoolsBSC = [ - //BUSD_YVS_SLP - "0xeDaF3C776AbAef600a63585232855800b354578a", - //BUSD_YVS_CakeLP - "0x99338d3cc1300ddfA6D0621d27e8387eAE2aE858", - //WBNB-YVS_CakeLP - "0xA12C87881fECCC2CA1F8e1E7ECbDa8Af3A89Ab3c", - //WBNB-YVS_CakeLPV2 - "0x226E28020fD59F1bE367cF4b20e76856e6d2D1DF", - //WBNB-YVS_SLP - "0x5E12A25A09b74313F0679D96aACB12886d2e02e4", - //WBNB-YVS_SLP - "0x5E12A25A09b74313F0679D96aACB12886d2e02e4", - //lpVaultWBNB_YVS_SLP - "0x5E12A25A09b74313F0679D96aACB12886d2e02e4" -]; - -// Vaults Part -const vaultContractsBSC = [ - //yvsBUSD - "0x3eB8BC3017ba663332CE9f8BdD89D9503EA978B0", - //yvsWBNB - "0x561819d509F94EBb08e75299A41Dc356af403F7B", - //yvs4Belt - "0x92d3f515AFAA05c8297Dd243Bae50b934A827f74", - //yvsbeltBNB - "0xA6B093259F39C8f9B55Ee2206a6b470Cf9D78C3B" -]; - -/*** Polygon Addresses ***/ -//Pools Part -const poolStakingContractPolygon = "0x21E2822d912343251554812785f7AE9b9c52F420"; -const YVS_polygon = "0xb565cf70613ca464d68427106af80c67a8e4b801"; -const poolLiquidityContractPolygon = "0x5b19B98d9A9357fa9E05E6b0b1eCdFC84eF10529" -const YVS_WETH_UNIV2Polygon = "0x6951eb8E9bd734290590C8e7770aEBFf19e4F043"; - -async function calcTvl(balances, underlying, balance, vaultContracts, chain = "ethereum") { - let chainBlocks = {}; - - const vaultUnderlying = ( - await sdk.api.abi.multiCall({ - abi: underlying, - calls: vaultContracts.map(vault => ({ - target: vault, - })), - chain: chain, - block: chainBlocks[chain], - }) - ).output.map(under => under.output); - - const vaultBalances = ( - await sdk.api.abi.multiCall({ - abi: balance, - calls: vaultContracts.map(vault => ({ - target: vault, - })), - chain: chain, - block: chainBlocks[chain], - }) - ).output.map(bal => bal.output); - - vaultUnderlying.forEach((Underlying, idx) => { - sdk.util.sumSingleBalance(balances, `${chain}:${Underlying}`, vaultBalances[idx]); - }); - - return balances; -} - -async function ethTvl() { - const balances = {}; - - await calcTvl(balances, abi.underlying, abi.balance, vaultContracts); - - return balances; -} - -async function bscTvl() { - const balances = {}; - - await calcTvl(balances, abi.underlying, abi.balance, vaultContractsBSC, "bsc"); - - return balances; -} - -module.exports = { - ethereum: { - staking: staking(poolStakingContract, YVS), - pool2: pool2(poolLiquidityContract, YVS_WETH_UNIV2), - tvl: ethTvl, - }, - bsc: { - staking: staking(poolStakingContractBSC, YVS_BSC, "bsc"), - pool2: pool2s(poolLiquidityContractBSC, lpPoolsBSC, "bsc"), - tvl: bscTvl, - }, - polygon: { - staking: staking(poolStakingContractPolygon, YVS_polygon, "polygon"), - pool2: pool2(poolLiquidityContractPolygon, YVS_WETH_UNIV2Polygon, "polygon"), - }, - methodology: - "Counts tvl of all Pools and Vaults through their Contracts, also there are pool2 and staking parts", -}; From 9201026ff33e165ca05462a5914405ce3f1ef097 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 22:08:00 +0000 Subject: [PATCH 286/393] aggregate uniswap code --- projects/uniswap/index.js | 2 +- projects/uniswap/v3.js | 70 ------------------- projects/{uniswapv3 => uniswap/v3}/index.js | 6 +- .../v3}/oldUniPools.json | 0 4 files changed, 4 insertions(+), 74 deletions(-) delete mode 100644 projects/uniswap/v3.js rename projects/{uniswapv3 => uniswap/v3}/index.js (95%) rename projects/{uniswapv3 => uniswap/v3}/oldUniPools.json (100%) diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 54e68cf1dc..155ca04637 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -1,6 +1,6 @@ const { getChainTvl } = require('../helper/getUniSubgraphTvl'); const sdk = require('@defillama/sdk') -const {optimism, ethereum:v3Ethereum} = require('../uniswapv3/index') +const {optimism, ethereum:v3Ethereum} = require('./v3/index') const v1graph = getChainTvl({ ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap' diff --git a/projects/uniswap/v3.js b/projects/uniswap/v3.js deleted file mode 100644 index 3ea03e52e9..0000000000 --- a/projects/uniswap/v3.js +++ /dev/null @@ -1,70 +0,0 @@ -const sdk = require('@defillama/sdk') - -const START_BLOCK = 12369621 -const FACTORY = '0x1F98431c8aD98523631AE4a59f267346ea31F984' - -module.exports = async function tvl(_, block) { - const logs = ( - await sdk.api.util.getLogs({ - keys: [], - toBlock: block, - target: FACTORY, - fromBlock: START_BLOCK, - topic: 'PoolCreated(address,address,uint24,int24,address)', - }) - ).output - - const pairAddresses = [] - const token0Addresses = [] - const token1Addresses = [] - for (let log of logs) { - token0Addresses.push(`0x${log.topics[1].substr(-40)}`.toLowerCase()) - token1Addresses.push(`0x${log.topics[2].substr(-40)}`.toLowerCase()) - pairAddresses.push(`0x${log.data.substr(-40)}`.toLowerCase()) - } - - const pairs = {} - // add token0Addresses - token0Addresses.forEach((token0Address, i) => { - const pairAddress = pairAddresses[i] - pairs[pairAddress] = { - token0Address: token0Address, - } - }) - - // add token1Addresses - token1Addresses.forEach((token1Address, i) => { - const pairAddress = pairAddresses[i] - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: token1Address, - } - }) - - let balanceCalls = [] - - for (let pair of Object.keys(pairs)) { - balanceCalls.push({ - target: pairs[pair].token0Address, - params: pair, - }) - balanceCalls.push({ - target: pairs[pair].token1Address, - params: pair, - }) - } - - const tokenBalances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: balanceCalls, - block, - }) - ) - - let balances = {}; - - sdk.util.sumMultiBalanceOf(balances, tokenBalances) - - return balances; -} diff --git a/projects/uniswapv3/index.js b/projects/uniswap/v3/index.js similarity index 95% rename from projects/uniswapv3/index.js rename to projects/uniswap/v3/index.js index 56346f1a26..fbe2e6844b 100644 --- a/projects/uniswapv3/index.js +++ b/projects/uniswap/v3/index.js @@ -1,6 +1,6 @@ -const { getChainTvl } = require('../helper/getUniSubgraphTvl'); +const { getChainTvl } = require('../../helper/getUniSubgraphTvl'); const sdk = require('@defillama/sdk') -const {transformOptimismAddress, transformArbitrumAddress} = require('../helper/portedTokens') +const {transformOptimismAddress, transformArbitrumAddress} = require('../../helper/portedTokens') const oldOptPools = require('./oldUniPools.json') const graphUrls = { @@ -9,7 +9,7 @@ const graphUrls = { arbitrum: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-dev', } -const { getBlock } = require('../helper/getBlock'); +const { getBlock } = require('../../helper/getBlock'); const FACTORY = '0x1F98431c8aD98523631AE4a59f267346ea31F984'; // same on all chains const startBlocks = { diff --git a/projects/uniswapv3/oldUniPools.json b/projects/uniswap/v3/oldUniPools.json similarity index 100% rename from projects/uniswapv3/oldUniPools.json rename to projects/uniswap/v3/oldUniPools.json From 151d018bb0dfb0dce281bd19f39bd0dddd6f021e Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Wed, 8 Dec 2021 22:16:56 +0000 Subject: [PATCH 287/393] remove helios and polycrystal --- projects/helios/index.js | 17 ---- projects/polycrystal/abi.json | 67 --------------- projects/polycrystal/index.js | 151 ---------------------------------- 3 files changed, 235 deletions(-) delete mode 100644 projects/helios/index.js delete mode 100644 projects/polycrystal/abi.json delete mode 100644 projects/polycrystal/index.js diff --git a/projects/helios/index.js b/projects/helios/index.js deleted file mode 100644 index 62dd1bfa5f..0000000000 --- a/projects/helios/index.js +++ /dev/null @@ -1,17 +0,0 @@ -const sdk = require('@defillama/sdk') - -const index = '0x7633Da43dFd4Ee5A5da99740F077ca9d97aA0d0e' - -async function tvl(_time, block){ - const supply = await sdk.api.erc20.totalSupply({ - target: index, - block - }) - return { - [index]: supply.output - } -} - -module.exports={ - tvl -} \ No newline at end of file diff --git a/projects/polycrystal/abi.json b/projects/polycrystal/abi.json deleted file mode 100644 index 5782d913bc..0000000000 --- a/projects/polycrystal/abi.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accCrystalPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "balanceOf": { - "inputs": [], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/polycrystal/index.js b/projects/polycrystal/index.js deleted file mode 100644 index 887a1c090d..0000000000 --- a/projects/polycrystal/index.js +++ /dev/null @@ -1,151 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const erc20 = require("../helper/abis/erc20.json"); - -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { transformPolygonAddress } = require("../helper/portedTokens"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const MasterHealer = "0xeBCC84D2A73f0c9E23066089C6C24F4629Ef1e6d"; - -const CrystalMine = "0x5BaDd6C71fFD0Da6E4C7D425797f130684D057dd"; -const CRYSTAL = "0x76bf0c28e604cc3fe9967c83b3c3f31c213cfe64"; - -const treasuryAddress = "0x5386881b46C37CdD30A748f7771CF95D7B213637"; -const erc20Tokens = [ - //WMATIC - "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", - //SNX - "0x50b728d8d964fd00c2d0aad81718b71311fef68a", - //DAI - "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", - //CRV - "0x172370d5cd63279efa6d502dab29171933a610af", - //USDC - "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", - //USDT - "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", - //AAVE - "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", - //LINK - "0xd6df932a45c0f255f85145f286ea0b292b21c90b", - //MANA - "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39", - //WETH - "0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4", - //FISH - "0x3a3df212b7aa91aa0402b9035b098891d276572b", - //ROLL - "0xc68e83a305b0fad69e264a1769a0a070f190d2d6", - //TITAN - "0xaaa5b9e6c589642f98a1cda99b9d024b8407285a", -]; - -/*** Treasury ***/ -const Treasury = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const transformAddress = await transformPolygonAddress(); - - for (const token of erc20Tokens) { - await sumTokensAndLPsSharedOwners( - balances, - [[token, false]], - [treasuryAddress], - chainBlocks["polygon"], - "polygon", - transformAddress - ); - } - return balances; -}; - -/*** Staking of native token CRYSTAL TVL Portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const bal = ( - await sdk.api.abi.call({ - abi: abi.balanceOf, - target: CrystalMine, - chain: "polygon", - block: chainBlocks["polygon"], - }) - ).output; - - sdk.util.sumSingleBalance(balances, `polygon:${CRYSTAL}`, bal); - - return balances; -}; - -const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const poolLength = ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: MasterHealer, - chain: "polygon", - block: chainBlocks["polygon"], - }) - ).output; - - const lpPositions = []; - - for (let index = 0; index < poolLength; index++) { - const lpsOrTokens = ( - await sdk.api.abi.call({ - abi: abi.poolInfo, - target: MasterHealer, - params: index, - chain: "polygon", - block: chainBlocks["polygon"], - }) - ).output.lpToken; - - const lpsOrTokens_Bal = ( - await sdk.api.abi.call({ - abi: erc20.balanceOf, - target: lpsOrTokens, - params: MasterHealer, - chain: "polygon", - block: chainBlocks["polygon"], - }) - ).output; - - lpPositions.push({ - token: lpsOrTokens, - balance: lpsOrTokens_Bal, - }); - } - - const transformAddress = await transformPolygonAddress(); - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks["polygon"], - "polygon", - transformAddress - ); - - return balances; -}; - -module.exports = { - misrepresentedTokens: true, - treasury: { - tvl: Treasury, - }, - staking: { - tvl: staking, - }, - polygon: { - tvl: polygonTvl, - }, - tvl: sdk.util.sumChainTvls([Treasury]), - methodology: - `We count liquidity on the Vaults (LP tokens) and Mines (LP tokens) threw MasterHealer contract; - we add the staking of the native token (CRYSTAL) separate threw CrystalMine contract; - and the treasury part separate as well`, -}; From bc90e7b32040415c0be9b7732d4477394c6ea1a3 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 22:20:11 +0000 Subject: [PATCH 288/393] remove unused modules --- projects/daoventues.js | 13 ------------- projects/eurxb.js | 40 ---------------------------------------- projects/linkswap.js | 35 ----------------------------------- 3 files changed, 88 deletions(-) delete mode 100644 projects/daoventues.js delete mode 100644 projects/eurxb.js delete mode 100644 projects/linkswap.js diff --git a/projects/daoventues.js b/projects/daoventues.js deleted file mode 100644 index 57d2eac6a1..0000000000 --- a/projects/daoventues.js +++ /dev/null @@ -1,13 +0,0 @@ -const {fetchURL} = require('./helper/utils') - -async function fetch(){ - const result = await fetchURL('https://app.daoventures.co/api/vaults/tvl/total') - return Number(result.data.body[0].tvl) -} - -module.exports = { - ethereum:{ - fetch - }, - fetch -} \ No newline at end of file diff --git a/projects/eurxb.js b/projects/eurxb.js deleted file mode 100644 index 18fb8a49eb..0000000000 --- a/projects/eurxb.js +++ /dev/null @@ -1,40 +0,0 @@ -const Web3 = require('web3'); -const BigNumber = require('bignumber.js'); -const { abis } = require('./config/eurxb/abis.js'); -const { tokensAddress, infuraKey } = require('./config/eurxb/constants.js'); -const { getContractInstance } = require('./config/eurxb/utils.js'); -const web3 = new Web3(new Web3.providers.HttpProvider(`https://mainnet.infura.io/v3/${infuraKey}`)) - -const getSat = async () => { - const contract = await getContractInstance(abis.eurxb, tokensAddress.eurxb); - const result = await contract.methods.totalSupply().call(); - return web3.utils.fromWei(result); -}; - -const getBond = async () => { - const contract = await getContractInstance(abis.bond, tokensAddress.bond); - const result = await contract.methods.totalValue().call(); - return web3.utils.fromWei(result); -}; - -const getEurxb = async () => { - const contract = await getContractInstance(abis.sat, tokensAddress.sat); - const result = await contract.methods.totalValue().call(); - return web3.utils.fromWei(result); -}; - -const fetch = async () => { - const sat = await getSat(); - const bond = await getBond(); - const eurxb = await getEurxb(); - - const tvl = new BigNumber(sat) - .plus(new BigNumber(bond)) - .plus(new BigNumber(eurxb)); - - return tvl.isGreaterThan(0) ? tvl.toString() : '0'; -}; - -module.exports = { - fetch -} diff --git a/projects/linkswap.js b/projects/linkswap.js deleted file mode 100644 index b848ac2108..0000000000 --- a/projects/linkswap.js +++ /dev/null @@ -1,35 +0,0 @@ -const retry = require('./helper/retry'); -const { GraphQLClient, gql } = require('graphql-request'); -const utils = require('./helper/utils'); - -async function fetch() { - - var endpoint = 'https://api.thegraph.com/subgraphs/name/yflink/linkswap-v1' - var graphQLClient = new GraphQLClient(endpoint); - - var query = gql` - { - linkswapFactory(id: "0x696708Db871B77355d6C2bE7290B27CF0Bb9B24b"){ - totalVolumeUSD - totalLiquidityUSD - txCount - } - bundles { - yflPrice - } - } - `; - const results = await retry(async bail => await graphQLClient.request(query)) - //console.log(results); - var gov = '0x75D1aA733920b14fC74c9F6e6faB7ac1EcE8482E'; - var yfl = '0x28cb7e841ee97947a86B06fA4090C8451f64c0be'; - let balance = await utils.returnBalance(yfl, gov); - let liquidity = results.linkswapFactory.totalLiquidityUSD; - let governance = results.bundles[0].yflPrice * balance; - let tvl = parseFloat(liquidity) + parseFloat(governance); - return tvl; -} - -module.exports = { - fetch -} From 0c7b3473ada1dea7542bc55c80c789b9df1a6fb7 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 22:28:05 +0000 Subject: [PATCH 289/393] remove cougar fetch adapter (tvl one better) --- projects/cougar/index.js | 56 ---------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 projects/cougar/index.js diff --git a/projects/cougar/index.js b/projects/cougar/index.js deleted file mode 100644 index 5b2d3857db..0000000000 --- a/projects/cougar/index.js +++ /dev/null @@ -1,56 +0,0 @@ -const { fetchURL } = require('../helper/utils') -const sdk = require("@defillama/sdk"); - -/* * * * * * * * -* ==> Correct adapter needs to be created. -* -*****************/ - -async function fetchBsc() { - const tvl = await fetchURL('https://cougarswap.io/statistic.json') - return tvl.data.bsc.tvl -} - -async function fetchPolygon() { - const tvl = await fetchURL('https://cougarswap.io/statistic.json') - return tvl.data.polygon.tvl -} - -async function fetchFantom() { - const tvl = await fetchURL('https://cougarswap.io/statistic.json') - return tvl.data.fantom.tvl -} - -async function fetchHarmony() { - const tvl = await fetchURL('https://cougarswap.io/statistic.json') - return tvl.data.harmony.tvl -} - -async function fetchAvax() { - const tvl = await fetchURL('https://cougarswap.io/statistic.json') - return tvl.data.avax.tvl -} - -async function fetch() { - const tvl = await fetchURL('https://cougarswap.io/statistic.json') - return tvl.data.totalTvl; -} - -module.exports = { - bsc: { - fetch: fetchBsc - }, - polygon: { - fetch: fetchPolygon - }, - fantom: { - fetch: fetchFantom - }, - harmony: { - fetch: fetchHarmony - }, - avax: { - fetch: fetchAvax - }, - fetch -} From d4d9f94ccb01384ab7a701e0c9fb71fc714f3642 Mon Sep 17 00:00:00 2001 From: Robsonsjre Date: Wed, 8 Dec 2021 20:19:21 -0300 Subject: [PATCH 290/393] added arbitrum integration --- projects/podsfinance/constants.js | 5 +++++ projects/podsfinance/index.js | 11 +++++++++-- projects/podsfinance/queries.js | 17 +++++++++++++++-- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/projects/podsfinance/constants.js b/projects/podsfinance/constants.js index 256e4fb8f3..4987fb49bb 100644 --- a/projects/podsfinance/constants.js +++ b/projects/podsfinance/constants.js @@ -12,5 +12,10 @@ module.exports = { id: 1, name: 'ethereum', subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods' + }, + NETWORK_ARBITRUM: { + id: 42161, + name: 'arbitrum', + subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods-arbitrum' } } diff --git a/projects/podsfinance/index.js b/projects/podsfinance/index.js index 2d298879af..5ac08dd57f 100644 --- a/projects/podsfinance/index.js +++ b/projects/podsfinance/index.js @@ -1,6 +1,6 @@ const sdk = require('@defillama/sdk') -const { NETWORK_POLYGON, NETWORK_MAINNET } = require('./constants.js') +const { NETWORK_POLYGON, NETWORK_MAINNET, NETWORK_ARBITRUM } = require('./constants.js') const { getTVL } = require('./queries.js') async function getEthereumTVL (time, ethBlock, chainBlocks) { @@ -11,6 +11,10 @@ async function getPolygonTVL (time, ethBlock, chainBlocks) { return getTVL(NETWORK_POLYGON, chainBlocks[NETWORK_POLYGON.name]) } +async function getArbitrumTVL (time, ethBlock, chainBlocks) { + return getTVL(NETWORK_ARBITRUM, chainBlocks[NETWORK_ARBITRUM.name]) +} + module.exports = { ethereum: { tvl: getEthereumTVL @@ -18,5 +22,8 @@ module.exports = { polygon: { tvl: getPolygonTVL }, - tvl: sdk.util.sumChainTvls([getEthereumTVL, getPolygonTVL]) + arbitrum: { + tvl: getArbitrumTVL + }, + tvl: sdk.util.sumChainTvls([getEthereumTVL, getPolygonTVL, getArbitrumTVL]) } diff --git a/projects/podsfinance/queries.js b/projects/podsfinance/queries.js index 40390fe7db..ec4d72f17e 100644 --- a/projects/podsfinance/queries.js +++ b/projects/podsfinance/queries.js @@ -7,7 +7,7 @@ async function getTVL (network, block) { const balances = {} const options = await getOptions(network, EXPIRATION_START_FROM) - const collateralInOptions = await sdk.api.abi.multiCall({ + const strikeAssetInOptions = await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', block, calls: options @@ -19,6 +19,18 @@ async function getTVL (network, block) { chain: network.name }) + const underlyingAssetInOptions = await sdk.api.abi.multiCall({ + abi: 'erc20:balanceOf', + block, + calls: options + .filter(option => option && option.underlyingAsset && option.address) + .map(option => ({ + target: option.underlyingAsset, + params: [option.address] + })), + chain: network.name + }) + const stablesInPools = await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', block, @@ -33,7 +45,8 @@ async function getTVL (network, block) { const transform = address => `${network.name}:${address}` - sdk.util.sumMultiBalanceOf(balances, collateralInOptions, true, transform) + sdk.util.sumMultiBalanceOf(balances, strikeAssetInOptions, true, transform) + sdk.util.sumMultiBalanceOf(balances, underlyingAssetInOptions, true, transform) sdk.util.sumMultiBalanceOf(balances, stablesInPools, true, transform) return balances } From f6af30f292a4e0ab64aa8970fbd3c0b8a43e8822 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 23:31:51 +0000 Subject: [PATCH 291/393] remove duplicated projects --- projects/hectordao/index.js | 47 ----------------------- projects/openocean/abi.json | 15 -------- projects/openocean/index.js | 76 ------------------------------------- 3 files changed, 138 deletions(-) delete mode 100644 projects/hectordao/index.js delete mode 100644 projects/openocean/abi.json delete mode 100644 projects/openocean/index.js diff --git a/projects/hectordao/index.js b/projects/hectordao/index.js deleted file mode 100644 index 7a3cbbcdee..0000000000 --- a/projects/hectordao/index.js +++ /dev/null @@ -1,47 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { staking } = require("../helper/staking"); -const { transformFantomAddress } = require("../helper/portedTokens"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const stakingContract = "0x9ae7972BA46933B3B20aaE7Acbf6C311847aCA40"; -const HEC = "0x5C4FDfc5233f935f20D2aDbA572F770c2E377Ab0"; - -const treasuryContract = "0xCB54EA94191B280C296E6ff0E37c7e76Ad42dC6A"; - -const DAI = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"; -const HEC_DAI_spLP = "0xbc0eecdA2d8141e3a26D2535C57cadcb1095bca9"; -const USDC = "0x04068da6c83afcfa0e13ba15a6696662335d5b75"; -const HEC_USDC_SPIRITLP = "0xd661952749f05aCc40503404938A91aF9aC1473b"; -const wFTM = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; - -async function ftmTvl(timestamp, chainBlocks) { - const balances = {}; - - const transformAddress = await transformFantomAddress(); - await sumTokensAndLPsSharedOwners( - balances, - [ - [DAI, false], - [USDC, false], - [wFTM, false], - [HEC_DAI_spLP, true], - [HEC_USDC_SPIRITLP, true], - ], - [treasuryContract], - chainBlocks["fantom"], - "fantom", - transformAddress - ); - - return balances; -} - -module.exports = { - fantom: { - staking: staking(stakingContract, HEC, "fantom"), - tvl: ftmTvl, - }, - tvl: sdk.util.sumChainTvls([ftmTvl]), - methodology: - "Counts DAI, DAI spLP (HEC-DAI), USDC, USDC SPIRIT-LP (HEC-USDC), wFTM on the treasury", -}; diff --git a/projects/openocean/abi.json b/projects/openocean/abi.json deleted file mode 100644 index 41f751031e..0000000000 --- a/projects/openocean/abi.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "stakeToken": { - "inputs": [], - "name": "stakeToken", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/openocean/index.js b/projects/openocean/index.js deleted file mode 100644 index 098b3a81be..0000000000 --- a/projects/openocean/index.js +++ /dev/null @@ -1,76 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); - -const { transformBscAddress } = require("../helper/portedTokens"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -//Staking OOE Token Contract -const SimpleStakingOOE_Etherem = "0xB99D38eB69214e493B1183FFA3d561FC9F75D519"; - -//Staking OOE-BNB LP Contract -const SimpleStakingOOB_BNB_Bsc = "0x1b4F54090F29eF9f94487969AEC31F2F6Dca88D7"; - -//Staking OOE-BUSD LP Contract -const SimpleStakingOOB_BUSD_Bsc = "0xB3ccece7f26acd558a2Eb7Eab53ae4D840b3401D"; - -const calcTvl = async (balances, chain, block, SimpleStaking) => { - const erc20TokenOrLp = ( - await sdk.api.abi.call({ - abi: abi.stakeToken, - target: SimpleStaking, - chain, - block, - }) - ).output; - - const transformAddress = await transformBscAddress(); - - await sumTokensAndLPsSharedOwners( - balances, - SimpleStaking == SimpleStakingOOE_Etherem - ? [[erc20TokenOrLp, false]] - : [[erc20TokenOrLp, true]], - [SimpleStaking], - block, - chain, - chain == "bsc" ? transformAddress : (addr) => addr - ); -}; - -/*** Staking of native token (OOE) on Ethereum TVL portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - await calcTvl( - balances, - "ethereum", - chainBlocks["ethereum"], - SimpleStakingOOE_Etherem - ); - - return balances; -}; - -/*** Binance TVL Portion ***/ -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - await calcTvl(balances, "bsc", chainBlocks["bsc"], SimpleStakingOOB_BNB_Bsc); - - await calcTvl(balances, "bsc", chainBlocks["bsc"], SimpleStakingOOB_BUSD_Bsc); - - return balances; -}; - -module.exports = { - misrepresentedTokens: true, - staking: { - tvl: staking, - }, - bsc: { - tvl: bscTvl, - }, - tvl: sdk.util.sumChainTvls([bscTvl]), - methodology: `We count as TVL the staking OOE-BNB and OOE-BUSD LPs on Binance network - threw their SimpleStaking contracts; and we count the staking native token (OOE) on Ethereum network`, -}; From 6d880453960f45196bd46f3e66fb42a5d7627875 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 23:42:23 +0000 Subject: [PATCH 292/393] fix imports --- projects/curve/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/curve/index.js b/projects/curve/index.js index 1035708db7..a4d49a1d60 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -1,5 +1,5 @@ -const { staking } = require('./helper/staking'); -const utils = require('./helper/utils'); +const { staking } = require('../helper/staking'); +const utils = require('../helper/utils'); async function eth() { let staked = await utils.fetchURL('https://api.curve.fi/api/getTVL') From b27afce6d1ae4236805d558d205ca8654a6bc1f3 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Wed, 8 Dec 2021 23:43:18 +0000 Subject: [PATCH 293/393] fix imports --- projects/ellipsis/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/ellipsis/index.js b/projects/ellipsis/index.js index 1465ac6d5b..a63e61bbc2 100644 --- a/projects/ellipsis/index.js +++ b/projects/ellipsis/index.js @@ -1,5 +1,5 @@ -const utils = require('./helper/utils'); -const {toUSDTBalances} = require('./helper/balances'); +const utils = require('../helper/utils'); +const {toUSDTBalances} = require('../helper/balances'); const sdk = require('@defillama/sdk') async function tvl() { From 779a12e07ef9e36df2aec4949895035c598d8b57 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 9 Dec 2021 00:27:25 +0000 Subject: [PATCH 294/393] update treasury --- projects/cerberusdao/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/projects/cerberusdao/index.js b/projects/cerberusdao/index.js index 78a25dce5e..9658925433 100644 --- a/projects/cerberusdao/index.js +++ b/projects/cerberusdao/index.js @@ -4,6 +4,10 @@ const treasury = "0x56D595ea5591D264bc1Ef9E073aF66685F0bFD31" module.exports = ohmTvl(treasury, [ //SHIB ["0x95aD61b0a150d79219dCF64E1E6Cc01f0B64C4cE", false], + //FLOKI + ["0x43f11c02439e2736800433b4594994bd43cd066d", false], + //WETH + ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", false], //uniswap LP shib/weth ["0xb5b6c3816c66fa6bc5b189f49e5b088e2de5082a", true], ], "ethereum", "0x95deaF8dd30380acd6CC5E4E90e5EEf94d258854", "0x8a14897eA5F668f36671678593fAe44Ae23B39FB") \ No newline at end of file From 6fcef6fa00ef46ed9fdabb0be3f2e248ee36891b Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 9 Dec 2021 00:41:19 +0000 Subject: [PATCH 295/393] fix growthdefi exports --- projects/growthdefi/index.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/projects/growthdefi/index.js b/projects/growthdefi/index.js index 07d031af6e..8c60039623 100644 --- a/projects/growthdefi/index.js +++ b/projects/growthdefi/index.js @@ -477,22 +477,17 @@ const morAvaxTvl = (timestamp, ethBlock, chainBlocks) => { module.exports = { misrepresentedTokens: true, - staking_eth: { - tvl: staking(stakingContract_eth, GRO_ETH), - }, - staking_bsc: { - tvl: staking(gRootStakingContract_bsc, GRO_BSC, "bsc"), - }, - treasury_bsc: { - tvl: treasury, + ethereum: { + staking: staking(stakingContract_eth, GRO_ETH), }, bsc: { + treasury, + staking: staking(gRootStakingContract_bsc, GRO_BSC, "bsc"), tvl: sdk.util.sumChainTvls([wheatBscTvl, morBscTvl]), }, avax: { tvl: sdk.util.sumChainTvls([wheatAvaxTvl, morAvaxTvl]), }, - tvl: sdk.util.sumChainTvls([wheatBscTvl, morBscTvl, wheatAvaxTvl, morAvaxTvl]), methodology: "We count liquidity on the Wheath, GRoot, Mor as products of Growthdefi Protocol through MasterChef and Staking Contracts", }; From ad1907732ddad54e8092c980ad8741d5f01ab4b7 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 9 Dec 2021 01:42:09 +0000 Subject: [PATCH 296/393] fix fegex and swapcat exports --- projects/fegex/index.js | 9 +++++---- projects/swapcat/index.js | 25 +++++++++++++++---------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/projects/fegex/index.js b/projects/fegex/index.js index b244faf125..e9225832de 100644 --- a/projects/fegex/index.js +++ b/projects/fegex/index.js @@ -7,12 +7,13 @@ const stakingContractBSC = "0xF8303c3ac316b82bCbB34649e24616AA9ED9E5F4"; const FEG_BSC = "0xacfc95585d80ab62f67a14c566c1b7a49fe91167"; module.exports = { + timetravel:true, misrepresentedTokens: true, - staking_eth: { - tvl: staking(stakingContractETH, FEG_ETH) + ethereum: { + staking: staking(stakingContractETH, FEG_ETH) }, - staking_bsc: { - tvl: staking(stakingContractBSC, FEG_BSC, "bsc"), + bsc: { + staking: staking(stakingContractBSC, FEG_BSC, "bsc"), }, tvl: async ()=>({}), methodology: diff --git a/projects/swapcat/index.js b/projects/swapcat/index.js index ac90d11c19..ce5fbff14d 100644 --- a/projects/swapcat/index.js +++ b/projects/swapcat/index.js @@ -14,13 +14,14 @@ const chainIds = { celo: 42220, songbird: 19, harmony: 1666600000, - etc: 61, + ethereumclassic: 61, heco: 128, rsk: 30, okexchain: 66, hpb: 269, - ewt: 246, + energyweb: 246, kcc: 321, + arbitrum: 42161, } function chainTvl(chain) { @@ -30,11 +31,15 @@ function chainTvl(chain) { } } -module.exports = Object.keys(chainIds).reduce((obj, chain) => ({ - ...obj, - [chain]: { - offers: chainTvl(chain) - } -}), { - tvl:async()=>({}) -}) \ No newline at end of file +module.exports = { + timetravel: false, + misrepresentedTokens:true, + ...Object.keys(chainIds).reduce((obj, chain) => ({ + ...obj, + [chain]: { + offers: chainTvl(chain) + } + }), { + tvl: async () => ({}) + }) +} \ No newline at end of file From 8c7764dd899428c941557e70513aaa8b12a811e9 Mon Sep 17 00:00:00 2001 From: Buns <68980965+BunsDev@users.noreply.github.com> Date: Wed, 8 Dec 2021 20:20:53 -0600 Subject: [PATCH 297/393] Create abi.json --- projects/luxor/abi.json | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 projects/luxor/abi.json diff --git a/projects/luxor/abi.json b/projects/luxor/abi.json new file mode 100644 index 0000000000..12773538d0 --- /dev/null +++ b/projects/luxor/abi.json @@ -0,0 +1,45 @@ + +{ + "totalValueDeployed": { + "inputs": [], + "name": "totalValueDeployed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "userInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "userInfo", + "outputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDebt", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} From c6c8dc64882dd3333dd1a9c13273a3db82954f2b Mon Sep 17 00:00:00 2001 From: Buns <68980965+BunsDev@users.noreply.github.com> Date: Wed, 8 Dec 2021 20:50:14 -0600 Subject: [PATCH 298/393] Create index.js --- projects/luxor/index.js | 64 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 projects/luxor/index.js diff --git a/projects/luxor/index.js b/projects/luxor/index.js new file mode 100644 index 0000000000..bbbc0d8173 --- /dev/null +++ b/projects/luxor/index.js @@ -0,0 +1,64 @@ + +const sdk = require("@defillama/sdk"); +const { default: BigNumber } = require("bignumber.js"); +const erc20 = require("../helper/abis/erc20.json"); +const { sumTokensAndLPsSharedOwners, sumSingleBalance } = require("../helper/unwrapLPs"); +const abi = require('./abi.json') + +const LuxorStaking = "0xf3F0BCFd430085e198466cdCA4Db8C2Af47f0802"; + +const LUX = "0x6671E20b83Ba463F270c8c75dAe57e3Cc246cB2b"; + +const treasuryAddresses = "0xDF2A28Cc2878422354A93fEb05B41Bd57d71DB24"; + +const DAI = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"; +const LUX_DAI = "0x46729c2AeeabE7774a0E710867df80a6E19Ef851"; +const WFTM = "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; + +/*** Staking of native token (LUX) TVL Portion ***/ +const staking = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + + for (const stakings of LuxorStaking) { + const stakingBalance = await sdk.api.abi.call({ + abi: erc20.balanceOf, + target: LUX, + params: stakings, + block: ethBlock, + }); + + sdk.util.sumSingleBalance(balances, LUX, stakingBalance.output); + } + + return balances; +}; + +/*** Bonds TVL Portion (Treasury) *** + * Treasury TVL consists of DAI, and WFTM balances + LP balances + ***/ +async function ethTvl(timestamp, block) { + const balances = {}; + + await sumTokensAndLPsSharedOwners( + balances, + [ + [DAI, false], + [WFTM, false], + [LUX_DAI, true], + ], + treasuryAddresses, + block + ); + + return balances; +} + +module.exports = { + start: 1638641102, // Dec 8th, 2021 + ethereum: { + tvl: ethTvl, + staking + }, + methodology: + "Counts DAI, DAI LP (LUX-DAI), WFTM on the treasury", +}; From ed58153d9706a09ecad9c2523ab95675b6c981ea Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 9 Dec 2021 03:49:50 +0000 Subject: [PATCH 299/393] fix aavegotchi --- projects/aavegotchi/index.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/projects/aavegotchi/index.js b/projects/aavegotchi/index.js index 3da18198be..02dce63a70 100644 --- a/projects/aavegotchi/index.js +++ b/projects/aavegotchi/index.js @@ -1,6 +1,6 @@ const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const { pool2Exports } = require("../helper/pool2"); +const { pool2s } = require("../helper/pool2"); const { transformPolygonAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { request, gql } = require("graphql-request"); @@ -101,26 +101,22 @@ const polygonTvl = async (timestamp, block, chainBlocks) => { transformAddress ); - const gotchisBalances = await getGotchisCollateral(timestamp, block); + const gotchisBalances = await getGotchisCollateral(timestamp, chainBlocks["polygon"]); sdk.util.sumMultiBalanceOf(balances, gotchisBalances, true, x => 'polygon:' + x); return balances; }; module.exports = { - misrepresentedTokens: true, - staking_polygon: { - tvl: staking(stkGHST_QUICKContract, GHST_Polygon, "polygon"), - }, - pool2s: pool2Exports(stkGHST_QUICKContract, GHST_pools2, "polygon").tvl, + timetravel: true, ethereum: { tvl: ethTvl, }, polygon: { + staking: staking(stkGHST_QUICKContract, GHST_Polygon, "polygon"), tvl: polygonTvl, + pool2: pool2s([stkGHST_QUICKContract], GHST_pools2, "polygon") }, - tvl: sdk.util.sumChainTvls([ethTvl, polygonTvl]), - // tvl: getGotchisCollateral, methodology: `We count liquidity on Vaults from ETHEREUM and Polygon chains through Vault Contracts; On Rarity Farming, Staking and Pool2s parts on Polygon chain through their Contrats`, From 96a1d1cb25581e15a6f34321702f29028e263b6e Mon Sep 17 00:00:00 2001 From: nemusona Date: Wed, 8 Dec 2021 21:56:33 -0600 Subject: [PATCH 300/393] rewrite luxor adapter --- projects/luxor/abi.json | 45 -------------------------- projects/luxor/index.js | 71 +++++++++++------------------------------ 2 files changed, 18 insertions(+), 98 deletions(-) delete mode 100644 projects/luxor/abi.json diff --git a/projects/luxor/abi.json b/projects/luxor/abi.json deleted file mode 100644 index 12773538d0..0000000000 --- a/projects/luxor/abi.json +++ /dev/null @@ -1,45 +0,0 @@ - -{ - "totalValueDeployed": { - "inputs": [], - "name": "totalValueDeployed", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "userInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/luxor/index.js b/projects/luxor/index.js index bbbc0d8173..884a5065ba 100644 --- a/projects/luxor/index.js +++ b/projects/luxor/index.js @@ -1,64 +1,29 @@ - -const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); -const erc20 = require("../helper/abis/erc20.json"); -const { sumTokensAndLPsSharedOwners, sumSingleBalance } = require("../helper/unwrapLPs"); -const abi = require('./abi.json') +const { ohmTvl } = require("../helper/ohm"); const LuxorStaking = "0xf3F0BCFd430085e198466cdCA4Db8C2Af47f0802"; const LUX = "0x6671E20b83Ba463F270c8c75dAe57e3Cc246cB2b"; -const treasuryAddresses = "0xDF2A28Cc2878422354A93fEb05B41Bd57d71DB24"; +const treasuryAddresses = "0xDF2A28Cc2878422354A93fEb05B41Bd57d71DB24"; const DAI = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"; const LUX_DAI = "0x46729c2AeeabE7774a0E710867df80a6E19Ef851"; const WFTM = "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; -/*** Staking of native token (LUX) TVL Portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - for (const stakings of LuxorStaking) { - const stakingBalance = await sdk.api.abi.call({ - abi: erc20.balanceOf, - target: LUX, - params: stakings, - block: ethBlock, - }); - - sdk.util.sumSingleBalance(balances, LUX, stakingBalance.output); +module.exports = ohmTvl( + treasuryAddresses, + [ + [DAI, false], + [LUX_DAI, true], + [WFTM, false], + ], + "fantom", + LuxorStaking, + LUX, + (addr) => { + if (addr === "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e") { + return "0x6b175474e89094c44da98b954eedeac495271d0f"; + } + return `fantom:${addr}`; } - - return balances; -}; - -/*** Bonds TVL Portion (Treasury) *** - * Treasury TVL consists of DAI, and WFTM balances + LP balances - ***/ -async function ethTvl(timestamp, block) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [DAI, false], - [WFTM, false], - [LUX_DAI, true], - ], - treasuryAddresses, - block - ); - - return balances; -} - -module.exports = { - start: 1638641102, // Dec 8th, 2021 - ethereum: { - tvl: ethTvl, - staking - }, - methodology: - "Counts DAI, DAI LP (LUX-DAI), WFTM on the treasury", -}; +); From 10bb221eade4601294aa4f7d46887dcad7f354a7 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 9 Dec 2021 05:32:45 +0000 Subject: [PATCH 301/393] update code to include staking --- projects/luxor/index.js | 44 +++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/projects/luxor/index.js b/projects/luxor/index.js index 884a5065ba..fc203b1ef8 100644 --- a/projects/luxor/index.js +++ b/projects/luxor/index.js @@ -1,29 +1,25 @@ -const { ohmTvl } = require("../helper/ohm"); +const { stakingPricedLP } = require('../helper/staking') +const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') +const {transformFantomAddress} = require('../helper/portedTokens') -const LuxorStaking = "0xf3F0BCFd430085e198466cdCA4Db8C2Af47f0802"; -const LUX = "0x6671E20b83Ba463F270c8c75dAe57e3Cc246cB2b"; +const treasury = "0xDF2A28Cc2878422354A93fEb05B41Bd57d71DB24" +const LUX = "0x6671e20b83ba463f270c8c75dae57e3cc246cb2b" -const treasuryAddresses = "0xDF2A28Cc2878422354A93fEb05B41Bd57d71DB24"; +async function tvl(time, ethBlock, chainBlocks){ + const balances = {} + const transform = await transformFantomAddress() + await sumTokensAndLPsSharedOwners(balances, [ + ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], + ["0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", false], + ["0x46729c2AeeabE7774a0E710867df80a6E19Ef851", true] + ], [treasury], chainBlocks.fantom, "fantom", transform) + return balances +} -const DAI = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"; -const LUX_DAI = "0x46729c2AeeabE7774a0E710867df80a6E19Ef851"; -const WFTM = "0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83"; - -module.exports = ohmTvl( - treasuryAddresses, - [ - [DAI, false], - [LUX_DAI, true], - [WFTM, false], - ], - "fantom", - LuxorStaking, - LUX, - (addr) => { - if (addr === "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e") { - return "0x6b175474e89094c44da98b954eedeac495271d0f"; +module.exports={ + fantom:{ + tvl, + staking: stakingPricedLP("0xf3F0BCFd430085e198466cdCA4Db8C2Af47f0802", LUX, "fantom", "0x46729c2AeeabE7774a0E710867df80a6E19Ef851", "dai", true) } - return `fantom:${addr}`; - } -); +} From 9f28899abe7dd19ab736aaa8f0ca4c3c1f160b27 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 9 Dec 2021 05:51:10 +0000 Subject: [PATCH 302/393] use helper --- projects/luxor/index.js | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/projects/luxor/index.js b/projects/luxor/index.js index fc203b1ef8..969ad8430f 100644 --- a/projects/luxor/index.js +++ b/projects/luxor/index.js @@ -1,25 +1,24 @@ -const { stakingPricedLP } = require('../helper/staking') -const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') -const {transformFantomAddress} = require('../helper/portedTokens') - +const { ohmTvl } = require("../helper/ohm"); const treasury = "0xDF2A28Cc2878422354A93fEb05B41Bd57d71DB24" const LUX = "0x6671e20b83ba463f270c8c75dae57e3cc246cb2b" -async function tvl(time, ethBlock, chainBlocks){ - const balances = {} - const transform = await transformFantomAddress() - await sumTokensAndLPsSharedOwners(balances, [ +module.exports=ohmTvl( + treasury, + [ ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], ["0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", false], ["0x46729c2AeeabE7774a0E710867df80a6E19Ef851", true] - ], [treasury], chainBlocks.fantom, "fantom", transform) - return balances -} - -module.exports={ - fantom:{ - tvl, - staking: stakingPricedLP("0xf3F0BCFd430085e198466cdCA4Db8C2Af47f0802", LUX, "fantom", "0x46729c2AeeabE7774a0E710867df80a6E19Ef851", "dai", true) - } -} + ], + "fantom", + "0xf3F0BCFd430085e198466cdCA4Db8C2Af47f0802", + LUX, + (addr) => { + if (addr.toLowerCase() === "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e") { + return "0x6b175474e89094c44da98b954eedeac495271d0f"; + } + return `fantom:${addr}`; + }, + undefined, + false +) From 8e08e62dfbb87bafcbf352469207931c04005db0 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Thu, 9 Dec 2021 06:45:30 +0000 Subject: [PATCH 303/393] add 0 tvl to eth classic on swapcat --- projects/swapcat/index.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/projects/swapcat/index.js b/projects/swapcat/index.js index ce5fbff14d..4cb0fc6869 100644 --- a/projects/swapcat/index.js +++ b/projects/swapcat/index.js @@ -31,10 +31,7 @@ function chainTvl(chain) { } } -module.exports = { - timetravel: false, - misrepresentedTokens:true, - ...Object.keys(chainIds).reduce((obj, chain) => ({ +const tvls = Object.keys(chainIds).reduce((obj, chain) => ({ ...obj, [chain]: { offers: chainTvl(chain) @@ -42,4 +39,10 @@ module.exports = { }), { tvl: async () => ({}) }) -} \ No newline at end of file +tvls.ethereumclassic.tvl = async () => ({}); + +module.exports = { + timetravel: false, + misrepresentedTokens:true, + ...tvls, +} From 4520b6f2eb345d0ce428223dd457e50bd3fa1bcc Mon Sep 17 00:00:00 2001 From: wepiggy-dev <73467813+wepiggy-dev@users.noreply.github.com> Date: Thu, 9 Dec 2021 16:45:35 +0800 Subject: [PATCH 304/393] add moonriver --- projects/wepiggy.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/projects/wepiggy.js b/projects/wepiggy.js index a739732334..46752a2add 100644 --- a/projects/wepiggy.js +++ b/projects/wepiggy.js @@ -50,6 +50,13 @@ const contracts = { decimals:18, }, }, + moonriver: { + comptroller: '0x9a9b2bF1d1c96332C55d0B6aCb8C2B441381116d', + gas:{ + pToken:"0x621CE6596E0B9CcF635316BFE7FdBC80C3029Bec", + decimals:18, + }, + }, }; const chainExports = {} From e712dc477a3d8ffba8c03f1def8978ffa7d0dcd8 Mon Sep 17 00:00:00 2001 From: Robin Shi Date: Thu, 9 Dec 2021 16:52:13 +0800 Subject: [PATCH 305/393] update the pool addresses of deri-protocol --- projects/deri/index.js | 204 +++++++++++++++++++++++++---------------- 1 file changed, 124 insertions(+), 80 deletions(-) diff --git a/projects/deri/index.js b/projects/deri/index.js index aa74c46e0b..53df38ac6e 100644 --- a/projects/deri/index.js +++ b/projects/deri/index.js @@ -1,123 +1,167 @@ -const sdk = require('@defillama/sdk'); -const { transformPolygonAddress } = require('../helper/portedTokens'); -const abi = require('./abi'); +const sdk = require("@defillama/sdk"); +const { transformPolygonAddress } = require("../helper/portedTokens"); +const abi = require("./abi"); -async function perpetualPool(block, chain, pool, balances, transform=a=>a) { +async function perpetualPool( + block, + chain, + pool, + balances, + transform = (a) => a +) { const { output: counts } = await sdk.api.abi.call({ block, target: pool, params: [], - abi: abi['getLengths'], + abi: abi["getLengths"], chain, }); const bTokenCount = counts[0]; let bTokenIds = []; - for (let i=0; i ({ - target: pool, - params: bTokenId, - })), - block, - abi: abi['getBToken'], - chain, - })).output.map(value => value.output); + } - for (i = 0; i < bTokens.length; i++) { - let tokenBalance = (await sdk.api.erc20.balanceOf({ + const bTokens = ( + await sdk.api.abi.multiCall({ + calls: bTokenIds.map((bTokenId) => ({ + target: pool, + params: bTokenId, + })), block, + abi: abi["getBToken"], chain, - target: bTokens[i].bTokenAddress, - owner: pool - })).output; + }) + ).output.map((value) => value.output); + + for (i = 0; i < bTokens.length; i++) { + let tokenBalance = ( + await sdk.api.erc20.balanceOf({ + block, + chain, + target: bTokens[i].bTokenAddress, + owner: pool, + }) + ).output; sdk.util.sumSingleBalance( - balances, transform(bTokens[i].bTokenAddress), tokenBalance); + balances, + transform(bTokens[i].bTokenAddress), + tokenBalance + ); } -}; -async function perpetualPoolLite(block, chain, pool, token, balances, transform=a=>a) { - let tokenBalance = (await sdk.api.erc20.balanceOf({ - block, - chain, - target: token, - owner: pool - })).output; +} +async function perpetualPoolLite( + block, + chain, + pool, + token, + balances, + transform = (a) => a +) { + let tokenBalance = ( + await sdk.api.erc20.balanceOf({ + block, + chain, + target: token, + owner: pool, + }) + ).output; sdk.util.sumSingleBalance(balances, transform(token), tokenBalance); -}; +} let bscContracts = { - 'a' : { - 'bTokenSymbol': '0x4fabb145d64652a948d72533023f6e7a623c7c53', - 'pool': '0x4B439ABCBc736837D0F7f7A9C5619bF8fa650e15' + a: { + bTokenSymbol: "0x4fabb145d64652a948d72533023f6e7a623c7c53", + pool: "0x8Eab619E6A8f7E8891598cADe6546a1214385D42", }, - 'b': { - 'bTokenSymbol': '0xe9e7cea3dedca5984780bafc599bd69add087d56', - 'pool': '0xbC259DCA83b7EdD81b28BcCd1fee87d7b881785a', - lite: true + b: { + bTokenSymbol: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + pool: "0x8Eab619E6A8f7E8891598cADe6546a1214385D42", + lite: true, }, - 'everlastingOption': { - 'bTokenSymbol': '0xe9e7cea3dedca5984780bafc599bd69add087d56', - 'pool': '0x6fEfdd54E0aA425F9B0E647d5BA6bF6d6f3F8Ab8', + everlastingOption: { + bTokenSymbol: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + pool: "0x574022307e60bE1f07da6Ec1cB8fE23d426e5831", + lite: true, + }, + deriPool: { + bTokenSymbol: "0xe60eaf5a997dfae83739e035b005a33afdcc6df5", + pool: "0x26bE73Bdf8C113F3630e4B766cfE6F0670Aa09cF", lite: true, }, - 'deriPool': { - 'bTokenSymbol': '0xe60eaf5a997dfae83739e035b005a33afdcc6df5', - 'pool': '0x9e2f5E284BEEb2C955987eD1EbB2149494CC1e41', - lite:true - } }; let polygonContracts = { - 'a': { - 'bTokenSymbol': '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', - 'pool': '0x6be39f5C04C837aE3c55bF19D10EC370c52Dc0ac' + a: { + bTokenSymbol: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + pool: "0x64195d64655A97023d78a69195D3ee15B8E1Dd13", }, - 'b': { - 'bTokenSymbol': '0xc2132d05d31c914a87c6611c10748aeb04b58e8f', - 'pool': '0x9C0033D74618BC081Aca8b5E4bf64574a8C5960E', - lite: true + b: { + bTokenSymbol: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + pool: "0xA8769A4Fb0Ca82eb474448B1683DCA3c79798B69", + lite: true, + }, + deriPool: { + bTokenSymbol: "0x3d1d2afd191b165d140e3e8329e634665ffb0e5e", + pool: "0xdDfCA16Cd80Ae3aeeb7C7ef743924Ac39A94cC9c", + lite: true, }, - 'deriPool':{ - 'bTokenSymbol': '0x3d1d2afd191b165d140e3e8329e634665ffb0e5e', - 'pool': '0x29e9dC4634bd9a8930FF07f4Fa2E1479CDF5d17F', - lite: true - } }; async function bsc(timestamp, ethBlock, chainBlocks) { let balances = {}; - const transform = a=>`bsc:${a}` + const transform = (a) => `bsc:${a}`; for ([key, contract] of Object.entries(bscContracts)) { - if(contract.lite === true){ - await perpetualPoolLite(chainBlocks['bsc'], 'bsc', contract.pool, - contract.bTokenSymbol, balances, transform); + if (contract.lite === true) { + await perpetualPoolLite( + chainBlocks["bsc"], + "bsc", + contract.pool, + contract.bTokenSymbol, + balances, + transform + ); } else { - await perpetualPool(chainBlocks['bsc'], 'bsc', contract.pool, - balances, transform); + await perpetualPool( + chainBlocks["bsc"], + "bsc", + contract.pool, + balances, + transform + ); } - }; + } return balances; -}; +} async function polygon(timestamp, ethBlock, chainBlocks) { let balances = {}; - const transform = await transformPolygonAddress() + const transform = await transformPolygonAddress(); for ([key, contract] of Object.entries(polygonContracts)) { - if(contract.lite === true){ - await perpetualPoolLite(chainBlocks['polygon'], 'polygon', contract.pool, - contract.bTokenSymbol, balances, transform); + if (contract.lite === true) { + await perpetualPoolLite( + chainBlocks["polygon"], + "polygon", + contract.pool, + contract.bTokenSymbol, + balances, + transform + ); } else { - await perpetualPool(chainBlocks['polygon'], 'polygon', contract.pool, - balances, transform); + await perpetualPool( + chainBlocks["polygon"], + "polygon", + contract.pool, + balances, + transform + ); } - }; + } return balances; -}; +} // node test.js projects/deri/index.js module.exports = { bsc: { - tvl: bsc + tvl: bsc, }, - polygon:{ - tvl: polygon - } -} + polygon: { + tvl: polygon, + }, +}; From 83b076e378a12706d7b47b1f3053150b25f2b0d1 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 9 Dec 2021 10:53:40 +0000 Subject: [PATCH 306/393] DIKO price --- projects/arkadiko.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/projects/arkadiko.js b/projects/arkadiko.js index 5f7a8c35b0..6c7322a2ad 100644 --- a/projects/arkadiko.js +++ b/projects/arkadiko.js @@ -3,7 +3,12 @@ const axios = require("axios"); async function tvl() { let balances = {}; - const dikoPrice = 1; + const dikoPrice = ( + await retry( + async (bail) => + await axios.get("https://arkadiko-api.herokuapp.com/api/v1/tokens/diko") + ) + ).data["price_in_cents"]; const response = ( await retry( @@ -29,7 +34,7 @@ async function tvl() { delete balances["usda-token"]; balances["usd-coin"] = Number(balances["usd-coin"]) + - Number(balances["arkadiko-token"] / 10 ** 6) * dikoPrice; + Number(balances["arkadiko-token"] / 10 ** 8) * dikoPrice; delete balances["arkadiko-token"]; return balances; @@ -37,6 +42,8 @@ async function tvl() { module.exports = { misrepresentedTokens: true, - tvl, + stacks: { + tvl, + }, }; // node test.js projects/arkadiko.js From fc4fd2c3872a82c1c9916c6ebc41cd9cfd2c296b Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 9 Dec 2021 18:58:03 +0000 Subject: [PATCH 307/393] float --- projects/float-capital/index.js | 63 +++++++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/projects/float-capital/index.js b/projects/float-capital/index.js index 7c912a893e..e941963724 100644 --- a/projects/float-capital/index.js +++ b/projects/float-capital/index.js @@ -1,15 +1,56 @@ -const { sumTokens} = require('../helper/unwrapLPs') +const { sumTokens } = require("../helper/unwrapLPs"); -const vaults = ["0xce5da4bebBA980BeC39da5b118750A47a23D4B85", "0x595b1408C9c2BF121c7674E270Ca7aCc0bBf100C", "0x694c240e63CF60a2cD2d38d84D902744640AcCDA"] -const amDAI = "0x27f8d03b3a2196956ed754badc28d73be8830a6e" +const vaults = [ + "0xce5da4bebBA980BeC39da5b118750A47a23D4B85", + "0x595b1408C9c2BF121c7674E270Ca7aCc0bBf100C", + "0x694c240e63CF60a2cD2d38d84D902744640AcCDA", +]; +const amDAI = "0x27f8d03b3a2196956ed754badc28d73be8830a6e"; +const avaults = [ + "0xefE423827b87751f9EB91A90a78edc624601565b", + "0x621cda10820555adAe8506eeC296cB9621E491Ff", +]; +const avDAI = "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a"; +const DAI = "0xd586e7f844cea2f87f50152665bcbc2c279d8d70"; +const transforms = { + "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a": + "0x6b175474e89094c44da98b954eedeac495271d0f", // avDAI + "0xd586e7f844cea2f87f50152665bcbc2c279d8d70": + "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI +}; -async function tvl(time, ethBlock, chainBlocks){ - const balances = {} - await sumTokens(balances, vaults.map(v=>[amDAI, v]), chainBlocks.polygon, "polygon", addr=>`polygon:${addr}`) - return balances +async function polyTvl(time, ethBlock, chainBlocks) { + const balances = {}; + await sumTokens( + balances, + vaults.map((v) => [amDAI, v]), + chainBlocks.polygon, + "polygon", + (addr) => `polygon:${addr}` + ); + return balances; } -module.exports={ - tvl, - methodology: `Gets the tokens on markets` -} \ No newline at end of file +async function avaxTvl(time, ethBlock, chainBlocks) { + const balances = {}; + await sumTokens( + balances, + avaults.map((v) => [avDAI, v]), + chainBlocks.avax, + "avax", + (addr) => { + return transforms[addr.toLowerCase()] ?? `avax:${addr}`; + } + ); + return balances; +} +// node test.js projects/float-capital/index.js +module.exports = { + polygon: { + tvl: polyTvl, + }, + avax: { + tvl: avaxTvl, + }, + methodology: `Gets the tokens on markets`, +}; From 47504e7fd21027fdba7668339e6561d315b5c084 Mon Sep 17 00:00:00 2001 From: nemusona Date: Thu, 9 Dec 2021 14:04:39 -0600 Subject: [PATCH 308/393] ten finance --- projects/tenfinance/abi.json | 107 +++++++----- projects/tenfinance/index.js | 314 ++++++++++++++++++++++++++++------- 2 files changed, 314 insertions(+), 107 deletions(-) diff --git a/projects/tenfinance/abi.json b/projects/tenfinance/abi.json index 8fb62c1c18..1d6c7c161f 100644 --- a/projects/tenfinance/abi.json +++ b/projects/tenfinance/abi.json @@ -1,46 +1,61 @@ -{ - "wantLockedTotal": { - "inputs": [], - "name": "wantLockedTotal", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "poolLength": { - "inputs": [], - "name": "poolLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "poolInfo": { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "poolInfo", - "outputs": [ - { "internalType": "contract IERC20", "name": "want", "type": "address" }, - { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, - { - "internalType": "uint256", - "name": "lastRewardBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accAQUAPerShare", - "type": "uint256" - }, - { "internalType": "address", "name": "strat", "type": "address" } - ], - "stateMutability": "view", - "type": "function" - } - } - - - \ No newline at end of file +{ + "wantLockedTotal": { + "inputs": [], + "name": "wantLockedTotal", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, + "poolLength": { + "inputs": [], + "name": "poolLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "poolInfo": { + "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "name": "poolInfo", + "outputs": [ + { "internalType": "contract IERC20", "name": "want", "type": "address" }, + { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, + { + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accAQUAPerShare", + "type": "uint256" + }, + { "internalType": "address", "name": "strat", "type": "address" } + ], + "stateMutability": "view", + "type": "function" + }, + "token0": { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "token1": { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/tenfinance/index.js b/projects/tenfinance/index.js index f41b3cae2e..5c4479415b 100644 --- a/projects/tenfinance/index.js +++ b/projects/tenfinance/index.js @@ -1,61 +1,253 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); -const {unwrapUniswapLPs} = require('../helper/unwrapLPs') - -const tenFarmAddress= '0x264A1b3F6db28De4D3dD4eD23Ab31A468B0C1A96'; - -const replacements = { - "0xa8Bb71facdd46445644C277F9499Dd22f6F0A30C": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", //beltBNB -> wbnb - "0x9cb73F20164e399958261c289Eb5F9846f4D1404": "0x55d398326f99059ff775485246999027b3197955", // 4belt -> usdt - "0x51bd63F240fB13870550423D208452cA87c44444":"0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //beltBTC-> - "0xAA20E8Cb61299df2357561C2AC2e1172bC68bc25":"0x2170ed0880ac9a755fd29b2688956bd959f933f8", //beltETH-> -} - -async function tvl(timestamp, ethBlock,chainBlocks) { - let balances = {}; - - const poolLength = (await sdk.api.abi.call({ - target: tenFarmAddress, - abi: abi['poolLength'], - chain:'bsc', - })).output; - - const lps = [] - for(var i = 0 ; i < poolLength ; i++){ - const poolInfo = (await sdk.api.abi.call({ - target: tenFarmAddress, - abi: abi['poolInfo'], - chain:'bsc', - params:i - })).output; - - const strategyAddress = poolInfo['strat']; - const wantAddress = poolInfo['want'] - - const wantSymbol = await sdk.api.erc20.symbol(wantAddress, "bsc") - - const poolTVL = (await sdk.api.abi.call({ - target: strategyAddress, - abi: abi['wantLockedTotal'], - chain:'bsc' - })).output; - if(wantSymbol.output.endsWith('LP')){ - lps.push({ - token: wantAddress, - balance: poolTVL - }) - } else { - let addr = replacements[wantAddress] ?? wantAddress - sdk.util.sumSingleBalance(balances, 'bsc:'+addr, poolTVL) - } - } - await unwrapUniswapLPs(balances, lps, chainBlocks.bsc, 'bsc', addr=>`bsc:${addr}`) - return balances; -} - -module.exports = { - bsc:{ - tvl, - }, - tvl -} +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); + +const tenFarmAddress = "0x264A1b3F6db28De4D3dD4eD23Ab31A468B0C1A96"; +const tenVault = "0xC2fB710D39f1D116FD3A70789381a3699Ff9fce0"; +const tenfi = "0xd15c444f1199ae72795eba15e8c1db44e47abf62"; + +const replacements = { + "0xa8bb71facdd46445644c277f9499dd22f6f0a30c": + "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", //beltBNB -> wbnb + "0x9cb73f20164e399958261c289eb5f9846f4d1404": + "bsc:0x55d398326f99059ff775485246999027b3197955", // 4belt -> usdt + "0x51bd63f240fb13870550423d208452ca87c44444": + "bsc:0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c", //beltBTC-> + "0xaa20e8cb61299df2357561c2ac2e1172bc68bc25": + "bsc:0x2170ed0880ac9a755fd29b2688956bd959f933f8", //beltETH-> + "0x13ab6739368a4e4abf24695bf52959224367391f": + "0x25f8087ead173b73d6e8b84329989a8eea16cf73", //YGG +}; + +async function tvl(timestamp, block, chainBlocks) { + let balances = {}; + + const poolLength = ( + await sdk.api.abi.call({ + target: tenFarmAddress, + abi: abi["poolLength"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + let lps = []; + let single = []; + + const poolInfos = ( + await sdk.api.abi.multiCall({ + calls: Array.from({ length: Number(poolLength) }, (_, k) => ({ + target: tenFarmAddress, + params: k, + })), + abi: abi["poolInfo"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const lockedTotals = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.strat, + })), + abi: abi["wantLockedTotal"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const symbols = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.want, + })), + abi: "erc20:symbol", + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const token0Tokens = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.want, + })), + abi: abi["token0"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const token1Tokens = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.want, + })), + abi: abi["token1"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + for (let i = 0; i < poolInfos.length; i++) { + const symbol = symbols[i].output; + const balance = lockedTotals[i].output; + const token = poolInfos[i].output.want; + if (symbol === null || balance === null || token === null) continue; + if (symbol.endsWith("LP")) { + const token0 = token0Tokens[i].output.toLowerCase(); + const token1 = token1Tokens[i].output.toLowerCase(); + if (token0 === tenfi || token1 === tenfi) continue; + lps.push({ + balance, + token, + }); + } else { + if (symbol === "TENFI") continue; + single.push({ + balance, + token, + }); + } + } + + await unwrapUniswapLPs(balances, lps, chainBlocks.bsc, "bsc", (addr) => { + if (replacements[addr.toLowerCase()] !== undefined) { + return replacements[addr.toLowerCase()]; + } + return `bsc:${addr}`; + }); + + single.forEach((p) => { + let token = p.token; + if (replacements[token.toLowerCase()] !== undefined) { + token = replacements[token.toLowerCase()]; + sdk.util.sumSingleBalance(balances, `${token}`, p.balance); + } else { + sdk.util.sumSingleBalance(balances, `bsc:${token}`, p.balance); + } + }); + + return balances; +} + +async function pool2(timestamp, block, chainBlocks) { + let balances = {}; + + const poolLength = ( + await sdk.api.abi.call({ + target: tenFarmAddress, + abi: abi["poolLength"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + let lps = []; + + const poolInfos = ( + await sdk.api.abi.multiCall({ + calls: Array.from({ length: Number(poolLength) }, (_, k) => ({ + target: tenFarmAddress, + params: k, + })), + abi: abi["poolInfo"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const lockedTotals = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.strat, + })), + abi: abi["wantLockedTotal"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const symbols = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.want, + })), + abi: "erc20:symbol", + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const token0Tokens = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.want, + })), + abi: abi["token0"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + const token1Tokens = ( + await sdk.api.abi.multiCall({ + calls: poolInfos.map((p) => ({ + target: p.output.want, + })), + abi: abi["token1"], + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + + for (let i = 0; i < poolInfos.length; i++) { + const symbol = symbols[i].output; + const balance = lockedTotals[i].output; + const token = poolInfos[i].output.want; + if (symbol === null || balance === null || token === null) continue; + if (symbol.endsWith("LP")) { + const token0 = token0Tokens[i].output; + const token1 = token1Tokens[i].output; + if (token0.toLowerCase() === tenfi || token1.toLowerCase() === tenfi) { + lps.push({ + balance, + token, + }); + } + } + } + + await unwrapUniswapLPs(balances, lps, chainBlocks.bsc, "bsc", (addr) => { + if (replacements[addr.toLowerCase()] !== undefined) { + return replacements[addr.toLowerCase()]; + } + return `bsc:${addr}`; + }); + + return balances; +} + +async function staking(timestamp, block, chainBlocks) { + let balances = {}; + let balance = ( + await sdk.api.erc20.balanceOf({ + target: tenfi, + owner: tenVault, + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + sdk.util.sumSingleBalance(balances, `bsc:${tenfi}`, balance); + return balances; +} + +module.exports = { + bsc: { + tvl, + pool2, + staking, + }, + tvl, +}; From cef9b0a8758d267b9732f607e08b0f1c72c9acbe Mon Sep 17 00:00:00 2001 From: BlazeWasHere Date: Thu, 9 Dec 2021 20:05:31 +0000 Subject: [PATCH 309/393] add avax neth pool --- projects/synapse/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/projects/synapse/index.js b/projects/synapse/index.js index f6385cf583..14c6a00d94 100644 --- a/projects/synapse/index.js +++ b/projects/synapse/index.js @@ -123,6 +123,9 @@ const DATA = { metapool: "0xf44938b0125a6662f9536281ad2cd6c499f22004", }, bridge: "0xc05e61d0e7a63d27546389b7ad62fdff5a91aace", + ethPool: "0x77a7e60555bC18B4Be44C181b2575eee46212d44", + // Well this is really Aave Avalanche Market WETH + weth: "0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21", bridgeAssets: [ "0xf1293574ee43950e7a8c9f1005ff097a9a713959", // NFD "0x321e7092a180bb43555132ec53aaa65a5bf84251", // gOHM @@ -240,6 +243,8 @@ const misrepresentedTokensMap = { // gOHM (MOVR) -> gOHM (ETH) "0x3bf21ce864e58731b6f28d68d5928bcbeb0ad172": "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f", + // avWETH (AVAX) -> WETH (ETH) + "0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21": WETH, }; const sumLegacyPools = async (balances, block, chain, transform) => { From b9ab7a58adc9ca174d7509436785e6272eec9643 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 9 Dec 2021 21:19:12 +0000 Subject: [PATCH 310/393] remove duplicates and unused --- projects/XDC/index.js | 24 ---- projects/babypigfinance/abi.json | 1 - projects/babypigfinance/index.js | 26 ----- projects/phoenixNew/abi.json | 53 --------- projects/phoenixNew/index.js | 132 --------------------- projects/pstake/index.js | 109 ------------------ projects/snowswap/abis/herc20.json | 23 ---- projects/snowswap/abis/yerc20.json | 32 ------ projects/snowswap/index.js | 177 ----------------------------- 9 files changed, 577 deletions(-) delete mode 100644 projects/XDC/index.js delete mode 100644 projects/babypigfinance/abi.json delete mode 100644 projects/babypigfinance/index.js delete mode 100644 projects/phoenixNew/abi.json delete mode 100644 projects/phoenixNew/index.js delete mode 100644 projects/pstake/index.js delete mode 100644 projects/snowswap/abis/herc20.json delete mode 100644 projects/snowswap/abis/yerc20.json delete mode 100644 projects/snowswap/index.js diff --git a/projects/XDC/index.js b/projects/XDC/index.js deleted file mode 100644 index 49d736a789..0000000000 --- a/projects/XDC/index.js +++ /dev/null @@ -1,24 +0,0 @@ -//https://xdc.blocksscan.io/api/accounts/xdc0000000000000000000000000000000000000088 -//npm install axios@0.21.1 - -// Date/Time headers/date -// TVL data/balanceNumber -// Block - -const axios = require('axios'); - -async function tvl(price) { - try { - const response = await axios.get('https://xdc.blocksscan.io/api/accounts/xdc0000000000000000000000000000000000000088'); - var logString = ("{Total TVL: "+response.data.balanceNumber*price+ ", Timestamp: " +Date.parse(response.headers.date)+ "}") - console.log(logString); - } catch (error) { - console.error(error); - } -} - -module.exports = { - tvl - } - -tvl(0.08686) \ No newline at end of file diff --git a/projects/babypigfinance/abi.json b/projects/babypigfinance/abi.json deleted file mode 100644 index 589dd99661..0000000000 --- a/projects/babypigfinance/abi.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"contract fBabypigToken","name":"_fbabypig","type":"address"},{"internalType":"address","name":"_devaddr","type":"address"},{"internalType":"address","name":"_feeAddress","type":"address"},{"internalType":"uint256","name":"_FbabypigPerSecond","type":"uint256"},{"internalType":"uint256","name":"_startTime","type":"uint256"}],"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"}],"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"}],"name":"EmergencyWithdraw","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":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SetDevAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"newAddress","type":"address"}],"name":"SetFeeAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"FbabypigPerSecond","type":"uint256"}],"name":"UpdateEmissionRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newStartTime","type":"uint256"}],"name":"UpdateStartTime","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":"Withdraw","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"address","name":"lpToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositFeeBP","type":"uint256"}],"name":"addPool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"pid","type":"uint256"},{"indexed":false,"internalType":"address","name":"lpToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"allocPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"depositFeeBP","type":"uint256"}],"name":"setPool","type":"event"},{"inputs":[],"name":"FbabypigPerSecond","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_EMISSION_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"contract IBEP20","name":"_lpToken","type":"address"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"devaddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"fbabypig","outputs":[{"internalType":"contract fBabypigToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"},{"internalType":"uint256","name":"_to","type":"uint256"}],"name":"getMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"massUpdatePools","outputs":[],"stateMutability":"nonpayable","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":"pendingFbabypig","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IBEP20","name":"","type":"address"}],"name":"poolExistence","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"poolInfo","outputs":[{"internalType":"contract IBEP20","name":"lpToken","type":"address"},{"internalType":"uint256","name":"allocPoint","type":"uint256"},{"internalType":"uint256","name":"lastRewardSecond","type":"uint256"},{"internalType":"uint256","name":"accFbabypigPerShare","type":"uint256"},{"internalType":"uint16","name":"depositFeeBP","type":"uint16"},{"internalType":"uint256","name":"lpSupply","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"poolLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_allocPoint","type":"uint256"},{"internalType":"uint16","name":"_depositFeeBP","type":"uint16"},{"internalType":"bool","name":"_withUpdate","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_devaddr","type":"address"}],"name":"setDevAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","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":"_FbabypigPerSecond","type":"uint256"}],"name":"updateEmissionRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"}],"name":"updatePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newStartTime","type":"uint256"}],"name":"updateStartTime","outputs":[],"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":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_pid","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/projects/babypigfinance/index.js b/projects/babypigfinance/index.js deleted file mode 100644 index c6f62c0dd7..0000000000 --- a/projects/babypigfinance/index.js +++ /dev/null @@ -1,26 +0,0 @@ -const abi = require("./abi.json"); -const { transformFantomAddress } = require("../helper/portedTokens"); -const { addFundsInMasterChef } = require("../helper/masterchef"); -const { staking } = require("../helper/staking"); -const { pool2 } = require('../helper/pool2') - - -const chef = "0x7f8ECcC1437aaCEFE533A6f1BfE2144b1d0d7D35" -const fbabypig = "0x3a76b1b3e827cc7350e66a854eced871a81a3527" -const fbabypigFtmLP = "0xc56a420486f547a5adc1dd64b4a13051baa4a8e0" - -async function tvl(timestamp, block, chainBlocks) { - const balances = {} - const transformAddress = await transformFantomAddress(); - await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [fbabypig, fbabypigFtmLP]) - return balances; -} - -module.exports = { - methodology: "TVL includes all farms in MasterChef contract", - fantom:{ - staking: staking(chef, fbabypig, "fantom"), - pool2: pool2(chef, fbabypigFtmLP, "fantom"), - tvl - }, -} \ No newline at end of file diff --git a/projects/phoenixNew/abi.json b/projects/phoenixNew/abi.json deleted file mode 100644 index 358abf0a3a..0000000000 --- a/projects/phoenixNew/abi.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "getPrice": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getTotalCollateral": { - "constant": true, - "inputs": [], - "name": "getTotalCollateral", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getCollateralPoolAddress": { - "constant": true, - "inputs": [], - "name": "getCollateralPoolAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/phoenixNew/index.js b/projects/phoenixNew/index.js deleted file mode 100644 index 72a46c3ce3..0000000000 --- a/projects/phoenixNew/index.js +++ /dev/null @@ -1,132 +0,0 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); -const BN = require("bignumber.js"); - -const Web3 = require('web3'); - -var polyWeb3 = new Web3(new Web3.providers.HttpProvider("https://rpc-mainnet.maticvigil.com/")); -var bscWeb3 = new Web3(new Web3.providers.HttpProvider("https://bsc-dataseed.binance.org/")); -var wanWeb3 = new Web3(new Web3.providers.HttpProvider("https://gwan-ssl.wandevs.org:56891/")); - -const leverFactoryAbi = [{"inputs":[{"internalType":"address","name":"multiSignature","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"leveragePool","type":"address"},{"indexed":true,"internalType":"address","name":"tokenA","type":"address"},{"indexed":true,"internalType":"address","name":"tokenB","type":"address"},{"indexed":false,"internalType":"uint256","name":"leverageRatio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"leverageRebaseWorth","type":"uint256"}],"name":"CreateLeveragePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"stakePool","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"interestrate","type":"uint256"}],"name":"CreateStakePool","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"bytes32","name":"msgHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value1","type":"uint256"}],"name":"DebugEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"},{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"}],"name":"OperatorTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOrigin","type":"address"},{"indexed":true,"internalType":"address","name":"newOrigin","type":"address"}],"name":"OriginTransferred","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"},{"constant":true,"inputs":[],"name":"LeveragePoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MinePoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PPTTimeLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PPTTokenID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"baseCoinName","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"buyFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint64","name":"leverageRatio","type":"uint64"},{"internalType":"uint256","name":"leverageRebaseWorth","type":"uint256"}],"name":"createLeveragePool","outputs":[{"internalType":"address payable","name":"_leveragePool","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint64","name":"_interestrate","type":"uint64"}],"name":"createStatePool","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAllLeveragePool","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAllStakePool","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"leverageRatio","type":"uint256"}],"name":"getLeveragePool","outputs":[{"internalType":"address","name":"_stakePoolA","type":"address"},{"internalType":"address","name":"_stakePoolB","type":"address"},{"internalType":"address","name":"_leveragePool","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getMultiSignatureAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getOperator","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"getStakePool","outputs":[{"internalType":"address","name":"_stakePool","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"implementationVersion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_swapRouter","type":"address"},{"internalType":"address","name":"_SwapLib","type":"address"},{"internalType":"uint64","name":"_rebalanceInterval","type":"uint64"},{"internalType":"uint64","name":"_buyFee","type":"uint64"},{"internalType":"uint64","name":"_sellFee","type":"uint64"},{"internalType":"uint64","name":"_rebalanceFee","type":"uint64"},{"internalType":"uint64","name":"_rebaseThreshold","type":"uint64"},{"internalType":"uint64","name":"_liquidateThreshold","type":"uint64"},{"internalType":"uint64","name":"_interestInflation","type":"uint64"}],"name":"initFactoryInfo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"interestInflation","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastRebalance","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"leveragePoolMap","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"liquidateThreshold","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ownerExpiredTime","outputs":[{"internalType":"uint256","name":"_expired","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"phxOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"phxSwapLib","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proxyinfoMap","outputs":[{"internalType":"address","name":"implementation","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"rebalanceAll","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"rebalanceFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebalanceInterval","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebasePoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebaseThreshold","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"rebaseTimeLimit","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"sellFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"_feeAddress","type":"address"}],"name":"setFeeAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_baseCoinName","type":"string"},{"internalType":"address payable","name":"_feeAddress","type":"address"},{"internalType":"address","name":"rebaseOperator","type":"address"},{"internalType":"address","name":"_stakePoolImpl","type":"address"},{"internalType":"address","name":"_leveragePoolImpl","type":"address"},{"internalType":"address","name":"_PPTCoinImpl","type":"address"},{"internalType":"address","name":"_rebaseTokenImpl","type":"address"},{"internalType":"address","name":"acceleratedMinePool","type":"address"},{"internalType":"address","name":"PHXVestingPool","type":"address"},{"internalType":"address","name":"_phxOracle","type":"address"}],"name":"setImplementAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint64","name":"rate","type":"uint64"}],"name":"setInterestRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint64","name":"_buyFee","type":"uint64"},{"internalType":"uint64","name":"_sellFee","type":"uint64"},{"internalType":"uint64","name":"_rebalanceFee","type":"uint64"}],"name":"setLeverageFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newManager","type":"address"}],"name":"setManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"newAddress","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_phxOracle","type":"address"}],"name":"setOracleAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_PHXVestingPool","type":"address"}],"name":"setPHXVestingPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint32","name":"_PPTTimeLimit","type":"uint32"}],"name":"setPPTTimeLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint64","name":"interval","type":"uint64"}],"name":"setRebalanceInterval","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint32","name":"_rebaseTimeLimit","type":"uint32"}],"name":"setRebaseTimeLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_swapLib","type":"address"}],"name":"setSwapLibAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_swapRouter","type":"address"}],"name":"setSwapRouterAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"stakePoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakePoolMap","outputs":[{"internalType":"address payable","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"swapRouter","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOrigin","type":"address"}],"name":"transferOrigin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"txOrigin","outputs":[{"internalType":"address","name":"_origin","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"update","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgradePhxProxy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"version_","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vestingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]; -const optionFactoryAbi = [{"inputs":[{"internalType":"address","name":"multiSignature","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"optionsManager","type":"address"},{"indexed":false,"internalType":"address","name":"collateralPool","type":"address"},{"indexed":false,"internalType":"address","name":"optionsPool","type":"address"},{"indexed":false,"internalType":"address","name":"pptCoin","type":"address"}],"name":"CreateOptionsManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"bytes32","name":"msgHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value1","type":"uint256"}],"name":"DebugEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOperator","type":"address"},{"indexed":true,"internalType":"address","name":"newOperator","type":"address"},{"indexed":true,"internalType":"uint256","name":"index","type":"uint256"}],"name":"OperatorTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOrigin","type":"address"},{"indexed":true,"internalType":"address","name":"newOrigin","type":"address"}],"name":"OriginTransferred","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"},{"constant":true,"inputs":[],"name":"MinePoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PPTTimeLimit","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PPTTokenID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PPTname","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"baseCoinName","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"collateralPoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"collateral","type":"address[]"},{"internalType":"uint256[]","name":"rate","type":"uint256[]"},{"internalType":"uint32[]","name":"underlyings","type":"uint32[]"}],"name":"createOptionsManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getMultiSignatureAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getOperator","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getOptionsMangerAddress","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getOptionsMangerLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"implementationVersion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[],"name":"impliedVolatility","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"operator","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"optionsCal","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"optionsManagerID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"optionsPoolID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"optionsPrice","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ownerExpiredTime","outputs":[{"internalType":"uint256","name":"_expired","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"phxOracle","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"proxyinfoMap","outputs":[{"internalType":"address","name":"implementation","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_baseCoinName","type":"string"},{"internalType":"address","name":"_operatorAddr","type":"address"},{"internalType":"address","name":"_optionsCalImpl","type":"address"},{"internalType":"address","name":"_optionsPoolImpl","type":"address"},{"internalType":"address","name":"_collateralPoolImpl","type":"address"},{"internalType":"address","name":"_optionsManagerImpl","type":"address"},{"internalType":"address","name":"_PPTCoinImpl","type":"address"},{"internalType":"address","name":"acceleratedMinePool","type":"address"},{"internalType":"address","name":"phxVestingPool","type":"address"},{"internalType":"address","name":"_phxOracle","type":"address"},{"internalType":"address","name":"_volatility","type":"address"},{"internalType":"address","name":"_optionsPrice","type":"address"}],"name":"setImplementAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newManager","type":"address"}],"name":"setManager","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"newAddress","type":"address"}],"name":"setOperator","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_phxOracle","type":"address"}],"name":"setOracleAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_PHXVestingPool","type":"address"}],"name":"setPHXVestingPool","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint32","name":"_PPTTimeLimit","type":"uint32"}],"name":"setPPTTimeLimit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOrigin","type":"address"}],"name":"transferOrigin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"txOrigin","outputs":[{"internalType":"address","name":"_origin","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"update","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"address","name":"implementation","type":"address"}],"name":"upgradePhxProxy","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"version_","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"vestingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"}]; -const optionManagerAbi = [{"inputs":[{"internalType":"address","name":"multiSignature","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"collateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"AddCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"settlement","type":"address"},{"indexed":false,"internalType":"uint256","name":"optionPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"optionAmount","type":"uint256"}],"name":"BuyOption","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value1","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value2","type":"uint256"}],"name":"DebugEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":false,"internalType":"bytes32","name":"msgHash","type":"bytes32"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value1","type":"uint256"}],"name":"DebugEvent","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sellValue","type":"uint256"}],"name":"ExerciseOption","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOrigin","type":"address"},{"indexed":true,"internalType":"address","name":"newOrigin","type":"address"}],"name":"OriginTransferred","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":"address","name":"from","type":"address"},{"indexed":false,"internalType":"address","name":"collateral","type":"address"},{"indexed":false,"internalType":"uint256","name":"allRedeem","type":"uint256"}],"name":"RedeemCollateral","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"sellValue","type":"uint256"}],"name":"SellOption","type":"event"},{"constant":false,"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addCollateral","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addressPermission","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"settlement","type":"address"},{"internalType":"uint256","name":"settlementAmount","type":"uint256"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint32","name":"underlying","type":"uint32"},{"internalType":"uint32","name":"expiration","type":"uint32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"optType","type":"uint8"}],"name":"buyOption","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"calCollateralWorth","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"underlyingPrice","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"optType","type":"uint8"}],"name":"calOptionsOccupied","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"calculateCollateralRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"tmpAddress","type":"address"},{"internalType":"uint256","name":"state","type":"uint256"}],"name":"checkAddressPermission","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"collateralPool","outputs":[{"internalType":"contract ICollateralPool","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"optionsId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"exerciseOption","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getAllRealBalance","outputs":[{"internalType":"int256[]","name":"","type":"int256[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAvailableCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"collateral","type":"address"}],"name":"getCollateralRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getCollateralWhiteList","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getInputAmountRange","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getLeftCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getMultiSignatureAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"settlement","type":"address"}],"name":"getNetWorthBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getOccupiedCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"underlyingPrice","type":"uint256"},{"internalType":"uint256","name":"strikePrice","type":"uint256"},{"internalType":"uint256","name":"expiration","type":"uint256"},{"internalType":"uint32","name":"underlying","type":"uint32"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint8","name":"optType","type":"uint8"}],"name":"getOptionsPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getOracleAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getPriceRateRange","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"settlement","type":"address"}],"name":"getRealBalance","outputs":[{"internalType":"int256","name":"","type":"int256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTokenNetworth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTotalCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getUnlockedCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserPayingUsd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUserTotalWorth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"implementationVersion","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":false,"inputs":[{"internalType":"address[]","name":"collateral","type":"address[]"},{"internalType":"uint256[]","name":"rate","type":"uint256[]"},{"internalType":"address","name":"oracleAddr","type":"address"},{"internalType":"address","name":"optionsPriceAddr","type":"address"},{"internalType":"address","name":"optionsPoolAddr","type":"address"},{"internalType":"address","name":"collateralPoolAddr","type":"address"},{"internalType":"address","name":"PPTCoinAddr","type":"address"}],"name":"initAddresses","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"isInputAmountInRange","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxPriceRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"minPriceRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"addAddress","type":"address"},{"internalType":"uint256","name":"permission","type":"uint256"}],"name":"modifyPermission","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"optionsPool","outputs":[{"internalType":"contract IOptionsPool","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"optionsPrice","outputs":[{"internalType":"contract IOptionsPrice","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"_owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"ownerExpiredTime","outputs":[{"internalType":"uint256","name":"_expired","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"pptCoin","outputs":[{"internalType":"contract IPPTCoin","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"},{"internalType":"address","name":"collateral","type":"address"}],"name":"redeemCollateral","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_collateralPool","type":"address"}],"name":"setCollateralPoolAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"collateral","type":"address"},{"internalType":"uint256","name":"colRate","type":"uint256"}],"name":"setCollateralRate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"bool","name":"halt","type":"bool"}],"name":"setHalt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"uint256","name":"_maxAmount","type":"uint256"}],"name":"setInputAmountRange","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_optionsPool","type":"address"}],"name":"setOptionsPoolAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_optionsPrice","type":"address"}],"name":"setOptionsPriceAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"oracle","type":"address"}],"name":"setOracleAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"_minPriceRate","type":"uint256"},{"internalType":"uint256","name":"_maxPriceRate","type":"uint256"}],"name":"setPriceRateRange","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOrigin","type":"address"}],"name":"transferOrigin","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"txOrigin","outputs":[{"internalType":"address","name":"_origin","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"update","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"collateral","type":"address"}],"name":"userInputCollateral","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"version_","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]; - -const wanOptionFactory = "0x74ffba6ee96399b2a31175c26dc28be8a9ffc4f0"; -const wanLeverFactory = "0x3d5bdb8c7a4f8fc044aab414b38151e7e51feeb0"; - -const wanOptionFactorySc = new wanWeb3.eth.Contract(optionFactoryAbi,wanOptionFactory); -const wanLeverFactorySc = new wanWeb3.eth.Contract(leverFactoryAbi,wanLeverFactory); - -async function getTotalCollateral(pools, chain, block) { - const balances = {}; - // Need to be called separately because BUSDT rejects when multicalled on BSC - await Promise.all(pools.map(pool => - sdk.api.erc20.balanceOf({ - target: pool[1], - owner: pool[0], - chain, - block - }).then(result => sdk.util.sumSingleBalance(balances, pool[2], result.output)) - )) - return balances -} - - - -var wanPools = []; -var wanTokenMap = new Map(); -wanTokenMap['0x11e77E27Af5539872efEd10abaA0b408cfd9fBBD'] = '0xdac17f958d2ee523a2206206994597c13d831ec7'; -wanTokenMap['0x52A9CEA01c4CBDd669883e41758B8eB8e8E2B34b'] = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'; - -async function wan(timestamp, ethBlock, chainBlocks) { - let managerLen = await wanOptionFactorySc.methods.getOptionsMangerLength().call(); - //console.log(managerLen); - for(var i=0;i { - sdk.util.sumSingleBalance(balances, balance[0], balance[1]) - }) -} - - - -async function tvl(timestamp, block, chainBlocks) { - const balances = {} - await Promise.all([ - //eth(timestamp, block, chainBlocks), - // bsc(timestamp, block, chainBlocks), - wan(timestamp, block, chainBlocks), - ]).then(poolBalances => poolBalances.forEach(pool=>mergeBalances(balances, pool))) - return balances -} - -module.exports = { - // ethereum: { - // tvl: eth, - // }, - // bsc: { - // tvl: bsc, - // }, - wan: { - tvl: wan, - }, - tvl -} \ No newline at end of file diff --git a/projects/pstake/index.js b/projects/pstake/index.js deleted file mode 100644 index 6ed63d54c7..0000000000 --- a/projects/pstake/index.js +++ /dev/null @@ -1,109 +0,0 @@ -const BigNumber = require("bignumber.js"); -const { request, gql } = require("graphql-request"); -const sdk = require("@defillama/sdk"); - -// chains with staking component: - -// ATOM -const stkATOMContract = "0x44017598f2AF1bD733F9D87b5017b4E7c1B28DDE"; -const stkATOMContractWithoutChecksum = - "0x44017598f2af1bd733f9d87b5017b4e7c1b28dde"; -const pATOMContract = "0x446E028F972306B5a2C36E81D3d088Af260132B3"; - -// XPRT -const stkXPRTContract = "0x45e007750Cc74B1D2b4DD7072230278d9602C499"; -const stkXPRTContractWithoutChecksum = - "0x45e007750cc74b1d2b4dd7072230278d9602c499"; -const pXPRTContract = "0x8793cD84c22B94B1fDD3800f02C4B1dcCa40D50b"; -// --- - -// stk contract array for Staking calculation -let stkContractArray = [ - stkATOMContractWithoutChecksum, - stkXPRTContractWithoutChecksum, -]; - -let pStakeContractArray = [ - stkATOMContract, - pATOMContract, - stkXPRTContract, - pXPRTContract, -]; - -const sushiGraphUrl = - "https://api.thegraph.com/subgraphs/name/sushiswap/exchange"; - -// graphQL query to only get the Staking Contract section of the TVL (pool2) - -const sushiGraphQuery = gql` - query pstakePairs($stkContract: String, $block: Int) { - pairs(where: { token0: $stkContract }, block: { number: $block }) { - reserve0 - token0 { - decimals - } - } - } -`; - -async function eth(timestamp, block) { - let balances = {}; - - // get the total supply of each token - const totalSupplyValues = await sdk.api.abi.multiCall({ - abi: "erc20:totalSupply", - calls: pStakeContractArray.map((t) => ({ target: t })), - block, - }); - - // add the total supply values individually to the balances object - totalSupplyValues.output.forEach((call, index) => { - const underlyingToken = pStakeContractArray[index]; - const underlyingTokenBalance = call.output; - sdk.util.sumSingleBalance( - balances, - underlyingToken, - underlyingTokenBalance - ); - }); - - // console.log("balances eth: ", balances); - return balances; -} - -async function pool2(timestamp, block) { - let balances = {}; - - for (let index = 0; index < stkContractArray.length; index++) { - const { pairs } = await request(sushiGraphUrl, sushiGraphQuery, { - stkContract: stkContractArray[index], - block: block, - }); - let reserve0BN = BigNumber(pairs[0].reserve0); - let decimals = Number(pairs[0].token0.decimals); - - const underlyingToken = stkContractArray[index]; - const underlyingTokenBalance = reserve0BN.shiftedBy(decimals).toString(); - // console.log("underlying balance: ", underlyingTokenBalance); - sdk.util.sumSingleBalance( - balances, - underlyingToken, - underlyingTokenBalance - ); - } - - // console.log("balances pool2: ", balances); - - return balances; -} - -module.exports = { - methodology: `We get the totalSupply of the constituent token contracts (like stkATOM, pATOM, stkXPRT, pXPRT etc.) and then we multiply it with the USD market value of the constituent token`, - ethereum: { - tvl: eth, - }, - pool2: { - tvl: pool2, - }, - // tvl: sdk.util.sumChainTvls([eth]), -}; diff --git a/projects/snowswap/abis/herc20.json b/projects/snowswap/abis/herc20.json deleted file mode 100644 index 18af3e9050..0000000000 --- a/projects/snowswap/abis/herc20.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "underlyingBalanceWithInvestmentForHolder": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "holder", - "type": "address" - } - ], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/snowswap/abis/yerc20.json b/projects/snowswap/abis/yerc20.json deleted file mode 100644 index 624ef2fadb..0000000000 --- a/projects/snowswap/abis/yerc20.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "token": { - "constant": true, - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getPricePerFullShare": { - "constant": true, - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/snowswap/index.js b/projects/snowswap/index.js deleted file mode 100644 index 61a4c93d28..0000000000 --- a/projects/snowswap/index.js +++ /dev/null @@ -1,177 +0,0 @@ -/*================================================== - Modules - ==================================================*/ - -const sdk = require("@defillama/sdk"); -const _ = require("underscore"); -const BN = require("bignumber.js"); - -// const abi1 = require("./abis/v1abi.json"); -// const abi2 = require("./abis/v2abi.json"); -const yerc20 = require("./abis/yerc20.json"); -const herc20 = require("./abis/herc20.json"); - -/*================================================== - Constants - ==================================================*/ - -const etherAddress = "0x0000000000000000000000000000000000000000"; -const fDai = "0xab7FA2B2985BCcfC13c6D86b1D5A17486ab1e04C"; - -async function getYprice(block, coin, amount) { - let token = await sdk.api.abi.call({ - block, - target: coin, - abi: yerc20["token"], - }); - token = token.output; - - let price = await sdk.api.abi.call({ - block, - target: coin, - abi: yerc20["getPricePerFullShare"], - }); - price = price.output; - return { token, price: amount.times(BN(price).div(1e18)) }; -} -/*================================================== - TVL - ==================================================*/ -async function tvl(timestamp, block) { - let blocks = [10867618, 11409366, 11662074, 12089837]; - let Pools = { - "0x4571753311E37dDb44faA8Fb78a6dF9a6E3c6C0B": { - // yVault USD - "0xACd43E627e64355f1861cEC6d3a6688B31a6F952": BN(0), //yDAI - "0x597aD1e0c13Bfe8025993D9e79C69E1c0233522e": BN(0), //yUSDC - "0x2f08119C6f07c006695E079AAFc638b8789FAf18": BN(0), //yUSDT - "0x37d19d1c4E1fa9DC47bD1eA12f742a0887eDa74a": BN(0), //yTUSD - }, - "0xBf7CCD6C446acfcc5dF023043f2167B62E81899b": { - // yVault Curve - "0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c": BN(0), //yCRV - "0x2994529C0652D127b7842094103715ec5299bBed": BN(0), //yBCRV - }, - "0xeF034645b9035C106acC04cB6460049D3c95F9eE": { - // btcsnow - "0x7Ff566E1d69DEfF32a7b244aE7276b9f90e9D0f6": BN(0), //YcrvRenWSBTC - "0x9aA8F427A17d6B0d91B6262989EdC7D45d6aEdf8": BN(0), //FcrvRENWBTC - }, - "0x16BEa2e63aDAdE5984298D53A4d4d9c09e278192": { - // eth2snow - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": BN(0), //wEth - "0x898BAD2774EB97cF6b94605677F43b41871410B1": BN(0), // vEth2 - "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb": BN(0), //aETHB - "0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd": BN(0), //crETH2 - }, - "0x8470281f5149eb282cE956D8C0E4f2EbBC0C21FC": { - // fUSD - "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": BN(0), //USDC - [fDai]: BN(0), //fDai - "0xf0358e8c3CD5Fa238a29301d0bEa3D63A17bEdBE": BN(0), //fUSDC - "0x053c80eA73Dc6941F518a68E2FC52Ac45BDE7c9C": BN(0), //fUSDT - }, - }; - //construct balances data for every token - let tokenBalances = {}; - for (let pool in Pools) { - for (let coin in Pools[pool]) { - const bal = await sdk.api.abi.call({ - block, - target: coin, - abi: "erc20:balanceOf", - params: pool, - }); - if (bal && bal.output) { - Pools[pool][coin] = BN(bal.output); - } - } - } - - var output = {}; - //construct price(TVL) data by unwrapping Yearn & Farm assets - for (const [index, [key, value]] of Object.entries(Object.entries(Pools))) { - if (index == 0 || index == 1) { - // pool 0 & 1 - for (let coin in Pools[key]) { - // Get yVault's balances in underlying token - if (index == 1) { - if (block <= blocks[0]) { - continue; - } - } - let p = await getYprice(block, coin, Pools[key][coin]); - if (p.token === "0x3B3Ac5386837Dc563660FB6a0937DFAa5924333B") { - output["0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8"] = output[ - "0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8" - ].plus(p.price); - } else { - output[p.token] = p.price; - } - } - } else if (index == 2) { - //pool 2 - for (let coin in Pools[key]) { - if (block <= blocks[1]) { - continue; - } - if (coin == "0x7Ff566E1d69DEfF32a7b244aE7276b9f90e9D0f6") { - let p = await getYprice(block, coin, Pools[key][coin]); - output[p.token] = p.price; - } else { - // harvest btc - // as crvRenBtc; - let underlyingBal = await sdk.api.abi.call({ - block, - target: coin, - abi: herc20["underlyingBalanceWithInvestmentForHolder"], - params: key, - }); - output["0x49849C98ae39Fff122806C06791Fa73784FB3675"] = BN( - underlyingBal.output - ); // asset: renbtc - } - } - } else if (index == 3) { - //pool 3 - //eth2snow pool has tvl in Eth, cumulatively. Staked eth price's fluctuates but currently there is no way to provide that information. - //please improve this part later. - if (block <= blocks[2]) { - continue; - } - output[etherAddress] = Object.values(Pools[key]).reduce( - (accumulator, currentValue) => BN(accumulator.plus(currentValue)), - BN(0) - ); - } else if (index == 4) { - //pool 4 - //fUSD pool has tvl in USDC, cumulatively. - if (block <= blocks[3]) { - continue; - } - let acc = BN(0); - for (let addr in Pools[key]) { - const plus = - addr === fDai - ? Pools[key][addr].div(BN(10).pow(BN(12))) - : Pools[key][addr]; - acc = acc.plus(plus); - } - - output["0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"] = acc; - } - } - return output; -} -/*================================================== - Exports - ==================================================*/ - -module.exports = { - name: "Snowswap", - website: "https://snowswap.org/", - token: "SNOW", - category: "dexes", - start: 1599207447, // 01/23/2021 @ 3:44pm (UTC) - tvl, -}; From c62c4cca4e504949ec42677a9e4f45c5d867619c Mon Sep 17 00:00:00 2001 From: Robsonsjre Date: Thu, 9 Dec 2021 19:55:39 -0300 Subject: [PATCH 311/393] reduced the number of calls --- projects/podsfinance/queries.js | 67 +++++++++++++-------------------- 1 file changed, 27 insertions(+), 40 deletions(-) diff --git a/projects/podsfinance/queries.js b/projects/podsfinance/queries.js index bb99b73239..25a7d5fbe3 100644 --- a/projects/podsfinance/queries.js +++ b/projects/podsfinance/queries.js @@ -1,69 +1,56 @@ -const sdk = require('@defillama/sdk') +const sdk = require("@defillama/sdk"); -const { EXPIRATION_START_FROM } = require('./constants.js') -const { getOptions } = require('./subgraph.js') +const { EXPIRATION_START_FROM } = require("./constants.js"); +const { getOptions } = require("./subgraph.js"); -async function getTVL (network, block) { - const balances = {} - const options = await getOptions(network, EXPIRATION_START_FROM) +async function getTVL(network, block) { + const balances = {}; + const options = await getOptions(network, EXPIRATION_START_FROM); - const strikeAssetInOptions = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', + const collateralInOptions = await sdk.api.abi.multiCall({ + abi: "erc20:balanceOf", block, calls: options .filter( - option => + (option) => option && option.strikeAsset && option.underlyingAsset && option.address ) - .map(option => [ + .map((option) => [ { target: option.strikeAsset, - params: [option.address] + params: [option.address], }, { target: option.underlyingAsset, - params: [option.address] - } + params: [option.address], + }, ]) .reduce((prev, curr) => prev.concat(curr), []), - chain: network.name - }) - - const underlyingAssetInOptions = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - block, - calls: options - .filter(option => option && option.underlyingAsset && option.address) - .map(option => ({ - target: option.underlyingAsset, - params: [option.address] - })), - chain: network.name - }) + chain: network.name, + }); const stablesInPools = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', + abi: "erc20:balanceOf", block, calls: options - .filter(option => option && option.pool && option.pool.address) - .map(option => ({ + .filter((option) => option && option.pool && option.pool.address) + .map((option) => ({ target: option.pool.tokenB, - params: [option.pool.address] + params: [option.pool.address], })), - chain: network.name - }) + chain: network.name, + }); - const transform = address => `${network.name}:${address}` + const transform = (address) => `${network.name}:${address}`; - sdk.util.sumMultiBalanceOf(balances, strikeAssetInOptions, true, transform) - sdk.util.sumMultiBalanceOf(balances, underlyingAssetInOptions, true, transform) - sdk.util.sumMultiBalanceOf(balances, stablesInPools, true, transform) - return balances + sdk.util.sumMultiBalanceOf(balances, collateralInOptions, true, transform); + sdk.util.sumMultiBalanceOf(balances, stablesInPools, true, transform); + return balances; } module.exports = { - getTVL -} + getTVL, +}; From 2ff01cb38282fe40eb4ec9359b4056c899faf9e2 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 00:59:13 +0000 Subject: [PATCH 312/393] add adapter for brinc --- projects/brinc/index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 projects/brinc/index.js diff --git a/projects/brinc/index.js b/projects/brinc/index.js new file mode 100644 index 0000000000..086ab1590b --- /dev/null +++ b/projects/brinc/index.js @@ -0,0 +1,23 @@ +const { stakingPricedLP } = require('../helper/staking') +const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') + + + +const treasury = "0x7BFf1FC001054c4FfFF4E9117415112E07212A4E" + +async function tvl(time, ethBlock){ + const balances = {} + await sumTokensAndLPsSharedOwners(balances, [ + ["0x6b175474e89094c44da98b954eedeac495271d0f", false], //dai + + ], [treasury], ethBlock, "ethereum") + return balances +} + +module.exports={ + methodology: `DAI reserves in the bonding curve `, + ethereum:{ + tvl, + //staking: stakingPricedLP("0xE5Df6583eE8DAe9F532e65D7D2C30A961c442f8a", "0x5fE5E1d5D86BDD4a7D84B4cAfac1E599c180488f", "ethereum", "0xe4f157c7ca54f435fcc3bb0b4452f98d3a48f303", "dai", true ) + } +} \ No newline at end of file From 2bc468a8a8dfc8028d3f8f30a9302b47cc61bd2c Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 01:39:05 +0000 Subject: [PATCH 313/393] add giza adapter --- projects/gizadao/index.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 projects/gizadao/index.js diff --git a/projects/gizadao/index.js b/projects/gizadao/index.js new file mode 100644 index 0000000000..e336680bf8 --- /dev/null +++ b/projects/gizadao/index.js @@ -0,0 +1,19 @@ +const { ohmTvl } = require('../helper/ohm') + +const transforms = { + "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e": "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI +} + +const treasury = "0x6e273a49Ba8F77d03C0CF5a190f226DcA7D46E9F" +module.exports = ohmTvl(treasury, [ + //DAI + ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], + //spirit LP + ["0x9026711a2097252a198e6602a052117eaa5f3cab", true], + //spirit LP + ["0x9733f6ac1fb1d750cc28261bbbbf902d239c1e36", true], + ], + "fantom", + "0xF5aB479d02336917bA84981fb8C3999147FcC12B", + "0x3389492f36642f27F7bF4a7749fb3FC2c8fbB7EE", + addr => (transforms[addr.toLowerCase()] ? transforms[addr.toLowerCase()] : `fantom:${addr}`) ,) \ No newline at end of file From d368e5229f86dd5eb2b768d4edb813634c109c71 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 02:22:15 +0000 Subject: [PATCH 314/393] add polygon tvl --- projects/bzx.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/bzx.js b/projects/bzx.js index 56822608c1..e7c3100f16 100644 --- a/projects/bzx.js +++ b/projects/bzx.js @@ -5,8 +5,8 @@ const utils = require('./helper/utils'); * *****************/ async function fetch() { - let staked = await utils.fetchURL('https://api.bzx.network/v1/vault-balance-usd?networks=bsc,eth') - return Number(staked.data.data.bsc.all) + Number(staked.data.data.eth.all); + let staked = await utils.fetchURL('https://api.bzx.network/v1/vault-balance-usd?networks=bsc,eth,polygon') + return Number(staked.data.data.bsc.all) + Number(staked.data.data.eth.all) + Number(staked.data.data.polygon.all); } module.exports = { From b742e3d7fd047406414333ce5710a5fba55b4e6d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 03:48:51 +0000 Subject: [PATCH 315/393] update staking function --- projects/vampireswap/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/vampireswap/index.js b/projects/vampireswap/index.js index 1ff5c1524b..262500b3cb 100644 --- a/projects/vampireswap/index.js +++ b/projects/vampireswap/index.js @@ -1,6 +1,6 @@ const {calculateUniTvl} = require('../helper/calculateUniTvl.js') const {transformFantomAddress} = require('../helper/portedTokens.js'); -const { staking } = require('../helper/staking.js'); +const { staking, stakingPricedLP } = require('../helper/staking.js'); const factory = '0xdf0a0a62995ae821d7a5cf88c4112c395fc41358' async function tvl(_timestamp, _ethBlock, chainBlocks){ @@ -12,7 +12,7 @@ async function tvl(_timestamp, _ethBlock, chainBlocks){ module.exports = { fantom:{ - staking: staking("0xa9d452E3CEA2b06d7DBE812A6C3ec81cf52334dD", "0x97058c0B5ff0E0E350e241EBc63b55906a9EADbc", "fantom"), + staking: stakingPricedLP("0xa9d452E3CEA2b06d7DBE812A6C3ec81cf52334dD", "0x97058c0B5ff0E0E350e241EBc63b55906a9EADbc", "fantom", "0x8fa291be663a069e6289f844944752cd011ec719", "wrapped-fantom", false), tvl, }, } \ No newline at end of file From da1c67db7f098b65808ba6d7d5dd6a0985c5ed99 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 05:48:54 +0000 Subject: [PATCH 316/393] add adapter for yokaiswap --- projects/yokaiswap/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/yokaiswap/index.js diff --git a/projects/yokaiswap/index.js b/projects/yokaiswap/index.js new file mode 100644 index 0000000000..56a69d9ac7 --- /dev/null +++ b/projects/yokaiswap/index.js @@ -0,0 +1,21 @@ +const { GraphQLClient, gql } = require('graphql-request') + +async function fetch() { + const endpoint = 'https://www.yokaiswap.com/subgraphs/name/yokaiswap/exchange' + const graphQLClient = new GraphQLClient(endpoint) + + const query = gql` + query yokaiFactories { + yokaiFactories { + totalLiquidityUSD + } + }`; + + const data = await graphQLClient.request(query); + + return data.yokaiFactories[0].totalLiquidityUSD;; +} + +module.exports = { + fetch +} \ No newline at end of file From 251a984f946f8f44372455406026f8da187f9d55 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 05:52:45 +0000 Subject: [PATCH 317/393] add adapter for wagyuswap --- projects/wagyuswap/index.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 projects/wagyuswap/index.js diff --git a/projects/wagyuswap/index.js b/projects/wagyuswap/index.js new file mode 100644 index 0000000000..97e73d584f --- /dev/null +++ b/projects/wagyuswap/index.js @@ -0,0 +1,21 @@ +const { GraphQLClient, gql } = require('graphql-request') + +async function fetch() { + const endpoint = 'https://thegraph.wagyuswap.app/subgraphs/name/wagyu' + const graphQLClient = new GraphQLClient(endpoint) + + const query = gql` + query pancakeFactories { + pancakeFactories { + totalLiquidityUSD + } + }`; + + const data = await graphQLClient.request(query); + + return data.pancakeFactories[0].totalLiquidityUSD;; +} + +module.exports = { + fetch +} \ No newline at end of file From df0f4408a55d3fe411edad64def87ab0e1ebffb6 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 05:58:14 +0000 Subject: [PATCH 318/393] add methodology --- projects/wagyuswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/wagyuswap/index.js b/projects/wagyuswap/index.js index 97e73d584f..5318b5addc 100644 --- a/projects/wagyuswap/index.js +++ b/projects/wagyuswap/index.js @@ -17,5 +17,6 @@ async function fetch() { } module.exports = { + methodology: `Finds TotalLiquidityUSD using the WagyuSwap subgraph "https://thegraph.wagyuswap.app/subgraphs/name/wagyu".`, fetch } \ No newline at end of file From 2e539bf26a0b9cf060233794eb777d0a6f3d701d Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Fri, 10 Dec 2021 05:59:14 +0000 Subject: [PATCH 319/393] add methodology --- projects/yokaiswap/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/projects/yokaiswap/index.js b/projects/yokaiswap/index.js index 56a69d9ac7..2123a4b574 100644 --- a/projects/yokaiswap/index.js +++ b/projects/yokaiswap/index.js @@ -17,5 +17,6 @@ async function fetch() { } module.exports = { + methodology: `Finds TotalLiquidityUSD using the YokaiSwap subgraph "https://www.yokaiswap.com/subgraphs/name/yokaiswap/exchange".`, fetch } \ No newline at end of file From 089134a18a130b46dc5d88a6164b6b01975c0ffb Mon Sep 17 00:00:00 2001 From: inti25 Date: Fri, 10 Dec 2021 21:18:18 +0700 Subject: [PATCH 320/393] Update upfi.js --- projects/upfi.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/upfi.js b/projects/upfi.js index 2779d04b60..940dc25e2a 100644 --- a/projects/upfi.js +++ b/projects/upfi.js @@ -2,16 +2,20 @@ const { getTokenAccountBalance } = require("./helper/solana"); const axios = require("axios"); const retry = require("./helper/retry"); -async function fetch() { +async function pool2() { const response = ( await retry(async (bail) => await axios.get("https://api.upfi.network/tvl")) ).data; - return response.tvl || 0; + return { + 'upfi-network': response.UPS_USDC, + 'usd-coin': response.USDC_UPFI + response.UPFI_3Pool, + } } module.exports = { timetravel: false, - methodology: - 'TVL data is pulled from the UPFI API "https://api.upfi.network/tvl".', - fetch, + methodology: 'TVL data is pulled from the UPFI API "https://api.upfi.network/tvl".', + pool2: { + tvl: pool2, + } }; From 43d6fdd4bda75b59c350d6a8feb63f8554a6ead1 Mon Sep 17 00:00:00 2001 From: P-Odziomek Date: Fri, 10 Dec 2021 16:28:11 +0100 Subject: [PATCH 321/393] Create index.js --- projects/colony/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/colony/index.js diff --git a/projects/colony/index.js b/projects/colony/index.js new file mode 100644 index 0000000000..ccf10844ac --- /dev/null +++ b/projects/colony/index.js @@ -0,0 +1,22 @@ +const sdk = require('@defillama/sdk') + +const stakingContract = '0x5B0d74C78F2588B3C5C49857EdB856cC731dc557' +const colonyGovernanceToken = '0xec3492a2508DDf4FDc0cD76F31f340b30d1793e6' + +async function tvl (timestamp, block) { + const valueLocked = (await sdk.api.erc20.balanceOf({ + block, + target: colonyGovernanceToken, + owner: stakingContract, + chain: 'avax' + })).output + return { [colonyGovernanceToken]: valueLocked } +} + +module.exports = { + methodology: 'TVL is calculated based on CLY tokens locked on Colony staking contract', + avalanche: { + tvl + }, + tvl +} From 503fa7af228f5b216e15386bba8ecdda86b4efbe Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 10 Dec 2021 19:23:59 +0000 Subject: [PATCH 322/393] Revert "Add Banana adapter" --- projects/banana/index.js | 53 ---------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 projects/banana/index.js diff --git a/projects/banana/index.js b/projects/banana/index.js deleted file mode 100644 index 3efcce9b0e..0000000000 --- a/projects/banana/index.js +++ /dev/null @@ -1,53 +0,0 @@ -const axios = require("axios"); -const { pool2BalanceFromMasterChefExports } = require("../helper/pool2.js"); -const { staking } = require("../helper/staking"); -const masterchefAbi = require("../helper/abis/masterchef.json"); - -const share = "0xc67b9b1b0557aeafa10aa1ffa1d7c87087a6149e"; -// const pool2lp = "0x59b901160bb8eeec517ed396ab68e0da81707c12"; -const masterChef = "0x0e69359B4783094260abFaD7dD904999fc1d6Fd0"; - -const fetch = async () => { - const { data = {} } = - (await axios.get("https://bananafarm.io/api/boba/tvl/total")) || {}; - return data.tvl || 0; -}; - -// const tvl = async () => { -// const { data = {} } = -// (await axios.get("https://bananafarm.io/api/boba/tvl")) || {}; -// // console.log(0, data); -// return data; -// }; - -// const staking = async () => { -// const { data = {} } = -// (await axios.get("https://bananafarm.io/api/boba/tvl/staking")) || {}; -// // console.log(1, data); -// return data; -// }; - -// const pool2 = async () => { -// const { data = {} } = -// (await axios.get("https://bananafarm.io/api/boba/tvl/pool2")) || {}; -// // console.log(2, data); -// return data; -// }; - -module.exports = { - methodology: `TVL is calculated by summing up the values of all LP tokens and our project's rewards token.`, - name: "Banana", - token: "BANA", - start: 1638237600, - boba: { - pool2: pool2BalanceFromMasterChefExports( - masterChef, - share, - "boba", - (addr) => `boba:${addr}`, - masterchefAbi.poolInfo - ), - staking: staking(masterChef, share, "boba"), - }, - fetch, -}; From f4480948804f70d58b4f50ff49f12258b6d72f10 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 10 Dec 2021 19:40:29 +0000 Subject: [PATCH 323/393] Hermes --- projects/hermes/abi.json | 110 ++++++++++ projects/hermes/index.js | 433 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 543 insertions(+) create mode 100644 projects/hermes/abi.json create mode 100644 projects/hermes/index.js diff --git a/projects/hermes/abi.json b/projects/hermes/abi.json new file mode 100644 index 0000000000..aec92ca258 --- /dev/null +++ b/projects/hermes/abi.json @@ -0,0 +1,110 @@ +{ + "poolInfo": { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolInfo", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "lpToken", + "type": "address" + }, + { + "internalType": "uint256", + "name": "allocPoint", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "lastRewardBlock", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "accIrisPerShare", + "type": "uint256" + }, + { + "internalType": "uint16", + "name": "depositFeeBP", + "type": "uint16" + }, + { + "internalType": "uint256", + "name": "lpSupply", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "balance": { + "inputs": [], + "name": "balance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "balanceof": { + "constant": true, + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "token0": { + "constant": true, + "inputs": [], + "name": "token0", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + "token1": { + "constant": true, + "inputs": [], + "name": "token1", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/hermes/index.js b/projects/hermes/index.js new file mode 100644 index 0000000000..9876ba93a7 --- /dev/null +++ b/projects/hermes/index.js @@ -0,0 +1,433 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); +const { GraphQLClient, gql } = require("graphql-request"); +const { default: BigNumber } = require("bignumber.js"); +const { addFundsInMasterChef } = require("../helper/masterchef"); +const { toUSDTBalances } = require("../helper/balances"); + +const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; + +const masterchefs = { + iris: "0x4aA8DeF481d19564596754CD2108086Cf0bDc71B", + apollo: "0x75409C27EA0E28A486B35Bad6006DD114Ae3559B", +}; +const tokens = { + apollo: "0x577aa684b89578628941d648f1fbd6dde338f059", + iron: "0xd86b5923f3ad7b585ed81b448170ae026c65ae9a", + usdc: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + lp_apir: "0x98c2343c581a95bb51b4ce4d76015923d7dd3a23", + lp_irice: "0x7e2cc09d3d36b3af6edff55b214fd62885234e95", + lp_usdcice: "0x34832d9ac4127a232c1919d840f7aae0fcb7315b", +}; +const lpFarms = { + lp_apir: "0x98c2343c581a95bb51b4ce4d76015923d7dd3a23", + lp_apice: "0xe6a2631d6ef2bd7921ce6d51758c0249270a2b63", +}; +const vaults = [ + //IRIS VAULTS + { + name: "KAVIAN/WMATIC", + vault: "0x75fd7fa818f0d970668dca795b7d79508776a5b1", + lpToken: "0xca2cfc8bf76d9d8eb08e824ee6278f7b885c3b70", + amm: "quickswap", + }, + { + name: "GBNT/WMATIC", + vault: "0x483a58Fd4B023CAE2789cd1E1e5F6F52f93df2C7", + lpToken: "0xd883c361d1e8a7e1f77d38e0a6e45d897006b798", + amm: "polycat", + }, + //APOLLO VAULTS + { + name: "USDC/WETH", + vault: "0x0f8860515B51bBbB3AEe4603Fe8716454a2Ed24C", + lpToken: "0x853ee4b2a13f8a742d64c8f088be7ba2131f670d", + amm: "quickswap", + }, + { + name: "USDC/USDT", + vault: "0xaaF43E30e1Aa6ed2dfED9CCD03AbAF7C34B5B8F6", + lpToken: "0x2cf7252e74036d1da831d11089d326296e64a728", + amm: "quickswap", + }, + { + name: "ETH/WMATIC", + vault: "0xC12b54BAEc88CC4F28501f90Bb189Ac7132ee97F", + lpToken: "0xadbf1854e5883eb8aa7baf50705338739e558e5b", + amm: "quickswap", + }, + { + name: "BTC/ETH", + vault: "0xf32baBB43226DdF187151Eb392c1e7F8C0F4a2BB", + lpToken: "0xdc9232e2df177d7a12fdff6ecbab114e2231198d", + amm: "quickswap", + }, + { + name: "DFYN/ROUTE", + vault: "0x467cb3cE716e0801355BFb3b3F4070108E46051f", + lpToken: "0xb0dc320ea9eea823a150763abb4a7ba8286cd08b", + amm: "dfyn", + }, +]; + +const ignoreAddr = [ + "0x75fd7fa818f0d970668dca795b7d79508776a5b1", //godKAVIANWMATIC + "0x483a58Fd4B023CAE2789cd1E1e5F6F52f93df2C7", //godGBNTWMATIC + "0x0f8860515B51bBbB3AEe4603Fe8716454a2Ed24C", //godUSDCWETH + "0xaaF43E30e1Aa6ed2dfED9CCD03AbAF7C34B5B8F6", //godUSDCUSDT + "0xC12b54BAEc88CC4F28501f90Bb189Ac7132ee97F", //godETHWMATIC + "0xf32baBB43226DdF187151Eb392c1e7F8C0F4a2BB", //godBTCETH + "0x467cb3cE716e0801355BFb3b3F4070108E46051f", //godDFYNROUTE + // "0x4d1E50D81C7FaFEBF4FC140c4C6eA7Fd1C2F372b", //DYFNLP + // "0x996B06F25069Cf9F0B88e639f8E1FB22C6558805", //DFYNLP + // "0xE6a2631D6Ef2BD7921cE6d51758c0249270A2B63", //APOLLO/ICE + // "0x98c2343c581a95BB51b4cE4D76015923D7dD3a23" //APOLLO/IRON +]; + +const endpoints = { + quickswap: "https://api.thegraph.com/subgraphs/name/apyvision/quickswap0921", + polycat: + "https://api.thegraph.com/subgraphs/name/polycatfi/polycat-finance-dex", + dfyn: "https://api.thegraph.com/subgraphs/name/ss-sonic/dfyn-v5", + balancer: + "https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2", +}; + +const query = gql` + query get_tvl($lpTokenId: String) { + pair(id: $lpTokenId) { + totalSupply + reserveUSD + } + } +`; + +const lpReservesAbi = { + 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", +}; +const lpSuppliesAbi = { + constant: true, + inputs: [], + name: "totalSupply", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + payable: false, + stateMutability: "view", + type: "function", +}; +const token0Abi = { + constant: true, + inputs: [], + name: "token0", + outputs: [{ internalType: "address", name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", +}; +const token1Abi = { + constant: true, + inputs: [], + name: "token1", + outputs: [{ internalType: "address", name: "", type: "address" }], + payable: false, + stateMutability: "view", + type: "function", +}; + +const balanceUSDCString = "polygon:" + tokens.usdc; + +//Transform apollo's balance into usdc's balance +async function apolloRoute(lpBalance) { + const lptokenA = tokens.lp_apir; + const lptokenIce = tokens.lp_irice; + const lptokenU = tokens.lp_usdcice; + var graphQLClient = new GraphQLClient(endpoints.dfyn); + const queryDfyn = gql` + query get_price($lptokenA: String, $lptokenU: String, $lptokenIce: String) { + Apollo: pair(id: "0x98c2343c581a95bb51b4ce4d76015923d7dd3a23") { + token1Price + } + Usdc: pair(id: "0x34832d9ac4127a232c1919d840f7aae0fcb7315b") { + token0Price + } + Ice: pair(id: "0x7e2cc09d3d36b3af6edff55b214fd62885234e95") { + token0Price + } + } + `; + const pair = await graphQLClient.request(queryDfyn, { + lptokenA, + lptokenU, + lptokenIce, + }); + const usdcBalance = BigNumber(lpBalance) + .times(BigNumber(pair.Apollo.token1Price)) + .times(BigNumber(pair.Ice.token0Price)) + .times(BigNumber(pair.Usdc.token0Price)) + .div(1e12); + return Number(usdcBalance).toFixed(0).toString(); +} + +// Async function to get the equivalent balance of apollos lp in usdc +async function unwrapApolloLPs( + balances, + lpPositions, + block, + chain = "polygon", + transformAddress = (addr) => addr, + excludeTokensRaw = [], + retry = false +) { + const excludeTokens = excludeTokensRaw.map((addr) => addr.toLowerCase()); + const lpTokenCalls = lpPositions.map((lpPosition) => ({ + target: lpPosition.token, + })); + const lpReserves = sdk.api.abi.multiCall({ + block, + abi: lpReservesAbi, + calls: lpTokenCalls, + chain, + }); + const lpSupplies = sdk.api.abi.multiCall({ + block, + abi: lpSuppliesAbi, + calls: lpTokenCalls, + chain, + }); + const tokens0 = sdk.api.abi.multiCall({ + block, + abi: token0Abi, + calls: lpTokenCalls, + chain, + }); + const tokens1 = sdk.api.abi.multiCall({ + block, + abi: token1Abi, + calls: lpTokenCalls, + chain, + }); + if (retry) { + await Promise.all( + [ + [lpReserves, lpReservesAbi], + [lpSupplies, lpSuppliesAbi], + [tokens0, token0Abi], + [tokens1, token1Abi], + ].map(async (call) => { + await requery(await call[0], chain, block, call[1]); + }) + ); + } + await Promise.all( + lpPositions.map(async (lpPosition) => { + try { + const lpToken = lpPosition.token; + const token0 = (await tokens0).output + .find((call) => call.input.target === lpToken) + .output.toLowerCase(); + const token1 = (await tokens1).output + .find((call) => call.input.target === lpToken) + .output.toLowerCase(); + if (excludeTokens.includes(token0) || excludeTokens.includes(token1)) { + return; + } + const supply = (await lpSupplies).output.find( + (call) => call.input.target === lpToken + ).output; + const { _reserve0, _reserve1 } = (await lpReserves).output.find( + (call) => call.input.target === lpToken + ).output; + const token0Balance = BigNumber(lpPosition.balance) + .times(BigNumber(_reserve0)) + .div(BigNumber(supply)); + // let token0Balance =Number(lpPosition.balance * _reserve0 / supply) + const token1Balance = BigNumber(lpPosition.balance) + .times(BigNumber(_reserve1)) + .div(BigNumber(supply)); + let tokenUsdcBalance = 0; + // let token1Balance = Number(lpPosition.balance * _reserve1 / supply) + if (token0 == tokens.apollo) + tokenUsdcBalance = await apolloRoute(token0Balance); + else if (token1 == tokens.apollo) + tokenUsdcBalance = await apolloRoute(token1Balance); + + sdk.util.sumSingleBalance( + balances, + balanceUSDCString, + tokenUsdcBalance + ); + + // + } catch (e) { + console.log( + `Failed to get data for LP token at ${lpPosition.token} on chain ${chain}` + ); + throw e; + } + }) + ); +} + +async function getBalancerTVL(chainBlocks) { + const block = chainBlocks.polygon; + const chain = "polygon"; + const lpTokenId = "0x7320d680ca9bce8048a286f00a79a2c9f8dcd7b3"; + const balancerAddr = + "0x7320d680ca9bce8048a286f00a79a2c9f8dcd7b3000100000000000000000044"; + var graphQLClient = new GraphQLClient(endpoints.balancer); + const queryBal = gql` + query get_price($balancerAddr: String) { + pool(id: $balancerAddr) { + totalLiquidity + totalShares + } + } + `; + const response = await graphQLClient.request(queryBal, { + balancerAddr, + }); + const price = BigNumber(response.pool.totalLiquidity).div( + response.pool.totalShares + ); + const balanceCall = sdk.api.abi.call({ + target: lpTokenId, + abi: abi.balanceof, + block: block, + params: masterchefs.apollo, + chain: chain, + }); + const lpBalance = (await balanceCall).output; + const usdTvl = BigNumber(lpBalance).times(price).div(1e18); + + return toUSDTBalances(usdTvl); +} + +async function getVaultTVL(vaultInfo, chainBlocks) { + const block = chainBlocks.polygon; + const chain = "polygon"; + const lpTokenId = vaultInfo.lpToken; + var graphQLClient = new GraphQLClient(endpoints[vaultInfo.amm]); + + //First, we'll get the totalSupply and the reserves in USD in the AMM 4 this lpToken + const pair = await graphQLClient.request(query, { + lpTokenId, + }); + + //Then, we get the balance in our vault + const balanceCall = sdk.api.abi.call({ + target: vaultInfo.vault, + abi: abi.balance, + block: block, + chain: chain, + }); + const lpBalance = (await balanceCall).output; + + //Last, the tvl in USD in our vault + const usdTvl = BigNumber(lpBalance) + .times(pair.pair.reserveUSD) + .div(pair.pair.totalSupply) + .div(1e18); + + return toUSDTBalances(usdTvl)["0xdac17f958d2ee523a2206206994597c13d831ec7"]; +} + +const tvlVaults = async (timestamp, ethBlock, chainBlocks) => { + let balances = {}; + for (let i = 0; i < vaults.length; i++) { + sdk.util.sumSingleBalance( + balances, + usdtAddress, + await getVaultTVL(vaults[i], chainBlocks) + ); + } + + return balances; +}; + +const tvlBalancer = async (timestamp, ethBlock, chainBlocks) => { + return await getBalancerTVL(chainBlocks); +}; + +const masterchefTVL = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + const transformAddress = (addr) => `polygon:${addr}`; + + await addFundsInMasterChef( + balances, + masterchefs.apollo, + chainBlocks.polygon, + "polygon", + transformAddress, + undefined, + ignoreAddr + ); + + //APOLLO LPS BALANCE + const balanceCall = sdk.api.abi.call({ + target: tokens.apollo, + abi: abi.balanceof, + params: masterchefs.apollo, + block: chainBlocks.polygon, + chain: "polygon", + }); + const lpBalance = (await balanceCall).output; + const balanceApolloIceLp = sdk.api.abi.call({ + target: tokens.apollo, + abi: abi.balanceof, + params: lpFarms.lp_apice, + block: chainBlocks.polygon, + chain: "polygon", + }); + const balanceApolloIronLp = sdk.api.abi.call({ + target: tokens.apollo, + abi: abi.balanceof, + params: lpFarms.lp_apir, + block: chainBlocks.polygon, + chain: "polygon", + }); + const lpPosition = [ + { + balance: (await balanceApolloIceLp).output, + token: lpFarms.lp_apice, + }, + { + balance: (await balanceApolloIronLp).output, + token: lpFarms.lp_apir, + }, + ]; + const apolloToUsdc = await apolloRoute(lpBalance); + + sdk.util.sumSingleBalance(balances, balanceUSDCString, apolloToUsdc); + unwrapApolloLPs( + balances, + lpPosition, + chainBlocks.polygon, + "polygon", + transformAddress + ); + + return balances; +}; + +module.exports = { + misrepresentedTokens: true, + methodology: + "Hermes TVL is calculated from our vaults, which are not native tokens. Pool 2 is based on the TVL of native tokens hosted in our masterchef.", + pool2: { + masterchefTVL, + tvlBalancer, + }, + vault: { + tvlVaults, + }, + tvl: sdk.util.sumChainTvls([masterchefTVL, tvlBalancer, tvlVaults]), +}; From 6977befad108d54d85621be27e8b97131e9f10e1 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 10 Dec 2021 19:55:06 +0000 Subject: [PATCH 324/393] wrappedfi --- projects/wrappedfi.js | 104 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 projects/wrappedfi.js diff --git a/projects/wrappedfi.js b/projects/wrappedfi.js new file mode 100644 index 0000000000..fc1918ba8d --- /dev/null +++ b/projects/wrappedfi.js @@ -0,0 +1,104 @@ +const sdk = require("@defillama/sdk"); +const { getBlock } = require("./helper/getBlock"); + +const ethContracts = [ + /** + * WCELO + * + * coingecko: wrapped-celo + * coinmarketcap: wrapped-celo + */ + '0xE452E6Ea2dDeB012e20dB73bf5d3863A3Ac8d77a', + + /** + * WFIL + * + * coingecko: wrapped-filecoin + * coinmarketcap: wrapped-filecoin + */ + '0x6e1A19F235bE7ED8E3369eF73b196C07257494DE', + + /** + * WCUSD + * + * coingecko: wrapped-celo-dollar + * coinmarketcap: wrapped-celo-dollar + */ + '0xad3E3Fc59dff318BecEaAb7D00EB4F68b1EcF195', + + /** + * WZEC + * + * coingecko: wrapped-zcash + * coinmarketcap: wrapped-zec + */ + '0x4A64515E5E1d1073e83f30cB97BEd20400b66E10', + + /** + * WLTC + * + * no price available + */ + '0x53c4871322Bb47e7A24136fce291a6dcC832a294', +]; + +const celoContracts = [ + /** + * CETH + * + * no identifiers for coingecko or coinmarketcap + */ + '0x2def4285787d58a2f811af24755a8150622f4361', // ceth + + /** + * CBTC or WBTC + * + * no identifiers for coingecko or coinmarketcap + */ + '0xD629eb00dEced2a080B7EC630eF6aC117e614f1b', +]; + +const ethTvls = ethContracts.map((contractAddress) => { + return async (timestamp, block) => { + if (contractAddress == '0x53c4871322Bb47e7A24136fce291a6dcC832a294') { + return { + litecoin: ( + await sdk.api.erc20.totalSupply({ + block, + target: contractAddress, + }) + ).output / 10 ** 18, + } + } + return { + [contractAddress]: ( + await sdk.api.erc20.totalSupply({ + block, + target: contractAddress, + }) + ).output, + }; + }; +}); + +const celoTvls = celoContracts.map((contractAddress) => { + return async (timestamp, ethBlock, chainBlocks) => { + const block = await getBlock(timestamp, "celo", chainBlocks); + + return { + [`celo:${contractAddress}`]: ( + await sdk.api.erc20.totalSupply({ + block, + target: contractAddress, + chain: "celo", + }) + ).output, + }; + }; +}); + +module.exports = { + ethereum: { tvl: sdk.util.sumChainTvls(ethTvls), }, + celo: { tvl: sdk.util.sumChainTvls(celoTvls), }, + methodology: 'The TVL consists of the underlying capital held in custody.' +}; \ No newline at end of file From 1fe649cc6d0e3192546017ff7b05a6ff712762e4 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Fri, 10 Dec 2021 20:18:10 +0000 Subject: [PATCH 325/393] gainsNetwork --- projects/gainsNetwork.js | 58 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 projects/gainsNetwork.js diff --git a/projects/gainsNetwork.js b/projects/gainsNetwork.js new file mode 100644 index 0000000000..545e958f6c --- /dev/null +++ b/projects/gainsNetwork.js @@ -0,0 +1,58 @@ +const { transformPolygonAddress } = require('./helper/portedTokens'); +const sdk = require('@defillama/sdk'); +const { getBlock } = require('./helper/getBlock'); +const { pool2 } = require('./helper/pool2'); + +const contracts = [ + '0x151757c2E830C467B28Fe6C09c3174b6c76aA0c5', + '0x203F5c9567d533038d2da70Cbc20e6E8B3f309F9', + '0x176586Dec2b70df5B72a6Efe158a87f210551798', + '0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD' +]; + +const tokens = { + DAI: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063', + dQUICK: '0xf28164a485b0b2c90639e47b0f377b4a438a16b1' +}; + +async function tvl(timestamp, block, chainBlocks) { + const transform = await transformPolygonAddress(); + const balances = {}; + block = await getBlock(timestamp, 'polygon', chainBlocks); + + const DAIbalance = (await sdk.api.abi.multiCall({ + calls: contracts.map((c) => ({ + target: tokens.DAI, + params: c + })), + abi: "erc20:balanceOf", + block, + chain: 'polygon' + })).output.reduce((a, b) => Number(a) + Number(b.output), 0); + + const dQUICKbalance = (await sdk.api.abi.multiCall({ + calls: contracts.map((c) => ({ + target: tokens.dQUICK, + params: c + })), + abi: "erc20:balanceOf", + block, + chain: 'polygon' + })).output.reduce((a, b) => Number(a) + Number(b.output), 0); + + return { + [transform(tokens.DAI)]: DAIbalance, + [transform(tokens.dQUICK)]: dQUICKbalance + }; +}; + +// node test.js projects/gainsNetwork.js +module.exports={ + polygon: { + tvl, + pool2: pool2( + '0x33025b177A35F6275b78f9c25684273fc24B4e43', + '0x6e53cb6942e518376e9e763554db1a45ddcd25c4', + 'polygon') + } +}; \ No newline at end of file From 0fb5e2b4f28697327f6f11371be9f8e34d701293 Mon Sep 17 00:00:00 2001 From: nemusona Date: Fri, 10 Dec 2021 15:37:07 -0600 Subject: [PATCH 326/393] jetswap onchain --- projects/jetswap/index.js | 80 ++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 17 deletions(-) diff --git a/projects/jetswap/index.js b/projects/jetswap/index.js index 7ca7d3c785..a4d01aa56d 100644 --- a/projects/jetswap/index.js +++ b/projects/jetswap/index.js @@ -1,12 +1,9 @@ -const { staking } = require("../helper/staking"); -const { getChainTvl } = require("../helper/getUniSubgraphTvl"); -const {uniTvlExport} = require('../helper/calculateUniTvl') +const sdk = require("@defillama/sdk"); +const { calculateUniTvl } = require("../helper/calculateUniTvl"); -const chainTvls = getChainTvl({ - fantom: "https://api.thegraph.com/subgraphs/name/smartcookie0501/jetswap-subgraph-fantom", - polygon: "https://api.thegraph.com/subgraphs/name/smartcookie0501/jetswap-subgraph-polygon", - bsc: "https://api.thegraph.com/subgraphs/name/smartcookie0501/jetswap-subgraph" -}) +const bscFactory = "0x0eb58E5c8aA63314ff5547289185cC4583DfCBD5"; +const polygonFactory = "0x668ad0ed2622C62E24f0d5ab6B6Ac1b9D2cD4AC7"; +const fantomFactory = "0xf6488205957f0b4497053d6422F49e27944eE3Dd"; const WINGS_TOKEN_BSC = "0x0487b824c8261462f88940f97053e65bdb498446"; const WINGS_TOKEN_POLYGON = "0x845E76A8691423fbc4ECb8Dd77556Cb61c09eE25"; @@ -16,21 +13,70 @@ const MASTER_BSC = "0x63d6EC1cDef04464287e2af710FFef9780B6f9F5"; const MASTER_POLYGON = "0x4e22399070aD5aD7f7BEb7d3A7b543e8EcBf1d85"; const MASTER_FANTOM = "0x9180583C1ab03587b545629dd60D2be0bf1DF4f2"; -const COINGECKO_WINGS_TOKEN = "bsc:0x0487b824c8261462f88940f97053e65bdb498446" +async function bscTvl(timestamp, block, chainBlocks) { + let balances = await calculateUniTvl( + (addr) => `bsc:${addr}`, + chainBlocks.bsc, + "bsc", + bscFactory, + 0, + true + ); + return balances; +} + +async function polygonTvl(timestamp, block, chainBlocks) { + let balances = calculateUniTvl( + (addr) => `polygon:${addr}`, + chainBlocks.polygon, + "polygon", + polygonFactory, + 0, + true + ); + return balances; +} + +async function fantomTvl(timestamp, block, chainBlocks) { + let balances = calculateUniTvl( + (addr) => `fantom:${addr}`, + chainBlocks.fantom, + "fantom", + fantomFactory, + 0, + true + ); + return balances; +} + +function staking(masterchef, token, chain) { + return async (_timestamp, _block, chainBlocks) => { + let balances = {}; + let balance = ( + await sdk.api.erc20.balanceOf({ + target: token, + owner: masterchef, + block: chainBlocks[chain], + chain, + }) + ).output; + sdk.util.sumSingleBalance(balances, `bsc:${WINGS_TOKEN_BSC}`, balance); + return balances; + }; +} module.exports = { - methodology: "TVL accounts for the liquidity on all AMM pools (see https://info.jetswap.finance, https://polygon-info.jetswap.finance, https://fantom-info.jetswap.finance). Staking includes all WINGS(pWINGS/fWINGS) staked in WINGS(pWINGS/fWINGS) MasterChef farms.", - misrepresentedTokens: true, bsc: { - staking: staking(MASTER_BSC, WINGS_TOKEN_BSC,"bsc", COINGECKO_WINGS_TOKEN), - tvl: chainTvls('bsc'), + tvl: bscTvl, + staking: staking(MASTER_BSC, WINGS_TOKEN_BSC, "bsc"), }, polygon: { - staking: staking(MASTER_POLYGON, WINGS_TOKEN_POLYGON,"polygon", COINGECKO_WINGS_TOKEN), - tvl: uniTvlExport('0x668ad0ed2622c62e24f0d5ab6b6ac1b9d2cd4ac7','polygon'), + tvl: polygonTvl, + staking: staking(MASTER_POLYGON, WINGS_TOKEN_POLYGON, "polygon"), }, fantom: { - staking: staking(MASTER_FANTOM, WINGS_TOKEN_FANTOM,"fantom", COINGECKO_WINGS_TOKEN), - tvl: chainTvls('fantom'), + tvl: fantomTvl, + staking: staking(MASTER_FANTOM, WINGS_TOKEN_FANTOM, "fantom"), }, + tvl: sdk.util.sumChainTvls([bscTvl, polygonTvl, fantomTvl]), }; From 931037285b2dc7c55d610aed91958c90bfea8578 Mon Sep 17 00:00:00 2001 From: nemusona Date: Fri, 10 Dec 2021 15:51:20 -0600 Subject: [PATCH 327/393] colony modification --- projects/colony/index.js | 44 ++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/projects/colony/index.js b/projects/colony/index.js index ccf10844ac..3f60858158 100644 --- a/projects/colony/index.js +++ b/projects/colony/index.js @@ -1,22 +1,32 @@ -const sdk = require('@defillama/sdk') +const sdk = require("@defillama/sdk"); -const stakingContract = '0x5B0d74C78F2588B3C5C49857EdB856cC731dc557' -const colonyGovernanceToken = '0xec3492a2508DDf4FDc0cD76F31f340b30d1793e6' +const stakingContract = "0x5B0d74C78F2588B3C5C49857EdB856cC731dc557"; +const colonyGovernanceToken = "0xec3492a2508DDf4FDc0cD76F31f340b30d1793e6"; -async function tvl (timestamp, block) { - const valueLocked = (await sdk.api.erc20.balanceOf({ - block, - target: colonyGovernanceToken, - owner: stakingContract, - chain: 'avax' - })).output - return { [colonyGovernanceToken]: valueLocked } +async function staking(timestamp, block, chainBlocks) { + let balances = {}; + const valueLocked = ( + await sdk.api.erc20.balanceOf({ + block: chainBlocks.avax, + target: colonyGovernanceToken, + owner: stakingContract, + chain: "avax", + }) + ).output; + sdk.util.sumSingleBalance( + balances, + `avax:${colonyGovernanceToken}`, + valueLocked + ); + return balances; } module.exports = { - methodology: 'TVL is calculated based on CLY tokens locked on Colony staking contract', - avalanche: { - tvl - }, - tvl -} + methodology: + "Staking is calculated based on CLY tokens locked on Colony staking contract", + avalanche: { + tvl: async () => ({}), + staking, + }, + tvl: async () => ({}), +}; From 3419cd6d56c984d284f3e76761b258a23b684c39 Mon Sep 17 00:00:00 2001 From: nemusona Date: Fri, 10 Dec 2021 17:48:41 -0600 Subject: [PATCH 328/393] switch padswap adapter to onchain --- projects/padswap/index.js | 52 +++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/projects/padswap/index.js b/projects/padswap/index.js index 7e448c47fb..6203766ca0 100644 --- a/projects/padswap/index.js +++ b/projects/padswap/index.js @@ -1,7 +1,7 @@ const { stakings } = require("../helper/staking"); const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); const { getChainTvlBuffered } = require("../helper/getUniSubgraphTvl"); -const { getBlock } = require("../helper/getBlock") +const { getBlock } = require("../helper/getBlock"); const TOAD_ADDRESS = "0x463e737d8f740395abf44f7aac2d9531d8d539e9"; const TOAD_FARM_ADDRESS = "0xe1F1EDfBcEfB1E924e4a031Ed6B4CAbC7e570154"; @@ -15,24 +15,33 @@ const PADSWAP_BSC_FACTORY_ADDRESS = const PADSWAP_MOONRIVER_FACTORY_ADDRESS = "0x760d2Bdb232027aB3b1594405077F9a1b91C04c1"; -const SUBGRAPH_BUFFER_DELAY = 10*60; // 10 minutes +const SUBGRAPH_BUFFER_DELAY = 10 * 60; // 10 minutes -const subgraphTvls = getChainTvlBuffered({ - bsc: "https://subgraph.toadlytics.com:8080/subgraphs/name/padswap-subgraph", - moonriver: - "https://api.thegraph.com/subgraphs/name/toadguy/padswap-subgraph-moonriver", -}, SUBGRAPH_BUFFER_DELAY); +const subgraphTvls = getChainTvlBuffered( + { + bsc: "https://subgraph.toadlytics.com:8080/subgraphs/name/padswap-subgraph", + moonriver: + "https://api.thegraph.com/subgraphs/name/toadguy/padswap-subgraph-moonriver", + }, + SUBGRAPH_BUFFER_DELAY +); module.exports = { methodology: `TVL accounts for the liquidity on all AMM pools (see https://info.padswap.exchange/ and https://movr-info.padswap.exchange/). Staking includes all TOAD staked in TOAD farms.`, misrepresentedTokens: true, bsc: { - tvl: subgraphTvls("bsc"), - /*calculateUsdUniTvl(PADSWAP_BSC_FACTORY_ADDRESS, "bsc", "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", [ - "0x463e737d8f740395abf44f7aac2d9531d8d539e9", //toad - "0xc0888d80ee0abf84563168b3182650c0addeb6d5", //pad - ], "wbnb"), - */ + //subgraphTvls("bsc"), + tvl: calculateUsdUniTvl( + PADSWAP_BSC_FACTORY_ADDRESS, + "bsc", + "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", + [ + "0x463e737d8f740395abf44f7aac2d9531d8d539e9", //toad + "0xc0888d80ee0abf84563168b3182650c0addeb6d5", //pad + ], + "wbnb" + ), + staking: stakings( [ TOAD_FARM_ADDRESS, @@ -44,11 +53,16 @@ module.exports = { ), }, moonriver: { - tvl: subgraphTvls("moonriver"), - /*calculateUsdUniTvl(PADSWAP_MOONRIVER_FACTORY_ADDRESS, "moonriver", "0x663a07a2648296f1a3c02ee86a126fe1407888e5", [ - "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", //usdc - "0x45488c50184ce2092756ba7cdf85731fd17e6f3d", //pad - ], "moonriver"), - */ + //subgraphTvls("moonriver"), + tvl: calculateUsdUniTvl( + PADSWAP_MOONRIVER_FACTORY_ADDRESS, + "moonriver", + "0x663a07a2648296f1a3c02ee86a126fe1407888e5", + [ + "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", //usdc + "0x45488c50184ce2092756ba7cdf85731fd17e6f3d", //pad + ], + "moonriver" + ), }, }; From dd243589c1e9faddfeb0426fa097e2cf24045861 Mon Sep 17 00:00:00 2001 From: 0xMadxi <0xMadxi> Date: Sat, 11 Dec 2021 15:08:37 +0800 Subject: [PATCH 329/393] Add calculation for MAXI-WAVAX PGL --- projects/maximizer/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/maximizer/index.js b/projects/maximizer/index.js index dd59b9780a..7aab3b94f0 100644 --- a/projects/maximizer/index.js +++ b/projects/maximizer/index.js @@ -8,6 +8,7 @@ const MAXI = "0x7C08413cbf02202a1c13643dB173f2694e0F73f0"; const DAI = "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70"; const WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; const MAXI_DAI_JLP = "0xfBDC4aa69114AA11Fae65E858e92DC5D013b2EA9"; +const MAXI_WAVAX_PGL = "0xbb700450811a30c5ee0dB80925Cf1BA53dBBd60A"; const staking = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; @@ -34,6 +35,7 @@ async function tvl(timestamp, block, chainBlocks) { [DAI, false], [WAVAX, false], [MAXI_DAI_JLP, true], + [MAXI_WAVAX_PGL, true], ], [Treasury], chainBlocks.avax, From 433f14c96f51ddecca4f6890f799019afdce5c8b Mon Sep 17 00:00:00 2001 From: 0xMadxi <0xMadxi> Date: Sat, 11 Dec 2021 15:07:21 +0800 Subject: [PATCH 330/393] Add calculation for PNG-WAVAX PGL --- projects/maximizer/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/maximizer/index.js b/projects/maximizer/index.js index 7aab3b94f0..0f48051cc4 100644 --- a/projects/maximizer/index.js +++ b/projects/maximizer/index.js @@ -9,6 +9,7 @@ const DAI = "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70"; const WAVAX = "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7"; const MAXI_DAI_JLP = "0xfBDC4aa69114AA11Fae65E858e92DC5D013b2EA9"; const MAXI_WAVAX_PGL = "0xbb700450811a30c5ee0dB80925Cf1BA53dBBd60A"; +const PNG_WAVAX_PGL = "0xd7538cABBf8605BdE1f4901B47B8D42c61DE0367"; const staking = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; @@ -36,6 +37,7 @@ async function tvl(timestamp, block, chainBlocks) { [WAVAX, false], [MAXI_DAI_JLP, true], [MAXI_WAVAX_PGL, true], + [PNG_WAVAX_PGL, true], ], [Treasury], chainBlocks.avax, From c082d179d3b216d064648f8b24333a6a20197389 Mon Sep 17 00:00:00 2001 From: 0xMadxi <0xMadxi> Date: Sat, 11 Dec 2021 15:09:03 +0800 Subject: [PATCH 331/393] Update methodology description --- projects/maximizer/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/maximizer/index.js b/projects/maximizer/index.js index 0f48051cc4..e404ed43f2 100644 --- a/projects/maximizer/index.js +++ b/projects/maximizer/index.js @@ -53,5 +53,6 @@ module.exports = { tvl, staking, }, - methodology: "Counts DAI, DAI JLP (MAXI-DAI), WAVAX on the treasury", + methodology: + "Counts DAI, DAI LP (MAXI-DAI JLP), WAVAX, WAVAX LP (MAXI-WAVAX PGL, PNG-WAVAX PGL) on the treasury", }; From 754ec7f0ea851eab18bc5edda74d1ff129dd2799 Mon Sep 17 00:00:00 2001 From: kenchangh Date: Sat, 11 Dec 2021 17:05:20 +0800 Subject: [PATCH 332/393] Added AVAX call vault --- projects/ribbon/index.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/projects/ribbon/index.js b/projects/ribbon/index.js index dbba2b43d1..d5ece3c224 100644 --- a/projects/ribbon/index.js +++ b/projects/ribbon/index.js @@ -1,7 +1,7 @@ const sdk = require('@defillama/sdk') const abi = require('./abi.json') -// Vaults +// Ethereum Vaults const ethCallVault = '0x0fabaf48bbf864a3947bdd0ba9d764791a60467a' const ethCallVaultV2 = '0x25751853Eab4D0eB3652B5eB6ecB102A2789644B' const wbtcCallVault = '0x8b5876f5B0Bf64056A89Aa7e97511644758c3E8c' @@ -11,22 +11,29 @@ const yvUSDCETHPutVault = '0x8FE74471F198E426e96bE65f40EeD1F8BA96e54f' const aaveCallVault = '0xe63151A0Ed4e5fafdc951D877102cf0977Abd365' const stETHCallVault = '0x53773E034d9784153471813dacAFF53dBBB78E8c' -// Assets +// Avalanche Vaults +const avaxCallVault = '0x98d03125c62DaE2328D9d3cb32b7B969e6a87787' + +// Ethereum Assets const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' const wbtc = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' const usdc = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48' const aave = '0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9' -async function addVault(balances, vault, token, block) { +// Avalanche Assets +const wavax = 'avax:0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7' + +async function addVault(balances, vault, token, block, chain='ethereum') { const totalBalance = await sdk.api.abi.call({ target: vault, block, - abi: abi.totalBalance + abi: abi.totalBalance, + chain, }) sdk.util.sumSingleBalance(balances, token, totalBalance.output) } -async function tvl(timestamp, block) { +async function ethTvl(_, block) { const balances = {} await Promise.all([ addVault(balances, ethCallVault, weth, block), @@ -41,9 +48,20 @@ async function tvl(timestamp, block) { return balances } +async function avaxTvl(_, block) { + const balances = {} + await Promise.all([ + addVault(balances, avaxCallVault, wavax, block, 'avax'), + ]) + return balances +} + module.exports = { ethereum: { - tvl + tvl: ethTvl + }, + avalanche: { + tvl: avaxTvl }, - tvl + tvl: sdk.util.sumChainTvls([ethTvl, avaxTvl]), } From e0f5fe11518f9f47817e93d5bc34fac057a9a617 Mon Sep 17 00:00:00 2001 From: cryptoethic Date: Sat, 11 Dec 2021 14:28:46 +0100 Subject: [PATCH 333/393] fix: tvl calcuation --- projects/starterra.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/starterra.js b/projects/starterra.js index 6448ff17b7..e747fa3236 100644 --- a/projects/starterra.js +++ b/projects/starterra.js @@ -15,7 +15,7 @@ async function fetch() { async () => await axios.get("https://api.starterra.io/cmc?q=tvl") ); - return parseFloat(res.data); + return parseFloat(res.data) - (await pool2()); } module.exports = { From 44c20466972b22ac26e2a35d7f816d4bd65e2f99 Mon Sep 17 00:00:00 2001 From: nemusona Date: Sat, 11 Dec 2021 16:55:50 -0600 Subject: [PATCH 334/393] opendao WIP --- projects/opendao/abi.json | 11 +++++++++ projects/opendao/index.js | 48 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 projects/opendao/abi.json create mode 100644 projects/opendao/index.js diff --git a/projects/opendao/abi.json b/projects/opendao/abi.json new file mode 100644 index 0000000000..8f017d5bb7 --- /dev/null +++ b/projects/opendao/abi.json @@ -0,0 +1,11 @@ +{ + "underlying": { + "constant": true, + "inputs": [], + "name": "underlying", + "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/opendao/index.js b/projects/opendao/index.js new file mode 100644 index 0000000000..123592a46d --- /dev/null +++ b/projects/opendao/index.js @@ -0,0 +1,48 @@ +const sdk = require("@defillama/sdk"); +const abi = require("./abi.json"); + +const vaults = [ + "0x0a234ef34614a4eed1c1430a23b46f95df5f4257", // pOPEN + "0xfff0cc78a7e7ce5d6ba60f23628ff9a63beee87f", // OCP + "0x09139d7343953163eacde83845b342c1d08999ef", // LIME + "0xd90ec012a6b2b549dd2a74024f1e025d0801696c", // LAND + "0xcfefc606c4c010c242431f60a7afc13461df399c", // ROSEN +]; + +async function tvl(timestamp, block, chainBlocks) { + let balances = {}; + let underlying = ( + await sdk.api.abi.multiCall({ + calls: vaults.map((p) => ({ + target: p, + })), + abi: abi.underlying, + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + let underlyingBalances = ( + await sdk.api.abi.multiCall({ + calls: underlying.map((p) => ({ + target: p.output, + params: p.input.target, + })), + abi: "erc20:balanceOf", + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + underlyingBalances.forEach((p) => { + sdk.util.sumSingleBalance(balances, `bsc:${p.input.target}`, p.output); + }); + return balances; +} + +module.exports = { + methodology: + "TVL consists of underlying tokens in vaults used as collateral to mint USDO", + bsc: { + tvl, + }, + tvl, +}; From 76406c49659fab95196b80493ea4b31650f2d9ff Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 12 Dec 2021 02:11:57 +0000 Subject: [PATCH 335/393] add adapter for safeswap --- projects/safeswap/index.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 projects/safeswap/index.js diff --git a/projects/safeswap/index.js b/projects/safeswap/index.js new file mode 100644 index 0000000000..1efb9dfe8e --- /dev/null +++ b/projects/safeswap/index.js @@ -0,0 +1,24 @@ +const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0xe9c29cB475C0ADe80bE0319B74AD112F1e80058F) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + polygon: { + tvl: calculateUsdUniTvl( + "0x5be44d6C5634161CdaDcC2bc35389325aa493e83", + "polygon", + "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270", + [ + "0xc2132d05d31c914a87c6611c10748aeb04b58e8f", + "0x2791bca1f2de4661ed88a30c99a7a9449aa84174", + "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619", + "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", + "0x7e7ff932fab08a0af569f93ce65e7b8b23698ad8", + "0xd0cfd20e8bbdb7621b705a4fd61de2e80c2cd02f", + "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39", + ], + "wmatic" + ), + }, +}; \ No newline at end of file From 7d8ca1a4e1489b07b9ea27b941f617be27570513 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 12 Dec 2021 02:41:41 +0000 Subject: [PATCH 336/393] add adapter for safeswap --- projects/safeswap/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/projects/safeswap/index.js b/projects/safeswap/index.js index 1efb9dfe8e..9bc270928a 100644 --- a/projects/safeswap/index.js +++ b/projects/safeswap/index.js @@ -21,4 +21,18 @@ module.exports = { "wmatic" ), }, + ethereum: { + tvl: calculateUsdUniTvl( + "0xB919aD419688F7C274f11F180112514941a910CB", + "ethereum", + "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + [ + "0xf4cd3d3fda8d7fd6c5a500203e38640a70bf9577", + "0xdac17f958d2ee523a2206206994597c13d831ec7", + "0x84cffa78b2fbbeec8c37391d2b12a04d2030845e", + "0x560cc7de81b2a594f6518713cbe122bcf297a6e8", + ], + "weth" + ), + }, }; \ No newline at end of file From c00a4c31a0b8a321ce3e43da3aaf06ce85cea863 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 12 Dec 2021 05:53:49 +0000 Subject: [PATCH 337/393] update sdk --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 31626d57ca..4ce844ad32 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "@acala-network/api": "^3.0.2", "@connext/nxtp-contracts": "0.0.93", "@connext/nxtp-utils": "0.0.93", - "@defillama/sdk": "^2.3.27", + "@defillama/sdk": "^2.3.28", "@makerdao/multicall": "^0.12.0", "@polkadot/api": "^6.6.1", "@port.finance/port-sdk": "^0.1.42", From 92e3760b3b756d6aace8d4f2e6f5518952cae25b Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Sun, 12 Dec 2021 06:05:13 +0000 Subject: [PATCH 338/393] add adapter for soy finance --- projects/soyfinance/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/soyfinance/index.js diff --git a/projects/soyfinance/index.js b/projects/soyfinance/index.js new file mode 100644 index 0000000000..1192bbbd55 --- /dev/null +++ b/projects/soyfinance/index.js @@ -0,0 +1,22 @@ +const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl"); + +module.exports = { + misrepresentedTokens: true, + methodology: + "Factory address (0x9CC7C769eA3B37F1Af0Ad642A268b80dc80754c5) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + callisto: { + tvl: calculateUsdUniTvl( + "0x9CC7C769eA3B37F1Af0Ad642A268b80dc80754c5", + "callisto", + "0xF5AD6F6EDeC824C7fD54A66d241a227F6503aD3a", + [ + "0x9FaE2529863bD691B4A7171bDfCf33C7ebB10a65",//soy + "0xbf6c50889d3a620eb42c0f188b65ade90de958c4",//busdt + "0xccc766f97629a4e14b3af8c91ec54f0b5664a69f",//etc + "0xcc208c32cc6919af5d8026dab7a3ec7a57cd1796",//eth + "0xccde29903e621ca12df33bb0ad9d1add7261ace9",//bnb + ], + "callisto" + ), + }, +}; \ No newline at end of file From d8de27237a20e149a2cd10e1468bf05f84062af0 Mon Sep 17 00:00:00 2001 From: Jonathan Chemla Date: Sun, 12 Dec 2021 09:37:18 +0100 Subject: [PATCH 339/393] Add xDefi wallet - only Sushiswap LP staking on onsen for now Add xDefi wallet - only Sushiswap LP staking on onsen for now --- projects/xdefi-wallet.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 projects/xdefi-wallet.js diff --git a/projects/xdefi-wallet.js b/projects/xdefi-wallet.js new file mode 100644 index 0000000000..fd90cc85aa --- /dev/null +++ b/projects/xdefi-wallet.js @@ -0,0 +1,12 @@ +const {pool2} = require('./helper/pool2') + +const xdefi_weth_slp = '0x37fc088cfd67349be00f5504d00ddb7f2274b3f6' +const masterchef = '0xef0881ec094552b2e128cf945ef17a6752b4ec5d' + +module.exports={ + methodology: 'xDefi token can be LP\'ed on Sushi and LP can be staked on Sushiswap Masterchef - and soon rebate vault and Pylon', + ethereum:{ + tvl: () => ({}), + pool2: pool2(masterchef, xdefi_weth_slp, 'ethereum'), + } +} From 51a61ccee0ca5f7eeb2055e4ed438bb69ef0384d Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 12 Dec 2021 08:59:44 +0000 Subject: [PATCH 340/393] fix tenfinance rpc errors --- projects/tenfinance/index.js | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/projects/tenfinance/index.js b/projects/tenfinance/index.js index 5c4479415b..e904428eac 100644 --- a/projects/tenfinance/index.js +++ b/projects/tenfinance/index.js @@ -1,6 +1,7 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); const tenFarmAddress = "0x264A1b3F6db28De4D3dD4eD23Ab31A468B0C1A96"; const tenVault = "0xC2fB710D39f1D116FD3A70789381a3699Ff9fce0"; @@ -94,7 +95,7 @@ async function tvl(timestamp, block, chainBlocks) { const symbol = symbols[i].output; const balance = lockedTotals[i].output; const token = poolInfos[i].output.want; - if (symbol === null || balance === null || token === null) continue; + if(token === "0xFBF4cf9CdD629bF102F68BFEE43A49923f869505") continue; if (symbol.endsWith("LP")) { const token0 = token0Tokens[i].output.toLowerCase(); const token1 = token1Tokens[i].output.toLowerCase(); @@ -206,7 +207,7 @@ async function pool2(timestamp, block, chainBlocks) { const symbol = symbols[i].output; const balance = lockedTotals[i].output; const token = poolInfos[i].output.want; - if (symbol === null || balance === null || token === null) continue; + if(token === "0xFBF4cf9CdD629bF102F68BFEE43A49923f869505") continue; if (symbol.endsWith("LP")) { const token0 = token0Tokens[i].output; const token1 = token1Tokens[i].output; @@ -229,25 +230,10 @@ async function pool2(timestamp, block, chainBlocks) { return balances; } -async function staking(timestamp, block, chainBlocks) { - let balances = {}; - let balance = ( - await sdk.api.erc20.balanceOf({ - target: tenfi, - owner: tenVault, - block: chainBlocks.bsc, - chain: "bsc", - }) - ).output; - sdk.util.sumSingleBalance(balances, `bsc:${tenfi}`, balance); - return balances; -} - module.exports = { bsc: { tvl, pool2, - staking, + staking: staking(tenVault, tenfi, "bsc"), }, - tvl, }; From 7b9d236fe9a44219221c43e76c4a66115b76ae82 Mon Sep 17 00:00:00 2001 From: Jonathan Chemla Date: Sun, 12 Dec 2021 10:28:19 +0100 Subject: [PATCH 341/393] Add Aztec TVL - eth and supportedassets locked into the rollup processor --- projects/aztec/abi.json | 8 +++++++ projects/aztec/index.js | 47 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 projects/aztec/abi.json create mode 100644 projects/aztec/index.js diff --git a/projects/aztec/abi.json b/projects/aztec/abi.json new file mode 100644 index 0000000000..a699cc857d --- /dev/null +++ b/projects/aztec/abi.json @@ -0,0 +1,8 @@ +{ + "getSupportedAsset": {"inputs":[{"internalType":"uint256","name":"assetId","type":"uint256"}],"name":"getSupportedAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, + "getSupportedAssets": {"inputs":[],"name":"getSupportedAssets","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"}, + "getTotalDeposited": {"inputs":[],"name":"getTotalDeposited","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}, + "getTotalFees": {"inputs":[],"name":"getTotalFees","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}, + "getTotalPendingDeposit": {"inputs":[],"name":"getTotalPendingDeposit","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"}, + "getTotalWithdrawn": {"inputs":[],"name":"getTotalWithdrawn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"} +} \ No newline at end of file diff --git a/projects/aztec/index.js b/projects/aztec/index.js new file mode 100644 index 0000000000..139228b5cb --- /dev/null +++ b/projects/aztec/index.js @@ -0,0 +1,47 @@ +const sdk = require("@defillama/sdk") +const abi = require('./abi.json'); + +const aztecRollupProcessor = '0x737901bea3eeb88459df9ef1BE8fF3Ae1B42A2ba' +// "getSupportedAssets" "getTotalDeposited" "getTotalPendingDeposit" "getTotalWithdrawn" "getTotalFees" +const weth = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' + +async function tvl(timestamp, ethBlock, chainBlocks) { + const balances = {} + + // Get aztec supported assets + const { output: supportedAssets } = await sdk.api.abi.call({ + abi: abi['getSupportedAssets'], + target: aztecRollupProcessor, + block: ethBlock, + chain: 'ethereum' + }) + + // Get eth balance + const { output: ethBalance } = await sdk.api.eth.getBalance({ + target: aztecRollupProcessor, + block: ethBlock, + chain: 'ethereum' + }); + sdk.util.sumSingleBalance( balances, weth, ethBalance ); + + // Get supported assets balances + const assetsBalances = await sdk.api.abi.multiCall({ + abi: 'erc20:balanceOf', + calls: supportedAssets.map( asset => ({ + params: aztecRollupProcessor, + target: asset, + })), + block: ethBlock, + chain: 'ethereum' + }) + sdk.util.sumMultiBalanceOf( balances, assetsBalances, true); + + return balances +} + +module.exports = { + methodology: "TVL of Aztec consists of ethereum and supported assets (DAI and renBTC at the moment) locked into the rollup processor", + ethereum: { + tvl, + } +} From 72b7c5c2c9ae07e7a704d2be09530dd5a855e4ee Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 12 Dec 2021 09:42:47 +0000 Subject: [PATCH 342/393] put staking/pool2 under chain export --- projects/alita-finance/index.js | 5 +- projects/avalaunch/index.js | 10 +- projects/capital-dao/index.js | 36 +- projects/cherryswap/index.js | 9 +- projects/cryptoyieldfocus/index.js | 9 +- projects/illuvium/index.js | 12 +- projects/mesofinance/abi.json | 774 ------------------------ projects/mesofinance/index.js | 24 +- projects/miningtycoon/index.js | 5 +- projects/morpheusswap/index.js | 8 +- projects/nerve/index.js | 9 +- projects/paintswap/index.js | 37 +- projects/plenty/index.js | 6 +- projects/pylon/index.js | 13 +- projects/shadecash/index.js | 9 +- projects/sunrise-gaming-by-dao/index.js | 35 +- 16 files changed, 57 insertions(+), 944 deletions(-) delete mode 100644 projects/mesofinance/abi.json diff --git a/projects/alita-finance/index.js b/projects/alita-finance/index.js index ffca7f121e..2d1350b737 100644 --- a/projects/alita-finance/index.js +++ b/projects/alita-finance/index.js @@ -27,10 +27,7 @@ module.exports = { misrepresentedTokens: true, bsc:{ tvl: bscTvl, - }, - staking:{ - tvl: poolsTvl, + staking: poolsTvl }, methodology: "The TVL is the total of all liquidity pools. The staking TVL is accounted as the ALI on MasterChef(0x4f7b2Be2bc3C61009e9aE520CCfc830612A10694)", - tvl: sdk.util.sumChainTvls([bscTvl]) } \ No newline at end of file diff --git a/projects/avalaunch/index.js b/projects/avalaunch/index.js index 42a976d910..4c55f967cb 100644 --- a/projects/avalaunch/index.js +++ b/projects/avalaunch/index.js @@ -48,11 +48,9 @@ async function staking(timestamp, ethBlock, chainBlocks){ module.exports={ methodology: "Within pool2, it counts the XAVA-AVAX staked in the farm", - tvl, - pool2:{ - tvl:pool2 + avalanche:{ + tvl, + pool2, + staking }, - staking:{ - tvl:staking - } } diff --git a/projects/capital-dao/index.js b/projects/capital-dao/index.js index dcce0c2bde..d5fd788c34 100644 --- a/projects/capital-dao/index.js +++ b/projects/capital-dao/index.js @@ -1,4 +1,3 @@ -const sdk = require('@defillama/sdk'); const {staking} = require('../helper/staking') const {pool2} = require('../helper/pool2') @@ -6,35 +5,12 @@ const cdsAddress = '0x3c48Ca59bf2699E51d4974d4B6D284AE52076e5e'; const lpWethCds = '0x0be902716176d66364f1c2ecf25829a6d95c5bee'; const stakingAddress = '0x0a6bfa6aaaef29cbb6c9e25961cc01849b5c97eb'; -async function tvl(timestamp, block) { - let balances = {}; - - const results = await sdk.api.abi.multiCall({ - block, - abi: 'erc20:balanceOf', - calls: [ - { - target: cdsAddress, - params: [lpWethCds] - }, - { - target: cdsAddress, - params: [stakingAddress] - } - ] - }) - sdk.util.sumMultiBalanceOf(balances, results); - - return balances -} - module.exports = { + timetravel: true, methodology: "TVL includes all farms in staking and swap contract", - staking:{ - tvl: staking(stakingAddress, cdsAddress) - }, - pool2:{ - tvl: pool2(stakingAddress, lpWethCds) - }, - tvl: async ()=>({}) + ethereum:{ + tvl: async ()=>({}), + staking: staking(stakingAddress, cdsAddress), + pool2: pool2(stakingAddress, lpWethCds) + } } diff --git a/projects/cherryswap/index.js b/projects/cherryswap/index.js index 1b8286d7ef..fd55ecd50b 100644 --- a/projects/cherryswap/index.js +++ b/projects/cherryswap/index.js @@ -26,10 +26,11 @@ const chainTvls = getChainTvl({ }) module.exports = { + timetravel: false, methodology: "Staking is the CHE staked on 0x9Ab8BCf67fE8d8D2aD27D42Ec2A0fD5C206DAE60, tvl is the liquidity on the exchange and the money locked on the pools that distribute CHE", - //tvl: chainTvls("okexchain"), // historical - fetch, - staking:{ - tvl: staking(cheStaking, che, "okexchain", "okexchain:"+che) + okexchain:{ + staking: staking(cheStaking, che, "okexchain", "okexchain:"+che), + fetch }, + fetch, } diff --git a/projects/cryptoyieldfocus/index.js b/projects/cryptoyieldfocus/index.js index f61361593a..a097a97960 100644 --- a/projects/cryptoyieldfocus/index.js +++ b/projects/cryptoyieldfocus/index.js @@ -36,16 +36,11 @@ const pool2 = async (timestamp, ethBlock, chainBlocks) => { }; module.exports = { - staking:{ - tvl:staking(STAKING_CONTRACT, cyf, 'avax', `avax:${cyf}`) - }, - pool2:{ - tvl: pool2 - }, avalanche: { tvl: avaxTvl, + pool2, + staking: staking(STAKING_CONTRACT, cyf, 'avax', `avax:${cyf}`) }, - tvl: sdk.util.sumChainTvls([avaxTvl]), methodology: "We add the tvl from the farming pools fetching from StakingContract", }; diff --git a/projects/illuvium/index.js b/projects/illuvium/index.js index 5c93e6dd24..bf075b9fb9 100644 --- a/projects/illuvium/index.js +++ b/projects/illuvium/index.js @@ -36,16 +36,12 @@ async function tvl(timestamp, block) { } module.exports = { + timetravel: true, methodology: `Counts the tokens staked on the flash pools, currently SNX on 0x9898d72c2901D09E72A426d1c24b6ab90eB100e7 and AXS on 0x099A3B242dceC87e729cEfc6157632d7D5F1c4ef pool2 are the SLP tokens locked on 0x8B4d8443a0229349A9892D4F7CbE89eF5f843F72 and staking are the ILV tokens on 0x25121EDDf746c884ddE4619b573A7B10714E2a36`, - staking:{ - tvl: staking - }, - pool2:{ - tvl: pool2 - }, ethereum:{ - tvl + tvl, + pool2, + staking }, - tvl } \ No newline at end of file diff --git a/projects/mesofinance/abi.json b/projects/mesofinance/abi.json deleted file mode 100644 index 073d9b8a1d..0000000000 --- a/projects/mesofinance/abi.json +++ /dev/null @@ -1,774 +0,0 @@ -[ - { - "inputs":[ - { - "internalType":"contract fMeso", - "name":"_tokenAddress", - "type":"address" - }, - { - "internalType":"address", - "name":"_devaddr", - "type":"address" - }, - { - "internalType":"address", - "name":"_feeAddress", - "type":"address" - }, - { - "internalType":"uint256", - "name":"_fMesoPerBlock", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"_startBlock", - "type":"uint256" - } - ], - "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" - } - ], - "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" - } - ], - "name":"EmergencyWithdraw", - "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":"address", - "name":"user", - "type":"address" - }, - { - "indexed":true, - "internalType":"address", - "name":"newAddress", - "type":"address" - } - ], - "name":"SetDevAddress", - "type":"event" - }, - { - "anonymous":false, - "inputs":[ - { - "indexed":true, - "internalType":"address", - "name":"user", - "type":"address" - }, - { - "indexed":true, - "internalType":"address", - "name":"newAddress", - "type":"address" - } - ], - "name":"SetFeeAddress", - "type":"event" - }, - { - "anonymous":false, - "inputs":[ - { - "indexed":true, - "internalType":"address", - "name":"user", - "type":"address" - }, - { - "indexed":false, - "internalType":"uint256", - "name":"fMesoPerBlock", - "type":"uint256" - } - ], - "name":"UpdateEmissionRate", - "type":"event" - }, - { - "anonymous":false, - "inputs":[ - { - "indexed":false, - "internalType":"uint256", - "name":"newStartBlock", - "type":"uint256" - } - ], - "name":"UpdateStartBlock", - "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":"Withdraw", - "type":"event" - }, - { - "anonymous":false, - "inputs":[ - { - "indexed":true, - "internalType":"uint256", - "name":"pid", - "type":"uint256" - }, - { - "indexed":false, - "internalType":"address", - "name":"lpToken", - "type":"address" - }, - { - "indexed":false, - "internalType":"uint256", - "name":"allocPoint", - "type":"uint256" - }, - { - "indexed":false, - "internalType":"uint256", - "name":"depositFeeBP", - "type":"uint256" - } - ], - "name":"addPool", - "type":"event" - }, - { - "anonymous":false, - "inputs":[ - { - "indexed":false, - "internalType":"bytes", - "name":"reason", - "type":"bytes" - } - ], - "name":"fMesoMintError", - "type":"event" - }, - { - "anonymous":false, - "inputs":[ - { - "indexed":true, - "internalType":"uint256", - "name":"pid", - "type":"uint256" - }, - { - "indexed":false, - "internalType":"address", - "name":"lpToken", - "type":"address" - }, - { - "indexed":false, - "internalType":"uint256", - "name":"allocPoint", - "type":"uint256" - }, - { - "indexed":false, - "internalType":"uint256", - "name":"depositFeeBP", - "type":"uint256" - } - ], - "name":"setPool", - "type":"event" - }, - { - "inputs":[ - - ], - "name":"MAX_EMISSION_RATE", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_allocPoint", - "type":"uint256" - }, - { - "internalType":"contract IERC20", - "name":"_lpToken", - "type":"address" - }, - { - "internalType":"uint16", - "name":"_depositFeeBP", - "type":"uint16" - }, - { - "internalType":"bool", - "name":"_withUpdate", - "type":"bool" - } - ], - "name":"add", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_pid", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"_amount", - "type":"uint256" - } - ], - "name":"deposit", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"devaddr", - "outputs":[ - { - "internalType":"address", - "name":"", - "type":"address" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_pid", - "type":"uint256" - } - ], - "name":"emergencyWithdraw", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"fMesoPerBlock", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"feeAddress", - "outputs":[ - { - "internalType":"address", - "name":"", - "type":"address" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_from", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"_to", - "type":"uint256" - } - ], - "name":"getMultiplier", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"pure", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"massUpdatePools", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "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":"pendingMeso", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"contract IERC20", - "name":"", - "type":"address" - } - ], - "name":"poolExistence", - "outputs":[ - { - "internalType":"bool", - "name":"", - "type":"bool" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "name":"poolInfo", - "outputs":[ - { - "internalType":"contract IERC20", - "name":"lpToken", - "type":"address" - }, - { - "internalType":"uint256", - "name":"allocPoint", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"lastRewardBlock", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"accfMesoPerShare", - "type":"uint256" - }, - { - "internalType":"uint16", - "name":"depositFeeBP", - "type":"uint16" - }, - { - "internalType":"uint256", - "name":"lpSupply", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"poolLength", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"renounceOwnership", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_pid", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"_allocPoint", - "type":"uint256" - }, - { - "internalType":"uint16", - "name":"_depositFeeBP", - "type":"uint16" - }, - { - "internalType":"bool", - "name":"_withUpdate", - "type":"bool" - } - ], - "name":"set", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"address", - "name":"_devaddr", - "type":"address" - } - ], - "name":"setDevAddress", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"address", - "name":"_feeAddress", - "type":"address" - } - ], - "name":"setFeeAddress", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"startBlock", - "outputs":[ - { - "internalType":"uint256", - "name":"", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - - ], - "name":"token", - "outputs":[ - { - "internalType":"contract fMeso", - "name":"", - "type":"address" - } - ], - "stateMutability":"view", - "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":"_fMesoPerBlock", - "type":"uint256" - } - ], - "name":"updateEmissionRate", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_pid", - "type":"uint256" - } - ], - "name":"updatePool", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_newStartBlock", - "type":"uint256" - } - ], - "name":"updateStartBlock", - "outputs":[ - - ], - "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":"uint256", - "name":"rewardDebt", - "type":"uint256" - } - ], - "stateMutability":"view", - "type":"function" - }, - { - "inputs":[ - { - "internalType":"uint256", - "name":"_pid", - "type":"uint256" - }, - { - "internalType":"uint256", - "name":"_amount", - "type":"uint256" - } - ], - "name":"withdraw", - "outputs":[ - - ], - "stateMutability":"nonpayable", - "type":"function" - } -] \ No newline at end of file diff --git a/projects/mesofinance/index.js b/projects/mesofinance/index.js index cc3532296a..504d995566 100644 --- a/projects/mesofinance/index.js +++ b/projects/mesofinance/index.js @@ -1,26 +1,6 @@ -const abi = require("./abi.json"); -const { transformFantomAddress } = require("../helper/portedTokens"); -const { addFundsInMasterChef } = require("../helper/masterchef"); -const { staking } = require("../helper/staking"); -const { pool2Exports } = require('../helper/pool2') - +const { masterChefExports } = require("../helper/masterchef"); const chef = "0x30b65159dB82eFCf8CEde9861bc6B85336310EB2" const meso = "0x4D9361A86D038C8adA3db2457608e2275B3E08d4" -const mesoFtmLP = "0x0Dd94754C2BC621Ef8De2fd7A9DF2BC5283e9479" - -async function tvl(timestamp, block, chainBlocks) { - const balances = {} - const transformAddress = await transformFantomAddress(); - await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [meso, mesoFtmLP]) - return balances; -} -module.exports = { - methodology: "TVL includes all farms in MasterChef contract", - staking:{ - tvl: staking(chef, meso, "fantom") - }, - pool2: pool2Exports(chef, [mesoFtmLP], "fantom"), - tvl, -} +module.exports = masterChefExports(chef, "fantom", meso) diff --git a/projects/miningtycoon/index.js b/projects/miningtycoon/index.js index 0771df90a5..0ac11a277f 100644 --- a/projects/miningtycoon/index.js +++ b/projects/miningtycoon/index.js @@ -40,9 +40,6 @@ module.exports = { methodology: 'TVL counts USDT staked to earn NT tokens and the staking portion of TVL counts the NT tokens that are staked to earn more NT tokens', heco:{ tvl, + staking }, - staking:{ - tvl:staking - }, - tvl } \ No newline at end of file diff --git a/projects/morpheusswap/index.js b/projects/morpheusswap/index.js index aac733dec6..24d170189d 100644 --- a/projects/morpheusswap/index.js +++ b/projects/morpheusswap/index.js @@ -15,8 +15,8 @@ async function tvl(timestamp, block, chainBlocks) { module.exports = { methodology: "TVL includes all farms in MasterChef contract", - staking:{ - tvl: staking(chef, morph, "fantom") - }, - tvl, + fantom:{ + tvl, + staking: staking(chef, morph, "fantom") + } } \ No newline at end of file diff --git a/projects/nerve/index.js b/projects/nerve/index.js index 3db28678c9..11c652cf70 100644 --- a/projects/nerve/index.js +++ b/projects/nerve/index.js @@ -89,9 +89,10 @@ async function tvl(timestamp, block, chainBlocks) { } module.exports = { + timetravel: true, start: 1614556800, // March 1, 2021 00:00 AM (UTC) - staking:{ - tvl: staking(xnrvAddress, nrv, "bsc") - }, - tvl, // tvl adapter + bsc:{ + tvl, + staking:staking(xnrvAddress, nrv, "bsc") + } } diff --git a/projects/paintswap/index.js b/projects/paintswap/index.js index db76e990fb..7dd73d3897 100644 --- a/projects/paintswap/index.js +++ b/projects/paintswap/index.js @@ -1,12 +1,10 @@ const { calculateUsdUniTvl } = require('../helper/getUsdUniTvl.js') -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); +const { staking } = require('../helper/staking.js'); const factory = '0x733A9D1585f2d14c77b49d39BC7d7dd14CdA4aa5' const masterchef = '0xCb80F529724B9620145230A0C866AC2FACBE4e3D' const ftm = '0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83' const brush = '0x85dec8c4b2680793661bca91a8f129607571863d' -const ftmBrushLP = '0x452590b8Aa292b963a9d0f2B5E71bC7c927859b3' const whitelist = [ brush, '0x04068da6c83afcfa0e13ba15a6696662335d5b75', @@ -14,33 +12,12 @@ const whitelist = [ '0x321162cd933e2be498cd2267a90534a804051b11' ] -const abiGetReserves = require('./abis/getReserves.json'); -const wftm = "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83" - -async function stakingtvl(timestamp, ethBlock, chainBlocks) { - // Get the brush staked in the masterchef - const brushBalance = await sdk.api.erc20.balanceOf({ - block: chainBlocks['fantom'], - target: brush, - owner: masterchef, - chain: 'fantom' - }) - const pool2Reserves = await sdk.api.abi.call({ - target: ftmBrushLP, - chain: 'fantom', - block: chainBlocks.fantom, - abi: abiGetReserves[0] - }) - const { reserve0, reserve1 } = pool2Reserves.output - return { - [wftm]: BigNumber(reserve0).times(brushBalance.output).div(reserve1).toFixed(0) - } -} - module.exports = { misrepresentedTokens: true, - staking:{ - tvl: stakingtvl - }, - tvl: calculateUsdUniTvl(factory, 'fantom', ftm, whitelist, 'fantom'), + timetravel: true, + doublecounted: false, + fantom:{ + tvl: calculateUsdUniTvl(factory, 'fantom', ftm, whitelist, 'fantom'), + staking: staking(masterchef, brush, "fantom"), + } } \ No newline at end of file diff --git a/projects/plenty/index.js b/projects/plenty/index.js index fb52972316..b30d2ed203 100644 --- a/projects/plenty/index.js +++ b/projects/plenty/index.js @@ -12,9 +12,11 @@ async function staking(){ } module.exports = { + timetravel: false, misrepresentedTokens: true, - staking:{ - fetch: staking + tezos:{ + staking, + fetch }, fetch } \ No newline at end of file diff --git a/projects/pylon/index.js b/projects/pylon/index.js index bece83ee5a..bf6a258a40 100644 --- a/projects/pylon/index.js +++ b/projects/pylon/index.js @@ -30,12 +30,9 @@ async function staking(){ module.exports = { timetravel: false, methodology: 'TVL counts the UST that has been deposted to the Protocol. Data is pulled from the Pylon API:"https://api.pylon.money/api/launchpad/v1/projects/mine".', - historical: false, - pool2:{ - tvl: pool2 - }, - staking:{ - tvl: staking - }, - tvl + terra:{ + pool2, + staking, + tvl + } } diff --git a/projects/shadecash/index.js b/projects/shadecash/index.js index a16997f1b1..82f426dd75 100644 --- a/projects/shadecash/index.js +++ b/projects/shadecash/index.js @@ -55,12 +55,7 @@ const MASTERCHEF = "0x1719ab3C1518eB28d570a1E52980Dbc137B12e66" module.exports = { fantom:{ tvl, + pool2: pool2(MASTERCHEF, "0x20aa395F3bcc4dc44a94215D129650533B3da0b3", 'fantom', addr=>`fantom:${addr}`), + staking: staking(MASTERCHEF, tokens.SHADE, 'fantom', 'fantom:'+tokens.SHADE), }, - pool2:{ - tvl: pool2(MASTERCHEF, "0x20aa395F3bcc4dc44a94215D129650533B3da0b3", 'fantom', addr=>`fantom:${addr}`) - }, - staking:{ - tvl: staking(MASTERCHEF, tokens.SHADE, 'fantom', 'fantom:'+tokens.SHADE) - }, - tvl, } \ No newline at end of file diff --git a/projects/sunrise-gaming-by-dao/index.js b/projects/sunrise-gaming-by-dao/index.js index bc9aa15a07..07e00f1ad0 100644 --- a/projects/sunrise-gaming-by-dao/index.js +++ b/projects/sunrise-gaming-by-dao/index.js @@ -1,4 +1,3 @@ -const sdk = require('@defillama/sdk'); const {staking} = require('../helper/staking') const {pool2} = require('../helper/pool2') @@ -6,34 +5,10 @@ const suncAddress = '0x692aCCdD8b86692427E0aa4752AE917Df01CC56F'; const lpWethSunc = '0xaf5a7469cf2571b973aeee9ae2f8aad00e1337d2'; const stakingAddress = '0x7dbE40ac6bB41A5FE4Fa2C74f31d7DEFBC793B58'; -async function tvl(timestamp, block) { - let balances = {}; - - const results = await sdk.api.abi.multiCall({ - block, - abi: 'erc20:balanceOf', - calls: [ - { - target: suncAddress, - params: [lpWethSunc] - }, - { - target: suncAddress, - params: [stakingAddress] - } - ] - }) - sdk.util.sumMultiBalanceOf(balances, results); - - return balances -} - module.exports = { - staking:{ - tvl: staking(stakingAddress, suncAddress) - }, - pool2:{ - tvl: pool2(stakingAddress, lpWethSunc) - }, - tvl: async ()=>({}) + ethereum:{ + staking: staking(stakingAddress, suncAddress), + pool2: pool2(stakingAddress, lpWethSunc), + tvl: async ()=>({}) + } } \ No newline at end of file From 0f36a1d22063f150483b424266b72d4ca189b89e Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 12 Dec 2021 10:24:21 +0000 Subject: [PATCH 343/393] more chain staking fixes --- projects/blizzard/index.js | 5 +-- projects/cyclefinance/index.js | 5 +-- projects/peakdefi/index.js | 66 ++++------------------------------ projects/penguin/index.js | 8 ++--- projects/perp/index.js | 18 +++------- projects/syncnetwork/index.js | 12 +++---- projects/timewarp/index.js | 14 +++++--- 7 files changed, 31 insertions(+), 97 deletions(-) diff --git a/projects/blizzard/index.js b/projects/blizzard/index.js index 0e84a152ef..cab757c094 100644 --- a/projects/blizzard/index.js +++ b/projects/blizzard/index.js @@ -114,12 +114,9 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { module.exports = { misrepresentedTokens: true, - staking: { - tvl: staking(VaultBlizz, BLIZZ, "avax"), - }, avalanche: { tvl: avaxTvl, + staking: staking(VaultBlizz, BLIZZ, "avax"), }, - tvl: sdk.util.sumChainTvls([avaxTvl]), methodology: "We count liquidity on the Vaults through their contracts", }; diff --git a/projects/cyclefinance/index.js b/projects/cyclefinance/index.js index 246d34a9fb..3e2ee59cbe 100644 --- a/projects/cyclefinance/index.js +++ b/projects/cyclefinance/index.js @@ -197,13 +197,10 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { module.exports = { misrepresentedTokens: true, - staking: { - tvl: staking, - }, avalanche: { tvl: avaxTvl, + staking }, - tvl: sdk.util.sumChainTvls([avaxTvl]), methodology: `We add liquidity that is on the VAULTS threw their contracts and the portion of staking the native token (CYCLE) && CYCLE/AVAX LP by coreRewards and avaxRewards contracts respectivly`, }; diff --git a/projects/peakdefi/index.js b/projects/peakdefi/index.js index eda0cc939b..52efd7f35c 100644 --- a/projects/peakdefi/index.js +++ b/projects/peakdefi/index.js @@ -1,14 +1,7 @@ -/*================================================== - Modules - ==================================================*/ - const _ = require('underscore'); const sdk = require("@defillama/sdk") const BigNumber = require('bignumber.js'); - - /*================================================== - Settings - ==================================================*/ +const { staking } = require('../helper/staking'); const zeroAddress = '0x0000000000000000000000000000000000000000' const peakAddress = '0x630d98424eFe0Ea27fB1b3Ab7741907DFFEaAd78' @@ -84,10 +77,6 @@ bsc: '0xe9428B8acaA6b9d7C3314D093975c291Ec59A009', } -/*================================================== - TVL - ==================================================*/ - async function getFundBalances(block) { let calls = []; let balances = {}; @@ -125,58 +114,17 @@ return balances; } - async function getStakedTokens(block) { - const balances = {}; - - const bscBalance = ( - await sdk.api.abi.call({ - block, - chain: 'bsc', - target: peakAddress, - params: [stakingContracts.bsc], - abi: 'erc20:balanceOf' - }) - ).output; - - sdk.util.sumSingleBalance(balances, peakAddress, bscBalance); - - const ethBalance = ( - await sdk.api.abi.call({ - block, - chain: 'ethereum', - target: peakAddress, - params: [stakingContracts.ethereum], - abi: 'erc20:balanceOf' - }) - ).output; - - sdk.util.sumSingleBalance(balances, peakAddress, ethBalance); - - return balances; - } - async function tvl(timestamp, block) { const balances = await getFundBalances(block); return balances; } - - async function staking(timestamp, block) { - const balances = await getStakedTokens(block); - return balances; - } - -/*================================================== - Exports - ==================================================*/ - module.exports = { - misrepresentedTokens: true, - name: 'PEAKDEFI', // Peakdefi - token: 'PEAK', // PEAK token - category: 'assets', // Allowed values as shown on DefiPulse: 'Derivatives', 'DEXes', 'Lending', 'Payments', 'Assets' start: 1607405152, // Dec-08-2020 05:25:52 PM +UTC - staking: { - tvl: staking + bsc:{ + staking: staking(stakingContracts.bsc, peakAddress, "bsc", peakAddress), + }, + ethereum:{ + staking: staking(stakingContracts.ethereum, peakAddress), + tvl }, - tvl, // Tvl adapter } \ No newline at end of file diff --git a/projects/penguin/index.js b/projects/penguin/index.js index cdceca418a..54df7a2f33 100644 --- a/projects/penguin/index.js +++ b/projects/penguin/index.js @@ -86,8 +86,8 @@ async function getTokensInMasterChef(time, ethBlock, chainBlocks) { } module.exports = { - staking: { - tvl: sdk.util.sumChainTvls([nest, nestv2].map(chef => staking(chef, pefiToken, "avax"))), - }, - tvl: getTokensInMasterChef, + avalanche:{ + staking: sdk.util.sumChainTvls([nest, nestv2].map(chef => staking(chef, pefiToken, "avax"))), + tvl: getTokensInMasterChef, + } } diff --git a/projects/perp/index.js b/projects/perp/index.js index 418c487a95..ddef6fd4b5 100644 --- a/projects/perp/index.js +++ b/projects/perp/index.js @@ -1,5 +1,6 @@ const sdk = require("@defillama/sdk"); -const {transformXdaiAddress} = require('../helper/portedTokens') +const {transformXdaiAddress} = require('../helper/portedTokens'); +const { staking } = require("../helper/staking"); const insuranceFund = "0x8C29F6F7fc1999aB84b476952E986F974Acb3824" const clearingHouse = "0x5d9593586b4B5edBd23E7Eba8d88FD8F09D83EBd" @@ -29,22 +30,11 @@ async function xdai(_timestamp, ethBlock, chainBlocks) { return balances } -async function ethStaking(_timestamp, ethBlock, chainBlocks) { - return { - [perpToken]: (await sdk.api.erc20.balanceOf({ - target: perpToken, - owner: stakingContract, - block: ethBlock - })).output - } -} - module.exports = { - staking: { - tvl: ethStaking + ethereum: { + staking: staking(stakingContract, perpToken) }, xdai: { tvl: xdai }, - tvl: sdk.util.sumChainTvls([xdai]) } \ No newline at end of file diff --git a/projects/syncnetwork/index.js b/projects/syncnetwork/index.js index 0cdaac8f82..427c71fa9a 100644 --- a/projects/syncnetwork/index.js +++ b/projects/syncnetwork/index.js @@ -46,11 +46,9 @@ async function staked(timestamp, block) { module.exports = { methodology:"Pool2 is the SYNC-ETH pair on UNI and staking according to their FAQ are SYNC tokens locked into CBOND contracts", - pool2: { - tvl: pool2, - }, - staking: { - tvl: staked, - }, - tvl: async () => ({}), + ethereum:{ + pool2, + staking: staked, + tvl: async () => ({}), + } }; diff --git a/projects/timewarp/index.js b/projects/timewarp/index.js index 909236a838..e9b8db79a9 100644 --- a/projects/timewarp/index.js +++ b/projects/timewarp/index.js @@ -38,7 +38,7 @@ const calcTvl = async (balances, chain, block, TimeWarpPool) => { }; /*** Staking of native token (TIME) on Ethereum and Binance TVL portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { +const stakingETH = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; // --- Staking of native token TIME on Ethereum --- @@ -49,6 +49,12 @@ const staking = async (timestamp, ethBlock, chainBlocks) => { TimeWarpPool_TIME_ETH ); + return balances; +}; + +const stakingBSC = async (timestamp, ethBlock, chainBlocks) => { + const balances = {}; + // --- Staking of native token TIME on Binance --- await calcTvl(balances, "bsc", chainBlocks["bsc"], TimeWarpPool_TIME_BSC); @@ -85,16 +91,14 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { module.exports = { misrepresentedTokens: true, - staking: { - tvl: staking, - }, ethereum: { tvl: ethTvl, + staking: stakingETH }, bsc: { tvl: bscTvl, + staking: stakingBSC }, - tvl: sdk.util.sumChainTvls([bscTvl, ethTvl]), methodology: `We count as TVL the staking Lps on Ethereum (TIME-ETH Sushiswap LP) and Binance (TIME-BNB Pancake LP) networks threw their TimeWarpPool contracts; and we count the staking native token (TIME) on both netwarks, separated from tvl`, From b2a5f3276577780794d3f26d6d6833cb1a659395 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 12 Dec 2021 11:35:48 +0000 Subject: [PATCH 344/393] separate more pool2/staking by chain --- projects/GajFinance/index.js | 21 ++++++++++++--------- projects/asgardfinance/index.js | 5 +---- projects/avaware/index.js | 7 ++----- projects/bunicorn/index.js | 5 +---- projects/coffin/index.js | 5 +---- projects/kafefinance/index.js | 22 ++++++++++------------ projects/keep3r.js | 8 ++++---- projects/klayswap/index.js | 15 +++++++++------ projects/koffeeswap/index.js | 5 +---- projects/kronos/index.js | 13 ++++++++----- projects/liquiddriver/index.js | 14 +++++++------- projects/nasdex/index.js | 10 ++++------ projects/summitdefi/index.js | 5 +---- 13 files changed, 61 insertions(+), 74 deletions(-) diff --git a/projects/GajFinance/index.js b/projects/GajFinance/index.js index b3bd703efa..d7693ce75b 100644 --- a/projects/GajFinance/index.js +++ b/projects/GajFinance/index.js @@ -14,9 +14,14 @@ const JUNGLEPOOL = '0xD45AB9b5655D1A3d58162ed1a311df178C04ddDe' const nativeEndpoint = "https://gajvaultapi.herokuapp.com/native" const nonNativeEndpoint = "https://gajvaultapi.herokuapp.com/nonNative" -async function staking(timestamp, ethBlock, chainBlocks) { +async function stakingPolygon(timestamp, ethBlock, chainBlocks) { const balances = {}; await sumTokensAndLPsSharedOwners(balances, [[GAJ_TOKEN, false]], [NFTFARM_GAJ, MASTER_GAJ, JUNGLEPOOL], chainBlocks.polygon, 'polygon', addr => `polygon:${addr}`) + return balances +} + +async function stakingAvax(timestamp, ethBlock, chainBlocks) { + const balances = {}; await sumTokensAndLPsSharedOwners(balances, [[GAJ_AVAX_TOKEN, false]], [NFTFARM_GAJ_AVAX], chainBlocks.avax, 'avax', addr => `avax:${addr}`) return balances } @@ -64,15 +69,13 @@ module.exports = { methodology: "TVL comes from NFT Farming, Jungle Pools, MasterChef and Vaults", tvl: vaults(false), avalanche:{ - tvl: vaults(false, 'avax') + tvl: vaults(false, 'avax'), + pool2: vaults(true, 'avax'), + staking: stakingAvax, }, polygon:{ - tvl: vaults(false, 'polygon') - }, - staking: { - tvl: staking + tvl: vaults(false, 'polygon'), + pool2: vaults(true, 'polygon'), + staking: stakingPolygon, }, - pool2: { - tvl: vaults(true) - } } diff --git a/projects/asgardfinance/index.js b/projects/asgardfinance/index.js index 7cf6fb86ca..0b0f0db85d 100644 --- a/projects/asgardfinance/index.js +++ b/projects/asgardfinance/index.js @@ -57,12 +57,9 @@ async function ethTvl(timestamp, block) { module.exports = { ethereum: { + staking, tvl: ethTvl, }, - staking: { - tvl: staking, - }, - tvl: sdk.util.sumChainTvls([ethTvl]), methodology: "Counts DAI, DAI SLP (ASG-DAI), FRAX, FRAX SLP (ASG-FRAX), UST, UST SLP (ASG-UST) on the treasury", }; diff --git a/projects/avaware/index.js b/projects/avaware/index.js index d4836ef7c8..95e61338c7 100644 --- a/projects/avaware/index.js +++ b/projects/avaware/index.js @@ -104,14 +104,11 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { }; module.exports = { - misrepresentedTokens: true, - staking: { - tvl: staking, - }, + timetravel: true, avalanche: { + staking, tvl: avaxTvl, }, - tvl: sdk.util.sumChainTvls([avaxTvl]), methodology: `We count TVL that is on the Farms threw FarmPoolManager contract and the portion of staking the native token (AVE) by treasury contract`, }; diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js index 9a2fed22b2..dfcb0366c3 100644 --- a/projects/bunicorn/index.js +++ b/projects/bunicorn/index.js @@ -94,9 +94,6 @@ module.exports = { misrepresentedTokens: true, bsc: { tvl: getTotalTVL, + staking: getTotalFarmTVL }, - staking: { - tvl: getTotalFarmTVL, - }, - tvl: getTotalTVL, }; diff --git a/projects/coffin/index.js b/projects/coffin/index.js index 917979beb2..62c49acbc8 100644 --- a/projects/coffin/index.js +++ b/projects/coffin/index.js @@ -46,12 +46,9 @@ const v2TVL = async (timestamp, ethBlock, chainBlocks) => { module.exports = { misrepresentedTokens: true, - staking: { - tvl: staking(stakingContract, WFTM, "fantom"), - }, fantom: { + staking: staking(stakingContract, WFTM, "fantom"), tvl: sdk.util.sumChainTvls([ftmTvl, v2TVL]), }, - tvl: sdk.util.sumChainTvls([ftmTvl, v2TVL]), methodology: "We count liquidity on the Farms through MasterChef and MasterChefv2 Contract", }; diff --git a/projects/kafefinance/index.js b/projects/kafefinance/index.js index ed7e3d296a..926d2435ca 100644 --- a/projects/kafefinance/index.js +++ b/projects/kafefinance/index.js @@ -1,4 +1,5 @@ const utils = require("../helper/utils"); +const {toUSDTBalances} = require("../helper/balances"); // Please refer to Github(https://github.com/kukafe/kafe-defillama/tree/main/kafe-defillama) for the codes to calculate the TVL via on-chain calls const apiUrl = "http://142.93.53.244:5001/getTvl"; @@ -16,7 +17,7 @@ async function fetchChain(chain, includePool2) { } totalTvl = totalTvl + Number(entry.TVL); }); - return Math.round(totalTvl); + return toUSDTBalances(Math.round(totalTvl)); } async function fetchCronos() { @@ -33,7 +34,7 @@ async function fetchMoonRiverPool2() { async function fetchMoonriverStaking() { let response = (await utils.fetchURL(apiUrl)).data; - return Math.round(Number(response["KAFE"].TVL)); + return toUSDTBalances(Math.round(Number(response["KAFE"].TVL))); } async function fetch() { @@ -43,17 +44,14 @@ async function fetch() { } module.exports = { + misrepresentedTokens: true, + timetravel: false, cronos: { - fetch: fetchCronos, + tvl: fetchCronos, }, moonriver: { - fetch: fetchMoonriver, + tvl: fetchMoonriver, + staking: fetchMoonriverStaking, + pool2: fetchMoonRiverPool2 }, - pool2: { - fetch: fetchMoonRiverPool2, - }, - staking: { - fetch: fetchMoonriverStaking, - }, - fetch, -}; +} diff --git a/projects/keep3r.js b/projects/keep3r.js index 73fb3cff20..4b56b93329 100644 --- a/projects/keep3r.js +++ b/projects/keep3r.js @@ -27,8 +27,8 @@ async function tvl(timestmpa, block) { return {}; }; module.exports = { - tvl, - staking: { - tvl: staking - } + ethereum:{ + tvl, + staking + }, }; \ No newline at end of file diff --git a/projects/klayswap/index.js b/projects/klayswap/index.js index 5d2dccdcf2..4da2d7f483 100644 --- a/projects/klayswap/index.js +++ b/projects/klayswap/index.js @@ -1,6 +1,7 @@ const retry = require('async-retry') const axios = require("axios"); const BigNumber = require("bignumber.js"); +const { toUSDTBalances } = require('../helper/balances'); async function fetchLiquidity() { const klayswapInfo = await retry(async bail => await axios.get('https://s.klayswap.com/stat/klayswapInfo.json')) @@ -10,7 +11,7 @@ async function fetchLiquidity() { for(const pool of recentPoolInfo){ totalLiquidity = totalLiquidity.plus(pool.poolVolume); } - return totalLiquidity.toFixed(2); + return toUSDTBalances(totalLiquidity.toFixed(2)); } async function fetchStakedToken() { @@ -25,13 +26,15 @@ async function fetchStakedToken() { const tvl = new BigNumber(dayTvl[dayTvl.length-1].amount); const stakedKsp = tvl.minus(totalLiquidity); - return stakedKsp.toFixed(2); + return toUSDTBalances(stakedKsp.toFixed(2)); } module.exports = { methodology: 'TVL counts the liquidity of KlaySwap DEX and staking counts the KSP that has been staked. Data is pulled from:"https://s.klayswap.com/stat/klayswapInfo.json".', - fetch: fetchLiquidity, - staking: { - fetch: fetchStakedToken - } + klaytn:{ + tvl: fetchLiquidity, + staking: fetchStakedToken + }, + misrepresentedTokens: true, + timetravel: false, } \ No newline at end of file diff --git a/projects/koffeeswap/index.js b/projects/koffeeswap/index.js index 6a693723aa..69db6da63f 100644 --- a/projects/koffeeswap/index.js +++ b/projects/koffeeswap/index.js @@ -89,13 +89,10 @@ const kccTvl = async (timestamp, ethBlock, chainBlocks) => { module.exports = { misrepresentedTokens: true, - staking: { - tvl: staking, - }, kcc: { + staking, tvl: kccTvl, }, - tvl: sdk.util.sumChainTvls([kccTvl]), methodology: "We count liquidity on the brews threw their contracts and the portion TVL staking the native token (KOFFEE) by FeatureStaking contract", }; diff --git a/projects/kronos/index.js b/projects/kronos/index.js index bcfd47cc48..c23cf0cfc9 100644 --- a/projects/kronos/index.js +++ b/projects/kronos/index.js @@ -3,6 +3,7 @@ const erc20 = require("../helper/abis/erc20.json"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); const axios = require("axios"); +const { toUSDTBalances } = require("../helper/balances"); const sKRNO_ADDRESS = "0x6555F93f608980526B5cA79b3bE2d4EdadB5C562"; const BOND_CALCULATOR = "0x1f6b7Bde22d1618724519d135839fDc5D2Ffd35A"; @@ -123,7 +124,7 @@ async function fetchStakedToken() { MINT_DATA_ARRAY.find((mintData) => mintData.NAME === "KDAI_KRNO_LP") ), ]); - return (sKRNOcirculatingSupply * marketPrice) / Math.pow(10, 9).toFixed(2); + return toUSDTBalances((sKRNOcirculatingSupply * marketPrice) / Math.pow(10, 9).toFixed(2)); } async function fetchLiquidity() { @@ -133,13 +134,15 @@ async function fetchLiquidity() { MINT_DATA_ARRAY.map((mintData) => getMintVolume(caver, mintData)) ); - return volumes.reduce((acc, cur) => acc + cur, 0).toFixed(2); + return toUSDTBalances(volumes.reduce((acc, cur) => acc + cur, 0).toFixed(2)); } module.exports = { - fetch: fetchLiquidity, - staking: { - fetch: fetchStakedToken, + timetravel: false, + misrepresentedTokens: true, + klaytn:{ + staking: fetchStakedToken, + tvl: fetchLiquidity }, methodology: "Counts tokens on the treasury for tvl and staked KRNO for staking", diff --git a/projects/liquiddriver/index.js b/projects/liquiddriver/index.js index 89cc4179d7..ee96876f74 100644 --- a/projects/liquiddriver/index.js +++ b/projects/liquiddriver/index.js @@ -196,11 +196,11 @@ const minichefTvl = async (timestamp, ethBlock, chainBlocks) => { }; module.exports = { - staking: { - tvl: staking(xLQDR, LQDR, "fantom", "fantom:" + LQDR), - }, - tvl: sdk.util.sumChainTvls([ - masterchefTvl, - minichefTvl, - ]), + fantom: { + staking: staking(xLQDR, LQDR, "fantom", "fantom:" + LQDR), + tvl: sdk.util.sumChainTvls([ + masterchefTvl, + minichefTvl, + ]), + } }; diff --git a/projects/nasdex/index.js b/projects/nasdex/index.js index 1e0e95c752..a5380570b6 100644 --- a/projects/nasdex/index.js +++ b/projects/nasdex/index.js @@ -7,13 +7,11 @@ const NSDX_USDC_UNIV2 = "0x56B8936a96cD5EE5C5837F385a19B4c2999fD74a"; module.exports = { misrepresentedTokens: true, - staking: { - tvl: staking(stakingContract, NSDX, "polygon"), + polygon:{ + staking: staking(stakingContract, NSDX, "polygon"), + pool2: pool2(stakingContract, NSDX_USDC_UNIV2, "polygon"), + tvl: async () => ({}), }, - pool2: { - tvl: pool2(stakingContract, NSDX_USDC_UNIV2, "polygon"), - }, - tvl: async () => ({}), methodology: "We count liquidity on the Stake Seccion through Staking (MasterChef) Contract", }; diff --git a/projects/summitdefi/index.js b/projects/summitdefi/index.js index 2ff8f527d7..7d96c0f232 100644 --- a/projects/summitdefi/index.js +++ b/projects/summitdefi/index.js @@ -131,13 +131,10 @@ const ftmTvl = async () => { module.exports = { misrepresentedTokens: true, - staking: { - tvl: staking(CartographerContract, WFTM, "fantom"), - }, fantom: { + staking: staking(CartographerContract, WFTM, "fantom"), tvl: ftmTvl, }, - tvl: sdk.util.sumChainTvls([ftmTvl]), methodology: "We count liquidity on the all Farm Cartographer Types through their Cartographer Contracts", }; From f03ca005192db333b2ea0041f6d7d0d0edf0f2da Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 12 Dec 2021 11:49:00 +0000 Subject: [PATCH 345/393] more staking/pool2 chain separation --- projects/babyswap/index.js | 25 +++---------------------- projects/farmersonly/index.js | 18 +++++++----------- projects/pancake-swap.js | 6 +++--- 3 files changed, 13 insertions(+), 36 deletions(-) diff --git a/projects/babyswap/index.js b/projects/babyswap/index.js index 4408b8663d..3b42270ab8 100644 --- a/projects/babyswap/index.js +++ b/projects/babyswap/index.js @@ -4,27 +4,11 @@ const abi = require("./abi.json"); const { addFundsInMasterChef } = require("../helper/masterchef"); const { transformBscAddress } = require("../helper/portedTokens"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); const MasterChefContract = "0xdfAa0e08e357dB0153927C7EaBB492d1F60aC730"; const BABY = "0x53E562b9B7E5E94b81f10e96Ee70Ad06df3D2657"; -/*** Staking of native token (BABY) TVL portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - let transformAddress = await transformBscAddress(); - - await sumTokensAndLPsSharedOwners( - balances, - [[BABY, false]], - [MasterChefContract], - chainBlocks["bsc"], - "bsc", - transformAddress - ); - - return balances; -}; // node test.js projects/babyswap/index.js const bscTvl = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; @@ -48,14 +32,11 @@ const bscTvl = async (timestamp, ethBlock, chainBlocks) => { }; module.exports = { - misrepresentedTokens: true, - staking: { - tvl: staking, - }, + timetravel: true, bsc: { + staking: staking(MasterChefContract, BABY, "bsc"), tvl: bscTvl, }, - tvl: sdk.util.sumChainTvls([bscTvl]), methodology: "We count liquidity on the Farms (LP tokens) and Pools (single tokens) seccions threw MasterChef Contract", }; diff --git a/projects/farmersonly/index.js b/projects/farmersonly/index.js index 99d0286a75..065a1477df 100644 --- a/projects/farmersonly/index.js +++ b/projects/farmersonly/index.js @@ -1,4 +1,5 @@ const { default: axios } = require("axios"); +const { toUSDTBalances } = require("../helper/balances"); const retry = require("../helper/retry"); const farmApi = "https://api.elision.farm/getFarmStats/harmony/farmersonlyfi"; @@ -43,30 +44,25 @@ async function getTvl(data, category) { async function harmonyTvl() { let farmTvl = await getFarmTvl(); let vaultTvl = await getVaultTvl(); - return farmTvl + vaultTvl; + return toUSDTBalances(farmTvl + vaultTvl); } async function pool2() { let farmTvl = await getFarmTvl("pool2"); let vaultTvl = await getVaultTvl("pool2"); - return farmTvl + vaultTvl; + return toUSDTBalances(farmTvl + vaultTvl); } async function staking() { let farmTvl = await getFarmTvl("staking"); let vaultTvl = await getVaultTvl("staking"); - return farmTvl + vaultTvl; + return toUSDTBalances(farmTvl + vaultTvl); } module.exports = { harmony: { - fetch: harmonyTvl, + tvl: harmonyTvl, + pool2, + staking }, - pool2: { - fetch: pool2, - }, - staking: { - fetch: staking, - }, - fetch: harmonyTvl }; diff --git a/projects/pancake-swap.js b/projects/pancake-swap.js index 68fcddb81b..f69fddc648 100644 --- a/projects/pancake-swap.js +++ b/projects/pancake-swap.js @@ -92,8 +92,8 @@ module.exports = { timetravel: true, misrepresentedTokens: true, methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://pancakeswap.info/ as the source. Staking accounts for the CAKE locked in MasterChef (0x73feaa1eE314F8c655E354234017bE2193C9E24E)', - staking: { - tvl: staking + bsc: { + staking, + tvl }, - tvl } From c6e5ab6332ae3ad497ec3397309da1dd4fa12f97 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Sun, 12 Dec 2021 12:30:32 +0000 Subject: [PATCH 346/393] remove unneeded export --- projects/opendao/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/projects/opendao/index.js b/projects/opendao/index.js index 123592a46d..b11ee3c971 100644 --- a/projects/opendao/index.js +++ b/projects/opendao/index.js @@ -44,5 +44,4 @@ module.exports = { bsc: { tvl, }, - tvl, }; From 9da6a0c1e5d6d38437d6a1a88c6a014cd665d189 Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 12 Dec 2021 13:44:38 +0000 Subject: [PATCH 347/393] stargate-finance adapters --- projects/stargate-finance/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/stargate-finance/index.js diff --git a/projects/stargate-finance/index.js b/projects/stargate-finance/index.js new file mode 100644 index 0000000000..229f79c51a --- /dev/null +++ b/projects/stargate-finance/index.js @@ -0,0 +1,13 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0xA2B48Ad28c09cc64CcCf9eD73e1EfceD052877d5"; +module.exports = ohmTvl(treasuryAddress, [ +//BSC-USD + ["0x55d398326f99059ff775485246999027b3197955", false], +//BUSD + ["0xe9e7cea3dedca5984780bafc599bd69add087d56", false], +//BABY LP + ["0xd397a40884ce00e662b419673e0b15cae628877f", true] , +//Pancake LP + ["0x41516dca7efe69518ec414de35e5aa067788de3d", true] +], "bsc", "0xb82aC36e9dF3c700F12ECF552F240BF4D7B7a212", "0x141381f07Fa31432243113Cda2F617d5d255d39a" , undefined, undefined, false) \ No newline at end of file From 816bf50cb8c6c5dacca8d41da61ea00c024b438a Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 12 Dec 2021 14:09:55 +0000 Subject: [PATCH 348/393] adapter for atlas-usv (check) --- projects/atlas-usv/index.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 projects/atlas-usv/index.js diff --git a/projects/atlas-usv/index.js b/projects/atlas-usv/index.js new file mode 100644 index 0000000000..984cfd68e1 --- /dev/null +++ b/projects/atlas-usv/index.js @@ -0,0 +1,13 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0x71EF2894E23D7ea7Fd73a3558B3a0bA25689bC86"; +module.exports = ohmTvl(treasuryAddress, [ +//DAI + ["0x8f3cf7ad23cd3cadbd9735aff958023239c6a063", false], +//FRAX + ["0x104592a158490a9228070e0a8e5343b499e125d0", false], +//SSX + ["0x9e2d266d6c90f6c0d80a88159b15958f7135b8af", false] , +//Sushi LP + ["0xc16e382aa7353aad0f598856afd9a93513542970", true] +], "polygon", "0x99bbc86E1f5447cf1908b27CEd0D2a0B9aA5efb2", "0xAC63686230f64BDEAF086Fe6764085453ab3023F") \ No newline at end of file From 0d6d822212de152f1e869ca45f031f505649fcd7 Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 12 Dec 2021 14:29:04 +0000 Subject: [PATCH 349/393] adapter pumpkin-dao --- projects/pumpkin-dao/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/pumpkin-dao/index.js diff --git a/projects/pumpkin-dao/index.js b/projects/pumpkin-dao/index.js new file mode 100644 index 0000000000..c8b78974be --- /dev/null +++ b/projects/pumpkin-dao/index.js @@ -0,0 +1,15 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0x0DEA39519cb8c7c549e321d3020E96f91Ed36Ed3"; +module.exports = ohmTvl(treasuryAddress, [ +//DAI + ["0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e", false], +//wFTM + ["0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", false], +//SPOOKY LP + ["0xdf42866dc8fa6a962124b5d9eb8c91fa447f4feb", true] , +//SPOOKY LP + ["0x01e7f6506bc3661dc690a0a076ace9d3d0253d92", true] +], "fantom", "0x5d189D8224a9aFBc3eC69bedBe2f6dd89B937E73", "0x8eDDA0107D661E82df660DBa01Ff1D40FA17B70c" , addr=> + addr.toLowerCase()==="0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"?"0x6b175474e89094c44da98b954eedeac495271d0f":`fantom:${addr}` +, undefined, false) \ No newline at end of file From ac4402861da07e6fc6c7b7b906436770daaebb8e Mon Sep 17 00:00:00 2001 From: haodi <82733821@qq.com> Date: Sun, 12 Dec 2021 22:46:26 +0800 Subject: [PATCH 350/393] fixed issue for Flux --- projects/flux/index.js | 64 +++++++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 22 deletions(-) diff --git a/projects/flux/index.js b/projects/flux/index.js index ccb5756d51..9e905308ff 100644 --- a/projects/flux/index.js +++ b/projects/flux/index.js @@ -1,34 +1,54 @@ -// import { providers, Contract } from "ethers"; const axios = require("axios"); -const url = "https://gateway.api.01defi.com/base/fluxTvl/get"; +const { toUSDTBalances } = require("../helper/balances"); -//total -async function fetch() { - const data = await axios.get(url); - return Number(data?.data?.data?.lendingTVL); -} +const url = "https://gateway.api.01defi.com/base/fluxTvl/get"; // tvl and staking amount -async function getChainData(chain) { - const data = await axios.get(url); - const info = (data?.data?.data?.detail || []).find( - (item) => item.chain === chain - ); +function getChainData(chain, type) { + return async () => { + const data = await axios.get(url); + const info = (data?.data?.data?.detail || []).find( + (item) => item.chain === chain + ); - return { - fetch: Number(info.lendingTVL), - staking: Number(info.stakedTVL), + switch (type) { + case "tvl": + return toUSDTBalances(info.lendingTVL); + case "staking": + return toUSDTBalances(info.stakedTVL); + } }; } module.exports = { timetravel: true, - bsc: getChainData('bsc'), - okexchain: getChainData('okexchain'), - heco: getChainData('heco'), - arbitrum: getChainData('arbitrum'), - polygon: getChainData('polygon'), - conflux: getChainData('conflux'), - fetch, + bsc: { + tvl: getChainData("bsc", "tvl"), + staking: getChainData("bsc", "staking"), + }, + okexchain: { + tvl: getChainData("okexchain", "tvl"), + staking: getChainData("okexchain", "staking"), + }, + heco: { + tvl: getChainData("heco", "tvl"), + staking: getChainData("heco", "staking"), + }, + arbitrum: { + tvl: getChainData("arbitrum", "tvl"), + staking: getChainData("arbitrum", "staking"), + }, + polygon: { + tvl: getChainData("polygon", "tvl"), + staking: getChainData("polygon", "staking"), + }, + conflux: { + tvl: getChainData("conflux", "tvl"), + staking: getChainData("conflux", "staking"), + }, + ethereum: { + tvl: getChainData("ethereum", "tvl"), + staking: getChainData("ethereum", "staking"), + }, name: "Flux Project", }; From 7d836fc2d673ba298059496cbba857e25540664a Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 12 Dec 2021 15:22:53 +0000 Subject: [PATCH 351/393] adapter papa-dao --- projects/papa-dao/Index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 projects/papa-dao/Index.js diff --git a/projects/papa-dao/Index.js b/projects/papa-dao/Index.js new file mode 100644 index 0000000000..926f63b937 --- /dev/null +++ b/projects/papa-dao/Index.js @@ -0,0 +1,15 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0x3C8e800B9f12771A5f150D0943De968ABc7A7bE1"; +module.exports = ohmTvl(treasuryAddress, [ +//MIM + ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], +//USDT.e + ["0xc7198437980c041c805a1edcba50c1ce5db95118", false], +//wAVAX + ["0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", false], +//JOE LP + ["0xa03a99cd3d553fe9ebbccecabcb8c47100482f72", true] , +//JOE LP + ["0x29828626ca711b0e13de1031aae1f5423100e642", true] +], "avax", "0x3875AC1F19E05813000F02414b3141DC3Ff991B6", "0x70b33ebC5544C12691d055b49762D0F8365d99Fe" ) \ No newline at end of file From 90edca3fd3ca097fede31f4beab25c9ab31783a0 Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 12 Dec 2021 15:31:05 +0000 Subject: [PATCH 352/393] adapter for cheesedao --- projects/cheesedao/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 projects/cheesedao/index.js diff --git a/projects/cheesedao/index.js b/projects/cheesedao/index.js new file mode 100644 index 0000000000..63fd939b3d --- /dev/null +++ b/projects/cheesedao/index.js @@ -0,0 +1,11 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0xf8c08c5aD8270424Ad914d379e85aC03a44fF996"; +module.exports = ohmTvl(treasuryAddress, [ +//1DAI + ["0xef977d2f931c1978db5f6747666fa1eacb0d0339", false], +//1FRAX + ["0xeb6c08ccb4421b6088e581ce04fcfbed15893ac3", false], +//Sushi LP + ["0x82723f6c0b32f28ddc2006b9cdbca6cee0ad957a", true] +], "harmony", "0x72Be77E232Dd13E6aE06088696B83256892c2933", "0xBbD83eF0c9D347C85e60F1b5D2c58796dBE1bA0d") \ No newline at end of file From 330e455ec4baae7421ac42b916951436a8a61829 Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 12 Dec 2021 15:51:30 +0000 Subject: [PATCH 353/393] adapter for ice-dao --- projects/ice-dao/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/ice-dao/index.js diff --git a/projects/ice-dao/index.js b/projects/ice-dao/index.js new file mode 100644 index 0000000000..6c2ae5f1fb --- /dev/null +++ b/projects/ice-dao/index.js @@ -0,0 +1,9 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0x4f3340A84e610Fb3030E6cE5081804BdD8D7532A"; +module.exports = ohmTvl(treasuryAddress, [ +//MIM + ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], +//JOE LP + ["0xfefb9b28f341d855b598e16ecc5f83b40cd827e6", true] +], "avax", "0x82eeefe5cc8ad478893b377327ef2b710c51059f", "0x9235b893a3e61a14b2d02a91ec1394fbf411689e") \ No newline at end of file From e99aaa9a1cfc0c93e85ee5732d93904606b6a586 Mon Sep 17 00:00:00 2001 From: Define101 Date: Sun, 12 Dec 2021 16:06:45 +0000 Subject: [PATCH 354/393] tempodao adapter --- projects/tempodao/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 projects/tempodao/index.js diff --git a/projects/tempodao/index.js b/projects/tempodao/index.js new file mode 100644 index 0000000000..18a320e2a3 --- /dev/null +++ b/projects/tempodao/index.js @@ -0,0 +1,9 @@ +const { ohmTvl } = require("../helper/ohm"); + +const treasuryAddress = "0x2af791E7EBa7efF93485CF8516bAf7bdc94d4db7"; +module.exports = ohmTvl(treasuryAddress, [ +//MIM + ["0x130966628846bfd36ff31a822705796e8cb8c18d", false], +//JOE LP + ["0xfefb9b28f341d855b598e16ecc5f83b40cd827e6", true] +], "avax", "0x6323c227f71b30babdd6fe84093027079a955662", "0x88a425b738682f58c0ff9fcf2cceb47a361ef4cf" , undefined, undefined, false) \ No newline at end of file From cfd96163b8bcfea774170e098960789a60d463da Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Sun, 12 Dec 2021 16:41:19 +0000 Subject: [PATCH 355/393] Update index.js --- projects/atlas-usv/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/atlas-usv/index.js b/projects/atlas-usv/index.js index 984cfd68e1..27925f7dff 100644 --- a/projects/atlas-usv/index.js +++ b/projects/atlas-usv/index.js @@ -10,4 +10,4 @@ module.exports = ohmTvl(treasuryAddress, [ ["0x9e2d266d6c90f6c0d80a88159b15958f7135b8af", false] , //Sushi LP ["0xc16e382aa7353aad0f598856afd9a93513542970", true] -], "polygon", "0x99bbc86E1f5447cf1908b27CEd0D2a0B9aA5efb2", "0xAC63686230f64BDEAF086Fe6764085453ab3023F") \ No newline at end of file +], "polygon", "0x99bbc86E1f5447cf1908b27CEd0D2a0B9aA5efb2", "0xAC63686230f64BDEAF086Fe6764085453ab3023F", undefined, undefined, false) From c683038e5c4de6a87a274da04b4a16236c0cd302 Mon Sep 17 00:00:00 2001 From: Serg Ilchuk Date: Mon, 13 Dec 2021 09:15:50 +0200 Subject: [PATCH 356/393] NFTb new contracts --- projects/nftb/index.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/projects/nftb/index.js b/projects/nftb/index.js index d1bacf318d..cee9437c0b 100644 --- a/projects/nftb/index.js +++ b/projects/nftb/index.js @@ -85,6 +85,21 @@ const bscPools = [ "0xf81628edeb110a73c016ab7afa57d80afae07f59", "bsc:0xf81628edeb110a73c016ab7afa57d80afae07f59", ], //1-Month LOTT Vault + [ + "0x01ba0f95Ca1Ba5Dd9981398fE79103F058381B12", + "0x22168882276e5d5e1da694343b41dd7726eeb288", + "bsc:0x22168882276e5d5e1da694343b41dd7726eeb288", + ], //6-Month WSB Vault + [ + "0x83ed2A12943c67e66f4084368A07F2B51CbF5e51", + "0x22168882276e5d5e1da694343b41dd7726eeb288", + "bsc:0x22168882276e5d5e1da694343b41dd7726eeb288", + ], //3-Month WSB Vault + [ + "0x3314CfD1c5538c7521790347FA129ec23FEDED4E", + "0x22168882276e5d5e1da694343b41dd7726eeb288", + "bsc:0x22168882276e5d5e1da694343b41dd7726eeb288", + ], //1-Month WSB Vault ]; async function bsc(_timestamp, block, chainBlocks) { From 1a19fdac04cbd4c80fcc4efb40e3210aa2d803ad Mon Sep 17 00:00:00 2001 From: 0xodia <0xodia@solend.fi> Date: Mon, 13 Dec 2021 00:02:10 -0800 Subject: [PATCH 357/393] Add borrowed and fixed eth tvl --- projects/solend/index.js | 202 +++++++++++++++++++++++++++++---------- 1 file changed, 154 insertions(+), 48 deletions(-) diff --git a/projects/solend/index.js b/projects/solend/index.js index e11957cf08..3881ab0ebd 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -1,53 +1,159 @@ -const {getTokenBalance} = require('../helper/solana') +const BigNumber = require("bignumber.js"); +const { PublicKey, Connection } = require("@solana/web3.js"); +const { parseReserve } = require("@solendprotocol/solend-sdk"); +const { getTokenBalance } = require("../helper/solana"); -async function tvl() { - const [usdcAmount, - btcAmount, - ethAmount, - srmAmount, - usdtAmount, - fttAmount, - rayAmount, - sbrAmount, - merAmount, - solAmount, - msolAmount, - wewethAmount, ] = await Promise.all([ +async function borrowed() { + const connection = new Connection("https://solana-api.projectserum.com/"); + + const parsedAccounts = await connection + .getMultipleAccountsInfo( + [ + new PublicKey("BgxfHJDzm44T7XG68MYKx7YisTjZu73tVovyZSjJMpmw"), + new PublicKey("GYzjMCXTDue12eUGKKWAqtF5jcBYNmewr6Db6LaguEaX"), + new PublicKey("3PArRsZQ6SLkr1WERZWyC6AqsajtALMq4C66ZMYz4dKQ"), + new PublicKey("5suXmvdbKQ98VonxGCXqViuWRu8k4zgZRxndYKsH2fJg"), + new PublicKey("8K9WC8xoh2rtQNY7iEGXtPvfbDCi563SdWhCAhuMP2xE"), + new PublicKey("2dC4V23zJxuv521iYQj8c471jrxYLNQFaGS6YPwtTHMd"), + new PublicKey("9n2exoMQwMTzfw6NFoFFujxYPndWVLtKREJePssrKb36"), + new PublicKey("Hthrt4Lab21Yz1Dx9Q4sFW4WVihdBUTtWRQBjPsYHCor"), + new PublicKey("5Sb6wDpweg6mtYksPJ2pfGbSyikrhR8Ut8GszcULQ83A"), + new PublicKey("8PbodeaosQP19SjYFx855UMqWxH2HynZLdBXmsrbac36"), + new PublicKey("CCpirWrgNuBVLdkP2haxLTbD6XqEgaYuVXixbbpxUB6"), + new PublicKey("CPDiKagfozERtJ33p7HHhEfJERjvfk1VAjMXAFLrvrKP"), + ], + "processed" + ) + .then((unparsedReserves) => { + return unparsedReserves.map((unparsedReserve) => + parseReserve(PublicKey.default, unparsedReserve) + ); + }); - getTokenBalance("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("AGFEad2et2ZJif9jaGpdMixQqvW5i81aBdvKe7PHNfz3", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("So11111111111111111111111111111111111111112", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - getTokenBalance("7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby"), - ]) - return { - 'bitcoin': btcAmount, - 'usd-coin': usdcAmount, - 'ethereum': ethAmount, - 'serum': srmAmount, - 'tether': usdtAmount, - 'ftx-token': fttAmount, - 'raydium': rayAmount, - 'saber': sbrAmount, - 'mercurial': merAmount, - 'solana': solAmount, - 'msol': msolAmount, - 'weweth': wewethAmount, - } + const [ + usdcAmount, + btcAmount, + ethAmount, + srmAmount, + usdtAmount, + fttAmount, + rayAmount, + sbrAmount, + merAmount, + solAmount, + msolAmount, + wewethAmount, + ] = parsedAccounts.map((acc) => { + return new BigNumber( + acc.info.liquidity.borrowedAmountWads.toString() + ).dividedBy( + new BigNumber( + `1${Array(acc.info.liquidity.mintDecimals + 19) + .fill("") + .join("0")}` + ) + ); + }); + + return { + bitcoin: btcAmount, + "usd-coin": usdcAmount, + ethereum: ethAmount.plus(wewethAmount), + serum: srmAmount, + tether: usdtAmount, + "ftx-token": fttAmount, + raydium: rayAmount, + saber: sbrAmount, + mercurial: merAmount, + solana: solAmount, + msol: msolAmount, + }; } -module.exports = { - timetravel: false, - tvl, - methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.', - hallmarks: [ - [1635940800, "SLND launch"] - ] +async function tvl() { + const [ + usdcAmount, + btcAmount, + ethAmount, + srmAmount, + usdtAmount, + fttAmount, + rayAmount, + sbrAmount, + merAmount, + solAmount, + msolAmount, + wewethAmount, + ] = await Promise.all([ + getTokenBalance( + "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "AGFEad2et2ZJif9jaGpdMixQqvW5i81aBdvKe7PHNfz3", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "So11111111111111111111111111111111111111112", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + getTokenBalance( + "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", + "DdZR6zRFiUt4S5mg7AV1uKB2z1f1WzcNYCaTEEWPAuby" + ), + ]); + return { + bitcoin: btcAmount, + "usd-coin": usdcAmount, + ethereum: ethAmount + wewethAmount, + serum: srmAmount, + tether: usdtAmount, + "ftx-token": fttAmount, + raydium: rayAmount, + saber: sbrAmount, + mercurial: merAmount, + solana: solAmount, + msol: msolAmount, + }; } + +module.exports = { + timetravel: false, + tvl, + borrowed, + methodology: + "TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.", + hallmarks: [[1635940800, "SLND launch"]], +}; From 3813aa49e1aa5a7fe5926c53ca459ce2ebd7da76 Mon Sep 17 00:00:00 2001 From: 0xodia <0xodia@solend.fi> Date: Mon, 13 Dec 2021 00:06:53 -0800 Subject: [PATCH 358/393] update package.json --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 4ce844ad32..df9ead3b71 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "@project-serum/anchor": "^0.18.2", "@project-serum/serum": "^0.13.38", "@solana/web3.js": "^1.30.2", + "@solendprotocol/solend-sdk": "^0.1.64", "@vechain/connex-driver": "^2.0.7", "@vechain/connex-framework": "^2.0.7", "async-retry": "^1.3.1", From 53c0d54530dd101df2dc062458b32261778f2675 Mon Sep 17 00:00:00 2001 From: 0xngmi <0xngmi@protonmail.com> Date: Mon, 13 Dec 2021 13:16:11 +0000 Subject: [PATCH 359/393] remove locked reward lina and separate pool2 for linear --- projects/linear/index.js | 50 ++++++++-------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) diff --git a/projects/linear/index.js b/projects/linear/index.js index 4aa9a32b90..1779ddcff4 100644 --- a/projects/linear/index.js +++ b/projects/linear/index.js @@ -2,7 +2,7 @@ const sdk = require("@defillama/sdk"); const BigNumber = require("bignumber.js"); const abis = require("./abis.json"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { pool2 } = require("../helper/pool2"); const LnCollateralSystemAddress = "0xcE2c94d40e289915d4401c3802D75f6cA5FEf57E"; const LnRewardLockerAddress = "0x66D60EDc3876b8aFefD324d4edf105fd5c4aBeDc"; @@ -21,6 +21,9 @@ const vaultpools = { }; function getBSCAddress(address) { + if(address.toLowerCase() === tokens.lUSD){ + return "bsc:"+tokens.bUSD + } return `bsc:${address}`; } @@ -35,13 +38,7 @@ async function tvl(timestamp, blockETH, chainBlocks) { params: LnCollateralSystemAddress, abi: "erc20:balanceOf", }); - - const lockedLina = await sdk.api.abi.call({ - block, - chain: "bsc", - target: LnRewardLockerAddress, - abi: abis["totalLockedAmount"], - }); + sdk.util.sumSingleBalance(balances, getBSCAddress(tokens["LINA"]), stakedLina.output) const bUSDPoolLockedlUSD = await sdk.api.abi.call({ block, @@ -59,44 +56,17 @@ async function tvl(timestamp, blockETH, chainBlocks) { abi: "erc20:balanceOf", }); - const vaultsLockedLpToken = await sdk.api.abi.call({ - block, - chain: "bsc", - target: vaultpools["LP"], - abi: abis["totalStakeAmount"], - }); - - balances[getBSCAddress(tokens["LINA"])] = BigNumber(stakedLina.output) - .plus(lockedLina.output) - .toFixed(0); - - await unwrapUniswapLPs( - balances, - [ - { - balance: vaultsLockedLpToken.output, - token: tokens["LPTOKEN"], - }, - ], - chainBlocks.bsc, - "bsc", - getBSCAddress - ); - - // use bUSD to represent lUSD as it is not listed on coingecko - delete balances[getBSCAddress(tokens["lUSD"])]; - - balances[getBSCAddress(tokens["bUSD"])] = BigNumber( - balances[getBSCAddress(tokens["bUSD"])] * 2 - ) - .plus(bUSDPoolLockedlUSD.output) - .plus(lUSDPoolLockedlUSD.output); + balances[getBSCAddress(tokens["bUSD"])] = BigNumber(bUSDPoolLockedlUSD.output) + .plus(lUSDPoolLockedlUSD.output).toFixed(0); return balances; } module.exports = { + timetravel: true, + methodology: "Counts LINA used to collateralize lUSD and lUSD locked in the vaults. lUSD is replaced with BUSD.", bsc: { tvl, + pool2: pool2(vaultpools["LP"], "0x392f351fc02a3b74f7900de81a9aaac13ec28e95", "bsc", getBSCAddress), }, }; From 4f587d5d3a1ae779c8464526c5dcb0cbca8076cd Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Mon, 13 Dec 2021 15:11:40 +0000 Subject: [PATCH 360/393] drops fix --- projects/drops/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/drops/index.js b/projects/drops/index.js index b39017e90c..253f67fc99 100644 --- a/projects/drops/index.js +++ b/projects/drops/index.js @@ -3,7 +3,7 @@ const BigNumber = require("bignumber.js"); const utils = require("../helper/utils"); const { Pools, tokensAddress } = require("./constants.js"); const { getContractInstance } = require("./utils.js"); - +// node test.js projects/drops/index.js const masterchefABI = require("./abis/masterchef.json"); const lptokenABI = require("./abis/lpToken.json"); const erc20TokenABI = require("./abis/ERC20.json"); @@ -124,8 +124,8 @@ const staking = async () => { module.exports = { methodology: "TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", - ethereum: { - tvl: fetch, - staking, + staking: { + fetch: staking }, + fetch }; From b9f47cd54a031757e0b1cef7e20ca5e7f7b2dbb7 Mon Sep 17 00:00:00 2001 From: 0xodia <0xodia@solend.fi> Date: Mon, 13 Dec 2021 13:47:08 -0800 Subject: [PATCH 361/393] rip parseRreserv --- package.json | 1 - projects/solend/index.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index df9ead3b71..4ce844ad32 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "@project-serum/anchor": "^0.18.2", "@project-serum/serum": "^0.13.38", "@solana/web3.js": "^1.30.2", - "@solendprotocol/solend-sdk": "^0.1.64", "@vechain/connex-driver": "^2.0.7", "@vechain/connex-framework": "^2.0.7", "async-retry": "^1.3.1", diff --git a/projects/solend/index.js b/projects/solend/index.js index 3881ab0ebd..57e7157a11 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -1,6 +1,6 @@ const BigNumber = require("bignumber.js"); const { PublicKey, Connection } = require("@solana/web3.js"); -const { parseReserve } = require("@solendprotocol/solend-sdk"); +const { parseReserve } = require("./utils"); const { getTokenBalance } = require("../helper/solana"); async function borrowed() { From 4b89353b32dfca4d77428da78e8a1ca1c724e5bd Mon Sep 17 00:00:00 2001 From: 0xodia <0xodia@solend.fi> Date: Mon, 13 Dec 2021 13:51:27 -0800 Subject: [PATCH 362/393] missing fil --- projects/solend/utils.js | 174 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 projects/solend/utils.js diff --git a/projects/solend/utils.js b/projects/solend/utils.js new file mode 100644 index 0000000000..2fa2f8473c --- /dev/null +++ b/projects/solend/utils.js @@ -0,0 +1,174 @@ +const BufferLayout = require("buffer-layout"); +const { PublicKey } = require("@solana/web3.js"); +const BN = require("bn.js"); + +const publicKey = (property = "publicKey") => { + const publicKeyLayout = BufferLayout.blob(32, property); + + const _decode = publicKeyLayout.decode.bind(publicKeyLayout); + const _encode = publicKeyLayout.encode.bind(publicKeyLayout); + + publicKeyLayout.decode = (buffer, offset) => { + const data = _decode(buffer, offset); + return new PublicKey(data); + }; + + publicKeyLayout.encode = (key, buffer, offset) => + _encode(key.toBuffer(), buffer, offset); + + return publicKeyLayout; +}; + +/** + * Layout for a 64bit unsigned value + */ +const uint64 = (property = "uint64") => { + const layout = BufferLayout.blob(8, property); + + const _decode = layout.decode.bind(layout); + const _encode = layout.encode.bind(layout); + + layout.decode = (buffer, offset) => { + const data = _decode(buffer, offset); + return new BN( + [...data] + .reverse() + .map((i) => `00${i.toString(16)}`.slice(-2)) + .join(""), + 16 + ); + }; + + layout.encode = (num, buffer, offset) => { + const a = num.toArray().reverse(); + let b = Buffer.from(a); + if (b.length !== 8) { + const zeroPad = Buffer.alloc(8); + b.copy(zeroPad); + b = zeroPad; + } + return _encode(b, buffer, offset); + }; + + return layout; +}; + +const uint128 = (property = "uint128") => { + const layout = BufferLayout.blob(16, property); + + const _decode = layout.decode.bind(layout); + const _encode = layout.encode.bind(layout); + + layout.decode = (buffer, offset) => { + const data = _decode(buffer, offset); + return new BN( + [...data] + .reverse() + .map((i) => `00${i.toString(16)}`.slice(-2)) + .join(""), + 16 + ); + }; + + layout.encode = (num, buffer, offset) => { + const a = num.toArray().reverse(); + let b = Buffer.from(a); + if (b.length !== 16) { + const zeroPad = Buffer.alloc(16); + b.copy(zeroPad); + b = zeroPad; + } + + return _encode(b, buffer, offset); + }; + + return layout; +}; +const LastUpdateLayout = BufferLayout.struct( + [uint64("slot"), BufferLayout.u8("stale")], + "lastUpdate" +); + +const ReserveLayout = BufferLayout.struct([ + BufferLayout.u8("version"), + + LastUpdateLayout, + + publicKey("lendingMarket"), + + BufferLayout.struct( + [ + publicKey("mintPubkey"), + BufferLayout.u8("mintDecimals"), + publicKey("supplyPubkey"), + // @FIXME: oracle option + // TODO: replace u32 option with generic equivalent + // BufferLayout.u32('oracleOption'), + publicKey("pythOracle"), + publicKey("switchboardOracle"), + uint64("availableAmount"), + uint128("borrowedAmountWads"), + uint128("cumulativeBorrowRateWads"), + uint128("marketPrice"), + ], + "liquidity" + ), + + BufferLayout.struct( + [ + publicKey("mintPubkey"), + uint64("mintTotalSupply"), + publicKey("supplyPubkey"), + ], + "collateral" + ), + + BufferLayout.struct( + [ + BufferLayout.u8("optimalUtilizationRate"), + BufferLayout.u8("loanToValueRatio"), + BufferLayout.u8("liquidationBonus"), + BufferLayout.u8("liquidationThreshold"), + BufferLayout.u8("minBorrowRate"), + BufferLayout.u8("optimalBorrowRate"), + BufferLayout.u8("maxBorrowRate"), + BufferLayout.struct( + [ + uint64("borrowFeeWad"), + uint64("flashLoanFeeWad"), + BufferLayout.u8("hostFeePercentage"), + ], + "fees" + ), + uint64("depositLimit"), + uint64("borrowLimit"), + publicKey("feeReceiver"), + ], + "config" + ), + + BufferLayout.blob(256, "padding"), +]); + +const parseReserve = (pubkey, info) => { + const { data } = info; + const buffer = Buffer.from(data); + const reserve = ReserveLayout.decode(buffer); + + if (reserve.lastUpdate.slot.isZero()) { + return null; + } + + const details = { + pubkey, + account: { + ...info, + }, + info: reserve, + }; + + return details; +}; +module.exports = { + parseReserve, +}; From 9cad5aab25a9dae3e453b2a02f59609af19ea5b5 Mon Sep 17 00:00:00 2001 From: freelife2010 Date: Tue, 14 Dec 2021 02:36:03 -0800 Subject: [PATCH 363/393] added borrowed amount --- projects/drops/index.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/projects/drops/index.js b/projects/drops/index.js index 253f67fc99..b83a6059f3 100644 --- a/projects/drops/index.js +++ b/projects/drops/index.js @@ -116,6 +116,11 @@ const fetch = async () => { return res.data ? new BigNumber(res.data.TVL) : 0; }; +const borrowed = async () => { + var res = await utils.fetchURL("https://drops.co/status"); + return res.data ? new BigNumber(res.data.totalBorrow) : 0; +}; + const staking = async () => { const stakingTVL = await stakedTVL(); return stakingTVL; @@ -125,7 +130,10 @@ module.exports = { methodology: "TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL.", staking: { - fetch: staking + fetch: staking, + }, + borrowed: { + fetch: borrowed, }, - fetch + fetch, }; From 78428d6d978079666d1d070f28e0013a717f92f2 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 14 Dec 2021 15:39:56 +0000 Subject: [PATCH 364/393] hermes edit --- projects/hermes/index.js | 62 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/projects/hermes/index.js b/projects/hermes/index.js index 9876ba93a7..eb75ef332e 100644 --- a/projects/hermes/index.js +++ b/projects/hermes/index.js @@ -6,7 +6,7 @@ const { addFundsInMasterChef } = require("../helper/masterchef"); const { toUSDTBalances } = require("../helper/balances"); const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; - +// node test.js projects/hermes/index.js const masterchefs = { iris: "0x4aA8DeF481d19564596754CD2108086Cf0bDc71B", apollo: "0x75409C27EA0E28A486B35Bad6006DD114Ae3559B", @@ -25,12 +25,12 @@ const lpFarms = { }; const vaults = [ //IRIS VAULTS - { - name: "KAVIAN/WMATIC", - vault: "0x75fd7fa818f0d970668dca795b7d79508776a5b1", - lpToken: "0xca2cfc8bf76d9d8eb08e824ee6278f7b885c3b70", - amm: "quickswap", - }, + // { + // name: "KAVIAN/WMATIC", + // vault: "0x75fd7fa818f0d970668dca795b7d79508776a5b1", + // lpToken: "0xca2cfc8bf76d9d8eb08e824ee6278f7b885c3b70", + // amm: "quickswap", + // }, { name: "GBNT/WMATIC", vault: "0x483a58Fd4B023CAE2789cd1E1e5F6F52f93df2C7", @@ -38,30 +38,30 @@ const vaults = [ amm: "polycat", }, //APOLLO VAULTS - { - name: "USDC/WETH", - vault: "0x0f8860515B51bBbB3AEe4603Fe8716454a2Ed24C", - lpToken: "0x853ee4b2a13f8a742d64c8f088be7ba2131f670d", - amm: "quickswap", - }, - { - name: "USDC/USDT", - vault: "0xaaF43E30e1Aa6ed2dfED9CCD03AbAF7C34B5B8F6", - lpToken: "0x2cf7252e74036d1da831d11089d326296e64a728", - amm: "quickswap", - }, - { - name: "ETH/WMATIC", - vault: "0xC12b54BAEc88CC4F28501f90Bb189Ac7132ee97F", - lpToken: "0xadbf1854e5883eb8aa7baf50705338739e558e5b", - amm: "quickswap", - }, - { - name: "BTC/ETH", - vault: "0xf32baBB43226DdF187151Eb392c1e7F8C0F4a2BB", - lpToken: "0xdc9232e2df177d7a12fdff6ecbab114e2231198d", - amm: "quickswap", - }, + // { + // name: "USDC/WETH", + // vault: "0x0f8860515B51bBbB3AEe4603Fe8716454a2Ed24C", + // lpToken: "0x853ee4b2a13f8a742d64c8f088be7ba2131f670d", + // amm: "quickswap", + // }, + // { + // name: "USDC/USDT", + // vault: "0xaaF43E30e1Aa6ed2dfED9CCD03AbAF7C34B5B8F6", + // lpToken: "0x2cf7252e74036d1da831d11089d326296e64a728", + // amm: "quickswap", + // }, + // { + // name: "ETH/WMATIC", + // vault: "0xC12b54BAEc88CC4F28501f90Bb189Ac7132ee97F", + // lpToken: "0xadbf1854e5883eb8aa7baf50705338739e558e5b", + // amm: "quickswap", + // }, + // { + // name: "BTC/ETH", + // vault: "0xf32baBB43226DdF187151Eb392c1e7F8C0F4a2BB", + // lpToken: "0xdc9232e2df177d7a12fdff6ecbab114e2231198d", + // amm: "quickswap", + // }, { name: "DFYN/ROUTE", vault: "0x467cb3cE716e0801355BFb3b3F4070108E46051f", From 8b58a33fe3b2da61071985ab69a1f9c6ec636b44 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 14 Dec 2021 16:22:00 +0000 Subject: [PATCH 365/393] karura update --- projects/karura-dex/index.js | 58 +++++++++++++++++++++++++------- projects/karura-lending/index.js | 34 +++++++++++++++---- 2 files changed, 73 insertions(+), 19 deletions(-) diff --git a/projects/karura-dex/index.js b/projects/karura-dex/index.js index 2803903cc1..14edcc4635 100644 --- a/projects/karura-dex/index.js +++ b/projects/karura-dex/index.js @@ -11,19 +11,39 @@ function formatTokenAmount(amount, tokenSymbol) { case "KSM": case "KAR": case "KUSD": + case "BNC": + case "LKSM": decimals = 12; break; } - return Number(amount)/(10**decimals) + return Number(amount / Number(10 ** decimals)); } const tokenToCoingecko = { KSM: "kusama", KAR: "karura", - KUSD: "tether" -} + KUSD: "tether", + BNC: "bifrost-native-coin", +}; + +async function lksmToksm(api, lksmAmount) { + const totalStaked = Number( + (await api.query.homaLite.totalStakingCurrency()).toString() + ); + + const totalLksmIssued = Number( + ( + await api.query.tokens.totalIssuance({ + Token: "LKSM", + }) + ).toString() + ); + + const ratio = totalStaked / totalLksmIssued; + return lksmAmount * ratio; +} async function tvl() { const provider = new WsProvider("wss://karura-rpc-1.aca-api.network"); @@ -36,19 +56,28 @@ async function tvl() { for (const [pair, pairAmounts] of pools) { // For some reason the pairs come are nested in an array so I take them out. - // toHuman puts them into an easy to use format for this + // toHuman puts them into an easy to use format for this const tokens = pair.toHuman()[0]; // The values are in hex representation so I map them to int - const amounts = pairAmounts.toJSON().map(v => BigInt(v)); + const amounts = pairAmounts.toJSON().map((v) => { + return Number(v); + }); // Iterate over all of the token symbols and add them to the object for (const i in tokens) { - const { Token } = tokens[i]; + let { Token } = tokens[i]; + + let amount = amounts[i]; + if (Token === "LKSM") { + Token = "KSM"; + amount = await lksmToksm(api, amount); + } + if (totalLiquidity[Token]) { - totalLiquidity[Token] += amounts[i]; + totalLiquidity[Token] = totalLiquidity[Token] + amount; } else { - totalLiquidity[Token] = amounts[i]; + totalLiquidity[Token] = amount; } } } @@ -57,13 +86,16 @@ async function tvl() { // Iterate over all of the keys and format the amounts for (const key in totalLiquidity) { - totalLiquidityFormatted[tokenToCoingecko[key]] = formatTokenAmount(totalLiquidity[key], key); + totalLiquidityFormatted[tokenToCoingecko[key]] = formatTokenAmount( + totalLiquidity[key], + key + ); } return totalLiquidityFormatted; } -module.exports={ - methodology:"Counts all liquidity on DEX pools. KUSD is counted as USDT", - tvl -} \ No newline at end of file +module.exports = { + methodology: "Counts all liquidity on DEX pools. KUSD is counted as USDT", + tvl, +}; diff --git a/projects/karura-lending/index.js b/projects/karura-lending/index.js index b40a4849d9..a077aef2ff 100644 --- a/projects/karura-lending/index.js +++ b/projects/karura-lending/index.js @@ -1,21 +1,43 @@ const { ApiPromise, WsProvider } = require("@polkadot/api"); const { options } = require("@acala-network/api"); +async function lksmToksm(api, lksmAmount) { + const totalStaked = Number( + (await api.query.homaLite.totalStakingCurrency()).toString() + ); + + const totalLksmIssued = Number( + await api.query.tokens.totalIssuance({ + Token: "LKSM", + }) + ).toString(); + + const ratio = totalStaked / totalLksmIssued; + + return lksmAmount * ratio; +} + async function tvl() { const provider = new WsProvider("wss://karura-rpc-1.aca-api.network"); const api = await ApiPromise.create(options({ provider })); // Query for all KSM positions, if there were multiple token positions // you could use loans.totalPositions.entries() to query them all at once - const positions = await api.query.loans.totalPositions({ Token: "KSM" }) - const totalCollateral = BigInt(positions.toJSON().collateral); + const ksmPositions = await api.query.loans.totalPositions({ Token: "KSM" }); + const ksmTotalCollateral = Number(ksmPositions.toJSON().collateral); + + const lksmPositions = await api.query.loans.totalPositions({ Token: "LKSM" }); + const lksmTotalCollateral = Number(lksmPositions.toJSON().collateral); + + const totalCollateral = + ksmTotalCollateral + (await lksmToksm(api, lksmTotalCollateral)); return { - "kusama" : Number(totalCollateral)/1e12 - } + kusama: Number(totalCollateral) / 1e12, + }; } module.exports = { methodology: "Counts collateral in lending market", - tvl -} \ No newline at end of file + tvl, +}; From 5dbc858828a6988d306f138cec3b7bdbf0b64ca1 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Tue, 14 Dec 2021 16:49:02 +0000 Subject: [PATCH 366/393] elephant dex --- projects/elephantdex/index.js | 49 ++++++++++++++--------------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/projects/elephantdex/index.js b/projects/elephantdex/index.js index 27b4edefba..fdcbddafb6 100644 --- a/projects/elephantdex/index.js +++ b/projects/elephantdex/index.js @@ -1,39 +1,28 @@ -const { request, gql } = require("graphql-request"); -const sdk = require('@defillama/sdk'); -const { toUSDTBalances } = require('../helper/balances'); +const { getBlock } = require("../helper/getBlock"); +const { transformHarmonyAddress } = require("../helper/portedTokens"); +const { calculateUniTvl } = require("../helper/calculateUniTvl"); -const graphUrl = 'https://elephantgraph.com/subgraphs/name/elephantproject/subgraph21' -const graphQuery = gql` -query get_tvl($block: Int) { - uniswapFactory( - id: "0x0Dea90EC11032615E027664D2708BC292Bbd976B", - block: { number: $block } - ) { - totalLiquidityUSD - }, -} -`; +const wONE = "bsc:0xdE976f3344cd9F06E451aF3A94a324afC3E154F4"; +async function tvl(timestamp, block, chainBlocks) { + block = await getBlock(timestamp, "harmony", chainBlocks); + const transform = await transformHarmonyAddress(); -async function tvl(timestamp) { - const {block} = await sdk.api.util.lookupBlock(timestamp,{ - chain: 'harmony' - }) - const response = await request( - graphUrl, - graphQuery, - { - block, - } + let balances = await calculateUniTvl( + transform, + block, + "harmony", + "0x0Dea90EC11032615E027664D2708BC292Bbd976B", + 18105518, + true ); - const usdTvl = Number(response.uniswapFactory.totalLiquidityUSD) - - return toUSDTBalances(usdTvl) + balances["harmony"] = balances[wONE] / 10 ** 18; + delete balances[wONE]; + return balances; } module.exports = { - harmony:{ + harmony: { tvl, }, - tvl -} +}; From f7f5d45f35d8e882d7fdab87b6b0c0d82147b1e2 Mon Sep 17 00:00:00 2001 From: DefyFarm Date: Tue, 14 Dec 2021 22:26:34 +0530 Subject: [PATCH 367/393] add defyswap --- projects/defyswap/index.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 projects/defyswap/index.js diff --git a/projects/defyswap/index.js b/projects/defyswap/index.js new file mode 100644 index 0000000000..547233de67 --- /dev/null +++ b/projects/defyswap/index.js @@ -0,0 +1,22 @@ +const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl.js"); +const { staking } = require("../helper/staking.js"); + +const factory = "0xAffdbEAE1ec595cba4C262Bdb52A6083aEc2e2a6"; +const masterchef = "0x53e986884c55c9AEDB7f003583f350EE789505D0"; +const ftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; +const dfy = "0x84b0b7718f8480a9eda3133fd385d7edf2b1d1c4"; +const whitelist = [ + dfy, + "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + "0x321162cd933e2be498cd2267a90534a804051b11", +]; + +module.exports = { + misrepresentedTokens: true, + timetravel: true, + doublecounted: false, + fantom: { + tvl: calculateUsdUniTvl(factory, "fantom", ftm, whitelist, "fantom"), + staking: staking(masterchef, dfy, "fantom"), + }, +}; From eaca88e23a9c6ae20d071193f8b0e2427c40ef7b Mon Sep 17 00:00:00 2001 From: nemusona Date: Tue, 14 Dec 2021 13:32:08 -0600 Subject: [PATCH 368/393] defyswap staking bal --- projects/defyswap/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/projects/defyswap/index.js b/projects/defyswap/index.js index 547233de67..e7bc895cc4 100644 --- a/projects/defyswap/index.js +++ b/projects/defyswap/index.js @@ -1,5 +1,5 @@ const { calculateUsdUniTvl } = require("../helper/getUsdUniTvl.js"); -const { staking } = require("../helper/staking.js"); +const { stakingUnknownPricedLP } = require("../helper/staking.js"); const factory = "0xAffdbEAE1ec595cba4C262Bdb52A6083aEc2e2a6"; const masterchef = "0x53e986884c55c9AEDB7f003583f350EE789505D0"; @@ -17,6 +17,12 @@ module.exports = { doublecounted: false, fantom: { tvl: calculateUsdUniTvl(factory, "fantom", ftm, whitelist, "fantom"), - staking: staking(masterchef, dfy, "fantom"), + staking: stakingUnknownPricedLP( + masterchef, + dfy, + "fantom", + "0x46c1dccC44c3255A22B8041856cff0dE8f5958D6", + (addr) => `fantom:${addr}` + ), }, }; From 93d0a8d45dca1f63bba5c63aeaabeb99456a3f47 Mon Sep 17 00:00:00 2001 From: krypto-dev Date: Wed, 15 Dec 2021 06:42:17 +1000 Subject: [PATCH 369/393] add gohmlp --- projects/hector/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/projects/hector/index.js b/projects/hector/index.js index 15fb82a6c0..c491a49914 100644 --- a/projects/hector/index.js +++ b/projects/hector/index.js @@ -12,6 +12,7 @@ const treasury = "0xCB54EA94191B280C296E6ff0E37c7e76Ad42dC6A" const dai = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e" const ftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83" const hecUsdcLP = "0xd661952749f05acc40503404938a91af9ac1473b" +const gohmLP = "0xde13DD3BCA9CBac23F46e5C587b48320F5f5c483" const usdc = "0x04068da6c83afcfa0e13ba15a6696662335d5b75" const mim = "0x82f0b8b456c1a451378467398982d4834b6829c1" const frax = "0xdc301622e621166bd8e82f2ca0a26c13ad0be355" @@ -39,6 +40,7 @@ async function tvl(timestamp, block, chainBlocks) { [frax, false], [hecUsdcLP, true], [fraxLp, true], + [gohmLP, true], [hecDaiSLP, true] ], [treasury], @@ -80,5 +82,5 @@ module.exports = { staking }, methodology: - "TVL consists of tokens that have been bonded on the protocol and staking consist of the native tokens that have been deposited to the staking contract", -}; + "Counts tokens on the treasury for TVL and staked EXOD for staking", +}; \ No newline at end of file From 7e0c7cbc85744b7d6cd7f4e2717ce844f1a6c684 Mon Sep 17 00:00:00 2001 From: BooXmas <95235576+BooXmas@users.noreply.github.com> Date: Wed, 15 Dec 2021 06:21:51 +0800 Subject: [PATCH 370/393] Create index.js --- projects/xmaspast/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 projects/xmaspast/index.js diff --git a/projects/xmaspast/index.js b/projects/xmaspast/index.js new file mode 100644 index 0000000000..7f3e7a7b13 --- /dev/null +++ b/projects/xmaspast/index.js @@ -0,0 +1,28 @@ +const abi = require("../helper/abis/masterchef.json") +const { transformFantomAddress } = require("../helper/portedTokens"); +const { addFundsInMasterChef } = require("../helper/masterchef"); +const { staking } = require("../helper/staking"); +const { pool2Exports } = require('../helper/pool2') + + +const chef = "0x138c4dB5D4Ab76556769e4ea09Bce1D452c2996F" +const xpast = "0xD3111Fb8BDf936B11fFC9eba3b597BeA21e72724" +const xpastFtmLP = "0x9665067DceF6a88d2dCf042ee25A2d98a2DDF8D6" +const xpastUsdcLP = "0x73B019D2B6fD28D85eeAD4E85909d69Cc0472D5F"; + +async function tvl(timestamp, block, chainBlocks) { + const balances = {} + const transformAddress = await transformFantomAddress(); + await addFundsInMasterChef(balances, chef, chainBlocks.fantom, "fantom", transformAddress, abi.poolInfo, [xpast, xpastFtmLP, xpastUsdcLP]); + return balances; +} + +module.exports = { + methodology: "TVL includes all farms in MasterChef contract", + fantom: { + tvl, + staking: staking(chef, xpast, "fantom"), + pool2: pool2Exports(chef, [xpastFtmLP, xpastUsdcLP], "fantom"), + }, + +} \ No newline at end of file From 17e74bd9fb7d9a9e57179a479f94c3d3caf3f8b3 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Tue, 14 Dec 2021 23:15:33 +0000 Subject: [PATCH 371/393] update cronaswap --- projects/cronaswap/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/cronaswap/index.js b/projects/cronaswap/index.js index 84d4184a25..6f155ae474 100644 --- a/projects/cronaswap/index.js +++ b/projects/cronaswap/index.js @@ -18,7 +18,11 @@ module.exports={ //USDT "0x66e428c3f67a68878562e79A0234c1F83c208770", //DAI - "0xF2001B145b43032AAF5Ee2884e456CCd805F677D" + "0xF2001B145b43032AAF5Ee2884e456CCd805F677D", + //WETH + "0xe44fd7fcb2b1581822d0c862b68222998a0c299a", + //WBTC + "0x062e66477faf219f25d27dced647bf57c3107d52", ], "crypto-com-chain"), staking: stakingPricedLP("0x77ea4a4cF9F77A034E4291E8f457Af7772c2B254", "0xadbd1231fb360047525BEdF962581F3eee7b49fe", "cronos", "0xeD75347fFBe08d5cce4858C70Df4dB4Bbe8532a0", "crypto-com-chain") } From a6f973cc13c08e4fa0fd4d720eb8a17f75eca83d Mon Sep 17 00:00:00 2001 From: nemusona Date: Tue, 14 Dec 2021 21:49:21 -0600 Subject: [PATCH 372/393] latte onchain --- projects/latte/index.js | 80 +++++++++++++++++++++++++++++++++-------- 1 file changed, 66 insertions(+), 14 deletions(-) diff --git a/projects/latte/index.js b/projects/latte/index.js index 28147c4d1d..a37473213b 100644 --- a/projects/latte/index.js +++ b/projects/latte/index.js @@ -1,21 +1,73 @@ -const utils = require('../helper/utils'); -const {toUSDTBalances} = require('../helper/balances'); +// const utils = require('../helper/utils'); +// const {toUSDTBalances} = require('../helper/balances'); +const sdk = require("@defillama/sdk"); +const { calculateUniTvl } = require("../helper/calculateUniTvl"); -const baseURL = 'https://api.latteswap.com/api' -async function fetch() { - const totalTvl = await utils.fetchURL(`${baseURL}/v1/amm/defi-llama/tvl-exclude-latte`) - return Number(totalTvl.data) +// const baseURL = 'https://api.latteswap.com/api' +// async function fetch() { +// const totalTvl = await utils.fetchURL(`${baseURL}/v1/amm/defi-llama/tvl-exclude-latte`) +// return Number(totalTvl.data) +// } + +// async function staking() { +// const latteTvl = await utils.fetchURL(`${baseURL}/v1/amm/defi-llama/tvl-latte-pool`) +// return toUSDTBalances(Number(latteTvl.data)) +// } + +const factory = "0x4DcE5Bdb81B8D5EdB66cA1b8b2616A8E0Dd5f807"; +const latteToken = "0x8D78C2ff1fB4FBA08c7691Dfeac7bB425a91c81A"; +const lattev2Token = "0xa269A9942086f5F87930499dC8317ccC9dF2b6CB"; +const masterchef = "0xbCeE0d15a4402C9Cc894D52cc5E9982F60C463d6"; +const translate = { + "0x8d78c2ff1fb4fba08c7691dfeac7bb425a91c81a": + "bsc:0xa269a9942086f5f87930499dc8317ccc9df2b6cb", // LATTE to LATTEv2 +}; + +async function tvl(timestamp, block, chainBlocks) { + return await calculateUniTvl( + (addr) => { + if (translate[addr.toLowerCase()] !== undefined) { + return translate[addr]; + } + return `bsc:${addr}`; + }, + chainBlocks.bsc, + "bsc", + factory, + 0, + true + ); } -async function staking() { - const latteTvl = await utils.fetchURL(`${baseURL}/v1/amm/defi-llama/tvl-latte-pool`) - return toUSDTBalances(Number(latteTvl.data)) +async function staking(timestamp, block, chainBlocks) { + let balances = {}; + let stakingBalances = ( + await sdk.api.abi.multiCall({ + calls: [ + { + target: latteToken, + params: masterchef, + }, + { + target: lattev2Token, + params: masterchef, + }, + ], + abi: "erc20:balanceOf", + block: chainBlocks.bsc, + chain: "bsc", + }) + ).output; + stakingBalances.forEach((p) => { + sdk.util.sumSingleBalance(balances, `bsc:${lattev2Token}`, p.output); + }); + return balances; } module.exports = { - bsc:{ - fetch, - staking + bsc: { + tvl, + staking, }, - fetch -} + tvl, +}; From 722994a2af4427f7f3fd24c3c624b579f8139f8c Mon Sep 17 00:00:00 2001 From: nemusona Date: Wed, 15 Dec 2021 00:00:30 -0600 Subject: [PATCH 373/393] temporarily remove gohmLP --- projects/hector/index.js | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/projects/hector/index.js b/projects/hector/index.js index c491a49914..1a89dc0a6b 100644 --- a/projects/hector/index.js +++ b/projects/hector/index.js @@ -1,22 +1,22 @@ const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const sdk = require('@defillama/sdk'); +const sdk = require("@defillama/sdk"); const erc20 = require("../helper/abis/erc20.json"); const { transformFantomAddress } = require("../helper/portedTokens"); -const { getBlock } = require('../helper/getBlock'); +const { getBlock } = require("../helper/getBlock"); -const hectorStakingv1 = "0x9ae7972BA46933B3B20aaE7Acbf6C311847aCA40" -const hectorStakingv2 = "0xD12930C8deeDafD788F437879cbA1Ad1E3908Cc5" -const hec = "0x5C4FDfc5233f935f20D2aDbA572F770c2E377Ab0" -const hecDaiSLP = "0xbc0eecdA2d8141e3a26D2535C57cadcb1095bca9" -const treasury = "0xCB54EA94191B280C296E6ff0E37c7e76Ad42dC6A" -const dai = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e" -const ftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83" -const hecUsdcLP = "0xd661952749f05acc40503404938a91af9ac1473b" -const gohmLP = "0xde13DD3BCA9CBac23F46e5C587b48320F5f5c483" -const usdc = "0x04068da6c83afcfa0e13ba15a6696662335d5b75" -const mim = "0x82f0b8b456c1a451378467398982d4834b6829c1" -const frax = "0xdc301622e621166bd8e82f2ca0a26c13ad0be355" -const fraxLp = "0x0f8D6953F58C0dd38077495ACA64cbd1c76b7501" +const hectorStakingv1 = "0x9ae7972BA46933B3B20aaE7Acbf6C311847aCA40"; +const hectorStakingv2 = "0xD12930C8deeDafD788F437879cbA1Ad1E3908Cc5"; +const hec = "0x5C4FDfc5233f935f20D2aDbA572F770c2E377Ab0"; +const hecDaiSLP = "0xbc0eecdA2d8141e3a26D2535C57cadcb1095bca9"; +const treasury = "0xCB54EA94191B280C296E6ff0E37c7e76Ad42dC6A"; +const dai = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"; +const ftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; +const hecUsdcLP = "0xd661952749f05acc40503404938a91af9ac1473b"; +const gohmLP = "0xde13DD3BCA9CBac23F46e5C587b48320F5f5c483"; +const usdc = "0x04068da6c83afcfa0e13ba15a6696662335d5b75"; +const mim = "0x82f0b8b456c1a451378467398982d4834b6829c1"; +const frax = "0xdc301622e621166bd8e82f2ca0a26c13ad0be355"; +const fraxLp = "0x0f8D6953F58C0dd38077495ACA64cbd1c76b7501"; const HectorStakings = [ // V1 @@ -25,7 +25,6 @@ const HectorStakings = [ hectorStakingv2, ]; - async function tvl(timestamp, block, chainBlocks) { const balances = {}; const transformAddress = await transformFantomAddress(); @@ -40,12 +39,12 @@ async function tvl(timestamp, block, chainBlocks) { [frax, false], [hecUsdcLP, true], [fraxLp, true], - [gohmLP, true], - [hecDaiSLP, true] + //[gohmLP, true], + [hecDaiSLP, true], ], [treasury], chainBlocks.fantom, - 'fantom', + "fantom", transformAddress ); @@ -56,8 +55,9 @@ async function tvl(timestamp, block, chainBlocks) { const staking = async (timestamp, ethBlock, chainBlocks) => { const balances = {}; const chain = "fantom"; - let stakingBalance, totalBalance = 0; - const block = await getBlock(timestamp, chain, chainBlocks) + let stakingBalance, + totalBalance = 0; + const block = await getBlock(timestamp, chain, chainBlocks); for (const stakings of HectorStakings) { stakingBalance = await sdk.api.abi.call({ abi: erc20.balanceOf, @@ -68,19 +68,19 @@ const staking = async (timestamp, ethBlock, chainBlocks) => { }); totalBalance += Number(stakingBalance.output); } - const address = `${chain}:${hec}` + const address = `${chain}:${hec}`; return { - [address]: totalBalance -} + [address]: totalBalance, + }; }; module.exports = { misrepresentedTokens: true, fantom: { tvl, - staking + staking, }, methodology: "Counts tokens on the treasury for TVL and staked EXOD for staking", -}; \ No newline at end of file +}; From c302d7381708e13ae7948b344272851e9f539b13 Mon Sep 17 00:00:00 2001 From: nemusona Date: Wed, 15 Dec 2021 00:09:30 -0600 Subject: [PATCH 374/393] add hec-gohm lp to hector --- projects/hector/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/hector/index.js b/projects/hector/index.js index 1a89dc0a6b..dddc690895 100644 --- a/projects/hector/index.js +++ b/projects/hector/index.js @@ -12,7 +12,7 @@ const treasury = "0xCB54EA94191B280C296E6ff0E37c7e76Ad42dC6A"; const dai = "0x8d11ec38a3eb5e956b052f67da8bdc9bef8abf3e"; const ftm = "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83"; const hecUsdcLP = "0xd661952749f05acc40503404938a91af9ac1473b"; -const gohmLP = "0xde13DD3BCA9CBac23F46e5C587b48320F5f5c483"; +const hecGohmLP = "0xEb7942E26368b2052CBbDa2c054482F00436ef7B"; const usdc = "0x04068da6c83afcfa0e13ba15a6696662335d5b75"; const mim = "0x82f0b8b456c1a451378467398982d4834b6829c1"; const frax = "0xdc301622e621166bd8e82f2ca0a26c13ad0be355"; @@ -39,7 +39,7 @@ async function tvl(timestamp, block, chainBlocks) { [frax, false], [hecUsdcLP, true], [fraxLp, true], - //[gohmLP, true], + [hecGohmLP, true], [hecDaiSLP, true], ], [treasury], @@ -82,5 +82,5 @@ module.exports = { staking, }, methodology: - "Counts tokens on the treasury for TVL and staked EXOD for staking", + "Counts tokens on the treasury for TVL and staked HEC for staking", }; From ebac2fc1fcda3fcaa57092729407947d6f241b18 Mon Sep 17 00:00:00 2001 From: Jack Lee Date: Wed, 15 Dec 2021 18:49:48 +0800 Subject: [PATCH 375/393] update beta insurance tvl --- projects/naos/index.js | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/projects/naos/index.js b/projects/naos/index.js index 942af6699d..06c6facccd 100644 --- a/projects/naos/index.js +++ b/projects/naos/index.js @@ -39,14 +39,16 @@ const BSC_NAOS_ADDRESS = "0x758d08864fb6cce3062667225ca10b8f00496cc2"; const BSC_BNB_ADDRESS = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; const CAKE_BNB_NAOS_LP_ADDRESS = "0xcaa662ad41a662b81be2aea5d59ec0697628665f"; const BSC_BOOST_POOL = "0x3dcd32dd2b225749aa830ca3b4f2411bfeb03db4"; -const BUSD_CONTRACT_ADDRESS = "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56"; +const BUSD_CONTRACT_ADDRESS = "0xe9e7cea3dedca5984780bafc599bd69add087d56"; const BUSD_CONTRACT_HOLDER = [ "0x9591ff9c5070107000155ff6c5ce049aa1443dd3", // Formation "0xb9ece39b356d5c0842301b42a716e4385617c871", // Transmuter + "0xcd2e1ebfc804dd867ca052133fa70d9db6d86ab7", // Beta insurance ]; const BSC_ALPACA_ADAPTERS = [ "0x640848400fc1cbaf9e4a1ed18d1bd3e2b16d1de2", // Formation adapter "0x4ca1a19d108b84f6f671ffe3555e7743c5ed6a2c", // Transmuter adapter + "0xAB806724B03D0F4aEE891976fA0Eee77bC22739b", // Beta insurance adapter ]; const BSC_STAKING_POOL_WITH_TRANSFER = @@ -187,9 +189,22 @@ async function bscTvl(timestamp, ethBlock, chainBlocks) { `bsc:${BUSD_CONTRACT_ADDRESS}`, transmuterBUSDAmount ); + // beta insurance + let { output: betaInsuranceBUSDTotalAmount } = await sdk.api.erc20.balanceOf({ + target: BUSD_CONTRACT_ADDRESS, + owner: BUSD_CONTRACT_HOLDER[2], // beta insurance address + block: block, + chain: "bsc", + }); + sdk.util.sumSingleBalance( + balances, + `bsc:${BUSD_CONTRACT_ADDRESS}`, + betaInsuranceBUSDTotalAmount + ); // ---- End BUSD // ---- Start ibBUSD (map ibBUSD value to BUSD) + // formation const ibBUSDAlpacaFormationAdapterValue = ( await sdk.api.abi.call({ target: BSC_ALPACA_ADAPTERS[0], @@ -198,7 +213,7 @@ async function bscTvl(timestamp, ethBlock, chainBlocks) { chain: "bsc", }) ).output; - + // transmuter const ibBUSDAlpacaTransmuterAdapterValue = ( await sdk.api.abi.call({ target: BSC_ALPACA_ADAPTERS[1], @@ -207,6 +222,15 @@ async function bscTvl(timestamp, ethBlock, chainBlocks) { chain: "bsc", }) ).output; + // beta insurance + const ibBUSDAlpacaBetaInsuranceAdapterValue = ( + await sdk.api.abi.call({ + target: BSC_ALPACA_ADAPTERS[2], // beta insurance adapter + abi: alpacaAdapterAbi[0], + block: block, + chain: "bsc", + }) + ).output; sdk.util.sumSingleBalance( balances, @@ -218,6 +242,11 @@ async function bscTvl(timestamp, ethBlock, chainBlocks) { `bsc:${BUSD_CONTRACT_ADDRESS}`, ibBUSDAlpacaTransmuterAdapterValue ); + sdk.util.sumSingleBalance( + balances, + `bsc:${BUSD_CONTRACT_ADDRESS}`, + ibBUSDAlpacaBetaInsuranceAdapterValue + ); // ---- End ibBUSD return balances; @@ -360,7 +389,7 @@ async function staking(timestamp, block) { async function bscStaking(timestamp, ethBlock, chainBlocks) { let block = chainBlocks["bsc"]; const balances = {}; - // Start naos staking + // ---- Start naos staking let { output: naosAmount } = await sdk.api.abi.call({ target: BSC_BOOST_POOL, abi: boostPoolAbi[0], // getPoolTotalDeposited From b0c5306383f324f28c7f51d8b4d0884d5f32d0ca Mon Sep 17 00:00:00 2001 From: rathi Date: Wed, 15 Dec 2021 19:07:33 +0800 Subject: [PATCH 376/393] feat: added mm-adapter --- projects/mm-finance/index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 projects/mm-finance/index.js diff --git a/projects/mm-finance/index.js b/projects/mm-finance/index.js new file mode 100644 index 0000000000..5cf008404e --- /dev/null +++ b/projects/mm-finance/index.js @@ -0,0 +1,17 @@ +const {calculateUsdUniTvl} = require('../helper/getUsdUniTvl') + +module.exports={ + misrepresentedTokens: true, + methodology: "Factory address (0xd590cC180601AEcD6eeADD9B7f2B7611519544f4) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + cronos: { + tvl:calculateUsdUniTvl("0xd590cC180601AEcD6eeADD9B7f2B7611519544f4", "cronos", "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", + [ + "0xbA452A1c0875D33a440259B1ea4DcA8f5d86D9Ae", //mmf + "0xc21223249ca28397b4b6541dffaecc539bff0c59", //usdc + "0xe44fd7fcb2b1581822d0c862b68222998a0c299a", //weth + "0x66e428c3f67a68878562e79a0234c1f83c208770", //usdt + "0x062E66477Faf219F25D27dCED647BF57C3107d52", //wbtc + ] + , "crypto-com-chain") + } +} \ No newline at end of file From 070ee554c0b00cc96d399d3a056a778e862435fa Mon Sep 17 00:00:00 2001 From: RobAnon Date: Wed, 15 Dec 2021 13:23:28 -0500 Subject: [PATCH 377/393] Non-functional code for Revest --- projects/revest/index.js | 84 +++++++++++++++++++++++++++++++++------- 1 file changed, 71 insertions(+), 13 deletions(-) diff --git a/projects/revest/index.js b/projects/revest/index.js index 492bab44b8..86873d7594 100644 --- a/projects/revest/index.js +++ b/projects/revest/index.js @@ -1,18 +1,76 @@ -const { default: axios } = require("axios") -const {sumTokensAndLPsSharedOwners} = require("../helper/unwrapLPs") +const { default: axios } = require("axios"); +const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const holder = "0xA81bd16Aa6F6B25e66965A2f842e9C806c0AA11F" +const holder = "0xA81bd16Aa6F6B25e66965A2f842e9C806c0AA11F"; -async function tvl(time, block){ - const tokens = await axios.get("https://defi-llama-feed.vercel.app/api/address") - const balances = {} - await sumTokensAndLPsSharedOwners(balances, tokens.data.body.map(t=>[t, false]), [holder], block) - return balances +async function tvl(time, block) { + const tokens = await axios.get( + "https://defi-llama-feed.vercel.app/api/address" + ); + const balances = {}; + await sumTokensAndLPsSharedOwners( + balances, + tokens.data.body.map((t) => [t, false]), + [holder], + block + ); + return balances; } -module.exports={ - methodology: "We list all tokens in our vault and sum them together", - ethereum:{ - tvl - } +async function polygonTVL(time, block) { + const tokens = await axios.get( + "https://defi-llama-feed.vercel.app/api/address?chainId=137" + ); + const balances = {}; + await sumTokensAndLPsSharedOwners( + balances, + tokens.data.body.map((t) => [t, false]), + [holder], + block + ); + return balances; } + +async function fantomTVL(time, block) { + const tokens = await axios.get( + "https://defi-llama-feed.vercel.app/api/address?chainId=250" + ); + const balances = {}; + await sumTokensAndLPsSharedOwners( + balances, + tokens.data.body.map((t) => [t, false]), + [holder], + block + ); + return balances; +} + +async function avaxTVL(time, block) { + const tokens = await axios.get( + "https://defi-llama-feed.vercel.app/api/address?chainId=43114" + ); + const balances = {}; + await sumTokensAndLPsSharedOwners( + balances, + tokens.data.body.map((t) => [t, false]), + [holder], + block + ); + return balances; +} + +module.exports = { + methodology: "We list all tokens in our vault and sum them together", + ethereum: { + tvl, + }, + polygon: { + polygonTVL, + }, + fantom: { + fantomTVL, + }, + avalanche: { + avaxTVL, + }, +}; From e978e1553f63244afca839ce48f115d6fbaa2921 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Wed, 15 Dec 2021 20:14:25 +0000 Subject: [PATCH 378/393] update chain exports --- projects/hermes/index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/projects/hermes/index.js b/projects/hermes/index.js index eb75ef332e..9cd0135938 100644 --- a/projects/hermes/index.js +++ b/projects/hermes/index.js @@ -425,9 +425,6 @@ module.exports = { pool2: { masterchefTVL, tvlBalancer, - }, - vault: { - tvlVaults, - }, + }, tvl: sdk.util.sumChainTvls([masterchefTVL, tvlBalancer, tvlVaults]), }; From 6cdc1c543c8d534bfc0426b0757d59f877615e7a Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Wed, 15 Dec 2021 20:18:57 +0000 Subject: [PATCH 379/393] update exports --- projects/hermes/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/hermes/index.js b/projects/hermes/index.js index 9cd0135938..0b586e9ba1 100644 --- a/projects/hermes/index.js +++ b/projects/hermes/index.js @@ -425,6 +425,9 @@ module.exports = { pool2: { masterchefTVL, tvlBalancer, - }, - tvl: sdk.util.sumChainTvls([masterchefTVL, tvlBalancer, tvlVaults]), + }, + polygon: { + tvlVaults, + }, + }; From ab1bf64bd57d5571b2313ce36cc68a27454b9601 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 15 Dec 2021 20:24:03 +0000 Subject: [PATCH 380/393] tempus --- projects/tempus.js | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/tempus.js diff --git a/projects/tempus.js b/projects/tempus.js new file mode 100644 index 0000000000..461bd5c58c --- /dev/null +++ b/projects/tempus.js @@ -0,0 +1,42 @@ +const sdk = require("@defillama/sdk"); + +const pools = [ + { + address: "0x6320E6844EEEa57343d5Ca47D3166822Ec78b116", + token: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + }, + { + address: "0x0697B0a2cBb1F947f51a9845b715E9eAb3f89B4F", + token: "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + }, +]; + +async function tvl(timestamp, block) { + let balances = {}; + const lockedBalances = ( + await sdk.api.abi.multiCall({ + abi: "erc20:balanceOf", + calls: pools.map((p) => ({ + target: p.token, + params: [p.address], + })), + block, + }) + ).output; + + for (let i = 0; i < pools.length; i++) { + sdk.util.sumSingleBalance( + balances, + pools[i].token, + lockedBalances[i].output + ); + } + + return balances; +} + +module.exports = { + ethereum: { + tvl, + }, +}; From 9effdf3abe916314111da7d3b06a64dd58ea8ed9 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 15 Dec 2021 20:53:02 +0000 Subject: [PATCH 381/393] honeyfarm --- projects/HoneyFarm/index2.js | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 projects/HoneyFarm/index2.js diff --git a/projects/HoneyFarm/index2.js b/projects/HoneyFarm/index2.js new file mode 100644 index 0000000000..c327e13d2d --- /dev/null +++ b/projects/HoneyFarm/index2.js @@ -0,0 +1,51 @@ +const { addFundsInMasterChef } = require("../helper/masterchef"); +const { getBlock } = require("../helper/getBlock"); +const { + transformAvaxAddress, + transformBscAddress, +} = require("../helper/portedTokens"); + +async function avax(timestamp, block, chainBlocks) { + let balances = {}; + block = await getBlock(timestamp, "avax", chainBlocks); + const transform = await transformAvaxAddress(); + + await addFundsInMasterChef( + {}, + "0x757490104fd4C80195D3C56bee4dc7B1279cCC51", + block, + "avax", + transform, + undefined, + ["0xB669c71431bc4372140bC35Aa1962C4B980bA507"] + ); + return balances; +} + +async function bsc(timestamp, block, chainBlocks) { + let balances = {}; + block = await getBlock(timestamp, "bsc", chainBlocks); + const transform = await transformBscAddress(); + + await addFundsInMasterChef( + {}, + "0x88E21dedEf04cf24AFe1847B0F6927a719AA8F35", + block, + "bsc", + transform, + undefined, + ["0x1A8d7AC01d21991BF5249A3657C97b2B6d919222"] + ); + return balances; +} + +module.exports = { + methodology: + "Only staked LP is counted as TVL. Excluded in TVL : Locked BEE in the RoyalJelly, NFT Jelly, value of BNB & xJOE which aren't on CoinGecko yet.", + avalanche: { + tvl: avax, + }, + bsc: { + tvl: bsc, + }, +}; // node test.js projects/HoneyFarm/index2.js From 03f1ead86d93a6d734e7291c357210a0e8abfe70 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 15 Dec 2021 20:58:56 +0000 Subject: [PATCH 382/393] honeyfarm --- projects/HoneyFarm/HoneyBee_Avax_ABI.json | 71 --------- projects/HoneyFarm/HoneyBee_BSC_ABI.json | 71 --------- projects/HoneyFarm/HoneyBee_Fantom_ABI.json | 76 ---------- projects/HoneyFarm/HoneyBee_Poly_ABI.json | 71 --------- projects/HoneyFarm/Index.js | 153 ++++++-------------- projects/HoneyFarm/index2.js | 51 ------- 6 files changed, 45 insertions(+), 448 deletions(-) delete mode 100644 projects/HoneyFarm/HoneyBee_Avax_ABI.json delete mode 100644 projects/HoneyFarm/HoneyBee_BSC_ABI.json delete mode 100644 projects/HoneyFarm/HoneyBee_Fantom_ABI.json delete mode 100644 projects/HoneyFarm/HoneyBee_Poly_ABI.json delete mode 100644 projects/HoneyFarm/index2.js diff --git a/projects/HoneyFarm/HoneyBee_Avax_ABI.json b/projects/HoneyFarm/HoneyBee_Avax_ABI.json deleted file mode 100644 index 15422a5414..0000000000 --- a/projects/HoneyFarm/HoneyBee_Avax_ABI.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accBEEPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earnfee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/HoneyFarm/HoneyBee_BSC_ABI.json b/projects/HoneyFarm/HoneyBee_BSC_ABI.json deleted file mode 100644 index 15422a5414..0000000000 --- a/projects/HoneyFarm/HoneyBee_BSC_ABI.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accBEEPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earnfee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/HoneyFarm/HoneyBee_Fantom_ABI.json b/projects/HoneyFarm/HoneyBee_Fantom_ABI.json deleted file mode 100644 index 843d747551..0000000000 --- a/projects/HoneyFarm/HoneyBee_Fantom_ABI.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accBEEPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "masterId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earnfee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/HoneyFarm/HoneyBee_Poly_ABI.json b/projects/HoneyFarm/HoneyBee_Poly_ABI.json deleted file mode 100644 index 8d02fd3f17..0000000000 --- a/projects/HoneyFarm/HoneyBee_Poly_ABI.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "poolInfo": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "poolInfo", - "outputs": [ - { - "internalType": "contract IBEP20", - "name": "lpToken", - "type": "address" - }, - { - "internalType": "uint256", - "name": "allocPoint", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "lastRewardTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accBEEPerShare", - "type": "uint256" - }, - { - "internalType": "uint16", - "name": "depositFeeBP", - "type": "uint16" - }, - { - "internalType": "uint256", - "name": "totalcap", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "isStrat", - "type": "bool" - }, - { - "internalType": "uint256", - "name": "stratId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stratFee", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "earned", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "accEarnPerShare", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/projects/HoneyFarm/Index.js b/projects/HoneyFarm/Index.js index 28aa4eb8e9..c327e13d2d 100644 --- a/projects/HoneyFarm/Index.js +++ b/projects/HoneyFarm/Index.js @@ -1,114 +1,51 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { staking } = require("../helper/staking"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const avaxabi = require("./HoneyBee_Avax_ABI.json"); -const bscabi = require("./HoneyBee_BSC_ABI.json"); -const polyabi = require("./HoneyBee_Poly_ABI.json"); -// const ftmabi = require("./HoneyBee_Fantom_ABI.json"); -// const abiGeneral = require("../helper/abis/masterchef.json"); -const { default: BigNumber } = require("bignumber.js"); - -const BEETOKEN = { - avax: "0xB669c71431bc4372140bC35Aa1962C4B980bA507", - bsc: "0x1A8d7AC01d21991BF5249A3657C97b2B6d919222", -}; - -const masterChef = { - avax: "0x757490104fd4C80195D3C56bee4dc7B1279cCC51", - bsc: "0x88E21dedEf04cf24AFe1847B0F6927a719AA8F35", -}; -const abi = { - avax: avaxabi, - bsc: bscabi, -}; - -// const ACC_BEE_PRECISION = 1e18; - -async function getTokensInMasterChef(time, ethBlock, chainBlocks, chain) { - const block = chainBlocks[chain]; - const transformAddress = (addr) => `${chain}:${addr}`; - const ignoreAddresses = [BEETOKEN[chain]]; - - const balances = {}; - const poolLength = ( - await sdk.api.abi.call({ - abi: abiGeneral.poolLength, - target: masterChef[chain], - block, - chain, - }) - ).output; - - const poolInfo = ( - await sdk.api.abi.multiCall({ - block, - calls: Array.from(Array(Number(poolLength)).keys()).map((i) => ({ - target: masterChef[chain], - params: i, - })), - abi: abi[chain].poolInfo, - chain, - }) - ).output; - - const [symbols] = await Promise.all([ - sdk.api.abi.multiCall({ - block, - calls: poolInfo.map((p) => ({ - target: p.output[0], - })), - abi: "erc20:symbol", - chain, - }), - ]); - - const lpPositions = []; - - symbols.output.forEach((symbol, idx) => { - const pool = poolInfo[idx].output; - const balance = +pool.totalcap; - const token = symbol.input.target; - - if (symbol.output.includes("LP") || symbol.output.includes("JLP")) { - lpPositions.push({ - balance, - token, - }); - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }); - - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); - return balances; +const { getBlock } = require("../helper/getBlock"); +const { + transformAvaxAddress, + transformBscAddress, +} = require("../helper/portedTokens"); + +async function avax(timestamp, block, chainBlocks) { + let balances = {}; + block = await getBlock(timestamp, "avax", chainBlocks); + const transform = await transformAvaxAddress(); + + await addFundsInMasterChef( + {}, + "0x757490104fd4C80195D3C56bee4dc7B1279cCC51", + block, + "avax", + transform, + undefined, + ["0xB669c71431bc4372140bC35Aa1962C4B980bA507"] + ); + return balances; } -async function avaxTvl(timestamp, block, chainBlocks) { - return await getTokensInMasterChef(timestamp, block, chainBlocks, "avax"); +async function bsc(timestamp, block, chainBlocks) { + let balances = {}; + block = await getBlock(timestamp, "bsc", chainBlocks); + const transform = await transformBscAddress(); + + await addFundsInMasterChef( + {}, + "0x88E21dedEf04cf24AFe1847B0F6927a719AA8F35", + block, + "bsc", + transform, + undefined, + ["0x1A8d7AC01d21991BF5249A3657C97b2B6d919222"] + ); + return balances; } -// async function fantomTvl(timestamp, block, chainBlocks) { -// return await getTokensInMasterChef(timestamp, block, chainBlocks, "fantom"); } - -async function bscTvl(timestamp, block, chainBlocks) { - return await getTokensInMasterChef(timestamp, block, chainBlocks, "bsc"); -} - -// async function polyTvl(timestamp, block, chainBlocks) { -// return await getTokensInMasterChef(timestamp, block, chainBlocks, "polygon"); } module.exports = { - methodology: - "Only staked LP is counted as TVL. Excluded in TVL : Locked BEE in the RoyalJelly, NFT Jelly, value of BNB & xJOE which aren't on CoinGecko yet.", - avalanche: { - tvl: avaxTvl, - }, - bsc: { - tvl: bscTvl, - }, -// polygon: { -// tvl: polyTvl, }, -// fantom: { -// tvl: fantomTvl, }, - tvl: sdk.util.sumChainTvls([avaxTvl, bscTvl]), -}; + methodology: + "Only staked LP is counted as TVL. Excluded in TVL : Locked BEE in the RoyalJelly, NFT Jelly, value of BNB & xJOE which aren't on CoinGecko yet.", + avalanche: { + tvl: avax, + }, + bsc: { + tvl: bsc, + }, +}; // node test.js projects/HoneyFarm/index2.js diff --git a/projects/HoneyFarm/index2.js b/projects/HoneyFarm/index2.js deleted file mode 100644 index c327e13d2d..0000000000 --- a/projects/HoneyFarm/index2.js +++ /dev/null @@ -1,51 +0,0 @@ -const { addFundsInMasterChef } = require("../helper/masterchef"); -const { getBlock } = require("../helper/getBlock"); -const { - transformAvaxAddress, - transformBscAddress, -} = require("../helper/portedTokens"); - -async function avax(timestamp, block, chainBlocks) { - let balances = {}; - block = await getBlock(timestamp, "avax", chainBlocks); - const transform = await transformAvaxAddress(); - - await addFundsInMasterChef( - {}, - "0x757490104fd4C80195D3C56bee4dc7B1279cCC51", - block, - "avax", - transform, - undefined, - ["0xB669c71431bc4372140bC35Aa1962C4B980bA507"] - ); - return balances; -} - -async function bsc(timestamp, block, chainBlocks) { - let balances = {}; - block = await getBlock(timestamp, "bsc", chainBlocks); - const transform = await transformBscAddress(); - - await addFundsInMasterChef( - {}, - "0x88E21dedEf04cf24AFe1847B0F6927a719AA8F35", - block, - "bsc", - transform, - undefined, - ["0x1A8d7AC01d21991BF5249A3657C97b2B6d919222"] - ); - return balances; -} - -module.exports = { - methodology: - "Only staked LP is counted as TVL. Excluded in TVL : Locked BEE in the RoyalJelly, NFT Jelly, value of BNB & xJOE which aren't on CoinGecko yet.", - avalanche: { - tvl: avax, - }, - bsc: { - tvl: bsc, - }, -}; // node test.js projects/HoneyFarm/index2.js From 03b3847643268260594632001c79fe5f6287921a Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 15 Dec 2021 21:11:14 +0000 Subject: [PATCH 383/393] honeyfarm staking --- projects/HoneyFarm/Index.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/projects/HoneyFarm/Index.js b/projects/HoneyFarm/Index.js index c327e13d2d..2dc6b21fdb 100644 --- a/projects/HoneyFarm/Index.js +++ b/projects/HoneyFarm/Index.js @@ -4,6 +4,7 @@ const { transformAvaxAddress, transformBscAddress, } = require("../helper/portedTokens"); +const { staking } = require("../helper/staking"); async function avax(timestamp, block, chainBlocks) { let balances = {}; @@ -44,8 +45,18 @@ module.exports = { "Only staked LP is counted as TVL. Excluded in TVL : Locked BEE in the RoyalJelly, NFT Jelly, value of BNB & xJOE which aren't on CoinGecko yet.", avalanche: { tvl: avax, + staking: staking( + "0x757490104fd4C80195D3C56bee4dc7B1279cCC51", + "0xB669c71431bc4372140bC35Aa1962C4B980bA507", + "avax" + ), }, bsc: { tvl: bsc, + staking: staking( + "0x88E21dedEf04cf24AFe1847B0F6927a719AA8F35", + "0x1A8d7AC01d21991BF5249A3657C97b2B6d919222", + "bsc" + ), }, -}; // node test.js projects/HoneyFarm/index2.js +}; // node test.js projects/HoneyFarm/index.js From d0188f2ea6c3c827e20b5bf6c7d3e10f09cabefb Mon Sep 17 00:00:00 2001 From: RobAnon Date: Wed, 15 Dec 2021 17:33:05 -0500 Subject: [PATCH 384/393] Fully functional Revest multi-chain TVL tracker --- projects/revest/index.js | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/projects/revest/index.js b/projects/revest/index.js index 86873d7594..588c356ecd 100644 --- a/projects/revest/index.js +++ b/projects/revest/index.js @@ -1,9 +1,14 @@ const { default: axios } = require("axios"); const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { + transformFantomAddress, + transformAvaxAddress, + transformPolygonAddress, +} = require("../helper/portedTokens.js"); const holder = "0xA81bd16Aa6F6B25e66965A2f842e9C806c0AA11F"; -async function tvl(time, block) { +async function mainnetTVL(time, block) { const tokens = await axios.get( "https://defi-llama-feed.vercel.app/api/address" ); @@ -22,11 +27,14 @@ async function polygonTVL(time, block) { "https://defi-llama-feed.vercel.app/api/address?chainId=137" ); const balances = {}; + const transform = await transformPolygonAddress(); await sumTokensAndLPsSharedOwners( balances, tokens.data.body.map((t) => [t, false]), [holder], - block + block["polygon"], + "polygon", + transform ); return balances; } @@ -36,11 +44,14 @@ async function fantomTVL(time, block) { "https://defi-llama-feed.vercel.app/api/address?chainId=250" ); const balances = {}; + const transform = await transformFantomAddress(); await sumTokensAndLPsSharedOwners( balances, tokens.data.body.map((t) => [t, false]), [holder], - block + block["fantom"], + "fantom", + transform ); return balances; } @@ -50,22 +61,32 @@ async function avaxTVL(time, block) { "https://defi-llama-feed.vercel.app/api/address?chainId=43114" ); const balances = {}; + const transform = await transformAvaxAddress(); await sumTokensAndLPsSharedOwners( balances, tokens.data.body.map((t) => [t, false]), [holder], - block + block["avax"], + "avax", + transform ); return balances; } +function sumTvl(tvlList = []) { + return async (...args) => { + const results = await Promise.all(tvlList.map((fn) => fn(...args))); + return results.reduce((a, c) => Object.assign(a, c), {}); + }; +} + module.exports = { methodology: "We list all tokens in our vault and sum them together", ethereum: { - tvl, + tvl: mainnetTVL, }, polygon: { - polygonTVL, + tvl: polygonTVL, }, fantom: { fantomTVL, @@ -73,4 +94,5 @@ module.exports = { avalanche: { avaxTVL, }, + tvl: sumTvl([mainnetTVL, polygonTVL, fantomTVL, avaxTVL]), }; From e42d5db70e4e0ebe846535e9f698bd9a10d942e9 Mon Sep 17 00:00:00 2001 From: RobAnon Date: Wed, 15 Dec 2021 17:34:54 -0500 Subject: [PATCH 385/393] Minor formatting fix --- projects/revest/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/revest/index.js b/projects/revest/index.js index 588c356ecd..5ee7e43770 100644 --- a/projects/revest/index.js +++ b/projects/revest/index.js @@ -89,10 +89,10 @@ module.exports = { tvl: polygonTVL, }, fantom: { - fantomTVL, + tvl: fantomTVL, }, avalanche: { - avaxTVL, + tvl: avaxTVL, }, tvl: sumTvl([mainnetTVL, polygonTVL, fantomTVL, avaxTVL]), }; From 72c5e4c48b11325a39df4a235c7d9577a5c1b6ae Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Wed, 15 Dec 2021 22:50:13 +0000 Subject: [PATCH 386/393] daoventures --- projects/daoventures/abi.json | 9 +++++++++ projects/daoventures/index.js | 6 +++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/projects/daoventures/abi.json b/projects/daoventures/abi.json index afdea09a20..739beacba9 100644 --- a/projects/daoventures/abi.json +++ b/projects/daoventures/abi.json @@ -6,6 +6,15 @@ "stateMutability": "view", "type": "function" }, + "getAllPoolInUSDProxy": { + "inputs": [ + { "internalType": "bool", "name": "includeVestedILV", "type": "bool" } + ], + "name": "getAllPoolInUSD", + "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "stateMutability": "view", + "type": "function" + }, "getTotalValueInPool": { "inputs": [], "name": "getTotalValueInPool", diff --git a/projects/daoventures/index.js b/projects/daoventures/index.js index 66098a3a5a..ff698fd6eb 100644 --- a/projects/daoventures/index.js +++ b/projects/daoventures/index.js @@ -44,8 +44,9 @@ async function tvl(timestamp, ethereumBlock, chainBlocks) { sdk.api.abi.call({ target: DAOvault.Metaverse, // contract address - abi: abi.getAllPoolInUSD, // erc20:methodName + abi: abi.getAllPoolInUSDProxy, // erc20:methodName block: block[block], // Current block number + params: [false], }), ]); @@ -80,7 +81,7 @@ async function final() { final(); */ - +// node test.js projects/daoventures/index.js async function stakingTvl(timestamp, block) { let balances = {}; let { output: balance } = await sdk.api.erc20.balanceOf({ @@ -104,5 +105,4 @@ module.exports = { tvl: tvl, staking: stakingTvl, }, - tvl: tvl, }; From 3d773e9e0f2c27873d8aeef62148d51515bb52e1 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 16 Dec 2021 02:41:49 +0000 Subject: [PATCH 387/393] update tvl export --- projects/hermes/index.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/projects/hermes/index.js b/projects/hermes/index.js index 0b586e9ba1..bd3feb3f65 100644 --- a/projects/hermes/index.js +++ b/projects/hermes/index.js @@ -422,12 +422,9 @@ module.exports = { misrepresentedTokens: true, methodology: "Hermes TVL is calculated from our vaults, which are not native tokens. Pool 2 is based on the TVL of native tokens hosted in our masterchef.", - pool2: { - masterchefTVL, - tvlBalancer, - }, polygon: { - tvlVaults, + pool2: sdk.util.sumChainTvls([masterchefTVL, tvlBalancer]), + tvl: tvlVaults }, - + }; From 138783efa175aeda9d02b84e511e4b8ef60f7383 Mon Sep 17 00:00:00 2001 From: Real Shaman <85087525+realdealshaman@users.noreply.github.com> Date: Thu, 16 Dec 2021 02:56:41 +0000 Subject: [PATCH 388/393] add correct staking function --- projects/xmaspast/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/xmaspast/index.js b/projects/xmaspast/index.js index 7f3e7a7b13..743a012251 100644 --- a/projects/xmaspast/index.js +++ b/projects/xmaspast/index.js @@ -1,7 +1,7 @@ const abi = require("../helper/abis/masterchef.json") const { transformFantomAddress } = require("../helper/portedTokens"); const { addFundsInMasterChef } = require("../helper/masterchef"); -const { staking } = require("../helper/staking"); +const { staking, stakingPricedLP } = require("../helper/staking"); const { pool2Exports } = require('../helper/pool2') @@ -21,7 +21,7 @@ module.exports = { methodology: "TVL includes all farms in MasterChef contract", fantom: { tvl, - staking: staking(chef, xpast, "fantom"), + staking: stakingPricedLP(chef, xpast, "fantom","0x9665067DceF6a88d2dCf042ee25A2d98a2DDF8D6", "fantom"), pool2: pool2Exports(chef, [xpastFtmLP, xpastUsdcLP], "fantom"), }, From 1a488205d5c7938c3b599f5251464b2559612cb6 Mon Sep 17 00:00:00 2001 From: "jwoong.song" Date: Thu, 16 Dec 2021 14:50:44 +0900 Subject: [PATCH 389/393] add klaytn TVL --- projects/qubit/abi.json | 125 +++++++++++++++++++++++----------------- projects/qubit/index.js | 91 +++++++++++++++++++++-------- 2 files changed, 138 insertions(+), 78 deletions(-) diff --git a/projects/qubit/abi.json b/projects/qubit/abi.json index 9ee4978d5c..16045b40fd 100644 --- a/projects/qubit/abi.json +++ b/projects/qubit/abi.json @@ -1,54 +1,73 @@ { - "allMarkets": { - "inputs": [], - "name": "allMarkets", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCash": { - "inputs": [], - "name": "getCash", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "underlying": { - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "totalBorrow": { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file + "allMarkets": { + "inputs": [], + "name": "allMarkets", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + "getCash": { + "inputs": [], + "name": "getCash", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "underlying": { + "inputs": [], + "name": "underlying", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + "totalBorrow": { + "inputs": [], + "name": "totalBorrow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + "totalValueLockedOf": { + "inputs": [ + { + "internalType": "address[]", + "name": "markets", + "type": "address[]" + } + ], + "name": "totalValueLockedOf", + "outputs": [ + { + "internalType": "uint256", + "name": "totalSupplyInUSD", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } +} diff --git a/projects/qubit/index.js b/projects/qubit/index.js index fcfefa3f15..83396c8e20 100644 --- a/projects/qubit/index.js +++ b/projects/qubit/index.js @@ -1,42 +1,79 @@ const sdk = require("@defillama/sdk"); -const abi = require('./abi.json') +const abi = require("./abi.json"); +const BigNumber = require("bignumber.js"); const qBnb = "0xbE1B5D17777565D67A5D2793f879aBF59Ae5D351"; // qBNB const wBnb = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; //wBNB -const qoreComptroller = "0xf70314eb9c7fe7d88e6af5aa7f898b3a162dcd48" +const qoreComptroller = "0xf70314eb9c7fe7d88e6af5aa7f898b3a162dcd48"; + +const dashboardKlaytn = "0x9A47D707FDffC561E3598990f25d3874af448568"; +const qTokensKlaytn = [ + "0xf6FB6Ce9dcc5Dac5BE99503B44630FfF1f24b1EC", // qKLAY + "0xE61688286f169A88189E6Fbe5478B5164723B14A", // qKUSDT + "0xb3e0030557CeC1CEf43062F71c2bE3b5f92f1B7b", // qKETH + "0x19e1e58d9EdFdDc35D11bEa53BCcf8Eb1425Bf0D", // qKWBTC + "0x0EaAAEB0623f6E263d020390e01d00a334EB531E", // QKDAI + "0xC1c3a6b591a493c01B1330ee744d2aF01F70EA32", // QKSP + "0x99dac5dF97eB189Cd244c5bfC8984f916f0eb4B0", // qWEMIX + "0x3dB032090A06e3dEaC905543C0AcC92B8f827a70", // qKQBT +]; + +const ZERO = new BigNumber(0); +const ETHER = new BigNumber(10).pow(18); function tvl(borrowed) { return async (timestamp, ethBlock, chainBlocks) => { - const chain = "bsc" - const block = chainBlocks[chain] + const chain = "bsc"; + const block = chainBlocks[chain]; const balances = {}; - const qTokens = (await sdk.api.abi.call({ - target: qoreComptroller, - block, - chain, - abi: abi.allMarkets - })).output - const [amounts, underlyings] = await Promise.all([borrowed?abi.totalBorrow: abi.getCash, abi.underlying].map(abi=>sdk.api.abi.multiCall({ - calls: qTokens.map(qt=>({target:qt})), - abi, - block, - chain - }))) + const qTokens = ( + await sdk.api.abi.call({ + target: qoreComptroller, + block, + chain, + abi: abi.allMarkets, + }) + ).output; + const [amounts, underlyings] = await Promise.all( + [borrowed ? abi.totalBorrow : abi.getCash, abi.underlying].map((abi) => + sdk.api.abi.multiCall({ + calls: qTokens.map((qt) => ({ target: qt })), + abi, + block, + chain, + }) + ) + ); for (let i = 0; i < qTokens.length; i++) { - const qtoken = qTokens[i] - const amount = amounts.output[i].output - const underlying = qtoken===qBnb?wBnb:underlyings.output[i].output - sdk.util.sumSingleBalance( - balances, - `bsc:${underlying}`, - amount - ); + const qtoken = qTokens[i]; + const amount = amounts.output[i].output; + const underlying = qtoken === qBnb ? wBnb : underlyings.output[i].output; + sdk.util.sumSingleBalance(balances, `bsc:${underlying}`, amount); } return balances; - } + }; +} + +function tvlKlaytn() { + return async (timestamp, ethBlock, chainBlocks) => { + const chain = "klaytn"; + const block = chainBlocks[chain]; + + const data = await sdk.api.abi.call({ + target: dashboardKlaytn, + block, + chain, + abi: abi.totalValueLockedOf, + params: [qTokensKlaytn], + }); + + return { + tether: new BigNumber(data.output).dividedBy(ETHER).toNumber(), + }; + }; } module.exports = { @@ -48,4 +85,8 @@ module.exports = { tvl: tvl(false), borrowed: tvl(true), }, + klaytn: { + // no borrowed: Dashboard contract of Qubit returns 'supply - borrow' value + tvl: tvlKlaytn(), + }, }; From 7a88360ee9b7a7314e0a832df6a10862cd706887 Mon Sep 17 00:00:00 2001 From: Peter Chung Date: Thu, 16 Dec 2021 22:43:44 +0800 Subject: [PATCH 390/393] add SpicySwap --- projects/spicyswap/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 projects/spicyswap/index.js diff --git a/projects/spicyswap/index.js b/projects/spicyswap/index.js new file mode 100644 index 0000000000..7ac0d29fa8 --- /dev/null +++ b/projects/spicyswap/index.js @@ -0,0 +1,16 @@ +const axios = require('axios'); +const BigNumber = require("bignumber.js"); +const dataUrl = 'https://spicyb.sdaotools.xyz/api/rest/SpicyDailyMetrics'; + +async function tvl() { + const data = (await axios(dataUrl)).data; + const totalLiquidity = new BigNumber(data.spicy_day_data[0].totalliquidityxtz).toFixed(2); + return { + tezos: totalLiquidity + } +} +module.exports = { + methodology: `TVL counts the liquidity of SpicySwap farms. Data is pulled from:"${dataUrl}".`, + misrepresentedTokens: true, + tvl +} From 1dd8fa98860ab832fb7011f9ce62be49640548ee Mon Sep 17 00:00:00 2001 From: mrmard Date: Tue, 7 Dec 2021 01:10:26 +0800 Subject: [PATCH 391/393] Added pool2 --- projects/pickle/index.js | 109 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/projects/pickle/index.js b/projects/pickle/index.js index 24d45c86a7..71fb92cbfd 100644 --- a/projects/pickle/index.js +++ b/projects/pickle/index.js @@ -5,6 +5,7 @@ const { unwrapUniswapLPs, unwrapCrv } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); const { toUSDT, usdtAddress } = require("../helper/balances"); const { staking } = require("../helper/staking"); +const { GraphQLClient, gql } = require("graphql-request"); const excluded = ["pbamm", "pickle-eth", "sushi-pickle-eth"]; const jars_url = @@ -14,6 +15,59 @@ const jars_url = const dillAddress = "0xbBCf169eE191A1Ba7371F30A1C344bFC498b29Cf"; const pickleAddress = "0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5"; +const pool2s = [ + { + contract: "0xfAA267C3Bb25a82CFDB604136a29895D30fd3fd8", // Gauge + lpToken: "0xdc98556Ce24f007A5eF6dC1CE96322d65832A819", // Uni Pickle-Eth + chain: "ethereum", + }, + { + contract: "0xbD17B1ce622d73bD438b9E658acA5996dc394b0d", // Masterchef + lpToken: "0xdc98556Ce24f007A5eF6dC1CE96322d65832A819", // Uni Pickle-Eth + chain: "ethereum", + }, + { + contract: "0xEF0881eC094552b2e128Cf945EF17a6752B4Ec5d", // Sushi MC2 + lpToken: "0x269Db91Fc3c7fCC275C2E6f22e5552504512811c", // Sushi Pickle-Eth + chain: "ethereum", + }, + { + contract: "0xBA12222222228d8Ba445958a75a0704d566BF2C8", // Balancer Vault + lpToken: "0xc2f082d33b5b8ef3a7e3de30da54efd3114512ac", // Balancer Pickle-Eth + chain: "arbitrum", + }, +]; + +async function getBalancerPoolLiquidity(poolAddress, block) { + // delayed by around 5 mins to allow subgraph to update + block -= 25; + var endpoint = `https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-arbitrum-v2`; + var graphQLClient = new GraphQLClient(endpoint); + var query = gql`{ + pools( + first: 1, + skip: 0, + block: {number: ${block}}, + where: {address_in: ["${poolAddress}"]} + ) { + address, + totalLiquidity + } + } + `; + + const results = await graphQLClient.request(query, { + block, + }); + + const result = results.pools[0]; + const filtered = { + address: result.address, + totalLiquidity: result.totalLiquidity, + }; + return filtered; +} + function chainTvl(chain) { return async (_timestamp, _ethBlock, chainBlocks) => { const block = chainBlocks[chain]; @@ -100,13 +154,68 @@ function chainTvl(chain) { }; } +function chainPool2(chain) { + return async (_timestamp, _ethBlock, chainBlocks) => { + const block = chainBlocks[chain]; + const transformAddress = await getChainTransform(chain); + const balances = {}; + + const chainPool2s = pool2s.filter((pool) => pool.chain === chain); + + if (chain === "ethereum") { + const pool2Balances = await Promise.all( + chainPool2s.map(async (pool) => { + return ( + await sdk.api.erc20.balanceOf({ + target: pool.lpToken, + owner: pool.contract, + }) + ).output; + }) + ); + + const lpPositions = chainPool2s.map((pool, idx) => { + return { + balance: pool2Balances[idx], + token: pool.lpToken, + }; + }); + + await unwrapUniswapLPs( + balances, + lpPositions, + block, + chain, + transformAddress + ); + } else if (chain === "arbitrum") { + const pool2Balances = await Promise.all( + chainPool2s.map(async (pool) => { + return await getBalancerPoolLiquidity(pool.lpToken, block); + }) + ); + + pool2Balances.forEach((pool) => { + sdk.util.sumSingleBalance( + balances, + usdtAddress, + toUSDT(pool.totalLiquidity) + ); + }); + } + return balances; + }; +} + module.exports = { arbitrum: { tvl: chainTvl("arbitrum"), + pool2: chainPool2("arbitrum"), }, ethereum: { tvl: chainTvl("ethereum"), staking: staking(dillAddress, pickleAddress), + pool2: chainPool2("ethereum"), }, polygon: { tvl: chainTvl("polygon"), From 82e01621e1f1d73f0e541cdae1b36c63a922c0b1 Mon Sep 17 00:00:00 2001 From: waynebruce0x Date: Thu, 16 Dec 2021 18:23:26 +0000 Subject: [PATCH 392/393] connext, pickle --- projects/connext/index.js | 5 ++- projects/helper/portedTokens.js | 61 ++++++++++++++++++++++++++------- projects/pickle/index.js | 5 +-- 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/projects/connext/index.js b/projects/connext/index.js index 41dfc79473..29d3be0d91 100644 --- a/projects/connext/index.js +++ b/projects/connext/index.js @@ -89,7 +89,7 @@ function chainTvl(chain) { const chains = [ "ethereum", - //"bsc", + "bsc", "polygon", "moonriver", "fantom", @@ -108,5 +108,4 @@ const chains = [ "boba", */ ]; - -module.exports = chainExports(chainTvl, Array.from(chains)); \ No newline at end of file +module.exports = chainExports(chainTvl, Array.from(chains)); diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index e0705f0ea2..07c3445d9d 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -185,20 +185,55 @@ const abiXdaiBridgeAbi = { }; async function transformXdaiAddress() { return async (address) => { - const result = await sdk.api.abi.call({ - target: bridgeAdd, - abi: abiXdaiBridgeAbi, - params: [address], - chain: "xdai", - }); - // XDAI -> DAI - if (address === "0x0000000000000000000000000000000000000000") { + if ( + address === "0x0000000000000000000000000000000000000000" || + address.toLowerCase() === "0x44fa8e6f47987339850636f88629646662444217" || + address.toLowerCase() === "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d" + ) { return `0x6b175474e89094c44da98b954eedeac495271d0f`; } - if (result.output === "0x0000000000000000000000000000000000000000") { - return `xdai:${address}`; + if ( + address.toLowerCase() === "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1" + ) { + return `0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2`; } - return result.output; + if ( + address.toLowerCase() === "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83" + ) { + return `0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48`; + } + if ( + address.toLowerCase() === "0x4537e328bf7e4efa29d05caea260d7fe26af9d74" + ) { + return `0x1f9840a85d5af5bf1d1762f925bdaddc4201f984`; + } + if ( + address.toLowerCase() === "0x4ecaba5870353805a9f068101a40e0f32ed605c6" + ) { + return `0xdac17f958d2ee523a2206206994597c13d831ec7`; + } + if ( + address.toLowerCase() === "0x7122d7661c4564b7c6cd4878b06766489a6028a2" + ) { + return `0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0`; + } + if ( + address.toLowerCase() === "0x8e5bbbb09ed1ebde8674cda39a0c169401db4252" + ) { + return `0x2260fac5e5542a773aa44fbcfedf7c193bc2c599`; + } + + // const result = await sdk.api.abi.call({ + // target: bridgeAdd, + // abi: abiXdaiBridgeAbi, + // params: [address], + // chain: "xdai", + // }); + // if (result.output === "0x0000000000000000000000000000000000000000") { + // return `xdai:${address}`; + // } + // // XDAI -> DAI + // return result.output; }; } @@ -356,7 +391,7 @@ async function transformArbitrumAddress() { compareAddresses(addr, token.address) ); if (dstToken !== undefined) { - return dstToken.extensions.bridgeInfo[1].tokenAddress; + return dstToken.extensions.bridgeInfo[1].tokenAddress; } return `arbitrum:${addr}`; }; @@ -478,4 +513,4 @@ module.exports = { transformArbitrumAddress, fixHarmonyBalances, transformIotexAddress, -}; \ No newline at end of file +}; diff --git a/projects/pickle/index.js b/projects/pickle/index.js index 24d45c86a7..edd51e0e21 100644 --- a/projects/pickle/index.js +++ b/projects/pickle/index.js @@ -5,10 +5,10 @@ const { unwrapUniswapLPs, unwrapCrv } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); const { toUSDT, usdtAddress } = require("../helper/balances"); const { staking } = require("../helper/staking"); - +// node test.js projects/pickle/index.js const excluded = ["pbamm", "pickle-eth", "sushi-pickle-eth"]; const jars_url = - "https://stkpowy01i.execute-api.us-west-1.amazonaws.com/prod/protocol/pools"; + "https://f8wgg18t1h.execute-api.us-west-1.amazonaws.com/prod/protocol/pools"; // Contracts const dillAddress = "0xbBCf169eE191A1Ba7371F30A1C344bFC498b29Cf"; @@ -20,6 +20,7 @@ function chainTvl(chain) { const transformAddress = await getChainTransform(chain); const balances = {}; + let a = await utils.fetchURL(jars_url); let jars = (await utils.fetchURL(jars_url)).data .map((jar) => { if (jar.network === (chain === "ethereum" ? "eth" : chain)) From d912d8d5a16bca84ae53e9d59f252319b5c3d74a Mon Sep 17 00:00:00 2001 From: mrmard Date: Sat, 11 Dec 2021 15:07:09 +0800 Subject: [PATCH 393/393] Data now fetched from pfcore --- projects/pickle/abi.json | 15 --- projects/pickle/index.js | 259 +++++++++------------------------------ 2 files changed, 56 insertions(+), 218 deletions(-) delete mode 100644 projects/pickle/abi.json diff --git a/projects/pickle/abi.json b/projects/pickle/abi.json deleted file mode 100644 index 7ca8432e5a..0000000000 --- a/projects/pickle/abi.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "balance": { - "inputs": [], - "name": "balance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/projects/pickle/index.js b/projects/pickle/index.js index 71fb92cbfd..8aba8773c0 100644 --- a/projects/pickle/index.js +++ b/projects/pickle/index.js @@ -1,223 +1,76 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const utils = require("../helper/utils"); -const { unwrapUniswapLPs, unwrapCrv } = require("../helper/unwrapLPs"); -const { getChainTransform } = require("../helper/portedTokens"); const { toUSDT, usdtAddress } = require("../helper/balances"); -const { staking } = require("../helper/staking"); -const { GraphQLClient, gql } = require("graphql-request"); +const axios = require("axios"); -const excluded = ["pbamm", "pickle-eth", "sushi-pickle-eth"]; -const jars_url = - "https://stkpowy01i.execute-api.us-west-1.amazonaws.com/prod/protocol/pools"; - -// Contracts -const dillAddress = "0xbBCf169eE191A1Ba7371F30A1C344bFC498b29Cf"; +const pfcore = "https://api.pickle.finance/prod/protocol/pfcore/"; const pickleAddress = "0x429881672B9AE42b8EbA0E26cD9C73711b891Ca5"; -const pool2s = [ - { - contract: "0xfAA267C3Bb25a82CFDB604136a29895D30fd3fd8", // Gauge - lpToken: "0xdc98556Ce24f007A5eF6dC1CE96322d65832A819", // Uni Pickle-Eth - chain: "ethereum", - }, - { - contract: "0xbD17B1ce622d73bD438b9E658acA5996dc394b0d", // Masterchef - lpToken: "0xdc98556Ce24f007A5eF6dC1CE96322d65832A819", // Uni Pickle-Eth - chain: "ethereum", - }, - { - contract: "0xEF0881eC094552b2e128Cf945EF17a6752B4Ec5d", // Sushi MC2 - lpToken: "0x269Db91Fc3c7fCC275C2E6f22e5552504512811c", // Sushi Pickle-Eth - chain: "ethereum", - }, - { - contract: "0xBA12222222228d8Ba445958a75a0704d566BF2C8", // Balancer Vault - lpToken: "0xc2f082d33b5b8ef3a7e3de30da54efd3114512ac", // Balancer Pickle-Eth - chain: "arbitrum", - }, -]; - -async function getBalancerPoolLiquidity(poolAddress, block) { - // delayed by around 5 mins to allow subgraph to update - block -= 25; - var endpoint = `https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-arbitrum-v2`; - var graphQLClient = new GraphQLClient(endpoint); - var query = gql`{ - pools( - first: 1, - skip: 0, - block: {number: ${block}}, - where: {address_in: ["${poolAddress}"]} - ) { - address, - totalLiquidity - } - } - `; - - const results = await graphQLClient.request(query, { - block, - }); - - const result = results.pools[0]; - const filtered = { - address: result.address, - totalLiquidity: result.totalLiquidity, - }; - return filtered; -} - -function chainTvl(chain) { +function fetch(chain, type) { return async (_timestamp, _ethBlock, chainBlocks) => { - const block = chainBlocks[chain]; - const transformAddress = await getChainTransform(chain); - const balances = {}; - - let jars = (await utils.fetchURL(jars_url)).data - .map((jar) => { - if (jar.network === (chain === "ethereum" ? "eth" : chain)) - return { - ...jar, - name: jar.identifier, - }; - }) - .filter((x) => x && !excluded.includes(x.name)); + const response = (await axios.get(pfcore))?.data; - const jar_balances = ( - await sdk.api.abi.multiCall({ - block, - calls: jars.map((jar) => ({ - target: jar.jarAddress, - })), - abi: abi.balance, - chain, - }) - ).output.map((val) => val.output); + chain = chain === "ethereum" ? "eth" : chain; - const lpPositions = []; + let tvl = 0; + let pool2 = 0; - await Promise.all( - jars.map(async (jar, idx) => { - if ( - ((jar.name.includes("crv") || jar.name === "dodohndeth") && - chain === "arbitrum") || - jar.name === "rbn-eth" - ) { - sdk.util.sumSingleBalance( - balances, - usdtAddress, - toUSDT(jar.liquidity_locked) - ); - } else if ( - jar.name.toLowerCase().includes("crv") && - jar.name != "yvecrv-eth" - ) { - await unwrapCrv( - balances, - jar.tokenAddress, - jar_balances[idx], - block, - chain, - transformAddress - ); - } else if (jar.name.includes("-") || jar.name.includes("lp")) { - lpPositions.push({ - balance: jar_balances[idx], - token: jar.tokenAddress, - }); - } else if (jar.name === "aleth") { - sdk.util.sumSingleBalance( - // sum as weth - balances, - "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - jar_balances[idx] - ); - } else { - sdk.util.sumSingleBalance( - balances, - transformAddress(jar.tokenAddress), - jar_balances[idx] - ); + Object.keys(response.assets).forEach((assetsType) => { + response.assets[assetsType].forEach((asset) => { + if (asset.chain === chain) { + if (asset.tags && asset.tags.includes("pool2")) { + pool2 += asset.details.harvestStats.balanceUSD; + } else { + tvl += asset.details.harvestStats?.balanceUSD ?? 0; + } } - }) - ); - await unwrapUniswapLPs( - balances, - lpPositions, - block, - chain, - transformAddress - ); - - return balances; - }; -} - -function chainPool2(chain) { - return async (_timestamp, _ethBlock, chainBlocks) => { - const block = chainBlocks[chain]; - const transformAddress = await getChainTransform(chain); - const balances = {}; - - const chainPool2s = pool2s.filter((pool) => pool.chain === chain); - - if (chain === "ethereum") { - const pool2Balances = await Promise.all( - chainPool2s.map(async (pool) => { - return ( - await sdk.api.erc20.balanceOf({ - target: pool.lpToken, - owner: pool.contract, - }) - ).output; - }) - ); - - const lpPositions = chainPool2s.map((pool, idx) => { - return { - balance: pool2Balances[idx], - token: pool.lpToken, - }; - }); - - await unwrapUniswapLPs( - balances, - lpPositions, - block, - chain, - transformAddress - ); - } else if (chain === "arbitrum") { - const pool2Balances = await Promise.all( - chainPool2s.map(async (pool) => { - return await getBalancerPoolLiquidity(pool.lpToken, block); - }) - ); - - pool2Balances.forEach((pool) => { - sdk.util.sumSingleBalance( - balances, - usdtAddress, - toUSDT(pool.totalLiquidity) - ); }); + }); + + let result = {}; + + switch (type) { + case "tvl": + result = { [usdtAddress]: toUSDT(tvl) }; + break; + case "pool2": + result = { [usdtAddress]: toUSDT(pool2) }; + break; + case "staking": + const picklesLocked = response.dill.pickleLocked; + result = { [pickleAddress]: picklesLocked * 1e18 }; + break; } - return balances; + + return result; }; } module.exports = { - arbitrum: { - tvl: chainTvl("arbitrum"), - pool2: chainPool2("arbitrum"), - }, ethereum: { - tvl: chainTvl("ethereum"), - staking: staking(dillAddress, pickleAddress), - pool2: chainPool2("ethereum"), + tvl: fetch("ethereum", "tvl"), + pool2: fetch("ethereum", "pool2"), + staking: fetch("ethereum", "staking"), }, polygon: { - tvl: chainTvl("polygon"), + tvl: fetch("polygon", "tvl"), + pool2: fetch("polygon", "pool2"), + }, + arbitrum: { + tvl: fetch("arbitrum", "tvl"), + pool2: fetch("arbitrum", "pool2"), + }, + moonriver: { + tvl: fetch("moonriver", "tvl"), + }, + harmony: { + tvl: fetch("harmony", "tvl"), + }, + okexchain: { + tvl: fetch("okex", "tvl"), + }, + cronos: { + tvl: fetch("cronos", "tvl"), + }, + aurora: { + tvl: fetch("aurora", "tvl"), }, };