Skip to main content

ICrafter

ICrafter

Crafting contracts interface

initialize

function initialize(address _admin, address _burnAddress, uint96 _craftableAmount, struct PluginsCore.Ingredient[] _inputs, struct PluginsCore.Ingredient[] _outputs, address _forwarder) external

Initializes contract (replaces constructor in proxy pattern)

NameTypeDescription
_adminaddressowner, can control outputs on contract
_burnAddressaddressBurn address for burn inputs
_craftableAmountuint96limit on the number of times this configuration can be crafted
_inputsstruct PluginsCore.Ingredient[]inputs for configuration
_outputsstruct PluginsCore.Ingredient[]outputs for configuration
_forwarderaddresstrusted forwarder address for openGSN

deposit

function deposit(uint96 amount, uint256[][] _outputsERC721Ids) external

Must be DEFAULT_ADMIN_ROLE. Automatically sends from _msgSender()

Used to deposit configuration outputs.

NameTypeDescription
amountuint96How many more times the configuration should be craftable
_outputsERC721Idsuint256[][]2D-array of ERC721 tokens used in crafting Example of _outputERC721Ids with amount = 2 with 3 Ingredients in outputs with TokenType.ERC721 [ [1, 2] [3, 4] [5, 6] ]

withdraw

function withdraw(uint96 amount) external

Must be DEFAULT_ADMIN_ROLE

Used to withdraw configuration outputs out of contract to the caller. Will also decrease craftableAmount

NameTypeDescription
amountuint96How many sets of outputs should be withdrawn

craft

function craft(uint96 amount, uint256[][] _inputERC721Ids) external

Craft amount

Used to craft. Consumes inputs and transfers outputs.

NameTypeDescription
amountuint96How many times to craft
_inputERC721Idsuint256[][]Array of pre-approved NFTs for crafting usage. Example of _inputERC721Ids with amount = 2 with 3 Ingredients in inputs with TokenType.ERC721 [ [1, 2] [3, 4] [5, 6] ]