Skip to main content

CoreETH

A simple module that allows for anyone to sell an NFT priced in ETH


note

All deployed addresses can be found on the Asks introduction page.

Check out the Key Considerations 🔑 section before getting started.

Ask Structure#

  • seller: The address of the seller
  • price: The price to fill the ask in wei
struct Ask {    address seller;    uint96 price;}

Storage#

askForNFT#

Returns an ask for a given NFT, if one exists
ERC-721 tokenAddress => ERC-721 tokenId => Ask

mapping(address => mapping(uint256 => Ask)) public askForNFT

Functions#

supportsInterface#

Implements EIP-165 for standard interface detection.

function supportsInterface(bytes4 _interfaceId) returns (bool)

createAsk#

Creates an ask for a specific ERC-721 NFT. Either the current owner or an approved operator can call this function.

Note that creating an ask for an ERC-721 token requires that the owner has previously approved the ERC-721 Transfer Helper for it to be valid.

function createAsk(    address _tokenContract,    uint256 _tokenId,    uint256 _price)

fillAsk#

Fills the ask for a specific NFT if enough ETH is provided.

function fillAsk(address _tokenContract, uint256 _tokenId)

setAskPrice#

Updates the ask price for a specfic NFT. Only the current owner is able to call this function.

function setAskPrice(    address _tokenContract,    uint256 _tokenId,    uint256 _price)

cancelAsk#

Cancels the ask for a specific NFT. Either the current owner or an approved operator can call this function.

function cancelAsk(address _tokenContract, uint256 _tokenId)

Events#

AskCreated#

AskCreated(    address indexed tokenContract,     uint256 indexed tokenId,     address seller,     uint256 price);

AskPriceUpdated#

Emitted when setAskPrice is called.

AskPriceUpdated(    address indexed tokenContract,     uint256 indexed tokenId,     address seller,     uint256 price);

AskCanceled#

AskCanceled(    address indexed tokenContract,     uint256 indexed tokenId,     address seller,     uint256 price);

AskFilled#

AskFilled(    address indexed tokenContract,     uint256 indexed tokenId,     address buyer,     address seller,     uint256 price);