diff --git a/contracts/CrowdPooling/impl/CP.sol b/contracts/CrowdPooling/impl/CP.sol index d04809e..db40ec3 100644 --- a/contracts/CrowdPooling/impl/CP.sol +++ b/contracts/CrowdPooling/impl/CP.sol @@ -17,6 +17,10 @@ import {SafeMath} from "../../lib/SafeMath.sol"; contract CP is CPVesting { using SafeMath for uint256; + receive() external payable { + require(_INITIALIZED_ == false, "WE_NOT_SAVE_ETH_AFTER_INIT"); + } + function init( address[] calldata addressList, uint256[] calldata timeLine, @@ -83,5 +87,7 @@ contract CP is CPVesting { require(_CLIFF_RATE_ <= 1e18, "CLIFF_RATE_WRONG"); _TOTAL_BASE_ = _BASE_TOKEN_.balanceOf(address(this)); + + require(address(this).balance == _SETTEL_FUND_, "SETTLE_FUND_NOT_MATCH"); } } diff --git a/contracts/CrowdPooling/impl/CPFunding.sol b/contracts/CrowdPooling/impl/CPFunding.sol index fa9d8e2..290e9a7 100644 --- a/contracts/CrowdPooling/impl/CPFunding.sol +++ b/contracts/CrowdPooling/impl/CPFunding.sol @@ -115,6 +115,8 @@ contract CPFunding is CPStorage { _transferQuoteOut(_POOL_, poolQuote); _TOTAL_LP_AMOUNT_ = IDVM(_POOL_).buyShares(address(this)); + + msg.sender.transfer(_SETTEL_FUND_); } // in case something wrong with base token contract diff --git a/contracts/CrowdPooling/impl/CPStorage.sol b/contracts/CrowdPooling/impl/CPStorage.sol index 662b378..7be9580 100644 --- a/contracts/CrowdPooling/impl/CPStorage.sol +++ b/contracts/CrowdPooling/impl/CPStorage.sol @@ -19,6 +19,7 @@ contract CPStorage is InitializableOwnable, ReentrancyGuard { using SafeMath for uint256; uint256 internal constant _SETTLEMENT_EXPIRE_ = 86400 * 7; + uint256 internal constant _SETTEL_FUND_ = 200 finney; // ============ Timeline ============ diff --git a/contracts/Factory/CrowdPoolingFactory.sol b/contracts/Factory/CrowdPoolingFactory.sol index 4e1fd39..16c731b 100644 --- a/contracts/Factory/CrowdPoolingFactory.sol +++ b/contracts/Factory/CrowdPoolingFactory.sol @@ -122,8 +122,6 @@ contract CrowdPoolingFactory is InitializableOwnable { _USER_REGISTRY_[creator].push(cpAddress); emit NewCP(baseToken, quoteToken, creator, cpAddress); - - //TODO: 初始存入资金,用于settle补贴 } // ============ View Functions ============ diff --git a/contracts/SmartRoute/DODOV2Proxy01.sol b/contracts/SmartRoute/DODOV2Proxy01.sol index 4b00bc8..e48cf9c 100644 --- a/contracts/SmartRoute/DODOV2Proxy01.sol +++ b/contracts/SmartRoute/DODOV2Proxy01.sol @@ -606,7 +606,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable uint256[] memory timeLine, uint256[] memory valueList, uint256 deadLine - ) external override judgeExpired(deadLine) returns (address newCrowdPooling) { + ) external override payable judgeExpired(deadLine) returns (address payable newCrowdPooling) { address _baseToken = baseToken; address _quoteToken = quoteToken == _ETH_ADDRESS_ ? _WETH_ : quoteToken; @@ -620,6 +620,7 @@ contract DODOV2Proxy01 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable false ); + newCrowdPooling.transfer(msg.value); IDODOV2(_CP_FACTORY_).initCrowdPooling( newCrowdPooling, diff --git a/contracts/SmartRoute/intf/IDODOV2.sol b/contracts/SmartRoute/intf/IDODOV2.sol index bb39a64..09d7a65 100644 --- a/contracts/SmartRoute/intf/IDODOV2.sol +++ b/contracts/SmartRoute/intf/IDODOV2.sol @@ -85,7 +85,7 @@ interface IDODOV2 { //========== CrowdPooling =========== - function createCrowdPooling() external returns (address newCrowdPooling); + function createCrowdPooling() external returns (address payable newCrowdPooling); function initCrowdPooling( address cpAddress, diff --git a/contracts/SmartRoute/intf/IDODOV2Proxy01.sol b/contracts/SmartRoute/intf/IDODOV2Proxy01.sol index 83cf96a..5437d00 100644 --- a/contracts/SmartRoute/intf/IDODOV2Proxy01.sol +++ b/contracts/SmartRoute/intf/IDODOV2Proxy01.sol @@ -100,7 +100,7 @@ interface IDODOV2Proxy01 is IDODOV1Proxy01 { uint256[] memory timeLine, uint256[] memory valueList, uint256 deadLine - ) external returns (address newCrowdPooling); + ) external payable returns (address payable newCrowdPooling); function bid( address assetTo,