-
Notifications
You must be signed in to change notification settings - Fork 4
/
tdt_status.js
31 lines (24 loc) · 943 Bytes
/
tdt_status.js
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
const ethers = require('ethers');
const BondedECDSAKeep = require("@keep-network/keep-ecdsa/artifacts/BondedECDSAKeep.json")
const Deposit = require("@keep-network/tbtc/artifacts/Deposit.json");
const states = require('./states')
if (process.argv.length < 3 || !process.argv[2]) {
console.error('node tdt_status.js [tdt]');
process.exit(1);
}
async function main() {
try {
const ip = new ethers.providers.InfuraProvider('homestead', process.env.INFURA_API);
const d = new ethers.Contract(process.argv[2], Deposit.abi, ip);
const k = new ethers.Contract(await d.keepAddress(), BondedECDSAKeep.abi, ip);
const r = await d.collateralizationPercentage()
const depositState = states[await d.currentState()];
console.log(`TDT ${dAddr} (${depositState}) of ${k.address} has ratio ${r}`)
} catch(err) {
console.error(`Could not get ratios: ${err.message}`)
process.exit(1)
}
}
main().catch(err => {
console.error(err);
})