IntegrationFactory
Inherits: IIntegrationFactory, Administrable, Initializable, Implementation
Author: gauthiermyr @ Kiln
IntegrationFactory deploys predefined integrations contracts through a ProxyFactory.
Unstructured Storage Friendly
State Variables
$factories
Mapping of deployed factories for channels
Type: mapping(bytes32 -> address)
Slot: keccak256(bytes("IntegrationFactory.1.factories")) - 1
types.Mapping internal constant $factories = types.Mapping.wrap(0x4e2544bc56f6c4fa0a65524c59b2051825cbd54dcbec5c39527253c4ae3998cb);
$implementations
Implementations mapping. Gives implementation address for a given channel
Type: mapping(bytes32 -> address)
Slot: keccak256(bytes("IntegrationFactory.1.implementations")) - 1
types.Mapping internal constant $implementations = types.Mapping.wrap(0x8185f5197e680e22bd57ca6481ef122b0bbaabba72f7030265b674bc0e43b011);
$outdated
Gives true for a channel if the related implementation requires a factory update
Type: mapping(bytes32 -> address)
Slot: keccak256(bytes("IntegrationFactory.1.outdated")) - 1
types.Mapping internal constant $outdated = types.Mapping.wrap(0xfa6a2da202829c8efa37af360272640192c97d0eaad911d49d5a3827eeb49e23);
$deployers
Mapping of accounts allowed to deploy integrations :
Type: mapping(address -> bool)
Slot: keccak256(bytes("IntegrationFactory.1.deployers")) - 1
types.Mapping internal constant $deployers = types.Mapping.wrap(0xb7fa6aee54ea33d353c1a47f0af14ba42a132b7ecbca87c0f3c74f23231367be);
CHANNEL_NATIVE_20_VPOOL
Channel identifier for Native vPool implementation 0x4e41544956455f32305f76504f4f4c0000000000000000000000000000000000
bytes32 constant CHANNEL_NATIVE_20_VPOOL = bytes32(abi.encodePacked("NATIVE_20_vPOOL"));
CHANNEL_LIQUID_20_A_VPOOL
Channel identifier for liquid ERC20 aToken implementation 0x4c49515549445f32305f415f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_LIQUID_20_A_VPOOL = bytes32(abi.encodePacked("LIQUID_20_A_vPOOL"));
CHANNEL_LIQUID_20_C_VPOOL
Channel identifier for liquid ERC20 cToken implementation 0x4c49515549445f32305f435f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_LIQUID_20_C_VPOOL = bytes32(abi.encodePacked("LIQUID_20_C_vPOOL"));
CHANNEL_NATIVE_1155_VPOOL
Channel identifier for native 1155 implementation 0x4e41544956455f313135355f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_NATIVE_1155_VPOOL = bytes32(abi.encodePacked("NATIVE_1155_vPOOL"));
CHANNEL_LIQUID_1155_VPOOL
Channel identifier for liquid 1155 implementation 0x4c49515549445f313135355f76504f4f4c000000000000000000000000000000
bytes32 constant CHANNEL_LIQUID_1155_VPOOL = bytes32(abi.encodePacked("LIQUID_1155_vPOOL"));
CHANNEL_VNFT
Channel identifier for vNFT implementation
bytes32 constant CHANNEL_VNFT = bytes32(abi.encodePacked("vNFT"));
Functions
onlyAllowedDeployer
This modifier ensures that only an allowed deployer or the contract admin is trying to deploy an integration
modifier onlyAllowedDeployer();
initialize
Initializes the contract with the given parameters.
function initialize(address admin_) external init(0);
Parameters
| Name | Type | Description |
|---|---|---|
admin_ | address | Factory admin |
deployNative20vPoolIntegration
Deploy a proxy for the implementation of a Native vPool integration contract
function deployNative20vPoolIntegration(address proxyOwner, Native20Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration |
deployLiquid20AvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 aToken vPool integration contract
function deployLiquid20AvPoolIntegration(address proxyOwner, Native20Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration | The parameters to initialize the contract. |
deployLiquid20CvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 cToken vPool integration contract
function deployLiquid20CvPoolIntegration(address proxyOwner, Native20Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native20Configuration | The parameters to initialize the contract. |
deployNative20vPoolIntegration
Deploy a proxy for the implementation of a Native vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployNative20vPoolIntegration(address proxyOwner, bytes calldata cdata) external override onlyAllowedDeployer returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployLiquid20AvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 aToken vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployLiquid20AvPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployLiquid20CvPoolIntegration
Deploy a proxy for the implementation of a liquid ERC20 cToken vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployLiquid20CvPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployNative1155vPoolIntegration
Deploy a proxy for the implementation of a native 1155 vPool integration contract
function deployNative1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native1155Configuration | The parameters to initialize the contract. |
deployLiquid1155vPoolIntegration
Deploy a proxy for the implementation of a liquid 1155 vPool integration contract
function deployLiquid1155vPoolIntegration(address proxyOwner, Native1155Configuration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | Native1155Configuration | The parameters to initialize the contract |
deployNative1155vPoolIntegration
Deploy a proxy for the implementation of a native 1155 vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployNative1155vPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployLiquid1155vPoolIntegration
Deploy a proxy for the implementation of a liquid 1155 vPool integration contract
Warning: this method does not check that the the calldata corresponds to the last implementation.
function deployLiquid1155vPoolIntegration(address proxyOwner, bytes calldata cdata)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes |
deployVNFTIntegration
Deploy a proxy for the implementation of a vNFT integration contract
Warning: this method does not check that the the calldata corresponds to the last vNFT implementation.
function deployVNFTIntegration(address proxyOwner, bytes calldata cdata) external override onlyAllowedDeployer returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
cdata | bytes | The initial calldata |
deployVNFTIntegration
Deploy a proxy for the implementation of a vNFT integration contract
function deployVNFTIntegration(address proxyOwner, IvNFT.VNFTConfiguration calldata config)
external
override
onlyAllowedDeployer
returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
proxyOwner | address | The address used as an admin for the proxy |
config | IvNFT.VNFTConfiguration |
updateImplementation
Update the channel implementation address
function updateImplementation(bytes32 channel, address implem, bool updateRequired) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | Channel to update |
implem | address | New implementation address for the channel |
updateRequired | bool | If true it will prevent from deploying an instance with the old implementation parameters |
setDeployer
Allow or disallow an address to deploy integration contracts
function setDeployer(address deployer, bool allowed) external onlyAdmin;
Parameters
| Name | Type | Description |
|---|---|---|
deployer | address | Address of the deployer |
allowed | bool | Allowed or not |
_factory
Internal methods
function _factory(bytes32 channel) internal view returns (address);
_implementation
function _implementation(bytes32 channel) internal view returns (address);
_isOutdated
function _isOutdated(bytes32 channel) internal view returns (bool);
_checkOutdated
Throw an error if the implementation has been updated and then the factory requires an update too
function _checkOutdated(bytes32 channel) internal view;
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
_deploy
function _deploy(bytes32 channel, address owner, bytes memory cdata) internal returns (address);
_deploy20
function _deploy20(bytes32 channel, address owner, Native20Configuration calldata config) internal returns (address);
_deploy1155
function _deploy1155(bytes32 channel, address owner, Native1155Configuration calldata config) internal returns (address);
factory
Getters
function factory(bytes32 channel) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
implementation
retrieve the implementation address for a channel
function implementation(bytes32 channel) external view returns (address);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |
outdated
retrieve whether the implementation for a channel is outdated
function outdated(bytes32 channel) external view returns (bool);
Parameters
| Name | Type | Description |
|---|---|---|
channel | bytes32 | channel identifier |