Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WithdrawRequestNFT's claimWithdraw is wrong in handling when there was fee #24

Open
seongyun-ko opened this issue Mar 26, 2024 · 0 comments

Comments

@seongyun-ko
Copy link
Contributor

image

https://etherscan.io/tx/0x188e077e92f10c9ca222cead4ab78e773c6ba330ecc12e4c89a71c88eeda1348

https://dashboard.tenderly.co/ether-fi/ether-fi/tx/mainnet/0x188e077e92f10c9ca222cead4ab78e773c6ba330ecc12e4c89a71c88eeda1348/state-diff

image

it is wrongly counting the unburned share due to the fee….

the correct fix would be like:

function claimWithdraw(uint256 tokenId) public {
    require(ownerOf(tokenId) == msg.sender, "Not the owner of the NFT");

    IWithdrawRequestNFT.WithdrawRequest memory request = _requests[tokenId];
    uint256 fee = uint256(request.feeGwei) * 1 gwei;
    uint256 amountToWithdraw = getClaimableAmount(tokenId);

    // transfer eth to requester
    address recipient = ownerOf(tokenId);
    _burn(tokenId);
    delete _requests[tokenId];

    uint256 amountBurnedShare = 0;
    if (fee > 0) {
        // send fee to membership manager
        amountBurnedShare += liquidityPool.withdraw(address(membershipManager), fee);
    }

    amountBurnedShare += liquidityPool.withdraw(recipient, amountToWithdraw);
    uint256 amountUnBurnedShare = request.shareOfEEth - amountBurnedShare;
    if (amountUnBurnedShare > 0) {
        accumulatedDustEEthShares += uint96(amountUnBurnedShare);
    }

    emit WithdrawRequestClaimed(uint32(tokenId), amountToWithdraw + fee, amountBurnedShare, recipient, fee);
}

so, the protocol is not calling burnAccumulatedDustEEthShares function.
We should fix it and upgrade the contract

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

No branches or pull requests

2 participants
@seongyun-ko and others