-
Notifications
You must be signed in to change notification settings - Fork 7
Minter
-
The contract maintains several special roles : minter, admin, governance, oracle
-
The contract maintains a map of managed assets, identified by their ethereum contract address.
-
FT are stored in separated FA2 contracts. Each contract can manage several tokens. Its defined at origination time, and cannot be changed afterwhile.
-
Each NFT is stored in a separated FA2 (one FA2 contract per NFT). Token ids are the same between ethereum and tezos.
-
The contract collects fees on behalf on the signers, the dev pool and the staking contract, according to the current fees distribution.
-
The contract can manage to some extent the underlying FA2s: migrating to a new minter contract, pause tokens.
These entrypoints are permissionned : only the quorum contract can call them.
(pair %mint_erc20
(bytes %erc_20)
(pair (pair %event_id (bytes %block_hash) (nat %log_index))
(pair (address %owner) (nat %amount)))
The targeted token is identified by its ERC20 contract address. Each minting operation is identified by the block hash and the log index inside the block, that way, it is truly unique.
Part of the amount is given the user, another goes to the fees reserve, according to the current fees levels.
(pair %mint_erc721
(bytes %erc_721)
(pair (pair %event_id (bytes %block_hash) (nat %log_index))
(pair (address %owner) (nat %token_id))))
The minting unique identifer is the same as mint_erc20. Fees are collected in xtz, so a payment is expected here.
(pair %add_erc20 (bytes %eth_contract) (pair %token_address address nat))
A token address is defined as a pair of address nat. The nat here is the token_id, identifying in a multi asset fa2 which asset we should target. As always, a token is identified by its eth contract address.
The contract will try to ensure that the token_address address in an actual fa2, containing in addition the entrypoints associated with wrap protocol (mint, burn, etc).
(pair %add_erc721 (bytes %eth_contract) (address %token_contract))
Very much the same logic than in add_erc20, but we don’t need a token id. Indeed, the token_id cannot be knonw in advance, because it’s a information comming from the ethereum network, at wrapping time. As a consequence, minter contract cannot rely on a multi NFT token contract.
Fees are collected in several steps:
-
For each minting or unwrap operation, fees are accumulated in the fees ledger, under the contract address.
-
A call of the different disribute entrypoints (from the quorum contract) will update the ledger, dispatching the accumulated fees to the proper recipients
-
Recipients must call one of the withdrawal entrypoints, and one ore several transfers will be issued.