forked from StrawberryFlavor/FarmingTest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
call.ts
38 lines (31 loc) · 1.68 KB
/
call.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { ethers } from "ethers";
import UpgradeableStakingLSTABI from './UpgradeableStakingLST.json'
import {ProxyAddress} from "./utils/config";
// 连接到以太坊节点
const provider = new ethers.providers.JsonRpcProvider("https://crosschain-dev.polkawallet.io:9909");
const ProxyContract = new ethers.Contract(ProxyAddress as any, UpgradeableStakingLSTABI, provider);
(async ()=>{
try {
const poolIndex = await ProxyContract.poolIndex();
console.log('ProxyContract poolIndex:', poolIndex.toString());
const liquid = await ProxyContract.LIQUID_CROWDLOAN();
console.log('ProxyContract LIQUID_CROWDLOAN:', liquid);
for (let i = 0; i < poolIndex; i++) {
const shareType = await ProxyContract.shareTypes(i);
const convertInfo = await ProxyContract.convertInfos(i);
const rewardTypes = await ProxyContract.rewardTypes(i);
const rewardsDeductionRates = await ProxyContract.rewardsDeductionRates(i);
const totalShares = await ProxyContract.totalShares(i);
console.log("=============================================================");
console.log(`Pool#${i}`);
console.log('shareTypes: ', shareType);
console.log('totalShares: ', totalShares.toString());
console.log('convert token: ', convertInfo.convertedShareType);
console.log('convert exchange rate: ', convertInfo.convertedExchangeRate);
console.log('rewardTypes: ', rewardTypes);
console.log('rewardsDeductionRates: ', rewardsDeductionRates.toString());
}
} catch (error) {
console.error('获取代币信息时出错:', error);
}
})()