Skip to content

Commit aba0edb

Browse files
authored
Merge pull request #697 from bancorprotocol/release-0.7.13
Release 0.7.13
2 parents b48de36 + 95a9fdd commit aba0edb

File tree

10 files changed

+10819
-11902
lines changed

10 files changed

+10819
-11902
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
### 0.7.13
2+
LiquidityProtection
3+
* Removed protection logic
4+
* Removed the ability to migrate positions to v3
5+
* Added support for settings total positions value
6+
* Updated withdrawal logic
7+
* Updated system migration to v3 logic
8+
9+
110
### 0.7.12
211
VortexBurner
312
* BNT -> vBNT trades are routed through v3

contracts/helpers/TestBancorNetworkV3.sol

-16
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,6 @@ contract TestBancorNetworkV3 is BancorNetwork {
2727
_networkToken.transferFrom(msg.sender, _bancorVault, tokenAmount);
2828
}
2929

30-
function migrateLiquidity(
31-
IReserveToken reserveToken,
32-
address, /* provider */
33-
uint256, /* amount */
34-
uint256 availableAmount,
35-
uint256 /* originalAmount */
36-
) external payable {
37-
if (reserveToken.isNativeToken()) {
38-
assert(msg.value == availableAmount);
39-
reserveToken.safeTransfer(_bancorVault, availableAmount);
40-
} else {
41-
require(msg.value == 0);
42-
reserveToken.safeTransferFrom(msg.sender, _bancorVault, availableAmount);
43-
}
44-
}
45-
4630
function tradeBySourceAmount(
4731
IERC20 sourceToken,
4832
IERC20 targetToken,

contracts/helpers/TestLiquidityProtection.sol

+10-18
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
1212
uint256 private _poolTokenRateD;
1313

1414
constructor(
15-
IBancorNetworkV3 networkV3,
1615
address payable vaultV3,
1716
ILiquidityProtectionSettings settings,
1817
ILiquidityProtectionStore store,
@@ -24,7 +23,6 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
2423
)
2524
public
2625
LiquidityProtection(
27-
networkV3,
2826
vaultV3,
2927
settings,
3028
store,
@@ -63,17 +61,13 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
6361
return (impLossRate.n, impLossRate.d);
6462
}
6563

66-
function compensationAmountTest(
67-
uint256 amount,
64+
function deductILTest(
6865
uint256 total,
6966
uint256 lossN,
70-
uint256 lossD,
71-
uint256 levelN,
72-
uint256 levelD
67+
uint256 lossD
7368
) external pure returns (uint256) {
7469
Fraction memory loss = Fraction({ n: lossN, d: lossD });
75-
Fraction memory level = Fraction({ n: levelN, d: levelD });
76-
return _compensationAmount(amount, total, loss, level);
70+
return _deductIL(total, loss);
7771
}
7872

7973
function averageRateTest(IDSToken poolToken, IReserveToken reserveToken) external view returns (uint256, uint256) {
@@ -83,6 +77,8 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
8377
}
8478

8579
function removeLiquidityTargetAmountTest(
80+
IDSToken poolToken,
81+
IReserveToken reserveToken,
8682
uint256 poolTokenRateN,
8783
uint256 poolTokenRateD,
8884
uint256 poolAmount,
@@ -92,9 +88,7 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
9288
uint128 removeSpotRateN,
9389
uint128 removeSpotRateD,
9490
uint128 removeAverageRateN,
95-
uint128 removeAverageRateD,
96-
uint256 addTimestamp,
97-
uint256 removeTimestamp
91+
uint128 removeAverageRateD
9892
) external returns (uint256) {
9993
_poolTokenRateOverride = true;
10094
_poolTokenRateN = poolTokenRateN;
@@ -109,14 +103,12 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
109103
removeAverageRateD: removeAverageRateD
110104
});
111105

112-
uint256 targetAmount = _removeLiquidityTargetAmount(
113-
IDSToken(0),
114-
IReserveToken(0),
106+
(uint256 targetAmount,) = _removeLiquidityAmounts(
107+
poolToken,
108+
reserveToken,
115109
poolAmount,
116110
reserveAmount,
117-
packedRates,
118-
addTimestamp,
119-
removeTimestamp
111+
packedRates
120112
);
121113
_poolTokenRateOverride = false;
122114
return targetAmount;

0 commit comments

Comments
 (0)