Lending Factory
IFluidLendingFactory
allTokens
function allTokens() external view returns (address[])
list of all created tokens
fTokenTypes
function fTokenTypes() external view returns (string[])
list of all fToken types that can be deployed
fTokenCreationCode
function fTokenCreationCode(string fTokenType_) external view returns (bytes)
returns the creation code for a certain fTokenType_
LIQUIDITY
function LIQUIDITY() external view returns (contract IFluidLiquidity)
address of the Liquidity contract.
computeToken
function computeToken(address asset_, string fTokenType_) external view returns (address token_)
computes deterministic token address for asset_
for a lending protocol
Parameters
Name | Type | Description |
---|---|---|
asset_ | address | address of the asset |
fTokenType_ | string | type of fToken: - if it's the native token, it should use NativeUnderlying - otherwise it should use fToken - could be more types available, check fTokenTypes() |
Return Values
Name | Type | Description |
---|---|---|
token_ | address | detemrinistic address of the computed token |
IFluidLendingFactoryAdmin
isAuth
function isAuth(address auth_) external view returns (bool)
reads if a certain auth_
address is an allowed auth or not. Owner is auth by default.
setAuth
function setAuth(address auth_, bool allowed_) external
Sets an address as allowed auth or not. Only callable by owner.
Parameters
Name | Type | Description |
---|---|---|
auth_ | address | address to set auth value for |
allowed_ | bool | bool flag for whether address is allowed as auth or not |
isDeployer
function isDeployer(address deployer_) external view returns (bool)
reads if a certain deployer_
address is an allowed deployer or not. Owner is deployer by default.
setDeployer
function setDeployer(address deployer_, bool allowed_) external
Sets an address as allowed deployer or not. Only callable by owner.
Parameters
Name | Type | Description |
---|---|---|
deployer_ | address | address to set deployer value for |
allowed_ | bool | bool flag for whether address is allowed as deployer or not |
setFTokenCreationCode
function setFTokenCreationCode(string fTokenType_, bytes creationCode_) external
Sets the creationCode_
bytecode for a certain fTokenType_
. Only callable by auths.
Parameters
Name | Type | Description |
---|---|---|
fTokenType_ | string | the fToken Type used to refer the creation code |
creationCode_ | bytes | contract creation code. can be set to bytes(0) to remove a previously available fTokenType_ |
createToken
function createToken(address asset_, string fTokenType_, bool isNativeUnderlying_) external returns (address token_)
creates token for asset_
for a lending protocol with interest. Only callable by deployers.
Parameters
Name | Type | Description |
---|---|---|
asset_ | address | address of the asset |
fTokenType_ | string | type of fToken: - if it's the native token, it should use NativeUnderlying - otherwise it should use fToken - could be more types available, check fTokenTypes() |
isNativeUnderlying_ | bool | flag to signal fToken type that uses native underlying at Liquidity |
Return Values
Name | Type | Description |
---|---|---|
token_ | address | address of the created token |
FluidLendingFactory
creates Fluid lending protocol fTokens, which are interacting with Fluid Liquidity.
fTokens are ERC20 & ERC4626 compatible tokens that allow to deposit to Fluid Liquidity to earn interest.
Tokens are created at a deterministic address (see computeToken()
), only executable by allow-listed auths.
Note the deployed token starts out with no config at Liquidity contract. This must be done by Liquidity auths in a separate step, otherwise no deposits will be possible. This contract is not upgradeable. It supports adding new fToken creation codes for future new fToken types.
constructor
constructor(contract IFluidLiquidity liquidity_, address owner_) public
initialize liquidity contract address & owner
computeToken
function computeToken(address asset_, string fTokenType_) public view returns (address token_)
computes deterministic token address for asset_
for a lending protocol
Parameters
Name | Type | Description |
---|---|---|
asset_ | address | address of the asset |
fTokenType_ | string | type of fToken: - if it's the native token, it should use NativeUnderlying - otherwise it should use fToken - could be more types available, check fTokenTypes() |
Return Values
Name | Type | Description |
---|---|---|
token_ | address | detemrinistic address of the computed token |
ErrorTypes
LendingFactory__InvalidParams
thrown when a method is called with invalid params
uint256 internal constant LendingFactory__InvalidParams = 22001;
LendingFactory__ZeroAddress
thrown when the provided input param address is zero
uint256 internal constant LendingFactory__ZeroAddress = 22002;
LendingFactory__TokenExists
thrown when the token already exists
uint256 internal constant LendingFactory__TokenExists = 22003;
LendingFactory__LiquidityNotConfigured
thrown when the fToken has not yet been configured at Liquidity
uint256 internal constant LendingFactory__LiquidityNotConfigured = 22004;
LendingFactory__Unauthorized
thrown when an unauthorized caller is trying to execute an auth-protected method
uint256 internal constant LendingFactory__Unauthorized = 22005;