update
This commit is contained in:
@@ -173,7 +173,7 @@ contract BaseMine is InitializableOwnable {
|
||||
rt.rewardVault = address(new RewardVault(rewardToken));
|
||||
|
||||
uint256 rewardAmount = rewardPerBlock.mul(endBlock.sub(startBlock));
|
||||
IERC20(rewardToken).transfer(rt.rewardVault, rewardAmount);
|
||||
IERC20(rewardToken).safeTransfer(rt.rewardVault, rewardAmount);
|
||||
RewardVault(rt.rewardVault).syncValue();
|
||||
|
||||
emit NewRewardToken(len, rewardToken);
|
||||
|
||||
@@ -10,9 +10,10 @@ pragma experimental ABIEncoderV2;
|
||||
import {SafeERC20} from "../../lib/SafeERC20.sol";
|
||||
import {IERC20} from "../../intf/IERC20.sol";
|
||||
import {SafeMath} from "../../lib/SafeMath.sol";
|
||||
import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol";
|
||||
import {BaseMine} from "./BaseMine.sol";
|
||||
|
||||
contract ERC20Mine is BaseMine {
|
||||
contract ERC20Mine is ReentrancyGuard, BaseMine {
|
||||
using SafeERC20 for IERC20;
|
||||
using SafeMath for uint256;
|
||||
|
||||
@@ -32,7 +33,7 @@ contract ERC20Mine is BaseMine {
|
||||
|
||||
// ============ Deposit && Withdraw && Exit ============
|
||||
|
||||
function deposit(uint256 amount) external {
|
||||
function deposit(uint256 amount) external preventReentrant {
|
||||
require(amount > 0, "DODOMineV3: CANNOT_DEPOSIT_ZERO");
|
||||
|
||||
_updateAllReward(msg.sender);
|
||||
@@ -47,7 +48,7 @@ contract ERC20Mine is BaseMine {
|
||||
emit Deposit(msg.sender, actualStakeAmount);
|
||||
}
|
||||
|
||||
function withdraw(uint256 amount) external {
|
||||
function withdraw(uint256 amount) external preventReentrant {
|
||||
require(amount > 0, "DODOMineV3: CANNOT_WITHDRAW_ZERO");
|
||||
|
||||
_updateAllReward(msg.sender);
|
||||
|
||||
@@ -73,7 +73,7 @@ contract ERC20V2Factory is InitializableOwnable {
|
||||
uint256 totalSupply,
|
||||
string memory name,
|
||||
string memory symbol,
|
||||
uint256 decimals
|
||||
uint8 decimals
|
||||
) external returns (address newERC20) {
|
||||
newERC20 = ICloneFactory(_CLONE_FACTORY_).clone(_ERC20_TEMPLATE_);
|
||||
IStdERC20(newERC20).init(msg.sender, totalSupply, name, symbol, decimals);
|
||||
@@ -85,7 +85,7 @@ contract ERC20V2Factory is InitializableOwnable {
|
||||
uint256 initSupply,
|
||||
string memory name,
|
||||
string memory symbol,
|
||||
uint256 decimals,
|
||||
uint8 decimals,
|
||||
uint256 tradeBurnRatio,
|
||||
uint256 tradeFeeRatio,
|
||||
address teamAccount,
|
||||
|
||||
@@ -39,6 +39,10 @@ contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry {
|
||||
// ============ Events ============
|
||||
event NewMineV3(address mine, address stakeToken, bool isLpToken);
|
||||
event RemoveMineV3(address mine, address stakeToken);
|
||||
event addAdmin(address admin);
|
||||
event removeAdmin(address admin);
|
||||
event addSingleToken(address token);
|
||||
event removeSingleToken(address token);
|
||||
|
||||
|
||||
function addMineV3(
|
||||
@@ -86,17 +90,21 @@ contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry {
|
||||
|
||||
function addAdminList (address contractAddr) external onlyOwner {
|
||||
isAdminListed[contractAddr] = true;
|
||||
emit addAdmin(contractAddr);
|
||||
}
|
||||
|
||||
function removeAdminList (address contractAddr) external onlyOwner {
|
||||
isAdminListed[contractAddr] = false;
|
||||
emit removeAdmin(contractAddr);
|
||||
}
|
||||
|
||||
function addSingleTokenList(address token) external onlyOwner {
|
||||
singleTokenList[token] = true;
|
||||
emit addSingleToken(token);
|
||||
}
|
||||
|
||||
function removeSingleTokenList(address token) external onlyOwner {
|
||||
singleTokenList[token] = false;
|
||||
emit removeSingleToken(token);
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ contract DODOMineV3Proxy is InitializableOwnable {
|
||||
event DepositRewardToVault(address mine, address rewardToken, uint256 amount);
|
||||
event DepositRewardToMine(address mine, address rewardToken, uint256 amount);
|
||||
event CreateMineV3(address account, address mineV3);
|
||||
event ChangeMineV3Template(address mineV3);
|
||||
|
||||
constructor(
|
||||
address cloneFactory,
|
||||
@@ -125,7 +126,8 @@ contract DODOMineV3Proxy is InitializableOwnable {
|
||||
|
||||
// ============ Admin Operation Functions ============
|
||||
|
||||
function updateMineV2Template(address _newMineV3Template) external onlyOwner {
|
||||
function updateMineV3Template(address _newMineV3Template) external onlyOwner {
|
||||
_MINEV3_TEMPLATE_ = _newMineV3Template;
|
||||
emit ChangeMineV3Template(_newMineV3Template);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +195,8 @@ contract DODORouteProxy {
|
||||
|
||||
if(assetFrom[i-1] == address(this)) {
|
||||
uint256 curAmount = curTotalAmount.div(curTotalWeight).mul(curPoolInfo.weight);
|
||||
//can improved
|
||||
// uint256 curAmount = curTotalAmount.mul(curPoolInfo.weight).div(curTotalWeight);
|
||||
|
||||
if(curPoolInfo.poolEdition == 1) {
|
||||
//For using transferFrom pool (like dodoV1, Curve)
|
||||
|
||||
4
contracts/external/ERC20/CustomERC20.sol
vendored
4
contracts/external/ERC20/CustomERC20.sol
vendored
@@ -14,7 +14,7 @@ contract CustomERC20 is InitializableOwnable {
|
||||
using SafeMath for uint256;
|
||||
|
||||
string public name;
|
||||
uint256 public decimals;
|
||||
uint8 public decimals;
|
||||
string public symbol;
|
||||
uint256 public totalSupply;
|
||||
|
||||
@@ -39,7 +39,7 @@ contract CustomERC20 is InitializableOwnable {
|
||||
uint256 _initSupply,
|
||||
string memory _name,
|
||||
string memory _symbol,
|
||||
uint256 _decimals,
|
||||
uint8 _decimals,
|
||||
uint256 _tradeBurnRatio,
|
||||
uint256 _tradeFeeRatio,
|
||||
address _team,
|
||||
|
||||
Reference in New Issue
Block a user