Skip to content

Commit cb2960d

Browse files
authored
Merge pull request #1820 from Dsummers91/master
Add 40 Acres
2 parents dc95cbd + b82e7dd commit cb2960d

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

Diff for: src/adaptors/40-acres/index.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const sdk = require('@defillama/sdk');
2+
3+
const utils = require('../utils');
4+
5+
async function getVault(timestamp, address, network, symbol, underlyingToken) {
6+
const vaultInfo = await utils.getERC4626Info(address, network, timestamp);
7+
const { tvl, ...rest } = vaultInfo;
8+
return {
9+
...rest,
10+
project: '40-acres',
11+
symbol,
12+
tvlUsd: tvl / 1e6,
13+
underlyingTokens: [underlyingToken],
14+
};
15+
};
16+
17+
const apy = async (timestamp) => {
18+
const fortyAcresBasevault = await getVault(
19+
timestamp,
20+
'0xB99B6dF96d4d5448cC0a5B3e0ef7896df9507Cf5',
21+
'base',
22+
'40base-USDC-Vault',
23+
'0x833589fcd6edb6e08f4c7c32d4f71b54bda02913'
24+
);
25+
26+
const fortyAcresOpvault = await getVault(
27+
timestamp,
28+
'0x08dCDBf7baDe91Ccd42CB2a4EA8e5D199d285957',
29+
'optimism',
30+
'40op-USDC-Vault',
31+
'0x0b2c639c533813f4aa9d7837caf62653d097ff85'
32+
);
33+
34+
return [fortyAcresBasevault, fortyAcresOpvault];
35+
};
36+
37+
module.exports = {
38+
timetravel: true,
39+
apy,
40+
url: 'https://www.40acres.finance/',
41+
};

Diff for: src/adaptors/utils.js

+3
Original file line numberDiff line numberDiff line change
@@ -455,18 +455,21 @@ exports.getERC4626Info = async (
455455
target: address,
456456
block: blockNow,
457457
abi: totalAssetsAbi,
458+
chain: chain,
458459
}),
459460
sdk.api.abi.call({
460461
target: address,
461462
block: blockNow,
462463
abi: convertToAssetsAbi,
463464
params: [assetUnit],
465+
chain: chain,
464466
}),
465467
sdk.api.abi.call({
466468
target: address,
467469
block: blockYesterday,
468470
abi: convertToAssetsAbi,
469471
params: [assetUnit],
472+
chain: chain,
470473
}),
471474
]);
472475
const apy = (priceNow.output / priceYesterday.output) ** 365 * 100 - 100;

0 commit comments

Comments
 (0)