Skip to content

Commit d8869a6

Browse files
authored
Merge pull request DefiLlama#3652 from waynebruce0x/main
grizzlyfi
2 parents 4bc1ac9 + a45f8e0 commit d8869a6

File tree

2 files changed

+134
-31
lines changed

2 files changed

+134
-31
lines changed

projects/curve/index.js

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ async function getPools(block, chain) {
6161
})).output;
6262
}
6363

64-
let allPools = {}
65-
Object.entries(pools).map(([key, list])=>{
66-
pools[key] = list.filter(p=>{
67-
if(allPools[p.output] === undefined){
68-
allPools[p.output] = true
69-
return true
64+
let allPools = {};
65+
Object.entries(pools).map(([key, list]) => {
66+
pools[key] = list.filter(p => {
67+
if (allPools[p.output] === undefined) {
68+
allPools[p.output] = true;
69+
return true;
7070
} else {
71-
return false
71+
return false;
7272
}
73-
})
74-
})
73+
});
74+
});
7575

7676
return pools;
7777
}
@@ -138,10 +138,14 @@ async function fixWrappedTokenBalances(balances, block, chain, transform) {
138138
await unwrapSdTokens(balances, contracts[chain].sdTokens, chain);
139139
}
140140

141-
const stDOT = "moonbeam:0xfa36fe1da08c89ec72ea1f0143a35bfd5daea108"
142-
if(stDOT in balances){
143-
balances["bsc:0x7083609fce4d1d8dc0c979aab8c869ea2c873402"] = BigNumber(balances[stDOT]).times(1e8).toFixed(0)
144-
delete balances[stDOT]
141+
const stDOT = "moonbeam:0xfa36fe1da08c89ec72ea1f0143a35bfd5daea108";
142+
if (stDOT in balances) {
143+
balances["bsc:0x7083609fce4d1d8dc0c979aab8c869ea2c873402"] = BigNumber(
144+
balances[stDOT]
145+
)
146+
.times(1e8)
147+
.toFixed(0);
148+
delete balances[stDOT];
145149
}
146150
}
147151

@@ -197,7 +201,7 @@ function mapGaugeTokenBalances(calls, chain) {
197201
//"0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171": "0x19793b454d3afc7b454f206ffe95ade26ca6912c", // maybe not? 4 0s poly
198202
"0x7f90122bf0700f9e7e1f688fe926940e8839f353": {
199203
to: "0xbf7e49483881c76487b0989cd7d9a8239b20ca41",
200-
pools: ["0x30df229cefa463e991e29d42db0bae2e122b2ac7"],
204+
pools: [],
201205
chains: []
202206
}, // need a pool conditional - only for (1) ['0x30dF229cefa463e991e29D42DB0bae2e122B2AC7']
203207
"0xd02a30d33153877bc20e5721ee53dedee0422b2f": {
@@ -210,11 +214,6 @@ function mapGaugeTokenBalances(calls, chain) {
210214
pools: [],
211215
chains: ["avax"]
212216
},
213-
"0x7f90122bf0700f9e7e1f688fe926940e8839f353": {
214-
to: "0xbF7E49483881C76487b0989CD7d9A8239B20CA41",
215-
pools: [],
216-
chains: ["arbitrum"]
217-
},
218217
"0x27e611fd27b276acbd5ffd632e5eaebec9761e40": {
219218
to: "0x8866414733F22295b7563f9C5299715D2D76CAf4",
220219
pools: [],
@@ -349,7 +348,7 @@ function tvl(chain) {
349348
let balances = {};
350349
const transform = await getChainTransform(chain);
351350
const poolList = await getPools(chainBlocks[chain], chain);
352-
const block = await getBlock(_t, chain, chainBlocks, true)
351+
const block = await getBlock(_t, chain, chainBlocks, true);
353352

354353
for (let registry of Object.keys(poolList)) {
355354
await unwrapPools(
@@ -378,27 +377,32 @@ const chainTypeExports = chains => {
378377

379378
exports.harmony = {
380379
tvl: async (ts, ethB, chainB) => {
381-
if(ts > 1655989200) { // harmony hack
382-
return {}
380+
if (ts > 1655989200) {
381+
// harmony hack
382+
return {};
383383
}
384-
const block = await getBlock(ts, "harmony", chainB, true)
385-
const balances = {}
386-
await sumTokensSharedOwners(balances,
387-
["0xef977d2f931c1978db5f6747666fa1eacb0d0339", "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f"],
384+
const block = await getBlock(ts, "harmony", chainB, true);
385+
const balances = {};
386+
await sumTokensSharedOwners(
387+
balances,
388+
[
389+
"0xef977d2f931c1978db5f6747666fa1eacb0d0339",
390+
"0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f"
391+
],
388392
["0xC5cfaDA84E902aD92DD40194f0883ad49639b023"],
389393
block,
390394
"harmony",
391-
addr=>`harmony:${addr}`
392-
)
393-
return balances
395+
addr => `harmony:${addr}`
396+
);
397+
return balances;
394398
}
395-
}
399+
};
396400
exports.hallmarks = [
397401
[1597446675, "CRV Launch"],
398402
[1621213201, "Convex Launch"],
399403
[1642374675, "MIM depeg"],
400404
[1651881600, "UST depeg"],
401-
[1654822801, "stETH depeg"],
405+
[1654822801, "stETH depeg"]
402406
];
403407
return exports;
404408
};

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)