ODCdataManagersfractionalizersfactories

FractionFactory

Contract with common logic for Fraction Data Manager Factory Clones

DEPLOY_GAS_LIMIT

uint128 DEPLOY_GAS_LIMIT

The gas limit for deploying a contract on a remote chain

NotEnoughFunds

error NotEnoughFunds(uint256 providedFunds, uint256 estimatedFee)

Error thrown when the provided funds are not enough for the estimated fee

SenderIsNotDataPointAdmin

error SenderIsNotDataPointAdmin(bytes32 datapoint, address sender)

Error thrown when someone tries to deploy Fraction with a DataPoint he is not admin for

SenderIsNotWrapperTokenOwner

error SenderIsNotWrapperTokenOwner(address wrapper, uint256 nftId, address sender)

Error thrown when someone tries to deploy Fraction with an nftId he is not owner of

FractionDataManagerCloneDeployed

event FractionDataManagerCloneDeployed(uint256 id, address dm, bytes32 dp)

Event emitted when a Fraction Data Manager Clone contract is deployed

MessageSent

event MessageSent(bytes32 guid)

Event emitted when a message is sent

FractionInitializationData

struct FractionInitializationData {
  DataPoint dp;
  string name;
  string symbol;
  address wrapper;
  uint256 nftId;
  uint256 upperGenesisId;
  bool userUnlockEnabled;
}

coreAddresses

struct IFractionFactory.CoreAddresses coreAddresses

constructor

constructor(address lzEndpoint, struct IFractionFactory.CoreAddresses coreAddresses_) internal

Creates a Fraction factory

Data Object should be OmnichainFungibleTokenWithLocalMintBurnSupplyDO for ERC20 and OmnichainFungibleFractionsWithLocalMintBurnSupplyDO for ERC1155

Parameters

NameTypeDescription
lzEndpointaddressAddress of Layer Zedro Endpoint (see https://docs.layerzero.network/v2/developers/evm/technical-reference/deployed-contracts)
coreAddresses_struct IFractionFactory.CoreAddresses

_initializeFraction

function _initializeFraction(address fractionDM, struct FractionFactory.FractionInitializationData initData, uint256 mintAmount, address mintBeneficiary) internal virtual

Calls Fraction contract initializer

Parameters

NameTypeDescription
fractionDMaddressAddress of Fraction DataManager to initialize
initDatastruct FractionFactory.FractionInitializationDataInitialization data
mintAmountuint256
mintBeneficiaryaddress

_transferFractionOwnership

function _transferFractionOwnership(address fractionDM, address newOwner) internal virtual

Transfers Fraction contract ownership

Parameters

NameTypeDescription
fractionDMaddressaddress of Fraction contract
newOwneraddressnew owner of Fraction contract

computeDeployAddress

function computeDeployAddress(address sender, address wrapper, uint256 nftId) public view returns (address dm)

Computes the address of the FractionERC20DataManagerClone contract that will be deployed

Parameters

NameTypeDescription
senderaddressThe address of the deployer
wrapperaddressThe address of the Wrapper NFT contract
nftIduint256The id of the NFT token

Return Values

NameTypeDescription
dmaddressThe address of the FractionERC20DataManagerClone contract that will be deployed

calculateDeployFee

function calculateDeployFee(struct IFractionFactory.DeploymentConfig deploymentConfig) external view returns (uint256 totalNativeFee)

Estimates the fee for deploying a Fraction Data Manager clone contract on multiple chains

Parameters

NameTypeDescription
deploymentConfigstruct IFractionFactory.DeploymentConfigConfiguration of deployed Fraction Data Manager

Return Values

NameTypeDescription
totalNativeFeeuint256The total fee in native tokens for deploying the FractionERC20DataManagerClone contract on multiple chains

setCoreAddresses

function setCoreAddresses(struct IFractionFactory.CoreAddresses coreAddresses_) external

deploy

function deploy(struct IFractionFactory.DeploymentConfig deploymentConfig, address payable refundAddress) external payable returns (address, bytes32)

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

NameTypeDescription
deploymentConfigstruct IFractionFactory.DeploymentConfigConfiguration of deployed Fraction Data Manager
refundAddressaddress payablewhere to send native coin refund

Return Values

NameTypeDescription
[0]address
[1]bytes32

_prepareDmAddressesWithDeployAndApproveFees

function _prepareDmAddressesWithDeployAndApproveFees(uint32[] chainIds, DataPoint dp, address localDm, bytes message) internal view virtual returns (OmnichainAddress[] dms, uint256[] deployFees, uint256 totalDeployFee, uint256 approvalFee)

_deployOnOtherChains

function _deployOnOtherChains(uint32[] chainIds, bytes message, address payable refundAddress, uint256[] nativeFee) internal

_deployOnLocalChain

function _deployOnLocalChain(bytes32 salt, struct FractionFactory.FractionInitializationData initData, uint256 amountToBeMinted, bool isPrimaryChain) internal returns (address fractionDM)

_lzReceive

function _lzReceive(struct Origin, bytes32, bytes _message, address, bytes) internal

_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

NameTypeDescription
struct Origin
bytes32
_messagebytesThe 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

function _estimateFee(uint32 eid, bytes message, uint128 destinationGasLimit) internal view returns (uint256)

_targetChainEid

function _targetChainEid(uint32 chainId) internal view returns (uint32)

_payNative

function _payNative(uint256 _nativeFee) internal pure returns (uint256 nativeFee)

Internal function to pay the native fee associated with the message.

Parameters

NameTypeDescription
_nativeFeeuint256The native fee to be paid.

Return Values

NameTypeDescription
nativeFeeuint256The amount of native currency paid.