4. Custom sale contract — selling your options

At this point, you should have your options showing up on OpenSea. Options are like regular items in that they are browsable on OpenSea, but they are always owned by the owner of the Factory contract.

Most importantly, the Factory owner can "sell" options. However, when an option is sold, instead of getting transferred to the buyer, the mint method for that particular optionId gets called. So, for example, if I were to sell _optionId 1 of the CreatureFactory contract, to 0xab23d, then mint(1, '0xab23d') would get called. Since the logic for that optionId is to mint 4 OpenSea creatures, 0xab23d would receive 4 brand new creatures.

When your Factory items first show up on OpenSea, they will show up as "sold out". You'll need to list them on sale by going to:


Excitingly, all of the OpenSea features for selling regular items are available for use in selling an option in your Factory. So you can sell with fixed prices, dutch auctions, bundles, ERC20 tokens of your choosing, etc.

Selling many of one option

While the OpenSea UI lets you sell one Factory item at a time, in many circumstances, you may want to sell off a large number of items to your initial users: for example, 100 swords or 100 packs of cards. For this, we recommend using the SDK to instantly create sales with a given supply. As an example, suppose you wanted to put 100 items up for sale in your crowdsale for a fixed price, expiring tomorrow. You could do the following:

// Expire these auctions one day from now. Omit `expirationTime` or set to 0 to never expire:
const expirationTime = (Date.now() / 1000 + 60 * 60 * 24)

const sellOrders = await seaport.createFactorySellOrders({
  assetId: <ASSET_OPTION_ID>,
  numberOfOrders: 100 // Will create 100 sell orders in parallel batches to speed things up

You can find an example of this in the opensea-creatures repository. To run the example script, simply run:

. .env
node scripts/initial_sale.js