Skip to content

Feat/instant exit#9

Merged
xrave110 merged 11 commits into
mainfrom
feat/instantExit
Jul 17, 2024
Merged

Feat/instant exit#9
xrave110 merged 11 commits into
mainfrom
feat/instantExit

Conversation

@xrave110
Copy link
Copy Markdown
Collaborator

Zapping feature, swap module, commonized tests (UTs and ITs on mode), new velo interface

Copy link
Copy Markdown

@imrtlfarm imrtlfarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks decent

/// @notice Transfers not claimed tokens to the sender.
/// @dev When contract doesn't have funds during exercise, this function allows to claim the tokens once contract is funded
/// @param to Destination address for token transfer
function claim(address to) external whenNotPaused {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eidolon is having second thoughts about claim system

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add pause to otoken

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but keep this modifier here and on exercise

Comment thread src/helpers/SwapHelper.sol Outdated
_configSwapProps(_swapProps);
}

function configSwapProps(SwapProps memory _swapProps) external virtual;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

setSwapProps

Comment thread src/helpers/SwapHelper.sol Outdated
_configSwapProps(_swapProps);
}

function configSwapProps(SwapProps memory _swapProps) external virtual;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave a comment here that says i needs to be permissioned in implementation

UniV3
}

struct SwapProps {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swap, SwapProperties, SwapData

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesnt matter tho im just hyper nit

_setInstantExitFee(_instantExitFee);
}

function _setInstantExitFee(uint256 _instantExitFee) internal {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably is fine to have the limit be 100%, but might be good to ponder on for a little bit to b sure

Comment thread src/exercise/DiscountExercise.sol
Comment thread src/exercise/DiscountExercise.sol Outdated
feeAmount = 0;
// transfer payment tokens from user to the set receivers
distributeFees(paymentToken.balanceOf(address(this)), paymentToken);
if (paymentToken.balanceOf(feeRecipients[0]) == 0 || paymentToken.balanceOf(feeRecipients[1]) == 0) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sketchy if statement

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe only check the amount we receive from the swap (return or balance check on this contract itself)


paymentAmount = amount.mulWadUp(price);
if (paymentAmount > _params.maxPaymentAmount) revert Exercise__SlippageTooHigh();
emit Exercised(from, recipient, underlyingAmount, paymentAmount);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is prob fine but it would be nice to know what kind of exercise zap or redeem this was in the event. however... its not worth doing anything about...

enum exerciseType maybe

{
if (block.timestamp > params.deadline) revert Exercise__PastDeadline();
// apply multiplier to price
paymentAmount = _getPaymentAmount(amount);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good job modularize repeated code

Comment thread src/exercise/DiscountExercise.sol Outdated
return _getPaymentAmount(amount);
}

function _getPaymentAmount(uint256 amount) private view returns (uint256 paymentAmount) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think about if internal or not once more (namespace vs possibility of wanting to call this function in child)

@xrave110 xrave110 merged commit 6f8a4c3 into main Jul 17, 2024
@xrave110 xrave110 deleted the feat/instantExit branch July 17, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants