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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.6.12; | |
| abstract contract Context { | |
| function _msgSender() internal view virtual returns (address payable) { | |
| return msg.sender; | |
| } | |
| function _msgData() internal view virtual returns (bytes memory) { | |
| this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 |
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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.6.12; | |
| library SafeMath { | |
| function add(uint x, uint y) internal pure returns (uint z) { | |
| require((z = x + y) >= x, 'ds-math-add-overflow'); | |
| } | |
| function sub(uint x, uint y) internal pure returns (uint z) { |
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
| pragma solidity ^0.6.12; | |
| interface IERC20 { | |
| /** | |
| * @dev Returns the amount of tokens in existence. | |
| */ | |
| function totalSupply() external view returns (uint256); | |
| /** | |
| * @dev Returns the amount of tokens owned by `account`. |
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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.6.12; | |
| /** | |
| * @dev Interface of the ERC20 standard as defined in the EIP. | |
| */ | |
| interface IERC20 { | |
| /** | |
| * @dev Returns the amount of tokens in existence. | |
| */ |
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
| pragma solidity ^0.6.12; | |
| /** | |
| * @dev Interface of the ERC20 standard as defined in the EIP. | |
| */ | |
| interface IERC20 { | |
| /** | |
| * @dev Returns the amount of tokens in existence. | |
| */ | |
| function totalSupply() external view returns (uint256); |
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
| import contracts from './contracts' | |
| import { FarmConfig, QuoteToken } from './types' | |
| const farms: FarmConfig[] = [ | |
| { | |
| pid: 0, | |
| risk: 5, | |
| lpSymbol: 'WAD', | |
| lpAddresses: { | |
| 97: '', |
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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.6.6; | |
| library SafeERC20 { | |
| using SafeMath for uint256; | |
| using Address for address; | |
| function safeTransfer(IERC20 token, address to, uint256 value) internal { |
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 stake(uint256 amount) external nonReentrant { | |
| require(amount <= maxStakeAmount, 'amount too high'); | |
| busd.safeTransferFrom(msg.sender, address(this), amount); | |
| if(feePermille > 0) { | |
| uint256 feeAmount = amount * feePermille / 1000; | |
| busd.safeTransfer(treasury, feeAmount); | |
| amount = amount - feeAmount; | |
| } | |
| uint256 xvonAmount = amount * xvonPermille / 1000; | |
| xvon.safeTransferFrom(msg.sender, address(this), xvonAmount); |
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); |
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
| // SPDX-License-Identifier: MIT | |
| pragma solidity ^0.6.6; | |
| library SafeMath { | |
| /** | |
| * @dev Returns the addition of two unsigned integers, reverting on | |
| * overflow. | |
| * | |
| * Counterpart to Solidity's `+` operator. |