FluidSmartLendingFactory ​
Inherits:Constants, Variables, Events, Error
Functions ​
validAddress ​
Validates that an address is not the zero address
modifier validAddress(address value_);constructor ​
constructor(address dexFactory_, address liquidity_, address owner_)
validAddress(dexFactory_)
validAddress(liquidity_)
validAddress(owner_)
Variables(owner_);onlyDeployers ​
Validates that msg.sender is deployer or owner
modifier onlyDeployers();allTokens ​
List of all created tokens
function allTokens() public view returns (address[] memory);isSmartLendingAuth ​
Reads if a certain auth_ address is an allowed auth for smartLending_ or not. Owner is auth by default.
function isSmartLendingAuth(address smartLending_, address auth_) public view returns (bool);isDeployer ​
Reads if a certain deployer_ address is an allowed deployer or not. Owner is deployer by default.
function isDeployer(address deployer_) public view returns (bool);smartLendingCreationCode ​
Retrieves the creation code for the SmartLending contract
function smartLendingCreationCode() public view returns (bytes memory);updateDeployer ​
Sets an address as allowed deployer or not. Only callable by owner.
function updateDeployer(address deployer_, bool allowed_) external onlyOwner validAddress(deployer_);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 |
updateSmartLendingAuth ​
Updates the authorization status of an address for a SmartLending contract. Only callable by owner.
function updateSmartLendingAuth(address smartLending_, address auth_, bool allowed_)
external
validAddress(smartLending_)
validAddress(auth_)
onlyOwner;Parameters
| Name | Type | Description |
|---|---|---|
smartLending_ | address | The address of the SmartLending contract |
auth_ | address | The address to be updated |
allowed_ | bool | The new authorization status |
setSmartLendingCreationCode ​
Sets the creationCode_ bytecode for new SmartLending contracts. Only callable by owner.
function setSmartLendingCreationCode(bytes calldata creationCode_) external onlyOwner;Parameters
| Name | Type | Description |
|---|---|---|
creationCode_ | bytes | New SmartLending contract creation code. |
spell ​
Spell allows owner aka governance to do any arbitrary call on factory
function spell(address target_, bytes memory data_) external onlyOwner returns (bytes memory response_);Parameters
| Name | Type | Description |
|---|---|---|
target_ | address | Address to which the call needs to be delegated |
data_ | bytes | Data to execute at the delegated address |
deploy ​
Deploys a new SmartLending contract. Only callable by deployers.
function deploy(uint256 dexId_) public onlyDeployers returns (address smartLending_);Parameters
| Name | Type | Description |
|---|---|---|
dexId_ | uint256 | The ID of the DEX for which the smart lending wrapper is being deployed |
Returns
| Name | Type | Description |
|---|---|---|
smartLending_ | address | The newly deployed SmartLending contract |
getSmartLendingAddress ​
Computes the address of a SmartLending contract based on a given dexId.
function getSmartLendingAddress(uint256 dexId_) public view returns (address);Parameters
| Name | Type | Description |
|---|---|---|
dexId_ | uint256 | The ID of the DEX for which the SmartLending contract address is being computed. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | address | The computed address of the SmartLending contract. |
totalSmartLendings ​
Returns the total number of SmartLending contracts deployed by the factory.
function totalSmartLendings() external view returns (uint256);Returns
| Name | Type | Description |
|---|---|---|
<none> | uint256 | The total number of SmartLending contracts deployed. |
isSmartLending ​
Checks if a given address (smartLending_) corresponds to a valid smart lending.
function isSmartLending(address smartLending_) public view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
smartLending_ | address | The smart lending address to check. |
Returns
| Name | Type | Description |
|---|---|---|
<none> | bool | Returns true if the given address corresponds to a valid smart lending, otherwise false. |
_getSalt ​
unique deployment salt for the smart lending
function _getSalt(uint256 dexId_) internal pure returns (bytes32);_deploy ​
Deploys a contract using the CREATE opcode with the provided bytecode (bytecode_). This is an internal function, meant to be used within the contract to facilitate the deployment of other contracts.
function _deploy(bytes memory bytecode_) internal returns (address address_);Parameters
| Name | Type | Description |
|---|---|---|
bytecode_ | bytes | The bytecode of the contract to be deployed. |
Returns
| Name | Type | Description |
|---|---|---|
address_ | address | Returns the address of the deployed contract. |

