cpV2 for audit
This commit is contained in:
@@ -23,7 +23,9 @@ import {SafeMath} from "../../lib/SafeMath.sol";
|
||||
contract CP is CPVesting {
|
||||
using SafeMath for uint256;
|
||||
|
||||
receive() external payable {}
|
||||
receive() external payable {
|
||||
require(_INITIALIZED_ == false, "WE_NOT_SAVE_ETH_AFTER_INIT");
|
||||
}
|
||||
|
||||
function init(
|
||||
address[] calldata addressList,
|
||||
@@ -110,6 +112,6 @@ contract CP is CPVesting {
|
||||
// ============ Version Control ============
|
||||
|
||||
function version() virtual external pure returns (string memory) {
|
||||
return "CP 1.0.1";
|
||||
return "CP 2.0.0";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,6 @@ contract CrowdPoolingFactory is InitializableOwnable {
|
||||
// ============ modifiers ===========
|
||||
|
||||
modifier valueCheck(
|
||||
address creator,
|
||||
address cpAddress,
|
||||
address baseToken,
|
||||
uint256[] memory timeLine,
|
||||
@@ -64,6 +63,7 @@ contract CrowdPoolingFactory is InitializableOwnable {
|
||||
|
||||
uint256 baseTokenBalance = IERC20(baseToken).balanceOf(cpAddress);
|
||||
require(valueList[0].mul(100) <= baseTokenBalance.mul(valueList[2]).div(10**18).mul(_CAP_RATIO_),"CP_FACTORY : QUOTE_CAP_INVALID");
|
||||
require(timeLine[3]>= _FREEZE_DURATION_, "CP_FACTORY : FREEZE_DURATION_INVALID");
|
||||
_;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ contract CrowdPoolingFactory is InitializableOwnable {
|
||||
uint256[] memory timeLine,
|
||||
uint256[] memory valueList,
|
||||
bool[] memory switches
|
||||
) external valueCheck(creator,cpAddress,tokens[0],timeLine,valueList) {
|
||||
) external valueCheck(cpAddress,tokens[0],timeLine,valueList) {
|
||||
{
|
||||
address[] memory addressList = new address[](7);
|
||||
addressList[0] = creator;
|
||||
|
||||
@@ -467,15 +467,15 @@ contract DODOV2Proxy02 is IDODOV2Proxy01, ReentrancyGuard, InitializableOwnable
|
||||
}
|
||||
|
||||
//============ CrowdPooling Functions (bid) ============
|
||||
function bid(
|
||||
address cpAddress,
|
||||
uint256 quoteAmount,
|
||||
uint8 flag, // 0 - ERC20, 1 - quoteInETH
|
||||
uint256 deadLine
|
||||
) external override payable preventReentrant judgeExpired(deadLine) {
|
||||
_deposit(msg.sender, cpAddress, IDODOV2(cpAddress)._QUOTE_TOKEN_(), quoteAmount, flag == 1);
|
||||
IDODOV2(cpAddress).bid(msg.sender);
|
||||
}
|
||||
// function bid(
|
||||
// address cpAddress,
|
||||
// uint256 quoteAmount,
|
||||
// uint8 flag, // 0 - ERC20, 1 - quoteInETH
|
||||
// uint256 deadLine
|
||||
// ) external override payable preventReentrant judgeExpired(deadLine) {
|
||||
// _deposit(msg.sender, cpAddress, IDODOV2(cpAddress)._QUOTE_TOKEN_(), quoteAmount, flag == 1);
|
||||
// IDODOV2(cpAddress).bid(msg.sender);
|
||||
// }
|
||||
|
||||
|
||||
function addLiquidityToV1(
|
||||
|
||||
@@ -92,12 +92,12 @@ interface IDODOV2Proxy01 {
|
||||
// ) external payable;
|
||||
|
||||
|
||||
function bid(
|
||||
address cpAddress,
|
||||
uint256 quoteAmount,
|
||||
uint8 flag, // 0 - ERC20, 1 - quoteInETH
|
||||
uint256 deadLine
|
||||
) external payable;
|
||||
// function bid(
|
||||
// address cpAddress,
|
||||
// uint256 quoteAmount,
|
||||
// uint8 flag, // 0 - ERC20, 1 - quoteInETH
|
||||
// uint256 deadLine
|
||||
// ) external payable;
|
||||
|
||||
function addLiquidityToV1(
|
||||
address pair,
|
||||
|
||||
@@ -137,6 +137,16 @@ contract DODOCpProxy is ReentrancyGuard {
|
||||
);
|
||||
}
|
||||
|
||||
function bid(
|
||||
address cpAddress,
|
||||
uint256 quoteAmount,
|
||||
uint8 flag, // 0 - ERC20, 1 - quoteInETH
|
||||
uint256 deadLine
|
||||
) external payable preventReentrant judgeExpired(deadLine) {
|
||||
_deposit(msg.sender, cpAddress, IDODOV2(cpAddress)._QUOTE_TOKEN_(), quoteAmount, flag == 1);
|
||||
IDODOV2(cpAddress).bid(msg.sender);
|
||||
}
|
||||
|
||||
//====================== internal =======================
|
||||
|
||||
function _deposit(
|
||||
|
||||
Reference in New Issue
Block a user