FluidReserveContract ​
Inherits:Error, ReserveContractAuth, UUPSUpgradeable
This contract manages the approval of tokens for use by protocols and the execution of rebalances on protocols
Functions ​
onlyRebalancer ​
Checks that the sender is a rebalancer
modifier onlyRebalancer();constructor ​
constructor();initialize ​
initializes the contract
function initialize(address[] memory _auths, address[] memory _rebalancers, address owner_)
    public
    initializer
    validAddress(owner_);Parameters
| Name | Type | Description | 
|---|---|---|
_auths | address[] | The addresses that have the auth to approve and revoke protocol token allowances | 
_rebalancers | address[] | The addresses that can execute a rebalance on a protocol | 
owner_ | address | owner address is able to upgrade contract and update auth users | 
_authorizeUpgrade ​
function _authorizeUpgrade(address) internal override onlyOwner;renounceOwnership ​
override renounce ownership as it could leave the contract in an unwanted state if called by mistake.
function renounceOwnership() public view override onlyOwner;rebalanceFToken ​
Executes a rebalance on a fToken protocol by calling that protocol's rebalance function
function rebalanceFToken(address protocol_, uint256 value_) public payable onlyRebalancer;Parameters
| Name | Type | Description | 
|---|---|---|
protocol_ | address | The protocol to rebalance | 
value_ | uint256 | any msg.value to send along (as fetched from resolver!) | 
rebalanceVault ​
Executes a rebalance on a vaultT1 protocol by calling that protocol's rebalance function
function rebalanceVault(address protocol_, uint256 value_) public payable onlyRebalancer;Parameters
| Name | Type | Description | 
|---|---|---|
protocol_ | address | The protocol to rebalance | 
value_ | uint256 | any msg.value to send along (as fetched from resolver!) | 
rebalanceDexVault ​
Executes a rebalance on a DEX vault protocol by calling that protocol's rebalance function
function rebalanceDexVault(
    address protocol_,
    uint256 value_,
    int256 colToken0MinMax_,
    int256 colToken1MinMax_,
    int256 debtToken0MinMax_,
    int256 debtToken1MinMax_
) public payable onlyRebalancer;Parameters
| Name | Type | Description | 
|---|---|---|
protocol_ | address | The protocol to rebalance | 
value_ | uint256 | any msg.value to send along (as fetched from resolver!) | 
colToken0MinMax_ | int256 | if vault supply is more than Liquidity Layer then deposit difference through reserve/rebalance contract | 
colToken1MinMax_ | int256 | if vault supply is less than Liquidity Layer then withdraw difference to reserve/rebalance contract | 
debtToken0MinMax_ | int256 | if vault borrow is more than Liquidity Layer then borrow difference to reserve/rebalance contract | 
debtToken1MinMax_ | int256 | if vault borrow is less than Liquidity Layer then payback difference through reserve/rebalance contract | 
rebalanceFTokens ​
calls rebalanceFToken multiple times
don't need onlyRebalancer modifier as it is already checked in rebalanceFToken function
function rebalanceFTokens(address[] calldata protocols_, uint256[] calldata values_) external payable;rebalanceVaults ​
calls rebalanceVault multiple times
don't need onlyRebalancer modifier as it is already checked in rebalanceVault function
function rebalanceVaults(address[] calldata protocols_, uint256[] calldata values_) external payable;rebalanceDexVaults ​
calls rebalanceDexVault multiple times
don't need onlyRebalancer modifier as it is already checked in rebalanceDexVault function
function rebalanceDexVaults(
    address[] calldata protocols_,
    uint256[] calldata values_,
    int256[] calldata colToken0MinMaxs_,
    int256[] calldata colToken1MinMaxs_,
    int256[] calldata debtToken0MinMaxs_,
    int256[] calldata debtToken1MinMaxs_
) external payable;withdrawFunds ​
Withdraws funds from the contract to a specified receiver
This function can only be called by the owner, which is always the Governance address
function withdrawFunds(address[] memory tokens_, uint256[] memory amounts_, address receiver_) external onlyOwner;Parameters
| Name | Type | Description | 
|---|---|---|
tokens_ | address[] | The tokens to withdraw | 
amounts_ | uint256[] | The amounts of each token to withdraw | 
receiver_ | address | The address to receive the withdrawn funds | 
getProtocolTokens ​
Gets the tokens that are approved for use by a protocol
function getProtocolTokens(address protocol_) external view returns (address[] memory result_);Parameters
| Name | Type | Description | 
|---|---|---|
protocol_ | address | The protocol to get the tokens for | 
Returns
| Name | Type | Description | 
|---|---|---|
result_ | address[] | The tokens that are approved for use by the protocol | 
getProtocolAllowances ​
Gets the allowances that are approved to a protocol
function getProtocolAllowances(address protocol_) public view returns (TokenAllowance[] memory allowances_);Parameters
| Name | Type | Description | 
|---|---|---|
protocol_ | address | The protocol to get the tokens for | 
Returns
| Name | Type | Description | 
|---|---|---|
allowances_ | TokenAllowance[] | The tokens that are approved for use by the protocol | 
getAllProtocolAllowances ​
Gets the allowances that are approved to a protocol
function getAllProtocolAllowances() public view returns (ProtocolTokenAllowance[] memory allowances_);Returns
| Name | Type | Description | 
|---|---|---|
allowances_ | ProtocolTokenAllowance[] | The tokens that are approved for use by all the protocols | 
receive ​
allow receive native token
receive() external payable;
