Skip to content

Commit 66ab5a9

Browse files
committed
grizzlyfi
1 parent b95bb44 commit 66ab5a9

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

projects/grizzlyfi/index.js

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
const sdk = require("@defillama/sdk");
2+
const { transformBscAddress } = require("../helper/portedTokens");
3+
const { staking } = require("../helper/staking");
4+
const { pool2 } = require("../helper/pool2");
5+
const { unwrapUniswapLPs } = require("../helper/unwrapLPs");
6+
7+
const abi = {
8+
inputs: [],
9+
name: "grizzlyStrategyDeposits",
10+
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
11+
stateMutability: "view",
12+
type: "function"
13+
};
14+
const hives = [
15+
{
16+
hive: "0xDa0Ae0710b080AC64e72Fa3eC44203F27750F801",
17+
token: "0x58F876857a02D6762E0101bb5C46A8c1ED44Dc16"
18+
},
19+
{
20+
hive: "0x8D83Ad61Ae6eDE4274876EE9ad9127843ba2AbF7",
21+
token: "0xEc6557348085Aa57C72514D67070dC863C0a5A8c"
22+
},
23+
{
24+
hive: "0xE4Dbb05498C42A6E780e4C6F96A4E20a7D7Cb1d6",
25+
token: "0x7EFaEf62fDdCCa950418312c6C91Aef321375A00"
26+
},
27+
{
28+
hive: "0x66B1bACAB888017cA96abBf28ad8d10B7A7B5eC3",
29+
token: "0x2354ef4DF11afacb85a5C7f98B624072ECcddbB1"
30+
},
31+
{
32+
hive: "0x9F45E2181D365F9057f67153e6D213e2358A5A4B",
33+
token: "0x66FDB2eCCfB58cF098eaa419e5EfDe841368e489"
34+
},
35+
{
36+
hive: "0x3cbF1d01A650e9DB566A123E3D5e42B9684C6b6a",
37+
token: "0xEa26B78255Df2bBC31C1eBf60010D78670185bD0"
38+
},
39+
{
40+
hive: "0x6fc2FEed99A97105B988657f9917B771CD809f40",
41+
token: "0xF45cd219aEF8618A92BAa7aD848364a158a24F33"
42+
}
43+
];
44+
45+
async function tvl(timestamp, block, chainBlocks) {
46+
const balances = {};
47+
block = chainBlocks.bsc;
48+
49+
const [{ output: bnbBalance }, { output: hiveBalances }] = await Promise.all([
50+
sdk.api.eth.getBalance({
51+
target: "0x1022a84f347fc1E6D47128E5364C9Aa1f43a2630",
52+
block: chainBlocks.bsc,
53+
chain: "bsc"
54+
}),
55+
sdk.api.abi.multiCall({
56+
calls: hives.map(h => ({ target: h.hive })),
57+
abi,
58+
chain: "bsc",
59+
block
60+
})
61+
]);
62+
63+
const lpPositions = hiveBalances.map((b, i) => ({
64+
balance: b.output,
65+
token: hives[i].token
66+
}));
67+
68+
await unwrapUniswapLPs(
69+
balances,
70+
lpPositions,
71+
block,
72+
"bsc",
73+
await transformBscAddress()
74+
);
75+
76+
sdk.util.sumSingleBalance(
77+
balances,
78+
"bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
79+
bnbBalance
80+
);
81+
82+
return balances;
83+
} // node test.js projects/grizzlyfi/index.js
84+
85+
module.exports = {
86+
bsc: {
87+
tvl,
88+
pool2: pool2(
89+
"0xF530B259fFf408aaB2B02aa60dd6fe48FCDC2FC9",
90+
"0x352008bf4319c3B7B8794f1c2115B9Aa18259EBb",
91+
"bsc"
92+
),
93+
staking: staking(
94+
"0x6F42895f37291ec45f0A307b155229b923Ff83F1",
95+
"0xa045e37a0d1dd3a45fefb8803d22457abc0a728a",
96+
"bsc"
97+
)
98+
}
99+
};

0 commit comments

Comments
 (0)