mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-01-12 16:53:02 +08:00
add gfs
This commit is contained in:
8
projects/gfs/contracts.json
Normal file
8
projects/gfs/contracts.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"iotex": {
|
||||
"gfs": {
|
||||
"address": "0x1ba725d2ba56482f11fee3642f1c739d25018e4d",
|
||||
"token": "0x19f3cb6a4452532793d1605c8736d4a94f48752c"
|
||||
}
|
||||
}
|
||||
}
|
||||
44
projects/gfs/index.js
Normal file
44
projects/gfs/index.js
Normal 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"),
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user