Skip to content

Commit 08ec5b0

Browse files
authored
update tests; bump lm version to fix permission issue (#314)
* update tests; bump lm version to fix permission issue * Update omnibus-sepolia.toml
1 parent 77b7a1f commit 08ec5b0

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

e2e/tasks/getLpPosition.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,28 @@ async function getLpPosition({ accountId, poolId, symbol }) {
2626
config.tokenAddress
2727
);
2828
let positionCratio = 0;
29+
let vaultCratio = 0;
2930
try {
30-
let positionCratio = await CoreProxy.callStatic.getPositionCollateralRatio(
31+
positionCratio = await CoreProxy.callStatic.getPositionCollateralRatio(
32+
accountId,
33+
poolId,
34+
config.tokenAddress
35+
);
36+
vaultCratio = await CoreProxy.callStatic.getPositionCollateralRatio(
3137
accountId,
3238
poolId,
3339
config.tokenAddress
3440
);
3541
} catch (err) {
3642
log('could not compute cratio for account');
3743
}
38-
log({ accountId, poolId, symbol, positionCollateral, positionCratio, positionDebt });
44+
log({ accountId, poolId, symbol, positionCollateral, positionCratio, vaultCratio, positionDebt });
3945

4046
return {
4147
collateral: parseFloat(ethers.utils.formatUnits(positionCollateral)),
4248
debt: parseFloat(ethers.utils.formatUnits(positionDebt)),
4349
positionCratio: parseFloat(ethers.utils.formatUnits(positionCratio)),
50+
vaultCratio: parseFloat(ethers.utils.formatUnits(vaultCratio)),
4451
};
4552
}
4653

e2e/tests/omnibus-mainnet.toml/LegacyMarket.e2e.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const assert = require('assert');
22
const { getLpPosition } = require('../../tasks/getLpPosition');
33
const { getAccountCollateral } = require('../../tasks/getAccountCollateral');
4+
const { getCollateralConfig } = require('../../tasks/getCollateralConfig');
45
const { ethers } = require('ethers');
56
const { syncTime } = require('../../tasks/syncTime');
67
const { contractWrite } = require('../../tasks/contractWrite');
@@ -94,7 +95,8 @@ describe(require('path').basename(__filename, '.e2e.js'), function () {
9495
);
9596

9697
log('the account should have the same debt as before');
97-
const newDebt = (await getLpPosition({ accountId, poolId: 1, symbol: 'SNX' })).debt;
98+
const lpPosition = await getLpPosition({ accountId, poolId: 1, symbol: 'SNX' });
99+
const newDebt = lpPosition.debt;
98100
log({ newDebt });
99101
assert.deepEqual(newDebt, debt);
100102

@@ -104,6 +106,21 @@ describe(require('path').basename(__filename, '.e2e.js'), function () {
104106
assert.deepEqual(accountInfo.totalAssigned, accountInfo.totalDeposited);
105107
// here we just assert that we have more than enough deposited. calculating the actual amount expected would required reading into reward escrow and doing some complicated stuff to figure out already vested amounts and etc.
106108
assert(accountInfo.totalDeposited - accountInfo.totalLocked >= snxBalance);
109+
110+
log('the account should not be in liquidatable state');
111+
const liquidationRatio = parseFloat(
112+
ethers.utils.formatUnits((await getCollateralConfig('SNX')).liquidationRatioD18)
113+
);
114+
115+
log({
116+
liquidationRatio,
117+
accountRatio: lpPosition.positionCratio,
118+
vaultRatio: lpPosition.vaultCratio,
119+
});
120+
121+
// the account should still be healthy after migration (massive sanity check)
122+
assert(lpPosition.positionCratio >= liquidationRatio);
123+
assert(lpPosition.vaultCratio >= liquidationRatio);
107124
});
108125

109126
// note: this test effectively has to run after the test above

omnibus-mainnet.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ defaultValue = "synthetix-spot-market:3.3.15"
2929
defaultValue = "synthetix-perps-market:3.3.19"
3030

3131
[setting.legacy_market_package]
32-
defaultValue = "synthetix-legacy-market:3.3.5"
32+
defaultValue = "synthetix-legacy-market:3.3.6"
3333

3434
[setting.susde_package]
3535
defaultValue = 'susde-token'

omnibus-sepolia.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name = "synthetix-omnibus"
2-
version = "5"
2+
version = "6"
33
description = "Includes the full synthetix system with configurations applied"
44
include = [
55
"tomls/settings.toml",
@@ -31,7 +31,7 @@ defaultValue = "synthetix:3.3.18"
3131
defaultValue = "synthetix-spot-market:3.3.15"
3232

3333
[setting.legacy_market_package]
34-
defaultValue = "synthetix-legacy-market:3.3.5"
34+
defaultValue = "synthetix-legacy-market:3.3.6"
3535

3636
[setting.susde_package]
3737
defaultValue = "fake-susde-token"

0 commit comments

Comments
 (0)