FractionFactory
Contract with common logic for Fraction Data Manager Factory Clones
DEPLOY_GAS_LIMIT
The gas limit for deploying a contract on a remote chain
NotEnoughFunds
Error thrown when the provided funds are not enough for the estimated fee
SenderIsNotDataPointAdmin
Error thrown when someone tries to deploy Fraction with a DataPoint he is not admin for
SenderIsNotWrapperTokenOwner
Error thrown when someone tries to deploy Fraction with an nftId he is not owner of
FractionDataManagerCloneDeployed
Event emitted when a Fraction Data Manager Clone contract is deployed
MessageSent
Event emitted when a message is sent
FractionInitializationData
coreAddresses
constructor
Creates a Fraction factory
Data Object should be OmnichainFungibleTokenWithLocalMintBurnSupplyDO for ERC20 and OmnichainFungibleFractionsWithLocalMintBurnSupplyDO for ERC1155
Parameters
Name | Type | Description |
---|---|---|
lzEndpoint | address | Address of Layer Zedro Endpoint (see https://docs.layerzero.network/v2/developers/evm/technical-reference/deployed-contracts) |
coreAddresses_ | struct IFractionFactory.CoreAddresses |
_initializeFraction
Calls Fraction contract initializer
Parameters
Name | Type | Description |
---|---|---|
fractionDM | address | Address of Fraction DataManager to initialize |
initData | struct FractionFactory.FractionInitializationData | Initialization data |
mintAmount | uint256 | |
mintBeneficiary | address |
_transferFractionOwnership
Transfers Fraction contract ownership
Parameters
Name | Type | Description |
---|---|---|
fractionDM | address | address of Fraction contract |
newOwner | address | new owner of Fraction contract |
computeDeployAddress
Computes the address of the FractionERC20DataManagerClone contract that will be deployed
Parameters
Name | Type | Description |
---|---|---|
sender | address | The address of the deployer |
wrapper | address | The address of the Wrapper NFT contract |
nftId | uint256 | The id of the NFT token |
Return Values
Name | Type | Description |
---|---|---|
dm | address | The address of the FractionERC20DataManagerClone contract that will be deployed |
calculateDeployFee
Estimates the fee for deploying a Fraction Data Manager clone contract on multiple chains
Parameters
Name | Type | Description |
---|---|---|
deploymentConfig | struct IFractionFactory.DeploymentConfig | Configuration of deployed Fraction Data Manager |
Return Values
Name | Type | Description |
---|---|---|
totalNativeFee | uint256 | The total fee in native tokens for deploying the FractionERC20DataManagerClone contract on multiple chains |
setCoreAddresses
deploy
Deploys a Fraction Data Manager contract (implements IFraction)
Ownership of created DataPoint is transferred to the caller All deployed DataManagers are approved to use DataObjects they need
Parameters
Name | Type | Description |
---|---|---|
deploymentConfig | struct IFractionFactory.DeploymentConfig | Configuration of deployed Fraction Data Manager |
refundAddress | address payable | where to send native coin refund |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | |
[1] | bytes32 |
_prepareDmAddressesWithDeployAndApproveFees
_deployOnOtherChains
_deployOnLocalChain
_lzReceive
_This function will be called on receiving request from another chain param _origin The origin information containing the source endpoint and sender address.
- srcEid: The source chain endpoint ID.
- sender: The sender address on the src chain.
- nonce: The nonce of the message. param guid The unique identifier for the received LayerZero message.
Parameters
Name | Type | Description |
---|---|---|
struct Origin | ||
bytes32 | ||
_message | bytes | The payload of the received message. param _executor The address of the executor for the received message. param _extraData Additional arbitrary data provided by the corresponding executor. |
address | ||
bytes |
_estimateFee
_targetChainEid
_payNative
Internal function to pay the native fee associated with the message.
Parameters
Name | Type | Description |
---|---|---|
_nativeFee | uint256 | The native fee to be paid. |
Return Values
Name | Type | Description |
---|---|---|
nativeFee | uint256 | The amount of native currency paid. |