Skip to content

Commit

Permalink
feat: added ramp because weights get disbalanced
Browse files Browse the repository at this point in the history
  • Loading branch information
0xethsign committed Jan 20, 2025
1 parent fefac5c commit 2674ea7
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Poolv2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1138,10 +1138,14 @@ contract PoolV2 is OwnableRoles, ReentrancyGuard, VM {
/// @param lpAmount_ lpAmount to be burnt to compensate for the removed token amount
/// @param amplification_ proposed new amplification
/// @param newWeights_ proposed new weights
function removeToken(uint256 tokenIndex_, uint256 lpAmount_, uint256 amplification_, uint256[] calldata newWeights_)
external
onlyOwner
{
/// @param duration_ duration of the ramp in seconds
function removeToken(
uint256 tokenIndex_,
uint256 lpAmount_,
uint256 amplification_,
uint256[] calldata newWeights_,
uint256 duration_
) external onlyOwner {
uint256 _numTokens = numTokens;

if (_numTokens <= 2) revert Pool__MustBeInitiatedWithMoreThanOneToken();
Expand All @@ -1151,6 +1155,9 @@ contract PoolV2 is OwnableRoles, ReentrancyGuard, VM {
if (tokenIndex_ >= numTokens) revert Pool__IndexOutOfBounds();
require(newWeights_.length == _numTokens - 1, "Length of newWeights_ array must be equal to numTokens - 1");

rampLastTime = block.timestamp;
rampStopTime = block.timestamp + duration_;

address removedAddress = tokens[tokenIndex_];
(,, uint256 _packedWeight) = _unpackVirtualBalance(packedVirtualBalances[tokenIndex_]);

Expand Down

0 comments on commit 2674ea7

Please sign in to comment.