Add Alpha1 v2 migration (#642)

This commit is contained in:
tudorhedged
2023-03-09 15:49:22 +01:00
committed by GitHub
parent ed430deedb
commit a3c9a172ee

View File

@@ -2,7 +2,8 @@ const utils = require('../utils');
const sdk = require('@defillama/sdk');
const superagent = require("superagent");
const ALPHA1_CONTRACT = '0xdE4133f0CFA1a61Ba94EC64b6fEde4acC1fE929E';
const ALPHA1_V1_CONTRACT = '0xdE4133f0CFA1a61Ba94EC64b6fEde4acC1fE929E';
const ALPHA1_V2_CONTRACT = '0x60908A71FbC9027838277f9f98e458BeF2A201da';
const ALPHA2_CONTRACT = '0x3C390b91Fc2f248E75Cd271e2dAbF7DcC955B1A3';
const abiAlpha1 = {
@@ -22,16 +23,25 @@ const abiAlpha2 = {
};
async function tvlAlpha1() {
const totalBalance = (
const balanceV1 = (
await sdk.api.abi.call({
abi: abiAlpha1,
chain: 'avax',
target: ALPHA1_CONTRACT,
target: ALPHA1_V1_CONTRACT,
params: [],
})
).output;
return totalBalance;
const balanceV2 = (
await sdk.api.abi.call({
abi: abiAlpha1,
chain: 'avax',
target: ALPHA1_V2_CONTRACT,
params: [],
})
).output;
return parseFloat(balanceV1) + parseFloat(balanceV2);
}
async function tvlAlpha2() {
@@ -49,11 +59,11 @@ async function tvlAlpha2() {
const poolsFunction = async () => {
const alpha1ApyData = await utils.getData(
'https://api.hedgefarm.workers.dev/alpha1/performance'
'https://api.hedgefarm.finance/alpha1/v2/performance'
);
const alpha2ApyData = await utils.getData(
'https://api.hedgefarm.workers.dev/alpha2/performance'
'https://api.hedgefarm.finance/alpha2/performance'
);
const btcbKey = 'avax:0x152b9d0fdc40c096757f570a51e494bd4b943e50';