Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion packages/contracts/contracts/BorrowerOperations.sol
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,7 @@ contract BorrowerOperations is
require(
_maxFeePercentage >= liquityBaseParams.BORROWING_FEE_FLOOR() &&
_maxFeePercentage <= DECIMAL_PRECISION,
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ contract TroveManagerBase is LiquityBase, TroveManagerStorage {
require(
_maxFeePercentage >= liquityBaseParams.REDEMPTION_FEE_FLOOR() &&
_maxFeePercentage <= DECIMAL_PRECISION,
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
}
}
4 changes: 2 additions & 2 deletions packages/contracts/contracts/LiquityBaseParams.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ contract LiquityBaseParams is ILiquityBaseParams, Ownable, Initializable, BaseMa
MCR = 1100000000000000000; // 110%
CCR = 1500000000000000000; // 150%
PERCENT_DIVISOR = 200; // dividing by 200 yields 0.5%
BORROWING_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 5; // 0.5%
REDEMPTION_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 5; // 0.5%
BORROWING_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 25; // 2.5%
REDEMPTION_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 25; // 2.5%
MAX_BORROWING_FEE = (DECIMAL_PRECISION / 100) * 5; // 5%
}

Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/docs/BorrowerOperations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ function _requireValidMaxFeePercentage(uint256 _maxFeePercentage, bool _isRecove
require(
_maxFeePercentage >= liquityBaseParams.BORROWING_FEE_FLOOR() &&
_maxFeePercentage <= DECIMAL_PRECISION,
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/docs/LiquityBaseParams.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function initialize() public initializer onlyOwner {
MCR = 1100000000000000000; // 110%
CCR = 1500000000000000000; // 150%
PERCENT_DIVISOR = 200; // dividing by 200 yields 0.5%
BORROWING_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 5; // 0.5%
REDEMPTION_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 5; // 0.5%
BORROWING_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 25; // 2.5%
REDEMPTION_FEE_FLOOR = (DECIMAL_PRECISION / 1000) * 25; // 2.5%
MAX_BORROWING_FEE = (DECIMAL_PRECISION / 100) * 5; // 5%
}
```
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/docs/TroveManagerBase.md
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ tion _requireValidMaxFeePercentage(uint256 _maxFeePercentage) internal view {
require(
_maxFeePercentage >= liquityBaseParams.REDEMPTION_FEE_FLOOR() &&
_maxFeePercentage <= DECIMAL_PRECISION,
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ tion _requireValidMaxFeePercentage(uint256 _maxFeePercentage) internal view {
require(
_maxFeePercentage >= liquityBaseParams.REDEMPTION_FEE_FLOOR() &&
_maxFeePercentage <= DECIMAL_PRECISION,
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
}
}
Expand Down
50 changes: 25 additions & 25 deletions packages/contracts/test/BorrowerOperationsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,15 +932,15 @@ contract("BorrowerOperations", async accounts => {

await assertRevert(
borrowerOperations.withdrawZUSD(dec(2, 18), dec(1, 16), A, A, { from: A }),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.withdrawZUSD("1000000000000000001", dec(1, 16), A, A, { from: A }),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
});

it("withdrawZUSD(): reverts if max fee < 0.5% in Normal mode", async () => {
it("withdrawZUSD(): reverts if max fee < 2.5% in Normal mode", async () => {
await openTrove({
extraZUSDAmount: toBN(dec(10, 16)),
ICR: toBN(dec(2, 18)),
Expand All @@ -964,15 +964,15 @@ contract("BorrowerOperations", async accounts => {

await assertRevert(
borrowerOperations.withdrawZUSD(0, dec(1, 16), A, A, { from: A }),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.withdrawZUSD(1, dec(1, 16), A, A, { from: A }),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.withdrawZUSD("4999999999999999", dec(1, 16), A, A, { from: A }),
"Max fee percentage must be between 0.5% and 100%"
borrowerOperations.withdrawZUSD("24999999999999999", dec(1, 16), A, A, { from: A }),
"Max fee percentage must be between 2.5% and 100%"
);
});

Expand Down Expand Up @@ -1046,9 +1046,9 @@ contract("BorrowerOperations", async accounts => {

baseRate = await troveManager.baseRate(); // expect 5% base rate
assert.equal(baseRate, dec(5, 16));
// Attempt with maxFee 0.5%%
// Attempt with maxFee 2.5%%
await assertRevert(
borrowerOperations.withdrawZUSD(dec(5, 15), dec(1, 16), A, A, { from: D }),
borrowerOperations.withdrawZUSD(dec(25, 15), dec(1, 16), A, A, { from: D }),
"Fee exceeded provided maximum"
);
});
Expand Down Expand Up @@ -2140,7 +2140,7 @@ contract("BorrowerOperations", async accounts => {
);
});

it("adjustTrove(): reverts if max fee < 0.5% in Normal mode", async () => {
it("adjustTrove(): reverts if max fee < 2.5% in Normal mode", async () => {
await openTrove({
extraZUSDAmount: toBN(dec(10000, 18)),
ICR: toBN(dec(2, 18)),
Expand All @@ -2149,22 +2149,22 @@ contract("BorrowerOperations", async accounts => {

await assertRevert(
borrowerOperations.adjustTrove(0, 0, dec(1, 16), true, A, A, { from: A, value: dec(2, 16) }),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.adjustTrove(1, 0, dec(1, 16), true, A, A, { from: A, value: dec(2, 16) }),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.adjustTrove("4999999999999999", 0, dec(1, 18), true, A, A, {
borrowerOperations.adjustTrove("24999999999999999", 0, dec(1, 18), true, A, A, {
from: A,
value: dec(2, 16)
}),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
});

it("adjustTrove(): allows max fee < 0.5% in Recovery mode", async () => {
it("adjustTrove(): allows max fee < 2.5% in Recovery mode", async () => {
await openTrove({
ICR: toBN(dec(2, 18)),
extraParams: { from: whale, value: toBN(dec(100, 16)) }
Expand All @@ -2191,7 +2191,7 @@ contract("BorrowerOperations", async accounts => {
});
await priceFeed.setPrice(dec(1, 16));
assert.isTrue(await th.checkRecoveryMode(contracts));
await borrowerOperations.adjustTrove("4999999999999999", 0, dec(1, 9), true, A, A, {
await borrowerOperations.adjustTrove("24999999999999999", 0, dec(1, 9), true, A, A, {
from: A,
value: dec(3000000, 16)
});
Expand Down Expand Up @@ -5084,42 +5084,42 @@ contract("BorrowerOperations", async accounts => {
from: A,
value: dec(1000, "ether")
}),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.openTrove("1000000000000000001", dec(20000, 18), B, B, {
from: B,
value: dec(1000, "ether")
}),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
});

it("openTrove(): reverts if max fee < 0.5% in Normal mode", async () => {
it("openTrove(): reverts if max fee < 2.5% in Normal mode", async () => {
await assertRevert(
borrowerOperations.openTrove(0, dec(195000, 18), A, A, {
from: A,
value: dec(1200, "ether")
}),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.openTrove(1, dec(195000, 18), A, A, {
from: A,
value: dec(1000, "ether")
}),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
await assertRevert(
borrowerOperations.openTrove("4999999999999999", dec(195000, 18), B, B, {
borrowerOperations.openTrove("24999999999999999", dec(195000, 18), B, B, {
from: B,
value: dec(1200, "ether")
}),
"Max fee percentage must be between 0.5% and 100%"
"Max fee percentage must be between 2.5% and 100%"
);
});

it("openTrove(): allows max fee < 0.5% in Recovery Mode", async () => {
it("openTrove(): allows max fee < 2.5% in Recovery Mode", async () => {
await borrowerOperations.openTrove(th._100pct, dec(195000, 16), A, A, {
from: A,
value: dec(2000, 16)
Expand All @@ -5134,7 +5134,7 @@ contract("BorrowerOperations", async accounts => {
await borrowerOperations.openTrove(1, dec(19500, 16), C, C, { from: C, value: dec(3100, 16) });
await priceFeed.setPrice(dec(25, 18));
assert.isTrue(await th.checkRecoveryMode(contracts));
await borrowerOperations.openTrove("4999999999999999", dec(19500, 16), D, D, {
await borrowerOperations.openTrove("24999999999999999", dec(19500, 16), D, D, {
from: D,
value: dec(3100, 16)
});
Expand Down
Loading