add weth 2 eth support in crowdpooling
This commit is contained in:
@@ -16,6 +16,7 @@ import {IDVM} from "../../DODOVendingMachine/intf/IDVM.sol";
|
||||
import {IDVMFactory} from "../../Factory/DVMFactory.sol";
|
||||
import {CPStorage} from "./CPStorage.sol";
|
||||
import {PMMPricing} from "../../lib/PMMPricing.sol";
|
||||
import {IDODOCallee} from "../../intf/IDODOCallee.sol";
|
||||
|
||||
contract CPFunding is CPStorage {
|
||||
using SafeERC20 for IERC20;
|
||||
@@ -39,12 +40,17 @@ contract CPFunding is CPStorage {
|
||||
emit Bid(to, input, mtFee);
|
||||
}
|
||||
|
||||
function cancel(address assetTo, uint256 amount) external phaseBidOrCalm preventReentrant {
|
||||
function cancel(address to, uint256 amount, bytes calldata data) external phaseBidOrCalm preventReentrant {
|
||||
require(_SHARES_[msg.sender] >= amount, "SHARES_NOT_ENOUGH");
|
||||
_burnShares(msg.sender, amount);
|
||||
_transferQuoteOut(assetTo, amount);
|
||||
_transferQuoteOut(to, amount);
|
||||
_sync();
|
||||
emit Cancel(assetTo,amount);
|
||||
|
||||
if(data.length > 0){
|
||||
IDODOCallee(to).CPCancelCall(msg.sender,amount,data);
|
||||
}
|
||||
|
||||
emit Cancel(msg.sender,amount);
|
||||
}
|
||||
|
||||
function _mintShares(address to, uint256 amount) internal {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
|
||||
|
||||
Copyright 2020 DODO ZOO.
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
@@ -43,6 +43,15 @@ contract DODOCalleeHelper is ReentrancyGuard {
|
||||
_withdraw(assetTo, _quoteToken, quoteAmount, _quoteToken == _WETH_);
|
||||
}
|
||||
|
||||
function CPCancelCall(
|
||||
address payable assetTo,
|
||||
uint256 amount,
|
||||
bytes calldata
|
||||
)external preventReentrant{
|
||||
address _quoteToken = IDODOV2(msg.sender)._QUOTE_TOKEN_();
|
||||
_withdraw(assetTo, _quoteToken, amount, _quoteToken == _WETH_);
|
||||
}
|
||||
|
||||
function _withdraw(
|
||||
address payable to,
|
||||
address token,
|
||||
|
||||
@@ -31,7 +31,7 @@ interface IDODOCallee {
|
||||
bytes calldata data
|
||||
) external;
|
||||
|
||||
function CACancelCall(
|
||||
function CPCancelCall(
|
||||
address sender,
|
||||
uint256 amount,
|
||||
bytes calldata data
|
||||
|
||||
Reference in New Issue
Block a user