Skip to content

FluidPauseAuthDex ​

Git Source

Inherits:Variables, Events, Error, BasicValidations, IFluidPauseAuthDex

Title: FluidPauseAuthDex

Executes pause/unpause operations at the DEX layer. Callable only by the main FluidPauseAuth contract. Emits only the borrow-limit freeze / restore events; the main contract emits the rest from return values.

Functions ​

onlyPauseAuthContract ​

solidity
modifier onlyPauseAuthContract() ;

constructor ​

solidity
constructor(
    address liquidity_,
    address vaultFactory_,
    address dexFactory_,
    address smartLendingFactory_,
    address authGate_
)
    validAddress(liquidity_)
    validAddress(vaultFactory_)
    validAddress(dexFactory_)
    validAddress(smartLendingFactory_)
    validAddress(authGate_);

setPauseAuthContract ​

Sets the FluidPauseAuth main contract address. Can only be called once (permanently locked after).

solidity
function setPauseAuthContract(address pauseAuth_) external validAddress(pauseAuth_);

isDexUserBorrowFrozen ​

Whether user_'s borrow limits on dex_ are frozen by this contract: a snapshot is held and the pool carries the preset. The preset alone means governance parked the user; nothing is restored then. False if the config changed under a held snapshot; the next unpause then only drops it.

solidity
function isDexUserBorrowFrozen(address dex_, address user_) external view returns (bool);

pauseVault ​

Pauses selected vault operations at the DEX layer.

solidity
function pauseVault(uint256 vaultId_, bool pauseSupply_, bool pauseWithdraw_, bool pauseBorrow_, bool pausePayback_)
    external
    override
    onlyPauseAuthContract
    returns (address vault_, bool actedSupply_, bool actedWithdraw_, bool actedBorrow_, bool actedPayback_);

Parameters

NameTypeDescription
vaultId_uint256Vault ID to pause.
pauseSupply_boolWhether to pause supply/deposit operations.
pauseWithdraw_boolWhether to pause withdraw operations.
pauseBorrow_boolWhether to pause borrow operations.
pausePayback_boolWhether to pause payback operations.

Returns

NameTypeDescription
vault_addressResolved vault address.
actedSupply_boolWhether supply/deposit pause state changed.
actedWithdraw_boolWhether withdraw pause state changed.
actedBorrow_boolWhether borrow state changed (pause bit, or limits freeze for borrow-only).
actedPayback_boolWhether payback pause state changed.

unpauseVault ​

Unpauses selected vault operations at the DEX layer.

solidity
function unpauseVault(
    uint256 vaultId_,
    bool unpauseSupply_,
    bool unpauseWithdraw_,
    bool unpauseBorrow_,
    bool unpausePayback_
)
    external
    override
    onlyPauseAuthContract
    returns (address vault_, bool actedSupply_, bool actedWithdraw_, bool actedBorrow_, bool actedPayback_);

Parameters

NameTypeDescription
vaultId_uint256Vault ID to unpause.
unpauseSupply_boolWhether to unpause supply/deposit operations.
unpauseWithdraw_boolWhether to unpause withdraw operations.
unpauseBorrow_boolWhether to unpause borrow operations.
unpausePayback_boolWhether to unpause payback operations.

Returns

NameTypeDescription
vault_addressResolved vault address.
actedSupply_boolWhether supply/deposit unpause state changed.
actedWithdraw_boolWhether withdraw unpause state changed.
actedBorrow_boolWhether borrow state changed (pause bit, or frozen limits restored).
actedPayback_boolWhether payback unpause state changed.

pauseSwapAndArbitrage ​

Pauses swap and arbitrage on a DEX pool.

solidity
function pauseSwapAndArbitrage(uint256 dexId_)
    external
    override
    onlyPauseAuthContract
    returns (address dex_, bool acted_);

Parameters

NameTypeDescription
dexId_uint256DEX ID to pause.

Returns

NameTypeDescription
dex_addressResolved DEX address.
acted_boolWhether swap and arbitrage pause state changed.

unpauseSwapAndArbitrage ​

Unpauses swap and arbitrage on a DEX pool.

solidity
function unpauseSwapAndArbitrage(uint256 dexId_)
    external
    override
    onlyPauseAuthContract
    returns (address dex_, bool acted_);

Parameters

NameTypeDescription
dexId_uint256DEX ID to unpause.

Returns

NameTypeDescription
dex_addressResolved DEX address.
acted_boolWhether swap and arbitrage unpause state changed.

pauseSmartLending ​

Pauses the smart lending contract on a DEX pool; both flags must be set, else 100143.

solidity
function pauseSmartLending(uint256 dexId_, bool pauseSupply_, bool pauseWithdraw_)
    external
    override
    onlyPauseAuthContract
    returns (address dex_, address smartLending_, bool actedSupply_, bool actedWithdraw_);

Parameters

NameTypeDescription
dexId_uint256DEX ID whose smart lending contract should be paused.
pauseSupply_boolWhether to pause smart lending supply/deposit operations.
pauseWithdraw_boolWhether to pause smart lending withdraw operations.

Returns

NameTypeDescription
dex_addressResolved DEX address.
smartLending_addressResolved smart lending address.
actedSupply_boolWhether smart lending supply/deposit pause state changed.
actedWithdraw_boolWhether smart lending withdraw pause state changed.

unpauseSmartLending ​

Unpauses the smart lending contract on a DEX pool; both flags must be set, else 100143.

solidity
function unpauseSmartLending(uint256 dexId_, bool unpauseSupply_, bool unpauseWithdraw_)
    external
    override
    onlyPauseAuthContract
    returns (address dex_, address smartLending_, bool actedSupply_, bool actedWithdraw_);

Parameters

NameTypeDescription
dexId_uint256DEX ID whose smart lending contract should be unpaused.
unpauseSupply_boolWhether to unpause smart lending supply/deposit operations.
unpauseWithdraw_boolWhether to unpause smart lending withdraw operations.

Returns

NameTypeDescription
dex_addressResolved DEX address.
smartLending_addressResolved smart lending address.
actedSupply_boolWhether smart lending supply/deposit unpause state changed.
actedWithdraw_boolWhether smart lending withdraw unpause state changed.

pauseUser ​

Pauses a user's selected operations on a DEX pool. Reverts PauseAuthDex__InvalidParams if a requested side has no row on the pool.

solidity
function pauseUser(
    uint256 dexId_,
    address user_,
    bool pauseSupply_,
    bool pauseWithdraw_,
    bool pauseBorrow_,
    bool pausePayback_
)
    external
    override
    onlyPauseAuthContract
    returns (address dex_, bool actedSupply_, bool actedWithdraw_, bool actedBorrow_, bool actedPayback_);

Parameters

NameTypeDescription
dexId_uint256DEX ID where the user should be paused.
user_addressUser address to pause on the DEX.
pauseSupply_boolWhether to pause supply/deposit operations.
pauseWithdraw_boolWhether to pause withdraw operations.
pauseBorrow_boolWhether to pause borrow operations.
pausePayback_boolWhether to pause payback operations.

Returns

NameTypeDescription
dex_addressResolved DEX address.
actedSupply_boolWhether supply/deposit pause state changed.
actedWithdraw_boolWhether withdraw pause state changed.
actedBorrow_boolWhether borrow state changed (pause bit, or limits freeze for borrow-only).
actedPayback_boolWhether payback pause state changed.

unpauseUser ​

Unpauses a user's selected operations on a DEX pool. Reverts PauseAuthDex__InvalidParams if a requested side has no row on the pool.

solidity
function unpauseUser(
    uint256 dexId_,
    address user_,
    bool unpauseSupply_,
    bool unpauseWithdraw_,
    bool unpauseBorrow_,
    bool unpausePayback_
)
    external
    override
    onlyPauseAuthContract
    returns (address dex_, bool actedSupply_, bool actedWithdraw_, bool actedBorrow_, bool actedPayback_);

Parameters

NameTypeDescription
dexId_uint256DEX ID where the user should be unpaused.
user_addressUser address to unpause on the DEX.
unpauseSupply_boolWhether to unpause supply/deposit operations.
unpauseWithdraw_boolWhether to unpause withdraw operations.
unpauseBorrow_boolWhether to unpause borrow operations.
unpausePayback_boolWhether to unpause payback operations.

Returns

NameTypeDescription
dex_addressResolved DEX address.
actedSupply_boolWhether supply/deposit unpause state changed.
actedWithdraw_boolWhether withdraw unpause state changed.
actedBorrow_boolWhether borrow state changed (pause bit, or frozen limits restored).
actedPayback_boolWhether payback unpause state changed.

_setSwapPauseState ​

Shared swap & arbitrage pause/unpause logic. wantsPaused_ == true → pause, false → unpause.

solidity
function _setSwapPauseState(uint256 dexId_, bool wantsPaused_) internal returns (address dex_, bool acted_);

_setVaultPauseState ​

Shared vault pause/unpause logic at DEX layer. wantsPaused_ == true → pause, false → unpause.

solidity
function _setVaultPauseState(
    uint256 vaultId_,
    bool pauseSupply_,
    bool pauseWithdraw_,
    bool pauseBorrow_,
    bool pausePayback_,
    bool wantsPaused_
) internal returns (address vault_, bool actedSupply_, bool actedWithdraw_, bool actedBorrow_, bool actedPayback_);

_setDexUserPauseState ​

whole sides toggle the pause bit; borrow without payback freezes limits; other half sides revert

solidity
function _setDexUserPauseState(
    address dex_,
    address user_,
    bool actSupply_,
    bool actWithdraw_,
    bool actBorrow_,
    bool actPayback_,
    bool wantsPaused_
) internal returns (bool actedSupply_, bool actedWithdraw_, bool actedBorrow_, bool actedPayback_);

_freezeDexUserBorrow ​

no-op for a missing row, a paused side (already stronger) and a leg already carrying the preset

solidity
function _freezeDexUserBorrow(address dex_, address user_) internal returns (bool);

_restoreDexUserBorrow ​

a pool off the preset was re-configured behind the freeze by another auth; that newer config wins

solidity
function _restoreDexUserBorrow(address dex_, address user_) internal returns (bool);

_revertIfNoDexUserRow ​

the pass-throughs name an exact pair, so like Liquidity's they revert for a side with no row

solidity
function _revertIfNoDexUserRow(address dex_, address user_, bool supplySide_, bool borrowSide_) internal view;

_dexUserBorrowData ​

solidity
function _dexUserBorrowData(address dex_, address user_) internal view returns (uint256);

_isFreezeConfig ​

solidity
function _isFreezeConfig(uint256 userBorrowData_) internal pure returns (bool);

_dexUserSideChanges ​

Whether the whole isBorrow_ side of user_ on dex_ would change state. False for an undefined user, whose side cannot be toggled.

solidity
function _dexUserSideChanges(address dex_, address user_, bool isBorrow_, bool wantsPaused_)
    internal
    view
    returns (bool);

_setSmartLendingPauseState ​

Shared smart lending pause/unpause logic. wantsPaused_ == true → pause, false → unpause.

solidity
function _setSmartLendingPauseState(uint256 dexId_, bool actSupply_, bool actWithdraw_, bool wantsPaused_)
    internal
    returns (address dex_, address smartLending_, bool actedSupply_, bool actedWithdraw_);

_getDexAddress ​

Reverts only for id 0; an undeployed id resolves to a codeless address that reverts on first call.

solidity
function _getDexAddress(uint256 dexId_) internal view returns (address dex_);

_isDexPausable ​

Returns whether a DEX address is a deployed DEX that can be interacted with.

solidity
function _isDexPausable(address dex_) internal view returns (bool);

_isVaultT1 ​

Returns whether vault_ is a T1 vault. Falls back to true on revert (older vaults without TYPE()).

solidity
function _isVaultT1(address vault_) internal view returns (bool);

_getVaultDexes ​

Resolves a vault to its connected supply-side and borrow-side DEX addresses. Reverts if unresolvable. Returns address(0) for sides that go through Liquidity instead of a DEX. T1 vaults always use Liquidity directly, so both returned values are address(0).

solidity
function _getVaultDexes(address vault_) internal view returns (address supplyDex_, address borrowDex_);