Integrate a Creation Fee

As previously established, a Creation Fee is a static fee (that can be either a burn fee or a transfer fee) that a user must pay when cloning your model contract from your Factory.

This example shows a Factory, implementing the EthereansFactory contract, integrating a Creation Fee.

You should use it as a guideline to adapt to your Fees system.

Example

The Factory implement the _burnOrTransferTokenAmount function provided by EthereansFactory in the deploy function:

function deploy(bytes calldata deployData) external payable override virtual returns(address deployedAddress, bytes memory deployedLazyInitResponse) {
    (bytes memory permitSignature, bytes memory deployDataInit) = abi.decode(deployData, (bytes, bytes));
    if(ILazyInitCapableElement(initializer).host().isContract()) {
        _burnOrTransferTokenAtCreation(msg.sender, permitSignature);
    }
    deployer[deployedAddress = modelAddress.clone()] = msg.sender;
    emit Deployed(modelAddress, deployedAddress, msg.sender, deployedLazyInitResponse = ILazyInitCapableElement(deployedAddress).lazyInit(deployDataInit));
    require(ILazyInitCapableElement(deployedAddress).initializer() == address(this));
}

Last updated