Last active
August 18, 2021 02:22
-
-
Save korrio/30804e5b8375b5fc0012d4e37708ec4a to your computer and use it in GitHub Desktop.
redeem.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function redeem(uint256 amount) external nonReentrant { | |
uint256 busdTransferAmount = amount * (1000 - xvonPermille - treasuryPermille) / 1000; | |
uint256 busdTreasuryAmount = amount * treasuryPermille / 1000; | |
uint256 xvonTransferAmount = xvon.balanceOf(address(this)) * amount / vdp.totalSupply(); | |
vdp.burn(msg.sender, amount); | |
busd.safeTransfer(treasury, busdTreasuryAmount); | |
busd.safeTransfer(msg.sender, busdTransferAmount); | |
xvon.safeTransferFrom(msg.sender, address(this), xvonTransferAmount); | |
emit Redeem(msg.sender, amount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment