Skip to content

FluidSmartLendingFactory ​

Git Source

Inherits:Constants, Variables, Events, Error

Functions ​

validAddress ​

Validates that an address is not the zero address

solidity
modifier validAddress(address value_);

constructor ​

solidity
constructor(address dexFactory_, address liquidity_, address owner_)
    validAddress(dexFactory_)
    validAddress(liquidity_)
    validAddress(owner_)
    Variables(owner_);

onlyDeployers ​

Validates that msg.sender is deployer or owner

solidity
modifier onlyDeployers();

allTokens ​

List of all created tokens

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

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

solidity
function isDeployer(address deployer_) public view returns (bool);

smartLendingCreationCode ​

Retrieves the creation code for the SmartLending contract

solidity
function smartLendingCreationCode() public view returns (bytes memory);

updateDeployer ​

Sets an address as allowed deployer or not. Only callable by owner.

solidity
function updateDeployer(address deployer_, bool allowed_) external onlyOwner validAddress(deployer_);

Parameters

NameTypeDescription
deployer_addressAddress to set deployer value for
allowed_boolBool 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.

solidity
function updateSmartLendingAuth(address smartLending_, address auth_, bool allowed_)
    external
    validAddress(smartLending_)
    validAddress(auth_)
    onlyOwner;

Parameters

NameTypeDescription
smartLending_addressThe address of the SmartLending contract
auth_addressThe address to be updated
allowed_boolThe new authorization status

setSmartLendingCreationCode ​

Sets the creationCode_ bytecode for new SmartLending contracts. Only callable by owner.

solidity
function setSmartLendingCreationCode(bytes calldata creationCode_) external onlyOwner;

Parameters

NameTypeDescription
creationCode_bytesNew SmartLending contract creation code.

spell ​

Spell allows owner aka governance to do any arbitrary call on factory

solidity
function spell(address target_, bytes memory data_) external onlyOwner returns (bytes memory response_);

Parameters

NameTypeDescription
target_addressAddress to which the call needs to be delegated
data_bytesData to execute at the delegated address

deploy ​

Deploys a new SmartLending contract. Only callable by deployers.

solidity
function deploy(uint256 dexId_) public onlyDeployers returns (address smartLending_);

Parameters

NameTypeDescription
dexId_uint256The ID of the DEX for which the smart lending wrapper is being deployed

Returns

NameTypeDescription
smartLending_addressThe newly deployed SmartLending contract

getSmartLendingAddress ​

Computes the address of a SmartLending contract based on a given dexId.

solidity
function getSmartLendingAddress(uint256 dexId_) public view returns (address);

Parameters

NameTypeDescription
dexId_uint256The ID of the DEX for which the SmartLending contract address is being computed.

Returns

NameTypeDescription
<none>addressThe computed address of the SmartLending contract.

totalSmartLendings ​

Returns the total number of SmartLending contracts deployed by the factory.

solidity
function totalSmartLendings() external view returns (uint256);

Returns

NameTypeDescription
<none>uint256The total number of SmartLending contracts deployed.

isSmartLending ​

Checks if a given address (smartLending_) corresponds to a valid smart lending.

solidity
function isSmartLending(address smartLending_) public view returns (bool);

Parameters

NameTypeDescription
smartLending_addressThe smart lending address to check.

Returns

NameTypeDescription
<none>boolReturns true if the given address corresponds to a valid smart lending, otherwise false.

_getSalt ​

unique deployment salt for the smart lending

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

solidity
function _deploy(bytes memory bytecode_) internal returns (address address_);

Parameters

NameTypeDescription
bytecode_bytesThe bytecode of the contract to be deployed.

Returns

NameTypeDescription
address_addressReturns the address of the deployed contract.