FluidDexT1Admin ​
Fluid Dex protocol Admin Module contract. Implements admin related methods to set pool configs Methods are limited to be called via delegateCall only. Dex CoreModule ("DexT1" contract) is expected to call the methods implemented here after checking the msg.sender is authorized.
constructor ​
constructor() public
_onlyDelegateCall ​
modifier _onlyDelegateCall()
_check ​
modifier _check()
_checkIsContractOrNativeAddress ​
function _checkIsContractOrNativeAddress(address value_) internal view
_checks that value_
address is a contract (which includes address zero check) or native address_
_checkIsContract ​
function _checkIsContract(address value_) internal view
_checks that value_
address is a contract (which includes address zero check)_
turnOnSmartCol ​
function turnOnSmartCol(uint256 token0Amt_) public payable
_turnOnSmartCol ​
function _turnOnSmartCol(uint256 token0Amt_, uint256 centerPrice_) internal
turnOnSmartDebt ​
function turnOnSmartDebt(uint256 token0Amt_) public
_turnOnSmartDebt ​
function _turnOnSmartDebt(uint256 token0Amt_, uint256 centerPrice_) internal
Can only borrow if DEX pool address borrow config is added in Liquidity Layer for both the tokens else Liquidity Layer will revert governance will have access to _turnOnSmartDebt, technically governance here can borrow as much as limits are set so it's governance responsibility that it borrows small amount between $100 - $10,000 Borrowing in 50:50 ratio (doesn't matter if pool configuration is set to 20:80, 30:70, etc, external swap will arbitrage & balance the pool)
updateFeeAndRevenueCut ​
function updateFeeAndRevenueCut(uint256 fee_, uint256 revenueCut_) public
Parameters ​
Name | Type | Description |
---|---|---|
fee_ | uint256 | in 4 decimals, 10000 = 1% |
revenueCut_ | uint256 | in 4 decimals, 100000 = 10%, 10% cut on fee_, so if fee is 1% and cut is 10% then cut in swap amount will be 10% of 1% = 0.1% |
updateRangePercents ​
function updateRangePercents(uint256 upperPercent_, uint256 lowerPercent_, uint256 shiftTime_) public
Parameters ​
Name | Type | Description |
---|---|---|
upperPercent_ | uint256 | in 4 decimals, 10000 = 1% |
lowerPercent_ | uint256 | in 4 decimals, 10000 = 1% |
shiftTime_ | uint256 | in secs, in how much time the upper percent configs change should be fully done |
updateThresholdPercent ​
function updateThresholdPercent(uint256 upperThresholdPercent_, uint256 lowerThresholdPercent_, uint256 thresholdShiftTime_, uint256 shiftTime_) public
Parameters ​
Name | Type | Description |
---|---|---|
upperThresholdPercent_ | uint256 | in 4 decimals, 10000 = 1% |
lowerThresholdPercent_ | uint256 | in 4 decimals, 10000 = 1% |
thresholdShiftTime_ | uint256 | in secs, in how much time the threshold percent should take to shift the ranges |
shiftTime_ | uint256 | in secs, in how much time the upper config changes should be fully done. |
updateCenterPriceAddress ​
function updateCenterPriceAddress(uint256 centerPriceAddress_, uint256 percent_, uint256 time_) public
we are storing uint nonce from which we will calculate the contract address, to store an address we need 160 bits which is quite a lot of storage slot
Parameters ​
Name | Type | Description |
---|---|---|
centerPriceAddress_ | uint256 | nonce < X30, this nonce will be used to calculate contract address |
percent_ | uint256 | |
time_ | uint256 |
updateHookAddress ​
function updateHookAddress(uint256 hookAddress_) public
we are storing uint nonce from which we will calculate the contract address, to store an address we need 160 bits which is quite a lot of storage slot
Parameters ​
Name | Type | Description |
---|---|---|
hookAddress_ | uint256 | nonce < X30, this nonce will be used to calculate contract address |
updateCenterPriceLimits ​
function updateCenterPriceLimits(uint256 maxCenterPrice_, uint256 minCenterPrice_) public
updateUtilizationLimit ​
function updateUtilizationLimit(uint256 token0UtilizationLimit_, uint256 token1UtilizationLimit_) public
updateUserSupplyConfigs ​
function updateUserSupplyConfigs(struct Structs.UserSupplyConfig[] userSupplyConfigs_) external
updateUserWithdrawalLimit ​
function updateUserWithdrawalLimit(address user_, uint256 newLimit_) external
sets a new withdrawal limit as the current limit for a certain user
Parameters ​
Name | Type | Description |
---|---|---|
user_ | address | user address for which to update the withdrawal limit |
newLimit_ | uint256 | new limit until which user supply can decrease to. Important: input in raw. Must account for exchange price in input param calculation. Note any limit that is < max expansion or > current user supply will set max expansion limit or current user supply as limit respectively. - set 0 to make maximum possible withdrawable: instant full expansion, and if that goes below base limit then fully down to 0. - set type(uint256).max to make current withdrawable 0 (sets current user supply as limit). |
updateUserBorrowConfigs ​
function updateUserBorrowConfigs(struct Structs.UserBorrowConfig[] userBorrowConfigs_) external
pauseUser ​
function pauseUser(address user_, bool pauseSupply_, bool pauseBorrow_) public
unpauseUser ​
function unpauseUser(address user_, bool unpauseSupply_, bool unpauseBorrow_) public
initialize ​
function initialize(struct Structs.InitializeVariables i_) public payable
note we have not added updateUtilizationLimit in the params here because struct of InitializeVariables already has 16 variables we might skip adding it and let it update through the indepdent function to keep initialize struct simple
pauseSwapAndArbitrage ​
function pauseSwapAndArbitrage() public
unpauseSwapAndArbitrage ​
function unpauseSwapAndArbitrage() public
rescueFunds ​
function rescueFunds(address token_) external
sends any potentially stuck funds to Liquidity contract.
this contract never holds any funds as all operations send / receive funds from user <-> Liquidity.
updateMaxSupplyShares ​
function updateMaxSupplyShares(uint256 maxSupplyShares_) external
updateMaxBorrowShares ​
function updateMaxBorrowShares(uint256 maxBorrowShares_) external
toggleOracleActivation ​
function toggleOracleActivation(bool turnOn_) external
Toggles the oracle activation
Parameters ​
Name | Type | Description |
---|---|---|
turnOn_ | bool | Whether to turn on or off the oracle |