Generated Docs
Solidity contracts provided as part of Paima Engine.
Core contracts
- PaimaL2Contract: The main L2 contract for a Paima L2.
State-annotated contracts
- AnnotatedMintNft: A standard ERC721 that accepts calldata in the mint function for any initialization data needed in a Paima dApp.
- InverseBaseProjectedNft: Project game state into a ERC721 NFT on an EVM layer initiated on said base layer.
- InverseAppProjectedNft: Project game state into a ERC721 NFT on an EVM layer initiated on the app layer.
- InverseBaseProjected1155: Project game state into a ERC1155 on an EVM layer initiated on said base layer.
- InverseAppProjected1155: Project game state into a ERC1155 on an EVM layer initiated on the app layer.
Facilitating monetization
- NativeNftSale: Facilitates selling NFTs that accepts extra data when buying for any initialization data needed in a Paima dApp.
- GenericPayment: Facilitates accepting payment that accepts extra data to know what the payment was for inside a Paima dApp.
- Erc20NftSale: Facilitates selling NFTs for specific ERC20s that accepts extra data when buying for any initialization data needed in a Paima dApp.
- OrderbookDexProxy: Proxy for the orderbook DEX contract.
- IOrderbookDex: Interface to facilitate trading inverse projected ERC1155 tokens.
- OrderbookDex: Facilitates trading inverse projected ERC1155 tokens.
Core contracts
import "@paima/evm-contracts/contracts/PaimaL2Contract.sol";
The main L2 contract for a Paima L2.
Functions
constructor(address _owner, uint256 _fee)public# |
Sets the contract owner to |
paimaSubmitGameInput(bytes data)public# |
Emits the |
withdrawFunds()public# |
Withdraws the contract balance to the |
setOwner(address newOwner)public# |
Sets the |
setFee(uint256 newFee)public# |
Sets the |
owner() → addresspublic# |
Contract owner. |
fee() → uint256public# |
Amount in wei that is required to be paid when calling |
PaimaGameInteraction(address indexed userAddress, bytes data, uint256 value)event# |
Emitted when |
State-annotated contracts
import "@paima/evm-contracts/contracts/AnnotatedMintNft.sol";
A standard ERC721 that accepts calldata in the mint function for any initialization data needed in a Paima dApp.
Upon deployment only the contract owner (specified in constructor parameter) is able to mint tokens. Additional
minters (e.g. NativeNftSale contract) need to be added by using the setMinter
function.
Modifiers
Functions
- constructor(name, symbol, supply, owner)
- supportsInterface(interfaceID)
- mint(_to, initialData)
- burn(_tokenId)
- setMinter(_minter)
- removeMinter(_minter)
- _baseURI()
- tokenURI(tokenId)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- updateMaxSupply(_maxSupply)
- exists(_tokenId)
- isMinter(_account)
- currentTokenId()
- baseURI()
- totalSupply()
- maxSupply()
- baseExtension()
- minters()
Ownable
ERC721
- balanceOf(owner)
- ownerOf(tokenId)
- name()
- symbol()
- approve(to, tokenId)
- getApproved(tokenId)
- setApprovalForAll(operator, approved)
- isApprovedForAll(owner, operator)
- transferFrom(from, to, tokenId)
- safeTransferFrom(from, to, tokenId)
- safeTransferFrom(from, to, tokenId, data)
- _ownerOf(tokenId)
- _getApproved(tokenId)
- _isAuthorized(owner, spender, tokenId)
- _checkAuthorized(owner, spender, tokenId)
- _increaseBalance(account, value)
- _update(to, tokenId, auth)
- _mint(to, tokenId)
- _safeMint(to, tokenId)
- _safeMint(to, tokenId, data)
- _burn(tokenId)
- _transfer(from, to, tokenId)
- _safeTransfer(from, to, tokenId)
- _safeTransfer(from, to, tokenId, data)
- _approve(to, tokenId, auth)
- _approve(to, tokenId, auth, emitEvent)
- _setApprovalForAll(owner, operator, approved)
- _requireOwned(tokenId)
Events
Errors
canMint()modifier# |
Reverts if |
onlyTokenOwner(uint256 tokenId)modifier# |
Reverts if |
constructor(string name, string symbol, uint256 supply, address owner)public# |
Sets the NFT's |
supportsInterface(bytes4 interfaceID) → boolpublic# |
Returns true if this contract implements the interface defined by |
mint(address _to, string initialData) → uint256external# |
Mints a new token to address |
burn(uint256 _tokenId)external# |
Burns token of ID |
setMinter(address _minter)external# |
Adds |
removeMinter(address _minter)external# |
Removes |
_baseURI() → stringinternal# |
Returns the |
tokenURI(uint256 tokenId) → stringpublic# |
Returns the token URI of specified |
setBaseURI(string _URI)external# |
Sets |
setBaseExtension(string _newBaseExtension)public# |
Sets |
updateMaxSupply(uint256 _maxSupply)external# |
Sets |
exists(uint256 _tokenId) → boolexternal# |
Returns true if specified |
isMinter(address _account) → boolpublic# |
Returns true if |
currentTokenId() → uint256public# |
The token ID that will be minted when calling the |
baseURI() → stringpublic# |
Base URI that is used in the |
totalSupply() → uint256public# |
Total token supply, increased by minting and decreased by burning. |
maxSupply() → uint256public# |
Maximum amount of tokens that is allowed to exist. |
baseExtension() → stringpublic# |
Base extension that is used in the |
minters() → mapping(address => bool)public# |
Returns true for addresses that are allowed to mint this token. |
UpdateMaxSupply(uint256 indexed oldMaxSupply, uint256 indexed newMaxSupply)event# |
Emitted when max supply is updated from |
SetMinter(address indexed newMinter)event# |
Emitted when |
RemoveMinter(address indexed oldMinter)event# |
Emitted when |
SetBaseURI(string oldUri, string newUri)event# |
Emitted when |
Minted(uint256 indexed tokenId, string initialData)event# |
Emitted when a new token with ID |
import "@paima/evm-contracts/contracts/token/IInverseProjectedNft.sol";
A standard ERC721 that can be burned and has a special tokenURI function accepting a custom base URI. See PRC3 for more.
Functions
- burn(_tokenId)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- tokenURI(tokenId, customBaseUri)
- tokenURI(tokenId, customUriInterface)
Events
burn(uint256 _tokenId)external# |
Burns token of ID |
setBaseURI(string _URI)external# |
Sets |
setBaseExtension(string _newBaseExtension)external# |
Sets |
tokenURI(uint256 tokenId, string customBaseUri) → stringexternal# |
Returns the token URI of specified |
tokenURI(uint256 tokenId, contract ITokenUri customUriInterface) → stringexternal# |
Returns the token URI of specified |
SetBaseExtension(string oldBaseExtension, string newBaseExtension)event# |
Emitted when |
SetBaseURI(string oldUri, string newUri)event# |
Emitted when |
import "@paima/evm-contracts/contracts/token/IInverseBaseProjectedNft.sol";
A Paima Inverse Projection NFT where initialization is handled by the base-layer. A standard ERC721 that accepts calldata in the mint function for any initialization data needed in a Paima dApp. See PRC3 for more.
Functions
IInverseProjectedNft
- burn(_tokenId)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- tokenURI(tokenId, customBaseUri)
- tokenURI(tokenId, customUriInterface)
Events
mint(address _to, string initialData, bytes data) → uint256external# |
Mints a new token to address |
mint(address _to, string initialData) → uint256external# |
Shorthand function that calls the |
Minted(uint256 indexed tokenId, string initialData)event# |
Emitted when the globally-enforced tokenId is minted, with |
import "@paima/evm-contracts/contracts/token/InverseBaseProjectedNft.sol";
A standard ERC721 that accepts calldata in the mint function for any initialization data needed in a Paima dApp. See PRC3 for more.
Modifiers
Functions
- constructor(name, symbol, owner)
- supportsInterface(interfaceId)
- mint(_to, initialData, data)
- mint(_to, initialData)
- burn(_tokenId)
- _baseURI()
- tokenURI(tokenId)
- tokenURI(tokenId, customBaseUri)
- tokenURI(tokenId, customUriInterface)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- updateMetadataBatch(_fromTokenId, _toTokenId)
- updateMetadata(_tokenId)
- currentTokenId()
- baseURI()
- totalSupply()
- baseExtension()
Ownable
ERC721
- balanceOf(owner)
- ownerOf(tokenId)
- name()
- symbol()
- approve(to, tokenId)
- getApproved(tokenId)
- setApprovalForAll(operator, approved)
- isApprovedForAll(owner, operator)
- transferFrom(from, to, tokenId)
- safeTransferFrom(from, to, tokenId)
- safeTransferFrom(from, to, tokenId, data)
- _ownerOf(tokenId)
- _getApproved(tokenId)
- _isAuthorized(owner, spender, tokenId)
- _checkAuthorized(owner, spender, tokenId)
- _increaseBalance(account, value)
- _update(to, tokenId, auth)
- _mint(to, tokenId)
- _safeMint(to, tokenId)
- _safeMint(to, tokenId, data)
- _burn(tokenId)
- _transfer(from, to, tokenId)
- _safeTransfer(from, to, tokenId)
- _safeTransfer(from, to, tokenId, data)
- _approve(to, tokenId, auth)
- _approve(to, tokenId, auth, emitEvent)
- _setApprovalForAll(owner, operator, approved)
- _requireOwned(tokenId)
Events
Errors
onlyTokenOwner(uint256 tokenId)modifier# |
Reverts if |
constructor(string name, string symbol, address owner)public# |
Sets the NFT's |
supportsInterface(bytes4 interfaceId) → boolpublic# |
Returns true if this contract implements the interface defined by |
mint(address _to, string initialData, bytes data) → uint256public# |
Mints a new token to address |
mint(address _to, string initialData) → uint256public# |
Shorthand function that calls the |
burn(uint256 _tokenId)public# |
Burns token of ID |
_baseURI() → stringinternal# |
Returns the |
tokenURI(uint256 tokenId) → stringpublic# |
Returns the token URI of specified |
tokenURI(uint256 tokenId, string customBaseUri) → stringpublic# |
Returns the token URI of specified |
tokenURI(uint256 tokenId, contract ITokenUri customUriInterface) → stringpublic# |
Returns the token URI of specified |
setBaseURI(string _URI)public# |
Sets |
setBaseExtension(string _newBaseExtension)public# |
Sets |
updateMetadataBatch(uint256 _fromTokenId, uint256 _toTokenId)public# |
Function that emits an event to notify third-parties (e.g. NFT marketplaces) about an update to consecutive range of tokens. Can be overridden in inheriting contract. |
updateMetadata(uint256 _tokenId)public# |
Function that emits an event to notify third-parties (e.g. NFT marketplaces) about an update to a single token. Can be overridden in inheriting contract. |
currentTokenId() → uint256public# |
The token ID that will be minted when calling the |
baseURI() → stringpublic# |
Base URI that is used in the |
totalSupply() → uint256public# |
Total token supply, increased by minting and decreased by burning. |
baseExtension() → stringpublic# |
Base extension that is used in the |
import "@paima/evm-contracts/contracts/token/IInverseAppProjectedNft.sol";
A Paima Inverse Projection NFT where initialization is handled by the app-layer.
A standard ERC721 that can be freely minted and stores an unique <minter, userTokenId>
pair (used in tokenURI) when minted.
See PRC3 for more.
Functions
IInverseProjectedNft
- burn(_tokenId)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- tokenURI(tokenId, customBaseUri)
- tokenURI(tokenId, customUriInterface)
Events
mint(address _to, bytes _verificationData, bytes _data) → uint256external# |
Mints a new token to address |
mint(address _to, bytes _verificationData) → uint256external# |
Shorthand function that calls the |
mint(address _to) → uint256external# |
Shorthand function that calls the |
currentNonce(address seller) → uint256external# |
Useful if you need to either needs to
|
Minted(uint256 indexed tokenId, address indexed minter, uint256 indexed userTokenId)event# |
Emitted when the globally-enforced tokenId in combination with an unique |
import "@paima/evm-contracts/contracts/token/InverseAppProjectedNft.sol";
A standard ERC721 that accepts calldata in the mint function for any initialization data needed in a Paima dApp. See PRC3 for more.
Modifiers
Functions
- constructor(name, symbol, owner)
- supportsInterface(interfaceId)
- currentNonce(user)
- validateMint(, )
- mint(_to, _verificationData, _data)
- mint(_to, _verificationData)
- mint(_to)
- burn(_tokenId)
- _baseURI()
- tokenURI(tokenId)
- tokenURI(tokenId, customBaseUri)
- tokenURI(tokenId, customUriInterface)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- updateMetadataBatch(_fromTokenId, _toTokenId)
- updateMetadata(_tokenId)
- tokenToMint()
- mintCount()
- currentTokenId()
- baseURI()
- totalSupply()
- baseExtension()
Ownable
ERC721
- balanceOf(owner)
- ownerOf(tokenId)
- name()
- symbol()
- approve(to, tokenId)
- getApproved(tokenId)
- setApprovalForAll(operator, approved)
- isApprovedForAll(owner, operator)
- transferFrom(from, to, tokenId)
- safeTransferFrom(from, to, tokenId)
- safeTransferFrom(from, to, tokenId, data)
- _ownerOf(tokenId)
- _getApproved(tokenId)
- _isAuthorized(owner, spender, tokenId)
- _checkAuthorized(owner, spender, tokenId)
- _increaseBalance(account, value)
- _update(to, tokenId, auth)
- _mint(to, tokenId)
- _safeMint(to, tokenId)
- _safeMint(to, tokenId, data)
- _burn(tokenId)
- _transfer(from, to, tokenId)
- _safeTransfer(from, to, tokenId)
- _safeTransfer(from, to, tokenId, data)
- _approve(to, tokenId, auth)
- _approve(to, tokenId, auth, emitEvent)
- _setApprovalForAll(owner, operator, approved)
- _requireOwned(tokenId)
Events
Errors
onlyTokenOwner(uint256 tokenId)modifier# |
Reverts if |
constructor(string name, string symbol, address owner)public# |
Sets the NFT's |
supportsInterface(bytes4 interfaceId) → boolpublic# |
Returns true if this contract implements the interface defined by |
currentNonce(address user) → uint256public# |
No description given |
validateMint(address, bytes) → boolinternal# |
No description given |
mint(address _to, bytes _verificationData, bytes _data) → uint256public# |
Mints a new token to address |
mint(address _to, bytes _verificationData) → uint256public# |
Shorthand function that calls the |
mint(address _to) → uint256public# |
Shorthand function that calls the |
burn(uint256 _tokenId)public# |
Burns token of ID |
_baseURI() → stringinternal# |
Returns the |
tokenURI(uint256 tokenId) → stringpublic# |
Returns the token URI of specified |
tokenURI(uint256 tokenId, string customBaseUri) → stringpublic# |
Returns the token URI of specified |
tokenURI(uint256 tokenId, contract ITokenUri customUriInterface) → stringpublic# |
Returns the token URI of specified |
setBaseURI(string _URI)public# |
Sets |
setBaseExtension(string _newBaseExtension)public# |
Sets |
updateMetadataBatch(uint256 _fromTokenId, uint256 _toTokenId)public# |
Function that emits an event to notify third-parties (e.g. NFT marketplaces) about an update to consecutive range of tokens. Can be overridden in inheriting contract. |
updateMetadata(uint256 _tokenId)public# |
Function that emits an event to notify third-parties (e.g. NFT marketplaces) about an update to a single token. Can be overridden in inheriting contract. |
tokenToMint() → mapping(uint256 => struct MintEntry)public# |
tokenId => MintEntry. |
mintCount() → mapping(address => uint256)public# |
No description given |
currentTokenId() → uint256public# |
The token ID that will be minted when calling the |
baseURI() → stringpublic# |
Base URI that is used in the |
totalSupply() → uint256public# |
Total token supply, increased by minting and decreased by burning. |
baseExtension() → stringpublic# |
Base extension that is used in the |
import "@paima/evm-contracts/contracts/token/IInverseProjected1155.sol";
A standard ERC1155 that can be burned and has a special uri function accepting a custom base URI.
Functions
- burn(id, value)
- burnBatch(ids, values)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- uri(id, customBaseUri)
- uri(id, customUriInterface)
Events
burn(uint256 id, uint256 value)external# |
Burns |
burnBatch(uint256[] ids, uint256[] values)external# |
Burns batch of |
setBaseURI(string _URI)external# |
Sets |
setBaseExtension(string _newBaseExtension)external# |
Sets |
uri(uint256 id, string customBaseUri) → stringexternal# |
Returns the token URI of specified |
uri(uint256 id, contract IUri customUriInterface) → stringexternal# |
Returns the token URI of specified |
SetBaseExtension(string oldBaseExtension, string newBaseExtension)event# |
Emitted when |
SetBaseURI(string oldUri, string newUri)event# |
Emitted when |
import "@paima/evm-contracts/contracts/token/IInverseBaseProjected1155.sol";
A Paima Inverse Projection ERC1155 token where initialization is handled by the base-layer. A standard ERC1155 that accepts calldata in the mint function for any initialization data needed in a Paima dApp.
Functions
IInverseProjected1155
- burn(id, value)
- burnBatch(ids, values)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- uri(id, customBaseUri)
- uri(id, customUriInterface)
Events
mint(uint256 value, bytes data, string initialData) → uint256external# |
Mints |
Minted(uint256 indexed tokenId, uint256 value, string initialData)event# |
Emitted when |
import "@paima/evm-contracts/contracts/token/InverseBaseProjected1155.sol";
A Paima Inverse Projection ERC1155 token where initialization is handled by the base-layer. A standard ERC1155 that accepts calldata in the mint function for any initialization data needed in a Paima dApp.
Functions
- constructor(_name, _symbol, _owner)
- supportsInterface(interfaceId)
- totalSupply(id)
- mint(value, data, initialData)
- burn(id, value)
- burnBatch(ids, values)
- uri(id)
- uri(id, customBaseUri)
- uri(id, customUriInterface)
- setBaseURI(_URI)
- setBaseExtension(_newBaseExtension)
- updateMetadataBatch(_fromTokenId, _toTokenId)
- updateMetadata(_tokenId)
- _update(from, to, ids, values)
- name()
- symbol()
- currentTokenId()
- baseURI()
- baseExtension()
Ownable
ERC1155
- balanceOf(account, id)
- balanceOfBatch(accounts, ids)
- setApprovalForAll(operator, approved)
- isApprovedForAll(account, operator)
- safeTransferFrom(from, to, id, value, data)
- safeBatchTransferFrom(from, to, ids, values, data)
- _updateWithAcceptanceCheck(from, to, ids, values, data)
- _safeTransferFrom(from, to, id, value, data)
- _safeBatchTransferFrom(from, to, ids, values, data)
- _setURI(newuri)
- _mint(to, id, value, data)
- _mintBatch(to, ids, values, data)
- _burn(from, id, value)
- _burnBatch(from, ids, values)
- _setApprovalForAll(owner, operator, approved)
Events
Errors
constructor(string _name, string _symbol, address _owner)public# |
Sets the NFT's |
supportsInterface(bytes4 interfaceId) → boolpublic# |
Returns true if this contract implements the interface defined by |
totalSupply(uint256 id) → uint256public# |
Returns the total amount of tokens with ID |
mint(uint256 value, bytes data, string initialData) → uint256public# |
Mints |
burn(uint256 id, uint256 value)public# |
Burns |
burnBatch(uint256[] ids, uint256[] values)public# |
Burns batch of |
uri(uint256 id) → stringpublic# |
Returns the token URI of specified |
uri(uint256 id, string customBaseUri) → stringpublic# |
Returns the token URI of specified |
uri(uint256 id, contract IUri customUriInterface) → stringpublic# |
Returns the token URI of specified |
setBaseURI(string _URI)public# |
Sets |
setBaseExtension(string _newBaseExtension)public# |
Sets |
updateMetadataBatch(uint256 _fromTokenId, uint256 _toTokenId)public# |
Function that emits an event to notify third-parties (e.g. NFT marketplaces) about an update to consecutive range of tokens. Can be overridden in inheriting contract. |
updateMetadata(uint256 _tokenId)public# |
Function that emits an event to notify third-parties (e.g. NFT marketplaces) about an update to a single token. Can be overridden in inheriting contract. |
_update(address from, address to, uint256[] ids, uint256[] values)internal# |
See {ERC1155-_update}. |
name() → stringpublic# |
No description given |
symbol() → stringpublic# |
No description given |
currentTokenId() → uint256public# |
The token ID that will be minted when calling the |
baseURI() → stringpublic# |
Base URI that is used in the |
baseExtension() → stringpublic# |
Base extension that is used in the |
import "@paima/evm-contracts/contracts/token/IInverseAppProjected1155.sol";