This commit is contained in:
owen05
2021-12-27 21:40:32 +08:00
parent b1b84f8818
commit 55fea6602f
10 changed files with 32 additions and 21 deletions

View File

@@ -82,8 +82,8 @@ contract CPVesting is CPFunding {
function _claimBaseToken(address to) internal {
uint256 claimableBaseAmount = getClaimableBaseToken(msg.sender);
_transferBaseOut(to, claimableBaseAmount);
_CLAIMED_BASE_TOKEN_[msg.sender] = _CLAIMED_BASE_TOKEN_[msg.sender].add(claimableBaseAmount);
_transferBaseOut(to, claimableBaseAmount);
emit ClaimBaseToken(msg.sender, claimableBaseAmount);
}

View File

@@ -24,9 +24,5 @@ interface ICP {
function emergencySettle() external;
function claimBaseToken() external;
function ClaimQuoteToken(address to,bytes calldata data) external;
function claimLPToken() external;
}

View File

@@ -168,7 +168,7 @@ contract FairFunding is Vesting {
// ============ Settle Functions ============
function settle() public isForceStop preventReentrant {
function settle() public isNotForceStop preventReentrant {
require(_FINAL_PRICE_ == 0 && isFundingEnd(), "CAN_NOT_SETTLE");
_FINAL_PRICE_ = getCurrentPrice();
if(_TOTAL_RAISED_FUNDS_ == 0) {
@@ -187,7 +187,7 @@ contract FairFunding is Vesting {
// ============ Funding Functions ============
function depositFunds(address to) external preventReentrant isForceStop returns(uint256 inputFund) {
function depositFunds(address to) external preventReentrant isNotForceStop returns(uint256 inputFund) {
require(isDepositOpen(), "DEPOSIT_NOT_OPEN");
uint256 currentFundBalance = IERC20(_FUNDS_ADDRESS_).balanceOf(address(this));

View File

@@ -142,7 +142,7 @@ contract InstantFunding is Vesting {
function depositFunds(address to)
external
preventReentrant
isForceStop
isNotForceStop
returns (uint256 newTokenAllocation)
{
require(isDepositOpen(), "DEPOSIT_NOT_OPEN");

View File

@@ -12,9 +12,11 @@ import {InitializableOwnable} from "../../lib/InitializableOwnable.sol";
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
import {SafeMath} from "../../lib/SafeMath.sol";
import {IERC20} from "../../intf/IERC20.sol";
import {SafeERC20} from "../../lib/SafeERC20.sol";
contract Storage is InitializableOwnable, ReentrancyGuard {
using SafeMath for uint256;
using SafeERC20 for IERC20;
bool public _FORCE_STOP_ = false;
address public _QUOTA_;
@@ -58,7 +60,7 @@ contract Storage is InitializableOwnable, ReentrancyGuard {
// ============ Modifiers ============
modifier isForceStop() {
modifier isNotForceStop() {
require(!_FORCE_STOP_, "FORCE_STOP");
_;
}
@@ -69,6 +71,6 @@ contract Storage is InitializableOwnable, ReentrancyGuard {
_FORCE_STOP_ = true;
_TOTAL_TOKEN_AMOUNT_ = 0;
uint256 tokenAmount = IERC20(_TOKEN_ADDRESS_).balanceOf(address(this));
IERC20(_TOKEN_ADDRESS_).transfer(_OWNER_, tokenAmount);
IERC20(_TOKEN_ADDRESS_).safeTransfer(_OWNER_, tokenAmount);
}
}

View File

@@ -52,6 +52,8 @@ contract Vesting is Storage {
cliffRate = _LP_CLIFF_RATE_;
}
require(timestamp >= vestingStart, "NOT_START_TO_CLAIM");
uint256 timePast = timestamp.sub(vestingStart);
if (timePast < vestingDuration) {
uint256 remainingTime = vestingDuration.sub(timePast);
@@ -94,12 +96,12 @@ contract Vesting is Storage {
DecimalMath.ONE,
isOpenTWAP
);
IERC20(_TOKEN_ADDRESS_).transferFrom(msg.sender, _INITIAL_POOL_, initialTokenAmount);
IERC20(_TOKEN_ADDRESS_).safeTransferFrom(msg.sender, _INITIAL_POOL_, initialTokenAmount);
if(totalUsedRaiseFunds > _INITIAL_FUND_LIQUIDITY_) {
IERC20(_FUNDS_ADDRESS_).transfer(_INITIAL_POOL_, _INITIAL_FUND_LIQUIDITY_);
IERC20(_FUNDS_ADDRESS_).safeTransfer(_INITIAL_POOL_, _INITIAL_FUND_LIQUIDITY_);
}else {
IERC20(_FUNDS_ADDRESS_).transfer(_INITIAL_POOL_, totalUsedRaiseFunds);
IERC20(_FUNDS_ADDRESS_).safeTransfer(_INITIAL_POOL_, totalUsedRaiseFunds);
}
(_TOTAL_LP_, , ) = IDVM(_INITIAL_POOL_).buyShares(address(this));

View File

@@ -12,6 +12,7 @@ import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
import {ICloneFactory} from "../lib/CloneFactory.sol";
import {SafeMath} from "../lib/SafeMath.sol";
import {IERC20} from "../intf/IERC20.sol";
import {SafeERC20} from "../lib/SafeERC20.sol";
import {DecimalMath} from "../lib/DecimalMath.sol";
import {IDODOStarter} from "../DODOStarter/intf/IDODOStarter.sol";
@@ -23,6 +24,8 @@ import {IDODOStarter} from "../DODOStarter/intf/IDODOStarter.sol";
*/
contract DODOStarterFactory is InitializableOwnable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
@@ -83,7 +86,7 @@ contract DODOStarterFactory is InitializableOwnable {
) external payable permissionCheck(addressList[0],addressList[1]) returns(address newFairFundPool){
newFairFundPool = ICloneFactory(_CLONE_FACTORY_).clone(_FAIR_FUND_TEMPLATE_);
IERC20(addressList[1]).transferFrom(msg.sender, newFairFundPool,sellTokenAmount);
IERC20(addressList[1]).safeTransferFrom(msg.sender, newFairFundPool,sellTokenAmount);
(bool success, ) = newFairFundPool.call{value: msg.value}("");
require(success, "Settle fund Transfer failed");
@@ -107,7 +110,7 @@ contract DODOStarterFactory is InitializableOwnable {
) external permissionCheck(addressList[0],addressList[1]) returns(address newInstantFundPool){
newInstantFundPool = ICloneFactory(_CLONE_FACTORY_).clone(_INSTANT_FUND_TEMPLATE_);
IERC20(addressList[1]).transferFrom(msg.sender, newInstantFundPool,sellTokenAmount);
IERC20(addressList[1]).safeTransferFrom(msg.sender, newInstantFundPool,sellTokenAmount);
IDODOStarter(newInstantFundPool).init(
addressList,

View File

@@ -16,6 +16,7 @@ const DODOToken = artifacts.require("DODOToken");
const UpCrowdPoolingFactory = artifacts.require("UpCrowdPoolingFactory");
const CpFactory = artifacts.require("CrowdPoolingFactory");
const MultiCall = artifacts.require("Multicall");
const UserQuota = artifacts.require("UserQuota");
const LockedTokenVault = artifacts.require("LockedTokenVault");
const DODORouteProxy = artifacts.require("DODORouteProxy");
const DODOCpProxy = artifacts.require("DODOCpProxy");
@@ -303,6 +304,12 @@ module.exports = async (deployer, network, accounts) => {
logger.log("MultiCallAddress: ", MultiCallAddress);
}
if (deploySwitch.UserQuota) {
await deployer.deploy(UserQuota);
UserQuotaAddress = UserQuota.address;
logger.log("UserQuotaAddress: ", UserQuotaAddress);
}
if (deploySwitch.CPFactory) {
logger.log("====================================================");
logger.log("network type: " + network);

View File

@@ -45,7 +45,7 @@
"solc": "^0.6.9",
"ts-node": "^8.10.2",
"typescript": "^3.9.5",
"web3": "^1.2.9",
"web3": "^1.2.8",
"web3-core-helpers": "^1.2.8",
"web3-eth-contract": "^1.2.8"
},
@@ -55,7 +55,6 @@
"prettier": "^2.0.5",
"prettier-plugin-solidity": "^1.0.0-alpha.52",
"solidity-coverage": "^0.7.7",
"truffle-assertions": "^0.9.2",
"web3-provider-engine": "~15.0.12"
"truffle-assertions": "^0.9.2"
}
}

View File

@@ -19,7 +19,6 @@
*/
var HDWalletProvider = require("@truffle/hdwallet-provider");
const NonceTrackerSubprovider = require('web3-provider-engine/subproviders/nonce-tracker')
var privKey = process.env.privKey;
var infuraId = process.env.infuraId;
@@ -104,7 +103,9 @@ module.exports = {
gas: 10000000,
gasPrice: 1500000000,
network_id: 4,
skipDryRun: true
skipDryRun: true,
confirmations: 2,
timeoutBlocks: 200,
},
live: {
@@ -120,8 +121,9 @@ module.exports = {
bsclive: {
provider: function () {
return new HDWalletProvider(privKey, "https://bsc-dataseed1.binance.org");
return new HDWalletProvider(privKey, "https://bsc-dataseed3.ninicoin.io");
},
networkCheckTimeout:100000,
network_id: 56,
confirmations: 10,
timeoutBlocks: 200,