mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Added variable fee collector address
This commit is contained in:
parent
d22662aadb
commit
2c26d733c7
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user