Skip to content

Commit

Permalink
multi-collateral flag/liquidate fixed and tested
Browse files Browse the repository at this point in the history
  • Loading branch information
leomassazza committed Nov 2, 2023
1 parent 5298f61 commit 95a5b98
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { depositCollateral, openPosition } from '../helpers';
import assertBn from '@synthetixio/core-utils/utils/assertions/assert-bignumber';
import assertEvent from '@synthetixio/core-utils/utils/assertions/assert-event';

describe.only('Keeper Rewards - Caps', () => {
describe('Keeper Rewards - Caps', () => {
const KeeperCosts = {
settlementCost: 1111,
flagCost: 3333,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SynthMarkets } from '@synthetixio/spot-market/test/common';
import assertBn from '@synthetixio/core-utils/utils/assertions/assert-bignumber';
import assertEvent from '@synthetixio/core-utils/utils/assertions/assert-event';

describe.only('Keeper Rewards - Collaterals', () => {
describe('Keeper Rewards - Collaterals', () => {
const KeeperCosts = {
settlementCost: 1111,
flagCost: 3333,
Expand Down Expand Up @@ -106,19 +106,12 @@ describe.only('Keeper Rewards - Collaterals', () => {
});

[
// {
// name: 'uncapped just cost',
// withRatio: false,
// lowerCap: 1,
// higherCap: bn(10),
// expected: KeeperCosts.flagCost + KeeperCosts.liquidateCost,
// },
{
name: 'uncapped plus reward ratio',
withRatio: true,
lowerCap: 1,
higherCap: bn(10),
expected: bn(5).add(KeeperCosts.flagCost + KeeperCosts.liquidateCost),
expected: bn(5).add(KeeperCosts.flagCost * 3 + KeeperCosts.liquidateCost),
},
].forEach((test) => {
describe(`${test.name}`, () => {
Expand Down Expand Up @@ -161,24 +154,7 @@ describe.only('Keeper Rewards - Collaterals', () => {
});

before('add collateral', async () => {
const res = await depositCollateral(collateralsTestCase[0].collateralData);
// res.stats().forEach((stat) => {
// console.log('spotInitialBalance', stat.spotInitialBalance().toString());
// console.log('perpsInitialBalance', stat.perpsInitialBalance().toString());
// console.log('tradeFee', stat.tradeFee().toString());
// console.log('spotFinalBalance', stat.spotFinalBalance().toString());
// console.log('perpsFinalBalance', stat.perpsFinalBalance().toString());
// });
console.log('xxxxx', await systems().PerpsMarket.totalCollateralValue(2));
console.log('xxxxx snxUSD', await systems().PerpsMarket.getCollateralAmount(2, 0));
console.log(
'xxxxx snxBTC',
await systems().PerpsMarket.getCollateralAmount(2, btcSynth.marketId())
);
console.log(
'xxxxx snxETH',
await systems().PerpsMarket.getCollateralAmount(2, ethSynth.marketId())
);
await depositCollateral(collateralsTestCase[0].collateralData);
});

before('open position', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { calculateFillPrice } from '../helpers/fillPrice';
import { wei } from '@synthetixio/wei';
import { calcCurrentFundingVelocity } from '../helpers/funding-calcs';

describe.only('Keeper Rewards - Settlement', () => {
describe('Keeper Rewards - Settlement', () => {
const KeeperCosts = {
settlementCost: 1111,
flagCost: 3333,
Expand Down

0 comments on commit 95a5b98

Please sign in to comment.