Skip to content

Commit

Permalink
Merge pull request #697 from bancorprotocol/release-0.7.13
Browse files Browse the repository at this point in the history
Release 0.7.13
  • Loading branch information
yudilevi authored Nov 23, 2022
2 parents b48de36 + 95a9fdd commit aba0edb
Show file tree
Hide file tree
Showing 10 changed files with 10,819 additions and 11,902 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### 0.7.13
LiquidityProtection
* Removed protection logic
* Removed the ability to migrate positions to v3
* Added support for settings total positions value
* Updated withdrawal logic
* Updated system migration to v3 logic


### 0.7.12
VortexBurner
* BNT -> vBNT trades are routed through v3
Expand Down
16 changes: 0 additions & 16 deletions contracts/helpers/TestBancorNetworkV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,6 @@ contract TestBancorNetworkV3 is BancorNetwork {
_networkToken.transferFrom(msg.sender, _bancorVault, tokenAmount);
}

function migrateLiquidity(
IReserveToken reserveToken,
address, /* provider */
uint256, /* amount */
uint256 availableAmount,
uint256 /* originalAmount */
) external payable {
if (reserveToken.isNativeToken()) {
assert(msg.value == availableAmount);
reserveToken.safeTransfer(_bancorVault, availableAmount);
} else {
require(msg.value == 0);
reserveToken.safeTransferFrom(msg.sender, _bancorVault, availableAmount);
}
}

function tradeBySourceAmount(
IERC20 sourceToken,
IERC20 targetToken,
Expand Down
28 changes: 10 additions & 18 deletions contracts/helpers/TestLiquidityProtection.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
uint256 private _poolTokenRateD;

constructor(
IBancorNetworkV3 networkV3,
address payable vaultV3,
ILiquidityProtectionSettings settings,
ILiquidityProtectionStore store,
Expand All @@ -24,7 +23,6 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
)
public
LiquidityProtection(
networkV3,
vaultV3,
settings,
store,
Expand Down Expand Up @@ -63,17 +61,13 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
return (impLossRate.n, impLossRate.d);
}

function compensationAmountTest(
uint256 amount,
function deductILTest(
uint256 total,
uint256 lossN,
uint256 lossD,
uint256 levelN,
uint256 levelD
uint256 lossD
) external pure returns (uint256) {
Fraction memory loss = Fraction({ n: lossN, d: lossD });
Fraction memory level = Fraction({ n: levelN, d: levelD });
return _compensationAmount(amount, total, loss, level);
return _deductIL(total, loss);
}

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

function removeLiquidityTargetAmountTest(
IDSToken poolToken,
IReserveToken reserveToken,
uint256 poolTokenRateN,
uint256 poolTokenRateD,
uint256 poolAmount,
Expand All @@ -92,9 +88,7 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
uint128 removeSpotRateN,
uint128 removeSpotRateD,
uint128 removeAverageRateN,
uint128 removeAverageRateD,
uint256 addTimestamp,
uint256 removeTimestamp
uint128 removeAverageRateD
) external returns (uint256) {
_poolTokenRateOverride = true;
_poolTokenRateN = poolTokenRateN;
Expand All @@ -109,14 +103,12 @@ contract TestLiquidityProtection is LiquidityProtection, TestTime {
removeAverageRateD: removeAverageRateD
});

uint256 targetAmount = _removeLiquidityTargetAmount(
IDSToken(0),
IReserveToken(0),
(uint256 targetAmount,) = _removeLiquidityAmounts(
poolToken,
reserveToken,
poolAmount,
reserveAmount,
packedRates,
addTimestamp,
removeTimestamp
packedRates
);
_poolTokenRateOverride = false;
return targetAmount;
Expand Down
Loading

0 comments on commit aba0edb

Please sign in to comment.