Skip to content

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 ​

solidity
constructor() public

_onlyDelegateCall ​

solidity
modifier _onlyDelegateCall()

_check ​

solidity
modifier _check()

_checkIsContractOrNativeAddress ​

solidity
function _checkIsContractOrNativeAddress(address value_) internal view

_checks that value_ address is a contract (which includes address zero check) or native address_

_checkIsContract ​

solidity
function _checkIsContract(address value_) internal view

_checks that value_ address is a contract (which includes address zero check)_

turnOnSmartCol ​

solidity
function turnOnSmartCol(uint256 token0Amt_) public payable

_turnOnSmartCol ​

solidity
function _turnOnSmartCol(uint256 token0Amt_, uint256 centerPrice_) internal

turnOnSmartDebt ​

solidity
function turnOnSmartDebt(uint256 token0Amt_) public

_turnOnSmartDebt ​

solidity
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 ​

solidity
function updateFeeAndRevenueCut(uint256 fee_, uint256 revenueCut_) public

Parameters ​

NameTypeDescription
fee_uint256in 4 decimals, 10000 = 1%
revenueCut_uint256in 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 ​

solidity
function updateRangePercents(uint256 upperPercent_, uint256 lowerPercent_, uint256 shiftTime_) public

Parameters ​

NameTypeDescription
upperPercent_uint256in 4 decimals, 10000 = 1%
lowerPercent_uint256in 4 decimals, 10000 = 1%
shiftTime_uint256in secs, in how much time the upper percent configs change should be fully done

updateThresholdPercent ​

solidity
function updateThresholdPercent(uint256 upperThresholdPercent_, uint256 lowerThresholdPercent_, uint256 thresholdShiftTime_, uint256 shiftTime_) public

Parameters ​

NameTypeDescription
upperThresholdPercent_uint256in 4 decimals, 10000 = 1%
lowerThresholdPercent_uint256in 4 decimals, 10000 = 1%
thresholdShiftTime_uint256in secs, in how much time the threshold percent should take to shift the ranges
shiftTime_uint256in secs, in how much time the upper config changes should be fully done.

updateCenterPriceAddress ​

solidity
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 ​

NameTypeDescription
centerPriceAddress_uint256nonce < X30, this nonce will be used to calculate contract address
percent_uint256
time_uint256

updateHookAddress ​

solidity
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 ​

NameTypeDescription
hookAddress_uint256nonce < X30, this nonce will be used to calculate contract address

updateCenterPriceLimits ​

solidity
function updateCenterPriceLimits(uint256 maxCenterPrice_, uint256 minCenterPrice_) public

updateUtilizationLimit ​

solidity
function updateUtilizationLimit(uint256 token0UtilizationLimit_, uint256 token1UtilizationLimit_) public

updateUserSupplyConfigs ​

solidity
function updateUserSupplyConfigs(struct Structs.UserSupplyConfig[] userSupplyConfigs_) external

updateUserWithdrawalLimit ​

solidity
function updateUserWithdrawalLimit(address user_, uint256 newLimit_) external

sets a new withdrawal limit as the current limit for a certain user

Parameters ​

NameTypeDescription
user_addressuser address for which to update the withdrawal limit
newLimit_uint256new 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 ​

solidity
function updateUserBorrowConfigs(struct Structs.UserBorrowConfig[] userBorrowConfigs_) external

pauseUser ​

solidity
function pauseUser(address user_, bool pauseSupply_, bool pauseBorrow_) public

unpauseUser ​

solidity
function unpauseUser(address user_, bool unpauseSupply_, bool unpauseBorrow_) public

initialize ​

solidity
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 ​

solidity
function pauseSwapAndArbitrage() public

unpauseSwapAndArbitrage ​

solidity
function unpauseSwapAndArbitrage() public

rescueFunds ​

solidity
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 ​

solidity
function updateMaxSupplyShares(uint256 maxSupplyShares_) external

updateMaxBorrowShares ​

solidity
function updateMaxBorrowShares(uint256 maxBorrowShares_) external

toggleOracleActivation ​

solidity
function toggleOracleActivation(bool turnOn_) external

Toggles the oracle activation

Parameters ​

NameTypeDescription
turnOn_boolWhether to turn on or off the oracle