wait to test

This commit is contained in:
owen05
2021-01-21 21:48:40 +08:00
parent 1c8d393ae1
commit 4095ebbb2f
9 changed files with 16 additions and 195 deletions

View File

@@ -62,7 +62,6 @@ contract DODOIncentive is InitializableOwnable {
emit SetBoost(_token, _boostRate);
}
//switch
function changePerReward(uint256 _dodoPerBlock) public onlyOwner {
_updateTotalReward();
dodoPerBlock = _dodoPerBlock;
@@ -97,7 +96,8 @@ contract DODOIncentive is InitializableOwnable {
uint256 fromRate = boosts[fromToken];
uint256 toRate = boosts[toToken];
uint256 rate = (fromRate >= toRate ? fromRate : toRate) + defaultRate;
require(rate <= 1000, "RATE_INVALID");
uint256 _totalReward = _getTotalReward();
uint256 reward = ((_totalReward - curTotalDistribution) * rate) / 1000;
uint256 _totalDistribution = curTotalDistribution + reward;

View File

@@ -8,45 +8,26 @@
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {ReentrancyGuard} from "../lib/ReentrancyGuard.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
interface IFeeRateImpl {
function getFeeRate(address pool, address trader) external view returns (uint256);
}
interface IFeeRateModel {
function getFeeRate(address trader) external view returns (uint256);
function init(address owner, uint256 feeRate) external;
function setFeeRate(uint256 newFeeRate) external;
}
contract FeeRateModel is ReentrancyGuard,InitializableOwnable {
//DEFAULT
uint256 public _FEE_RATE_;
mapping(address => uint256) feeMapping;
event SetSpecificFeeRate(bool result);
event SetFeeRate(bool result);
contract FeeRateModel is InitializableOwnable {
address public feeRateImpl;
function setFeeProxy(address _feeRateImpl) public onlyOwner {
feeRateImpl = _feeRateImpl;
}
function init(address owner, uint256 feeRate) external {
initOwner(owner);
_FEE_RATE_ = feeRate;
}
function setSpecificFeeRate(address trader, uint256 feeRate, address logicContractAddr) external onlyOwner {
bool r;
(r, ) = logicContractAddr.delegatecall(abi.encodeWithSignature("setSpecificFeeRate(address,uint256)", trader,feeRate));
emit SetSpecificFeeRate(r);
}
function setFeeRate(uint256 newFeeRate, address logicContractAddr) external onlyOwner {
bool r;
(r, ) = logicContractAddr.delegatecall(abi.encodeWithSignature("setFeeRate(uint256)", newFeeRate));
emit SetFeeRate(r);
}
function getFeeRate(address trader) external view returns (uint256) {
uint256 feeRate = feeMapping[trader];
if(feeRate == 0)
return _FEE_RATE_;
return feeRate;
if(feeRateImpl == address(0))
return 0;
return IFeeRateImpl(feeRateImpl).getFeeRate(msg.sender,trader);
}
}

View File

@@ -1,27 +0,0 @@
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {ReentrancyGuard} from "../lib/ReentrancyGuard.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
contract FeeRateModelLogic is ReentrancyGuard,InitializableOwnable {
//DEFAULT
uint256 public _FEE_RATE_;
mapping(address => uint256) feeMapping;
function setSpecificFeeRate(address trader, uint256 feeRate) external onlyOwner {
require(trader != address(0), "INVALID ADDRESS!");
feeMapping[trader] = feeRate;
}
function setFeeRate(uint256 newFeeRate) external onlyOwner {
_FEE_RATE_ = newFeeRate;
}
}