From a2825b3c1f594641f40bc3c6cb2a610349423bfa Mon Sep 17 00:00:00 2001 From: RickGriff Date: Tue, 30 Jan 2024 15:36:11 +0700 Subject: [PATCH] Fix GasCompensationTest --- contracts/test/GasCompensationTest.js | 303 +++++++++++++------------- 1 file changed, 148 insertions(+), 155 deletions(-) diff --git a/contracts/test/GasCompensationTest.js b/contracts/test/GasCompensationTest.js index d3a0ac0e..523f5bcf 100644 --- a/contracts/test/GasCompensationTest.js +++ b/contracts/test/GasCompensationTest.js @@ -49,8 +49,8 @@ contract("Gas compensation tests", async (accounts) => { let troveManagerTester; let borrowerOperationsTester; - const getOpenTroveLUSDAmount = async (totalDebt) => - th.getOpenTroveLUSDAmount(contracts, totalDebt); + const getOpenTroveBoldAmount = async (totalDebt) => + th.getOpenTroveBoldAmount(contracts, totalDebt); const openTrove = async (params) => th.openTrove(contracts, params); const logICRs = (ICRList) => { @@ -75,11 +75,6 @@ contract("Gas compensation tests", async (accounts) => { contracts.stabilityPool.address, contracts.borrowerOperations.address ); - const LQTYContracts = await deploymentHelper.deployLQTYContracts( - bountyAddress, - lpRewardsAddress, - multisig - ); priceFeed = contracts.priceFeedTestnet; boldToken = contracts.boldToken; @@ -90,8 +85,7 @@ contract("Gas compensation tests", async (accounts) => { defaultPool = contracts.defaultPool; borrowerOperations = contracts.borrowerOperations; - await deploymentHelper.connectCoreContracts(contracts, LQTYContracts); - await deploymentHelper.connectLQTYContractsToCore(LQTYContracts, contracts); + await deploymentHelper.connectCoreContracts(contracts); }); // --- Raw gas compensation calculations --- @@ -252,9 +246,9 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 200 coll = 9.999 ETH - debt = 10 LUSD + debt = 10 Bold 0.5% of coll = 0.04995 ETH. USD value: $9.99 - -> Expect composite debt = 10 + 200 = 2100 LUSD*/ + -> Expect composite debt = 10 + 200 = 2100 Bold*/ const compositeDebt_1 = await troveManagerTester.getCompositeDebt( dec(10, 18) ); @@ -262,17 +256,17 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 200 coll = 0.055 ETH - debt = 0 LUSD + debt = 0 Bold 0.5% of coll = 0.000275 ETH. USD value: $0.055 - -> Expect composite debt = 0 + 200 = 200 LUSD*/ + -> Expect composite debt = 0 + 200 = 200 Bold*/ const compositeDebt_2 = await troveManagerTester.getCompositeDebt(0); assert.equal(compositeDebt_2, dec(200, 18)); // /* ETH:USD price = 200 // coll = 6.09232408808723580 ETH - // debt = 200 LUSD + // debt = 200 Bold // 0.5% of coll = 0.004995 ETH. USD value: $6.09 - // -> Expect composite debt = 200 + 200 = 400 LUSD */ + // -> Expect composite debt = 200 + 200 = 400 Bold */ const compositeDebt_3 = await troveManagerTester.getCompositeDebt( dec(200, 18) ); @@ -287,9 +281,9 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 200 coll = 10 ETH - debt = 123.45 LUSD + debt = 123.45 Bold 0.5% of coll = 0.5 ETH. USD value: $10 - -> Expect composite debt = (123.45 + 200) = 323.45 LUSD */ + -> Expect composite debt = (123.45 + 200) = 323.45 Bold */ const compositeDebt = await troveManagerTester.getCompositeDebt( "123450000000000000000" ); @@ -306,8 +300,8 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 200 $/E coll = 100 ETH - debt = 2000 LUSD - -> Expect composite debt = (2000 + 200) = 2200 LUSD */ + debt = 2000 Bold + -> Expect composite debt = (2000 + 200) = 2200 Bold */ const compositeDebt_1 = ( await troveManagerTester.getCompositeDebt(dec(2000, 18)) ).toString(); @@ -316,8 +310,8 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 200 $/E coll = 10.001 ETH - debt = 200 LUSD - -> Expect composite debt = (200 + 200) = 400 LUSD */ + debt = 200 Bold + -> Expect composite debt = (200 + 200) = 400 Bold */ const compositeDebt_2 = ( await troveManagerTester.getCompositeDebt(dec(200, 18)) ).toString(); @@ -326,8 +320,8 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 200 $/E coll = 37.5 ETH - debt = 500 LUSD - -> Expect composite debt = (500 + 200) = 700 LUSD */ + debt = 500 Bold + -> Expect composite debt = (500 + 200) = 700 Bold */ const compositeDebt_3 = ( await troveManagerTester.getCompositeDebt(dec(500, 18)) ).toString(); @@ -336,8 +330,8 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 45323.54542 $/E coll = 94758.230582309850 ETH - debt = 1 billion LUSD - -> Expect composite debt = (1000000000 + 200) = 1000000200 LUSD */ + debt = 1 billion Bold + -> Expect composite debt = (1000000000 + 200) = 1000000200 Bold */ await priceFeed.setPrice("45323545420000000000000"); const price_2 = await priceFeed.getPrice(); const compositeDebt_4 = ( @@ -351,8 +345,8 @@ contract("Gas compensation tests", async (accounts) => { /* ETH:USD price = 1000000 $/E (1 million) coll = 300000000 ETH (300 million) - debt = 54321.123456789 LUSD - -> Expect composite debt = (54321.123456789 + 200) = 54521.123456789 LUSD */ + debt = 54321.123456789 Bold + -> Expect composite debt = (54321.123456789 + 200) = 54521.123456789 Bold */ await priceFeed.setPrice(dec(1, 24)); const price_3 = await priceFeed.getPrice(); const compositeDebt_5 = ( @@ -366,7 +360,7 @@ contract("Gas compensation tests", async (accounts) => { const price = await priceFeed.getPrice(); await openTrove({ ICR: toBN(dec(200, 18)), extraParams: { from: whale } }); - // A opens with 1 ETH, 110 LUSD + // A opens with 1 ETH, 110 Bold await openTrove({ ICR: toBN("1818181818181818181"), extraParams: { from: alice }, @@ -377,23 +371,23 @@ contract("Gas compensation tests", async (accounts) => { // Expect aliceICR = (1 * 200) / (110) = 181.81% assert.isAtMost(th.getDifference(alice_ICR, "1818181818181818181"), 1000); - // B opens with 0.5 ETH, 50 LUSD + // B opens with 0.5 ETH, 50 Bold await openTrove({ ICR: toBN(dec(2, 18)), extraParams: { from: bob } }); const bob_ICR = (await troveManager.getCurrentICR(bob, price)).toString(); // Expect Bob's ICR = (0.5 * 200) / 50 = 200% assert.isAtMost(th.getDifference(bob_ICR, dec(2, 18)), 1000); - // F opens with 1 ETH, 100 LUSD + // F opens with 1 ETH, 100 Bold await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(100, 18), + extraBoldAmount: dec(100, 18), extraParams: { from: flyn }, }); const flyn_ICR = (await troveManager.getCurrentICR(flyn, price)).toString(); // Expect Flyn's ICR = (1 * 200) / 100 = 200% assert.isAtMost(th.getDifference(flyn_ICR, dec(2, 18)), 1000); - // C opens with 2.5 ETH, 160 LUSD + // C opens with 2.5 ETH, 160 Bold await openTrove({ ICR: toBN(dec(3125, 15)), extraParams: { from: carol } }); const carol_ICR = ( await troveManager.getCurrentICR(carol, price) @@ -401,7 +395,7 @@ contract("Gas compensation tests", async (accounts) => { // Expect Carol's ICR = (2.5 * 200) / (160) = 312.50% assert.isAtMost(th.getDifference(carol_ICR, "3125000000000000000"), 1000); - // D opens with 1 ETH, 0 LUSD + // D opens with 1 ETH, 0 Bold await openTrove({ ICR: toBN(dec(4, 18)), extraParams: { from: dennis } }); const dennis_ICR = ( await troveManager.getCurrentICR(dennis, price) @@ -409,7 +403,7 @@ contract("Gas compensation tests", async (accounts) => { // Expect Dennis's ICR = (1 * 200) / (50) = 400.00% assert.isAtMost(th.getDifference(dennis_ICR, dec(4, 18)), 1000); - // E opens with 4405.45 ETH, 32598.35 LUSD + // E opens with 4405.45 ETH, 32598.35 Bold await openTrove({ ICR: toBN("27028668628933700000"), extraParams: { from: erin }, @@ -418,7 +412,7 @@ contract("Gas compensation tests", async (accounts) => { // Expect Erin's ICR = (4405.45 * 200) / (32598.35) = 2702.87% assert.isAtMost(th.getDifference(erin_ICR, "27028668628933700000"), 100000); - // H opens with 1 ETH, 180 LUSD + // H opens with 1 ETH, 180 Bold await openTrove({ ICR: toBN("1111111111111111111"), extraParams: { from: harriet }, @@ -438,42 +432,41 @@ contract("Gas compensation tests", async (accounts) => { // A-E open troves const { totalDebt: A_totalDebt } = await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(100, 18), + extraBoldAmount: dec(100, 18), extraParams: { from: alice }, }); const { totalDebt: B_totalDebt } = await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(200, 18), + extraBoldAmount: dec(200, 18), extraParams: { from: bob }, }); const { totalDebt: C_totalDebt } = await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(300, 18), + extraBoldAmount: dec(300, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: A_totalDebt, + extraBoldAmount: A_totalDebt, extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: B_totalDebt.add(C_totalDebt), + extraBoldAmount: B_totalDebt.add(C_totalDebt), extraParams: { from: erin }, }); - // D, E each provide LUSD to SP - await stabilityPool.provideToSP(A_totalDebt, ZERO_ADDRESS, { + // D, E each provide Bold to SP + await stabilityPool.provideToSP(A_totalDebt, { from: dennis, gasPrice: GAS_PRICE, }); await stabilityPool.provideToSP( B_totalDebt.add(C_totalDebt), - ZERO_ADDRESS, { from: erin, gasPrice: GAS_PRICE } ); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); // --- Price drops to 9.99 --- await priceFeed.setPrice("9990000000000000000"); @@ -510,9 +503,9 @@ contract("Gas compensation tests", async (accounts) => { const _0pt5percent_aliceColl = aliceColl.div(web3.utils.toBN("200")); assert.equal(compensationReceived_A, _0pt5percent_aliceColl); - // Check SP LUSD has decreased due to the liquidation - const LUSDinSP_A = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_A.lte(LUSDinSP_0)); + // Check SP Bold has decreased due to the liquidation + const BoldinSP_A = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_A.lte(BoldinSP_0)); // Check ETH in SP has received the liquidation const ETHinSP_A = await stabilityPool.getETH(); @@ -552,9 +545,9 @@ contract("Gas compensation tests", async (accounts) => { const _0pt5percent_bobColl = bobColl.div(web3.utils.toBN("200")); assert.equal(compensationReceived_B, _0pt5percent_bobColl); // 0.5% of 2 ETH - // Check SP LUSD has decreased due to the liquidation of B - const LUSDinSP_B = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_B.lt(LUSDinSP_A)); + // Check SP Bold has decreased due to the liquidation of B + const BoldinSP_B = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_B.lt(BoldinSP_A)); // Check ETH in SP has received the liquidation const ETHinSP_B = await stabilityPool.getETH(); @@ -601,9 +594,9 @@ contract("Gas compensation tests", async (accounts) => { const _0pt5percent_carolColl = carolColl.div(web3.utils.toBN("200")); assert.equal(compensationReceived_C, _0pt5percent_carolColl); - // Check SP LUSD has decreased due to the liquidation of C - const LUSDinSP_C = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_C.lt(LUSDinSP_B)); + // Check SP Bold has decreased due to the liquidation of C + const BoldinSP_C = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_C.lt(BoldinSP_B)); // Check ETH in SP has not changed due to the lquidation of C const ETHinSP_C = await stabilityPool.getETH(); @@ -625,41 +618,41 @@ contract("Gas compensation tests", async (accounts) => { // A-E open troves await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(200, 18), + extraBoldAmount: dec(200, 18), extraParams: { from: alice }, }); await openTrove({ ICR: toBN(dec(120, 16)), - extraLUSDAmount: dec(5000, 18), + extraBoldAmount: dec(5000, 18), extraParams: { from: bob }, }); await openTrove({ ICR: toBN(dec(60, 18)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(80, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(80, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: erin }, }); - // D, E each provide 10000 LUSD to SP - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { + // D, E each provide 10000 Bold to SP + await stabilityPool.provideToSP(dec(1, 23), { from: dennis, gasPrice: GAS_PRICE, }); - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { + await stabilityPool.provideToSP(dec(1, 23), { from: erin, gasPrice: GAS_PRICE, }); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); const ETHinSP_0 = await stabilityPool.getETH(); // --- Price drops to 199.999 --- @@ -704,9 +697,9 @@ contract("Gas compensation tests", async (accounts) => { const _0pt5percent_aliceColl = aliceColl.div(web3.utils.toBN("200")); assert.equal(compensationReceived_A, _0pt5percent_aliceColl); - // Check SP LUSD has decreased due to the liquidation of A - const LUSDinSP_A = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_A.lt(LUSDinSP_0)); + // Check SP Bold has decreased due to the liquidation of A + const BoldinSP_A = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_A.lt(BoldinSP_0)); // Check ETH in SP has increased by the remainder of B's coll const collRemainder_A = aliceColl.sub(_0pt5percent_aliceColl); @@ -758,9 +751,9 @@ contract("Gas compensation tests", async (accounts) => { .toString(); assert.equal(compensationReceived_B, _0pt5percent_bobColl); - // Check SP LUSD has decreased due to the liquidation of B - const LUSDinSP_B = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_B.lt(LUSDinSP_A)); + // Check SP Bold has decreased due to the liquidation of B + const BoldinSP_B = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_B.lt(BoldinSP_A)); // Check ETH in SP has increased by the remainder of B's coll const collRemainder_B = bobColl.sub(_0pt5percent_bobColl); @@ -779,41 +772,41 @@ contract("Gas compensation tests", async (accounts) => { // A-E open troves await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(2000, 18), + extraBoldAmount: dec(2000, 18), extraParams: { from: alice }, }); await openTrove({ ICR: toBN(dec(1875, 15)), - extraLUSDAmount: dec(8000, 18), + extraBoldAmount: dec(8000, 18), extraParams: { from: bob }, }); await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(4, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(4, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: erin }, }); - // D, E each provide 10000 LUSD to SP - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { + // D, E each provide 10000 Bold to SP + await stabilityPool.provideToSP(dec(1, 23), { from: dennis, gasPrice: GAS_PRICE, }); - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { + await stabilityPool.provideToSP(dec(1, 23), { from: erin, gasPrice: GAS_PRICE, }); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); const ETHinSP_0 = await stabilityPool.getETH(); await priceFeed.setPrice(dec(200, 18)); @@ -857,9 +850,9 @@ contract("Gas compensation tests", async (accounts) => { .toString(); assert.equal(compensationReceived_A, _0pt5percent_aliceColl); - // Check SP LUSD has decreased due to the liquidation of A - const LUSDinSP_A = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_A.lt(LUSDinSP_0)); + // Check SP Bold has decreased due to the liquidation of A + const BoldinSP_A = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_A.lt(BoldinSP_0)); // Check ETH in SP has increased by the remainder of A's coll const collRemainder_A = aliceColl.sub(_0pt5percent_aliceColl); @@ -907,9 +900,9 @@ contract("Gas compensation tests", async (accounts) => { .toString(); assert.equal(compensationReceived_B, _0pt5percent_bobColl); - // Check SP LUSD has decreased due to the liquidation of B - const LUSDinSP_B = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_B.lt(LUSDinSP_A)); + // Check SP Bold has decreased due to the liquidation of B + const BoldinSP_B = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_B.lt(BoldinSP_A)); // Check ETH in SP has increased by the remainder of B's coll const collRemainder_B = bobColl.sub(_0pt5percent_bobColl); @@ -928,37 +921,37 @@ contract("Gas compensation tests", async (accounts) => { // A-E open troves const { totalDebt: A_totalDebt } = await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(100, 18), + extraBoldAmount: dec(100, 18), extraParams: { from: alice }, }); const { totalDebt: B_totalDebt } = await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(200, 18), + extraBoldAmount: dec(200, 18), extraParams: { from: bob }, }); await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(300, 18), + extraBoldAmount: dec(300, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: A_totalDebt, + extraBoldAmount: A_totalDebt, extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: B_totalDebt, + extraBoldAmount: B_totalDebt, extraParams: { from: erin }, }); - // D, E each provide LUSD to SP - await stabilityPool.provideToSP(A_totalDebt, ZERO_ADDRESS, { + // D, E each provide Bold to SP + await stabilityPool.provideToSP(A_totalDebt, { from: dennis, }); - await stabilityPool.provideToSP(B_totalDebt, ZERO_ADDRESS, { from: erin }); + await stabilityPool.provideToSP(B_totalDebt, { from: erin }); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); // th.logBN('TCR', await troveManager.getTCR(await priceFeed.getPrice())) // --- Price drops to 9.99 --- @@ -1043,35 +1036,35 @@ contract("Gas compensation tests", async (accounts) => { // A-E open troves await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(200, 18), + extraBoldAmount: dec(200, 18), extraParams: { from: alice }, }); await openTrove({ ICR: toBN(dec(120, 16)), - extraLUSDAmount: dec(5000, 18), + extraBoldAmount: dec(5000, 18), extraParams: { from: bob }, }); await openTrove({ ICR: toBN(dec(60, 18)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(80, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(80, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: erin }, }); - // D, E each provide 10000 LUSD to SP - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: dennis }); - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: erin }); + // D, E each provide 10000 Bold to SP + await stabilityPool.provideToSP(dec(1, 23), { from: dennis }); + await stabilityPool.provideToSP(dec(1, 23), { from: erin }); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); const ETHinSP_0 = await stabilityPool.getETH(); // --- Price drops to 199.999 --- @@ -1180,35 +1173,35 @@ contract("Gas compensation tests", async (accounts) => { // A-E open troves await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(2000, 18), + extraBoldAmount: dec(2000, 18), extraParams: { from: alice }, }); await openTrove({ ICR: toBN(dec(1875, 15)), - extraLUSDAmount: dec(8000, 18), + extraBoldAmount: dec(8000, 18), extraParams: { from: bob }, }); await openTrove({ ICR: toBN(dec(2, 18)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(4, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(4, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: erin }, }); - // D, E each provide 10000 LUSD to SP - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: dennis }); - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: erin }); + // D, E each provide 10000 Bold to SP + await stabilityPool.provideToSP(dec(1, 23), { from: dennis }); + await stabilityPool.provideToSP(dec(1, 23), { from: erin }); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); const ETHinSP_0 = await stabilityPool.getETH(); await priceFeed.setPrice(dec(200, 18)); @@ -1298,40 +1291,40 @@ contract("Gas compensation tests", async (accounts) => { // A-F open troves await openTrove({ ICR: toBN(dec(118, 16)), - extraLUSDAmount: dec(2000, 18), + extraBoldAmount: dec(2000, 18), extraParams: { from: alice }, }); await openTrove({ ICR: toBN(dec(526, 16)), - extraLUSDAmount: dec(8000, 18), + extraBoldAmount: dec(8000, 18), extraParams: { from: bob }, }); await openTrove({ ICR: toBN(dec(488, 16)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(545, 16)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(10, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: erin }, }); await openTrove({ ICR: toBN(dec(10, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: flyn }, }); - // D, E each provide 10000 LUSD to SP - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: erin }); - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: flyn }); + // D, E each provide 10000 Bold to SP + await stabilityPool.provideToSP(dec(1, 23), { from: erin }); + await stabilityPool.provideToSP(dec(1, 23), { from: flyn }); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); // price drops to 200 await priceFeed.setPrice(dec(200, 18)); @@ -1401,9 +1394,9 @@ contract("Gas compensation tests", async (accounts) => { await web3.eth.getBalance(liquidator) ); - // Check LUSD in SP has decreased - const LUSDinSP_1 = await stabilityPool.getTotalLUSDDeposits(); - assert.isTrue(LUSDinSP_1.lt(LUSDinSP_0)); + // Check Bold in SP has decreased + const BoldinSP_1 = await stabilityPool.getTotalBoldDeposits(); + assert.isTrue(BoldinSP_1.lt(BoldinSP_0)); // Check liquidator's balance has increased by the expected compensation amount const compensationReceived = liquidatorBalance_after @@ -1426,26 +1419,26 @@ contract("Gas compensation tests", async (accounts) => { // A-D open troves await openTrove({ ICR: toBN(dec(118, 16)), - extraLUSDAmount: dec(2000, 18), + extraBoldAmount: dec(2000, 18), extraParams: { from: alice }, }); await openTrove({ ICR: toBN(dec(526, 16)), - extraLUSDAmount: dec(8000, 18), + extraBoldAmount: dec(8000, 18), extraParams: { from: bob }, }); await openTrove({ ICR: toBN(dec(488, 16)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); await openTrove({ ICR: toBN(dec(545, 16)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); - const LUSDinDefaultPool_0 = await defaultPool.getLUSDDebt(); + const BoldinDefaultPool_0 = await defaultPool.getBoldDebt(); // price drops to 200 await priceFeed.setPrice(dec(200, 18)); @@ -1510,9 +1503,9 @@ contract("Gas compensation tests", async (accounts) => { await web3.eth.getBalance(liquidator) ); - // Check LUSD in DefaultPool has decreased - const LUSDinDefaultPool_1 = await defaultPool.getLUSDDebt(); - assert.isTrue(LUSDinDefaultPool_1.gt(LUSDinDefaultPool_0)); + // Check Bold in DefaultPool has decreased + const BoldinDefaultPool_1 = await defaultPool.getBoldDebt(); + assert.isTrue(BoldinDefaultPool_1.gt(BoldinDefaultPool_0)); // Check liquidator's balance has increased by the expected compensation amount const compensationReceived = liquidatorBalance_after @@ -1542,40 +1535,40 @@ contract("Gas compensation tests", async (accounts) => { // A-F open troves const { totalDebt: A_totalDebt } = await openTrove({ ICR: toBN(dec(118, 16)), - extraLUSDAmount: dec(2000, 18), + extraBoldAmount: dec(2000, 18), extraParams: { from: alice }, }); const { totalDebt: B_totalDebt } = await openTrove({ ICR: toBN(dec(526, 16)), - extraLUSDAmount: dec(8000, 18), + extraBoldAmount: dec(8000, 18), extraParams: { from: bob }, }); const { totalDebt: C_totalDebt } = await openTrove({ ICR: toBN(dec(488, 16)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); const { totalDebt: D_totalDebt } = await openTrove({ ICR: toBN(dec(545, 16)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(10, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: erin }, }); await openTrove({ ICR: toBN(dec(10, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: flyn }, }); - // D, E each provide 10000 LUSD to SP - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: erin }); - await stabilityPool.provideToSP(dec(1, 23), ZERO_ADDRESS, { from: flyn }); + // D, E each provide 10000 Bold to SP + await stabilityPool.provideToSP(dec(1, 23), { from: erin }); + await stabilityPool.provideToSP(dec(1, 23), { from: flyn }); - const LUSDinSP_0 = await stabilityPool.getTotalLUSDDeposits(); + const BoldinSP_0 = await stabilityPool.getTotalBoldDeposits(); // price drops to 200 await priceFeed.setPrice(dec(200, 18)); @@ -1630,7 +1623,7 @@ contract("Gas compensation tests", async (accounts) => { .add(carolColl.sub(_0pt5percent_carolColl)) .add(dennisColl.sub(_0pt5percent_dennisColl)); - // Expect liquidatedDebt = 51 + 190 + 1025 + 13510 = 14646 LUSD + // Expect liquidatedDebt = 51 + 190 + 1025 + 13510 = 14646 Bold const expectedLiquidatedDebt = A_totalDebt.add(B_totalDebt) .add(C_totalDebt) .add(D_totalDebt); @@ -1658,36 +1651,36 @@ contract("Gas compensation tests", async (accounts) => { // A-F open troves const { totalDebt: A_totalDebt } = await openTrove({ ICR: toBN(dec(118, 16)), - extraLUSDAmount: dec(2000, 18), + extraBoldAmount: dec(2000, 18), extraParams: { from: alice }, }); const { totalDebt: B_totalDebt } = await openTrove({ ICR: toBN(dec(526, 16)), - extraLUSDAmount: dec(8000, 18), + extraBoldAmount: dec(8000, 18), extraParams: { from: bob }, }); const { totalDebt: C_totalDebt } = await openTrove({ ICR: toBN(dec(488, 16)), - extraLUSDAmount: dec(600, 18), + extraBoldAmount: dec(600, 18), extraParams: { from: carol }, }); const { totalDebt: D_totalDebt } = await openTrove({ ICR: toBN(dec(545, 16)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: dennis }, }); await openTrove({ ICR: toBN(dec(10, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: erin }, }); await openTrove({ ICR: toBN(dec(10, 18)), - extraLUSDAmount: dec(1, 23), + extraBoldAmount: dec(1, 23), extraParams: { from: flyn }, }); - const LUSDinDefaultPool_0 = await defaultPool.getLUSDDebt(); + const BoldinDefaultPool_0 = await defaultPool.getBoldDebt(); // price drops to 200 await priceFeed.setPrice(dec(200, 18)); @@ -1733,7 +1726,7 @@ contract("Gas compensation tests", async (accounts) => { .add(carolColl.sub(_0pt5percent_carolColl)) .add(dennisColl.sub(_0pt5percent_dennisColl)); - // Expect liquidatedDebt = 51 + 190 + 1025 + 13510 = 14646 LUSD + // Expect liquidatedDebt = 51 + 190 + 1025 + 13510 = 14646 Bold const expectedLiquidatedDebt = A_totalDebt.add(B_totalDebt) .add(C_totalDebt) .add(D_totalDebt); @@ -1759,11 +1752,11 @@ contract("Gas compensation tests", async (accounts) => { const _10_accounts = accounts.slice(1, 11); let debt = 50; - // create 10 troves, constant coll, descending debt 100 to 90 LUSD + // create 10 troves, constant coll, descending debt 100 to 90 Bold for (const account of _10_accounts) { const debtString = debt.toString().concat("000000000000000000"); await openTrove({ - extraLUSDAmount: debtString, + extraBoldAmount: debtString, extraParams: { from: account, value: dec(30, "ether") }, }); @@ -1820,11 +1813,11 @@ contract("Gas compensation tests", async (accounts) => { const _20_accounts = accounts.slice(1, 21); let coll = 50; - // create 20 troves, increasing collateral, constant debt = 100LUSD + // create 20 troves, increasing collateral, constant debt = 100Bold for (const account of _20_accounts) { const collString = coll.toString().concat("000000000000000000"); await openTrove({ - extraLUSDAmount: dec(100, 18), + extraBoldAmount: dec(100, 18), extraParams: { from: account, value: collString }, }); @@ -1876,7 +1869,7 @@ contract("Gas compensation tests", async (accounts) => { const account = accountsList[accountIdx]; const collString = coll.toString().concat("000000000000000000"); await openTrove({ - extraLUSDAmount: dec(100, 18), + extraBoldAmount: dec(100, 18), extraParams: { from: account, value: collString }, });