Added variable fee collector address

This commit is contained in:
Thrilok Kumar 2020-07-17 19:56:06 +05:30
parent d22662aadb
commit 2c26d733c7
2 changed files with 25 additions and 5 deletions

View File

@ -20,6 +20,7 @@ interface LiqudityInterface {
interface InstaPoolFeeInterface {
function getFee() external view returns(uint);
function getFeeCollector() external view returns(address);
}
interface CTokenInterface {
@ -298,8 +299,7 @@ contract LiquidityAccess is LiquidityManage {
_transfer(payable(address(liquidityContract)), token, _amt);
liquidityContract.returnLiquidity(_tknAddrs);
_transfer(payable(IndexInterface(getIndexAddr()).master()), token, feeAmt);
_transfer(payable(InstaPoolFeeInterface(getInstaPoolFeeAddr()).getFeeCollector()), token, feeAmt);
setUint(setId, _amt);
@ -358,7 +358,11 @@ contract LiquidityAccess is LiquidityManage {
(uint feeAmt,) = calculateFeeAmt(tokens[i], _amt);
_transfer(payable(address(liquidityContract)), tokens[i], _amt);
_transfer(payable(IndexInterface(getIndexAddr()).master()), tokens[i], feeAmt);
_transfer(
payable(InstaPoolFeeInterface(getInstaPoolFeeAddr()).getFeeCollector()),
tokens[i],
feeAmt
);
setUint(setId[i], _amt);
@ -391,7 +395,11 @@ contract LiquidityAccess is LiquidityManage {
_transfer(payable(address(liquidityContract)), token, _amt);
liquidityContract.returnLiquidity(_tknAddrs);
_transfer(payable(IndexInterface(getIndexAddr()).master()), token, poolFeeAmt);
_transfer(
payable(InstaPoolFeeInterface(getInstaPoolFeeAddr()).getFeeCollector()),
token,
poolFeeAmt
);
_transfer(payable(origin), token, originFeeAmt);

View File

@ -8,24 +8,36 @@ interface IndexInterface {
contract Helpers {
address public constant instaIndex = 0x2971AdFa57b20E5a416aE5a708A8655A9c74f723;
uint64 internal fee;
address internal feeCollector;
modifier isChief {
require(IndexInterface(instaIndex).master() == msg.sender, "not-Master");
_;
}
function changeFee(uint _fee) external isChief {
function changeFee(uint256 _fee) external isChief {
require(fee <= 2 * 10 ** 15, "Fee is more than 0.2%");
fee = uint64(_fee);
}
function changeFeeCollector(address _feeCollector) external isChief {
require(feeCollector != _feeCollector, "Same-feeCollector");
require(_feeCollector != address(0), "feeCollector-is-address(0)");
feeCollector = _feeCollector;
}
}
contract InstaPoolFee is Helpers {
constructor () public {
fee = 9 * 10 ** 14;
feeCollector = IndexInterface(instaIndex).master();
}
function getFee() public view returns (uint256) {
return uint256(fee);
}
function getFeeCollector() public view returns (address) {
return feeCollector;
}
}