Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix liquidations fork test fail #1646

Merged
merged 3 commits into from
Jan 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions test/integration/behaviors/liquidations.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ function itCanLiquidate({ ctx }) {
});

describe('getting liquidated', () => {
let beforeDebt;
let beforeBalance;
let beforeDebt, beforeDebttedSnx;
let beforeBalance, beforeCredittedSnx;

before('otherUser calls liquidateDelinquentAccount', async () => {
beforeDebt = (
await Synthetix.debtBalanceOf(someUser.address, toBytes32('sUSD'))
).toString();
beforeDebttedSnx = await Synthetix.balanceOf(someUser.address);
beforeCredittedSnx = await Synthetix.balanceOf(otherUser.address);
beforeBalance = await SynthsUSD.balanceOf(otherUser.address);

await Synthetix.connect(otherUser).liquidateDelinquentAccount(
Expand All @@ -99,11 +101,6 @@ function itCanLiquidate({ ctx }) {
);
});

it('is liquidated', async () => {
// = sUSD liquidated / SNX Price * 1.1
assert.bnLt(await Synthetix.balanceOf(someUser.address), '100000000000000000000');
});

it('deducts sUSD debt from the liquidated', async () => {
assert.bnLt(
await Synthetix.debtBalanceOf(someUser.address, toBytes32('sUSD')),
Expand All @@ -114,6 +111,16 @@ function itCanLiquidate({ ctx }) {
it('burns sUSD from otherUser', async () => {
assert.bnLt(await SynthsUSD.balanceOf(otherUser.address), beforeBalance);
});

it('transfers SNX from otherUser', async () => {
const amountSent = beforeDebttedSnx.sub(await Synthetix.balanceOf(someUser.address));

assert.bnNotEqual(amountSent, '0');
assert.bnEqual(
await Synthetix.balanceOf(otherUser.address),
beforeCredittedSnx.add(amountSent)
);
});
});
});
});
Expand Down