This commit is contained in:
jansen
2022-04-30 16:14:48 +08:00
parent 4af0d51310
commit a64fa7eab6
2 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
{
"iotex": {
"gfs": {
"address": "0x1ba725d2ba56482f11fee3642f1c739d25018e4d",
"token": "0x19f3cb6a4452532793d1605c8736d4a94f48752c"
}
}
}

44
projects/gfs/index.js Normal file
View File

@@ -0,0 +1,44 @@
const sdk = require("@defillama/sdk");
const { getChainTransform } = require("../helper/portedTokens");
const contracts = require("./contracts.json");
const { getBlock } = require("../helper/getBlock");
const { sumSingleBalance } = require("@defillama/sdk/build/generalUtil");
const { sumLPWithOnlyOneToken } = require("./../helper/unwrapLPs");
const iotx = "0x6fb3e0a217407efff7ca062d46c26e5d60a14d69";
const wiotx = "0xA00744882684C3e4747faEFD68D283eA44099D03";
function pool2(chain, gasToken) {
return async (timestamp, block, chainBlocks) => {
block = await getBlock(timestamp, chain, chainBlocks);
let balances = { iotex: 0 };
for (let contract of Object.entries(contracts[chain])) {
await sumLPWithOnlyOneToken(
balances,
contract[1].token,
contract[1].address,
wiotx,
block,
"iotex"
);
}
if (iotx in balances) {
balances["iotex"] += balances[iotx] / 10 ** 18;
delete balances[iotx];
}
if (wiotx in balances) {
balances["iotex"] += balances[wiotx] / 10 ** 18;
delete balances[wiotx];
}
return balances;
};
}
module.exports = {
iotex: {
tvl: () => ({}),
pool2: pool2("iotex", "iotex"),
},
};