Skip to main content

LSP23LinkedContractsFactory

Standard Specifications
Solidity implementation

Public Methods​

Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally.

computeAddresses​

References
  • Specification details: LSP-23-LinkedContractsFactory
  • Solidity implementation: LSP23LinkedContractsFactory.sol
  • Function signature: computeAddresses(ILSP23LinkedContractsFactory.PrimaryContractDeployment,ILSP23LinkedContractsFactory.SecondaryContractDeployment,address,bytes)
  • Function selector: 0xdecfb0b9
function computeAddresses(
ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment,
ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment,
address postDeploymentModule,
bytes postDeploymentModuleCalldata
)
external
view
returns (address primaryContractAddress, address secondaryContractAddress);

Computes the addresses of a primary contract and a secondary linked contract

Parameters​

NameTypeDescription
primaryContractDeploymentILSP23LinkedContractsFactory.PrimaryContractDeploymentContains the needed parameter to deploy the primary contract. (salt, fundingAmount, creationBytecode)
secondaryContractDeploymentILSP23LinkedContractsFactory.SecondaryContractDeploymentContains the needed parameter to deploy the secondary contract. (fundingAmount, creationBytecode, addPrimaryContractAddress, extraConstructorParams)
postDeploymentModuleaddressThe optional module to be executed after deployment
postDeploymentModuleCalldatabytesThe data to be passed to the post deployment module

Returns​

NameTypeDescription
primaryContractAddressaddressThe address of the deployed primary contract.
secondaryContractAddressaddressThe address of the deployed secondary contract.

computeERC1167Addresses​

References
  • Specification details: LSP-23-LinkedContractsFactory
  • Solidity implementation: LSP23LinkedContractsFactory.sol
  • Function signature: computeERC1167Addresses(ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit,ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit,address,bytes)
  • Function selector: 0x8da85898
function computeERC1167Addresses(
ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit,
ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit,
address postDeploymentModule,
bytes postDeploymentModuleCalldata
)
external
view
returns (address primaryContractAddress, address secondaryContractAddress);

Computes the addresses of a primary and a secondary linked contracts ERC1167 proxies to be created

Parameters​

NameTypeDescription
primaryContractDeploymentInitILSP23LinkedContractsFactory.PrimaryContractDeploymentInitContains the needed parameters to deploy a primary proxy contract. (salt, fundingAmount, implementationContract, initializationCalldata)
secondaryContractDeploymentInitILSP23LinkedContractsFactory.SecondaryContractDeploymentInitContains the needed parameters to deploy the secondary proxy contract. (fundingAmount, implementationContract, initializationCalldata, addPrimaryContractAddress, extraInitializationParams)
postDeploymentModuleaddressThe optional module to be executed after deployment.
postDeploymentModuleCalldatabytesThe data to be passed to the post deployment module.

Returns​

NameTypeDescription
primaryContractAddressaddressThe address of the deployed primary contract proxy
secondaryContractAddressaddressThe address of the deployed secondary contract proxy

deployContracts​

References
  • Specification details: LSP-23-LinkedContractsFactory
  • Solidity implementation: LSP23LinkedContractsFactory.sol
  • Function signature: deployContracts(ILSP23LinkedContractsFactory.PrimaryContractDeployment,ILSP23LinkedContractsFactory.SecondaryContractDeployment,address,bytes)
  • Function selector: 0xf830c0ab
function deployContracts(
ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment,
ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment,
address postDeploymentModule,
bytes postDeploymentModuleCalldata
)
external
payable
returns (address primaryContractAddress, address secondaryContractAddress);

Contracts deployed. Contract Address: primaryContractAddress. Primary Contract Address: primaryContractAddress

Deploys a primary and a secondary linked contract.

Parameters​

NameTypeDescription
primaryContractDeploymentILSP23LinkedContractsFactory.PrimaryContractDeploymentContains the needed parameter to deploy a contract. (salt, fundingAmount, creationBytecode)
secondaryContractDeploymentILSP23LinkedContractsFactory.SecondaryContractDeploymentContains the needed parameter to deploy the secondary contract. (fundingAmount, creationBytecode, addPrimaryContractAddress, extraConstructorParams)
postDeploymentModuleaddressThe optional module to be executed after deployment
postDeploymentModuleCalldatabytesThe data to be passed to the post deployment module

Returns​

NameTypeDescription
primaryContractAddressaddressThe address of the primary contract.
secondaryContractAddressaddressThe address of the secondary contract.

deployERC1167Proxies​

References
  • Specification details: LSP-23-LinkedContractsFactory
  • Solidity implementation: LSP23LinkedContractsFactory.sol
  • Function signature: deployERC1167Proxies(ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit,ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit,address,bytes)
  • Function selector: 0x17c042c4
function deployERC1167Proxies(
ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit,
ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit,
address postDeploymentModule,
bytes postDeploymentModuleCalldata
)
external
payable
returns (address primaryContractAddress, address secondaryContractAddress);

Contract proxies deployed. Primary Proxy Address: primaryContractAddress. Secondary Contract Proxy Address: secondaryContractAddress

Deploys ERC1167 proxies of a primary contract and a secondary linked contract

Parameters​

NameTypeDescription
primaryContractDeploymentInitILSP23LinkedContractsFactory.PrimaryContractDeploymentInitContains the needed parameters to deploy a proxy contract. (salt, fundingAmount, implementationContract, initializationCalldata)
secondaryContractDeploymentInitILSP23LinkedContractsFactory.SecondaryContractDeploymentInitContains the needed parameters to deploy the secondary proxy contract. (fundingAmount, implementationContract, initializationCalldata, addPrimaryContractAddress, extraInitializationParams)
postDeploymentModuleaddressThe optional module to be executed after deployment.
postDeploymentModuleCalldatabytesThe data to be passed to the post deployment module.

Returns​

NameTypeDescription
primaryContractAddressaddressThe address of the deployed primary contract proxy
secondaryContractAddressaddressThe address of the deployed secondary contract proxy

Internal Methods​

Any method labeled as internal serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs.

Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities.

_deployPrimaryContract​

function _deployPrimaryContract(struct ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment, struct ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal nonpayable returns (address primaryContractAddress);

_deploySecondaryContract​

function _deploySecondaryContract(struct ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, address primaryContractAddress) internal nonpayable returns (address secondaryContractAddress);

_deployAndInitializePrimaryContractProxy​

function _deployAndInitializePrimaryContractProxy(struct ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit, struct ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal nonpayable returns (address primaryContractAddress);

_deployAndInitializeSecondaryContractProxy​

function _deployAndInitializeSecondaryContractProxy(struct ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, address primaryContractAddress) internal nonpayable returns (address secondaryContractAddress);

_generatePrimaryContractSalt​

function _generatePrimaryContractSalt(struct ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment, struct ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal pure returns (bytes32 primaryContractGeneratedSalt);

_generatePrimaryContractProxySalt​

function _generatePrimaryContractProxySalt(struct ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit, struct ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal pure returns (bytes32 primaryContractProxyGeneratedSalt);

Events​

DeployedContracts​

References
  • Specification details: LSP-23-LinkedContractsFactory
  • Solidity implementation: LSP23LinkedContractsFactory.sol
  • Event signature: DeployedContracts(address,address,ILSP23LinkedContractsFactory.PrimaryContractDeployment,ILSP23LinkedContractsFactory.SecondaryContractDeployment,address,bytes)
  • Event topic hash: 0x1ea27dabd8fd1508e844ab51c2fd3d9081f2684346857f9187da6d4a1aa7d3e6
event DeployedContracts(
address indexed primaryContract,
address indexed secondaryContract,
ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment,
ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment,
address postDeploymentModule,
bytes postDeploymentModuleCalldata
);

Emitted when a primary and secondary contract are deployed.

Parameters​

NameTypeDescription
primaryContract indexedaddressAddress of the deployed primary contract.
secondaryContract indexedaddressAddress of the deployed secondary contract.
primaryContractDeploymentILSP23LinkedContractsFactory.PrimaryContractDeploymentParameters used for the primary contract deployment.
secondaryContractDeploymentILSP23LinkedContractsFactory.SecondaryContractDeploymentParameters used for the secondary contract deployment.
postDeploymentModuleaddressAddress of the post-deployment module.
postDeploymentModuleCalldatabytesCalldata passed to the post-deployment module.

DeployedERC1167Proxies​

References
  • Specification details: LSP-23-LinkedContractsFactory
  • Solidity implementation: LSP23LinkedContractsFactory.sol
  • Event signature: DeployedERC1167Proxies(address,address,ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit,ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit,address,bytes)
  • Event topic hash: 0xb03dbe7a02c063899f863d542410b5b038c8f537045be3a26e7144e0074e1c7b
event DeployedERC1167Proxies(
address indexed primaryContract,
address indexed secondaryContract,
ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit,
ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit,
address postDeploymentModule,
bytes postDeploymentModuleCalldata
);

Emitted when proxies of a primary and secondary contract are deployed.

Parameters​

NameTypeDescription
primaryContract indexedaddressAddress of the deployed primary contract proxy.
secondaryContract indexedaddressAddress of the deployed secondary contract proxy.
primaryContractDeploymentInitILSP23LinkedContractsFactory.PrimaryContractDeploymentInitParameters used for the primary contract proxy deployment.
secondaryContractDeploymentInitILSP23LinkedContractsFactory.SecondaryContractDeploymentInitParameters used for the secondary contract proxy deployment.
postDeploymentModuleaddressAddress of the post-deployment module.
postDeploymentModuleCalldatabytesCalldata passed to the post-deployment module.

Errors​

InvalidValueSum​

References
error InvalidValueSum();

Invalid value sent.

Reverts when the msg.value sent is not equal to the sum of value used for the deployment of the contract & its owner contract.


PrimaryContractProxyInitFailureError​

References
error PrimaryContractProxyInitFailureError(bytes errorData);

Failed to deploy & initialize the Primary Contract Proxy. Error: errorData.

Reverts when the deployment & intialization of the contract has failed.

Parameters​

NameTypeDescription
errorDatabytesPotentially information about why the deployment & intialization have failed.

SecondaryContractProxyInitFailureError​

References
error SecondaryContractProxyInitFailureError(bytes errorData);

Failed to deploy & initialize the Secondary Contract Proxy. Error: errorData.

Reverts when the deployment & intialization of the secondary contract has failed.

Parameters​

NameTypeDescription
errorDatabytesPotentially information about why the deployment & intialization have failed.