Opium Network
  • Opium Documentation
  • Introduction to Opium
    • What is Opium
    • FAQs
  • Restrictions
    • Restrictions
  • Security and Audits
    • Disclaimer
    • Audits
    • Bounty program
  • Governance
    • Decentralized setup
    • Governance flow
      • Proposal creating
      • Process of voting – technical description
    • $Opium governance token
  • For users
    • Opium.Finance
    • opium.exchange
  • FOR DEVELOPERS
    • Deployment Addresses
      • Opium Protocol v2
      • Opium Protocol v1
    • High-level overview
    • Opium Protocol V2
      • Core
      • Registry
      • SyntheticAggregator
      • OracleAggregator
      • OpiumProxyFactory
      • OpiumPositionToken
    • Opium Protocol V1
      • Core
      • Registry
      • TokenMinter
      • TokenSpender
      • SyntheticAggregator
      • OracleAggregator
      • Helpers
      • Interfaces
      • Common Errors
        • OracleAggregator Errors
        • Core Errors
      • oID - Oracle recipe
      • sID - Derivative recipe
      • EIP-2547: Composable Multiclass Token
    • Tutorials
      • OracleId examples
      • SyntheticId examples
      • End-to-end tutorial
    • Opium API
      • Subgraph V2
      • Subgraph V1
    • SDK
      • Opium V2 SDK
      • Opium Finance Pools SDK
      • Swap Rate SDK/API
  • Complex description
    • Glossary
    • Opium derivatives
    • Oracle and derivative recipes
    • Oracle and derivative registers
    • Opium margin
    • Opium swaps (TMtm)
    • Opium order books
Powered by GitBook
On this page

Was this helpful?

  1. FOR DEVELOPERS
  2. Opium Protocol V1

TokenMinter

Its main responsibility is to perform actions on tokens representing the LONG and SHORT positions of a financial product.

As the Opium Protocol makes use of its own token standard ERC721O, the TokenMinter exposes a set of functions to work with it.

Its main consumer in the Opium Protocol is the Core contract, which makes use of the TokenMinter to mint LONG/SHORT positions upon the creation of a new financial product and burn them after the successful execution of the said financial product.

Contract functions description

mint(address _buyer, address _seller, bytes32 _derivativeHash, uint256 _quantity) external

Wrapper around ERC7210BackwardCompatible _mint. It mints LONG and SHORT ERC721O tokens according to the specified quantity respectively to the buyer and the seller. The tokenId of the LONG and SHORT position token is computed based on the provided _derivativeHash. The access to the function is restricted by the onlyCore modifier which grants its usage only to the Core contract.

mint(address _buyer, bytes32 _derivativeHash, uint256 _quantity)

only for pooled

burn(address _tokenOwner, uint256 _tokenId, uint256 _quantity) external

Wrapper around ERC7210BackwardCompatible _burn. It burns a specified tokenId position on behalf of a _tokenOwner. The access to the function is restricted by the onlyCore modifier which grants its usage only to the Core contract.

name() external view returns(string memory)

It returns a common name for all the position tokens.

symbol() external external view returns(string memory)

It returns a common symbol for all the position tokens.

isApprovedOrOwner(address _spender, address _owner, uint256 _tokenId) public view returns(bool)

isOpiumSpender(address _spender) public view returns(bool)

PreviousRegistryNextTokenSpender

Last updated 3 years ago

Was this helpful?