Skip to content

Commit

Permalink
log liquidation info
Browse files Browse the repository at this point in the history
  • Loading branch information
ewansheldon committed Jun 24, 2024
1 parent 6e9a485 commit efed08c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/liquidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ const getVaultManager = async _ => {
const scheduleLiquidation = async _ => {
// checks for undercollateralised vaults and liquidates
schedule.scheduleJob('6,36 * * * *', async _ => {
console.log('running liquidations')
const start = Math.floor(new Date / 1000);
const network = getNetwork('arbitrum');
const index = await getContract(network.name, 'SmartVaultIndex');
const { manager, wallet } = await getVaultManager();
Expand All @@ -68,17 +70,22 @@ const scheduleLiquidation = async _ => {
const vault = await getContract(network.name, 'SmartVault', vaultAddress);
try {
if (await vault.connect(wallet).undercollateralised()) {
console.log(`liquidating ${tokenID}`)
const RewardGateway = await getContract(network.name, 'RewardGateway');
await RewardGateway.connect(wallet).liquidateVault(tokenID);
}
} catch (e) {
console.log('vault data error', tokenID);
}
}
const end = Math.floor(new Date / 1000);

console.log(`liquidations complete ${end - start}s`)
});

// posts liquidation info to discord
schedule.scheduleJob('55 9 * * *', async _ => {
console.log('logging liquidation info');
const { manager, wallet, provider } = await getVaultManager();
const EUROs = await getContract(network.name, 'EUROs');
liquidatorETHBalance = ethers.utils.formatEther(await provider.getBalance(wallet.address));
Expand Down

0 comments on commit efed08c

Please sign in to comment.