Inscribe
Search…
Inscribe Interface
core/Inscribe.sol at main · Inscribe-so/core
GitHub
The Inscribe contract holds the logic for adding and removing inscriptions.

Get Inscriber

Fetches the inscriber for the inscription at inscriptionId
1
function getInscriber(uint256 inscriptionId) external view returns (address);
Copied!

Add Base URI

Verifies that inscriptionId is inscribed to the NFT at nftAddress, tokenId
1
function verifyInscription(uint256 inscriptionId, address nftAddress, uint256 tokenId) external view returns (bool);
Copied!

Get Nonce

Fetches the nonce used for adding an inscription with a signature
Note: If a user inscribes multiple times on the same NFT, only one inscription will go through.
1
function getNonce(address inscriber, address nftAddress, uint256 tokenId) external view returns (uint256);
Copied!

Get Inscription URI

Fetches the inscriptionURI at inscriptionId

Requirements

  • inscriptionId must exist
1
function getInscriptionURI(uint256 inscriptionId) external view returns (string memory inscriptionURI);
Copied!

Approve

Gives an inscriber a one time approval to add or remove an inscription for tokenId at nftAddress
1
function approve(address to, address nftAddress, uint256 tokenId) external;
Copied!

Get Approved

Returns the address approved for the tokenId at nftAddress
1
function getApproved(address nftAddress, uint256 tokenId) external view returns (address);
Copied!

Set Approval for All

Similar to the ERC721 implementation, Approve or remove operator as an operator for the caller.
Operators can modify any inscription for any NFT owned by the caller.

Requirements

  • The operator cannot be the caller.
Emits an {ApprovalForAll} event.
1
function setApprovalForAll(address operator, bool approved) external;
Copied!

Is Approved For All

Returns if the operator is allowed to inscribe or remove inscriptions for all NFTs owned by owner
1
function isApprovedForAll(address owner, address operator) external view returns (bool);
Copied!

Add Inscription With No Sig

Adds an inscription on-chain to the specified NFT. This is mainly used to sign your own NFTs or for other smart contracts to add inscription functionality.

Parameters

nftAddress The NFT contract address
tokenId The tokenId of the NFT that is being signed
contentHash A hash of the content. This hash will not change and will be used to verify the contents in the frontend. This hash must be hosted by inscription operators at the baseURI in order to be considered a valid inscription.
baseUriId The id of the inscription operator

Requirements

  • The user calling this method must own the tokenId at nftAddress or has been approved
1
function addInscriptionWithNoSig(
2
address nftAddress,
3
uint256 tokenId,
4
bytes32 contentHash,
5
uint256 baseUriId
6
) external;
Copied!

Add Inscription With Base URI Id

Adds an inscription on-chain to the specified NFT. Call this method if you are using an inscription operator.

Parameters

nftAddress The NFT contract address
tokenId The tokenId of the NFT that is being signed
inscriber The address of the inscriber
contentHash A hash of the content. This hash will not change and will be used to verify the contents in the frontend. This hash must be hosted by inscription operators at the baseURI in order to be considered a valid inscription.
baseUriId The id of the inscription operator
nonce A unique value to ensure every sig is different. Get this value by calling getNonce
sig Signature of the hash, signed by the inscriber
1
function addInscriptionWithBaseUriId(
2
address nftAddress,
3
uint256 tokenId,
4
address inscriber,
5
bytes32 contentHash,
6
uint256 baseUriId,
7
uint256 nonce,
8
bytes calldata sig
9
) external;
Copied!

Add Inscription With Inscription URI

Adds an inscription on-chain to the specified NFT. Call this method if you have a specified inscription URI. For example, if you wanted to commit an IPFS hash to host the content hash instead of using an inscription operator.

Parameters

nftAddress The NFT contract address
tokenId The tokenId of the NFT that is being signed
inscriber The address of the inscriber
contentHash A hash of the content. This hash will not change and will be used to verify the contents in the frontend
inscriptionURI URI of where the hash is stored
nonce A unique value to ensure every sig is different. Get this value by calling getNonce
sig Signature of the hash, signed by the inscriber

Requirements

  • The user calling this method must own the tokenId at nftAddress or has been approved
1
function addInscriptionWithBaseUriId(
2
address nftAddress,
3
uint256 tokenId,
4
address inscriber,
5
bytes32 contentHash,
6
uint256 baseUriId,
7
uint256 nonce,
8
bytes calldata sig
9
) external;
Copied!

Remove Inscription

Removes inscription on-chain

Requirements

  • The user calling this method must own the tokenId at nftAddress of the inscription at inscriptionId or has been approved
1
function removeInscription(uint256 inscriptionId, address nftAddress, uint256 tokenId) external;
Copied!

Migrate URI - Base URI ID

Migrations are necessary if you would like an inscription operator to host your content hash or if you would like to swap to a new inscription operator. For example, if an inscription operator went down, you would need to call migrateURI to host your inscription at a different operator.
1
function migrateURI(uint256 inscriptionId, uint256 baseUriId, address nftAddress, uint256 tokenId) external;
Copied!

Migrate URI - Inscription URI

Migrates the URI to inscription URI. This is mainly to migrate to an ipfs link. The content hash must be stored at inscriptionURI in order to be considered valid by frontend.
1
function migrateURI(uint256 inscriptionId, string calldata inscriptionURI, address nftAddress, uint256 tokenId) external;
Copied!
Last modified 7mo ago