Skip to content

Commit 95fe94a

Browse files
0x-minatoariyan-hashstack
andauthored
Adding Endur to Defillama (DefiLlama#12438)
Co-authored-by: ariyan-hashstack <[email protected]>
1 parent 3c6d40c commit 95fe94a

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

projects/endur/erc4626abi.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
const ERC4626Abi = [
2+
{
3+
"name": "asset",
4+
"type": "function",
5+
"inputs": [],
6+
"outputs": [
7+
{
8+
"type": "core::starknet::contract_address::ContractAddress"
9+
}
10+
],
11+
"state_mutability": "view"
12+
},
13+
{
14+
"name": "balanceOf",
15+
"type": "function",
16+
"inputs": [
17+
{
18+
"name": "account",
19+
"type": "core::starknet::contract_address::ContractAddress"
20+
}
21+
],
22+
"outputs": [
23+
{
24+
"type": "core::integer::u256"
25+
}
26+
],
27+
"state_mutability": "view",
28+
"customInput": 'address',
29+
},
30+
{
31+
"name": "total_assets",
32+
"type": "function",
33+
"inputs": [],
34+
"outputs": [
35+
{
36+
"type": "core::integer::u256"
37+
}
38+
],
39+
"state_mutability": "view"
40+
}
41+
]
42+
43+
const ERC4626AbiMap = {}
44+
ERC4626Abi.forEach(i => ERC4626AbiMap[i.name] = i)
45+
46+
module.exports = {
47+
ERC4626AbiMap
48+
}

projects/endur/index.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Endur is a liquid staking solution for STRK
3+
*/
4+
5+
const {multiCall} = require("../helper/chain/starknet");
6+
const ADDRESSES = require('../helper/coreAssets.json');
7+
const { ERC4626AbiMap } = require('./erc4626abi')
8+
9+
const LSTDATA = [{ //data of an LST contract; currently only xSTRK
10+
address: "0x28d709c875c0ceac3dce7065bec5328186dc89fe254527084d1689910954b0a", // address of xSTRK vault contract
11+
token: ADDRESSES.starknet.STRK
12+
}]
13+
14+
// returns the tvl of the all LST tokens in terms of their native token
15+
async function tvl(api) {
16+
const totalAssets = await multiCall({
17+
calls: LSTDATA.map(c => c.address),
18+
abi: ERC4626AbiMap.total_assets
19+
});
20+
// the balance of the tokens will be xTOKEN
21+
// considering all 1 TOKEN = 1xTOKEN
22+
// eg for now we only have xSTRK i.e 1 STRK = 1 xSTRK
23+
24+
api.addTokens(LSTDATA.map(c => c.token), totalAssets);
25+
}
26+
27+
module.exports = {
28+
doublecounted: true,
29+
methodology: "The TVL is the total staked STRK managed by Endur's LST",
30+
starknet: {
31+
tvl,
32+
},
33+
};

0 commit comments

Comments
 (0)