Files
dodo-contractV2/contracts/lib/FeeRateModel.sol
2022-04-24 11:23:18 +08:00

39 lines
1.2 KiB
Solidity

/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
interface IFeeRateImpl {
function getFeeRate(address pool, address trader) external view returns (uint256);
function addCpPoolInfo(address cpPool, address quoteToken, int globalQuota, address feeAddr, address quotaAddr) external;
}
interface IFeeRateModel {
function getFeeRate(address trader) external view returns (uint256);
}
contract FeeRateModel is InitializableOwnable {
address public feeRateImpl;
function setFeeProxy(address _feeRateImpl) public onlyOwner {
feeRateImpl = _feeRateImpl;
}
function getFeeRate(address trader) external view returns (uint256) {
if(feeRateImpl == address(0))
return 0;
return IFeeRateImpl(feeRateImpl).getFeeRate(msg.sender,trader);
}
function addCpPoolInfo(address cpPool, address quoteToken, int globalQuota, address feeAddr, address quotaAddr) external {
IFeeRateImpl(feeRateImpl).addCpPoolInfo(cpPool, quoteToken, globalQuota, feeAddr, quotaAddr);
}
}