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 {
|
interface InstaPoolFeeInterface {
|
||||||
function getFee() external view returns(uint);
|
function getFee() external view returns(uint);
|
||||||
|
function getFeeCollector() external view returns(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CTokenInterface {
|
interface CTokenInterface {
|
||||||
|
@ -298,8 +299,7 @@ contract LiquidityAccess is LiquidityManage {
|
||||||
_transfer(payable(address(liquidityContract)), token, _amt);
|
_transfer(payable(address(liquidityContract)), token, _amt);
|
||||||
liquidityContract.returnLiquidity(_tknAddrs);
|
liquidityContract.returnLiquidity(_tknAddrs);
|
||||||
|
|
||||||
_transfer(payable(IndexInterface(getIndexAddr()).master()), token, feeAmt);
|
_transfer(payable(InstaPoolFeeInterface(getInstaPoolFeeAddr()).getFeeCollector()), token, feeAmt);
|
||||||
|
|
||||||
|
|
||||||
setUint(setId, _amt);
|
setUint(setId, _amt);
|
||||||
|
|
||||||
|
@ -358,7 +358,11 @@ contract LiquidityAccess is LiquidityManage {
|
||||||
(uint feeAmt,) = calculateFeeAmt(tokens[i], _amt);
|
(uint feeAmt,) = calculateFeeAmt(tokens[i], _amt);
|
||||||
|
|
||||||
_transfer(payable(address(liquidityContract)), 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);
|
setUint(setId[i], _amt);
|
||||||
|
|
||||||
|
@ -391,7 +395,11 @@ contract LiquidityAccess is LiquidityManage {
|
||||||
|
|
||||||
_transfer(payable(address(liquidityContract)), token, _amt);
|
_transfer(payable(address(liquidityContract)), token, _amt);
|
||||||
liquidityContract.returnLiquidity(_tknAddrs);
|
liquidityContract.returnLiquidity(_tknAddrs);
|
||||||
_transfer(payable(IndexInterface(getIndexAddr()).master()), token, poolFeeAmt);
|
_transfer(
|
||||||
|
payable(InstaPoolFeeInterface(getInstaPoolFeeAddr()).getFeeCollector()),
|
||||||
|
token,
|
||||||
|
poolFeeAmt
|
||||||
|
);
|
||||||
_transfer(payable(origin), token, originFeeAmt);
|
_transfer(payable(origin), token, originFeeAmt);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,24 +8,36 @@ interface IndexInterface {
|
||||||
contract Helpers {
|
contract Helpers {
|
||||||
address public constant instaIndex = 0x2971AdFa57b20E5a416aE5a708A8655A9c74f723;
|
address public constant instaIndex = 0x2971AdFa57b20E5a416aE5a708A8655A9c74f723;
|
||||||
uint64 internal fee;
|
uint64 internal fee;
|
||||||
|
address internal feeCollector;
|
||||||
|
|
||||||
modifier isChief {
|
modifier isChief {
|
||||||
require(IndexInterface(instaIndex).master() == msg.sender, "not-Master");
|
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%");
|
require(fee <= 2 * 10 ** 15, "Fee is more than 0.2%");
|
||||||
fee = uint64(_fee);
|
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 {
|
contract InstaPoolFee is Helpers {
|
||||||
constructor () public {
|
constructor () public {
|
||||||
fee = 9 * 10 ** 14;
|
fee = 9 * 10 ** 14;
|
||||||
|
feeCollector = IndexInterface(instaIndex).master();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFee() public view returns (uint256) {
|
function getFee() public view returns (uint256) {
|
||||||
return uint256(fee);
|
return uint256(fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFeeCollector() public view returns (address) {
|
||||||
|
return feeCollector;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user