add permit

This commit is contained in:
owen05
2020-11-29 23:40:19 +08:00
parent d90e031a30
commit 7290f73634
12 changed files with 602 additions and 18 deletions

View File

@@ -67,14 +67,15 @@ contract DVMFunding is DVMVault {
address to,
uint256 baseMinAmount,
uint256 quoteMinAmount,
bytes calldata data
bytes calldata data,
uint256 deadline
) external preventReentrant returns (uint256 baseAmount, uint256 quoteAmount) {
require(deadline >= block.timestamp, 'DODOV2 DVMFUNDING: EXPIRED');
require(shareAmount <= _SHARES_[msg.sender], "DLP_NOT_ENOUGH");
uint256 baseBalance = _BASE_TOKEN_.balanceOf(address(this));
uint256 quoteBalance = _QUOTE_TOKEN_.balanceOf(address(this));
uint256 totalShares = totalSupply;
require(shareAmount <= _SHARES_[msg.sender], "DLP_NOT_ENOUGH");
baseAmount = baseBalance.mul(shareAmount).div(totalShares);
quoteAmount = quoteBalance.mul(shareAmount).div(totalShares);