### Install Seaport Source: https://github.com/projectopensea/seaport/blob/main/README.md Commands to clone the repository, install dependencies, and compile contracts. ```bash git clone --recurse-submodules https://github.com/ProjectOpenSea/seaport && cd seaport yarn install yarn build ``` -------------------------------- ### Example Contract Offerer Lifecycle Source: https://github.com/projectopensea/seaport/blob/main/docs/SeaportDocumentation.md Illustrates the lifecycle journey for an example contract offerer within the Seaport protocol, including methods for simulating order generation and post-execution validation. ```Solidity function getExampleOrder() internal pure returns (SpentItem[] memory offer, ReceivedItem[] memory consideration) { // Show what the order would look like given some set of params. // Should match the order that would be generated by `generateOrder`. SpentItem[] memory _offer; ReceivedItem[] memory _consideration; return (_offer, _consideration); } function ratifyOrder( SpentItem[] calldata /* offer */, ReceivedItem[] calldata /* consideration */, bytes calldata /* context */, bytes32[] calldata /*orderHashes*/, uint256 /* contractNonce */ ) external pure virtual override returns (bytes4 /* ratifyOrderMagicValue */) { // Do some post-execution validation here if desired. return ContractOffererInterface.ratifyOrder.selector; } /** * @dev Returns the metadata for this contract offerer. */ function getSeaportMetadata() external pure override returns ( string memory name, Schema[] memory schemas // map to Seaport Improvement Proposal IDs ) { schemas = new Schema[](1); schemas[0].id = 1337; schemas[0].metadata = new bytes(0); return ("ExampleContractOfferer", schemas); } } ``` -------------------------------- ### PausableZone Contract Example Source: https://github.com/projectopensea/seaport/blob/main/docs/ZoneDocumentation.md An example implementation of a zone contract. ```solidity contracts/zones/PausableZone.sol ``` -------------------------------- ### Build Seaport Artifacts Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md Clones the Seaport repository, checks out a specific release tag, installs dependencies, and builds the artifacts. ```bash git clone https://github.com/ProjectOpenSea/seaport && cd seaport git checkout 821a049 yarn install && yarn build ``` -------------------------------- ### Signing a Bulk Order Source: https://github.com/projectopensea/seaport/blob/main/docs/SeaportDocumentation.md Example of how to sign a bulk order using a typed data signing function. ```javascript const signature = _signTypedData( domainData, bulkOrderType, value ); ``` -------------------------------- ### Example Seaport App Contract Source: https://github.com/projectopensea/seaport/blob/main/docs/SeaportDocumentation.md A simplified Solidity code example illustrating a Seaport app contract that sells one Blitmaps NFT at a time for 10 or more ETH. This contract implements the `ContractOffererInterface` and defines the `generateOrder` function to handle order generation logic. ```solidity import { ContractOffererInterface } from "../interfaces/ContractOffererInterface.sol"; import { ItemType } from "../lib/ConsiderationEnums.sol"; import { ReceivedItem, Schema, SpentItem } from "../lib/ConsiderationStructs.sol"; /** * @title ExampleContractOfferer * @notice ExampleContractOfferer is a pseudocode sketch of a Seaport app * contract that sells one Blitmaps NFT at a time for 10 or more ETH. */ contract ExampleContractOfferer is ContractOffererInterface { error OrderUnavailable(); address private immutable _SEAPORT; address private immutable _BLITMAPS; constructor(address seaport, address blitmaps) { _SEAPORT = seaport; _BLITMAPS = blitmaps; } receive() external payable {} function generateOrder( address, SpentItem[] calldata originalOffer, SpentItem[] calldata originalConsideration, bytes calldata /* context */ ) external virtual override returns (SpentItem[] memory offer, ReceivedItem[] memory consideration) { SpentItem memory _originalOffer = originalOffer[0]; SpentItem memory _originalConsideration = originalConsideration[0]; if ( // Ensure that the original prompt was looking for a Blitmaps item. (_originalOffer.token == _BLITMAPS && _originalOffer.amount == 1) && // Ensure that the original prompt was willing to spend 10 ETH. (_originalConsideration.amount >= 10 ether) ) { // Set the offer and consideration that were supplied during deployment. offer = new SpentItem[](1); consideration = new ReceivedItem[](1); offer[0] = _originalOffer; consideration[0] = ReceivedItem({ itemType: ItemType.NATIVE, token: address(0), identifier: 0, amount: 10 ether, recipient: payable(address(this)) }); } else { revert OrderUnavailable(); } } function previewOrder( address /* caller */, address, SpentItem[] calldata, SpentItem[] calldata, bytes calldata /* context */ ) external view override ``` -------------------------------- ### Example Bulk Order Object Source: https://github.com/projectopensea/seaport/blob/main/docs/SeaportDocumentation.md An example of a bulk order object in JavaScript, conforming to the defined `bulkOrderType`. ```javascript const bulkOrder = { name: "tree", type: "OrderComponents[2][2][2][2][2][2][2]", BulkOrder: [{ offerer: "0x123...", zone: "0x456...", offer: [{ itemType: 1, token: "0x789...", identifierOrCriteria: 123456, startAmount: 100, endAmount: 200 }], consideration: [{ itemType: 2, token: "0xabc...", identifierOrCriteria: 789012, startAmount: 1, endAmount: 1, recipient: "0xdef..." }], orderType: 0, startTime: 1546300800, endTime: 1546387199, zoneHash: "0x9abcdef...", salt: 123456, conduitKey: "0xabcdef...", counter: 789012345678901234 }, { offerer: "0x987...", zone: "0x654...", offer: [{ itemType: 1, token: "0x321...", identifierOrCriteria: 654321, startAmount: 150, endAmount: 250 }], consideration: [{ itemType: 2, token: "0xcba...", identifierOrCriteria: 987654, startAmount: 1, endAmount: 1, recipient: "0xfed..." }], orderType: 1, startTime: 1547300800, endTime: 1547387199, zoneHash: "0x1abcdef...", salt: 987654, conduitKey: "0x1abcdef...", counter: 789012345678901234 }] }; ``` -------------------------------- ### Build Seaport-core Artifacts Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md Clones the seaport-core repository, checks out a specific release tag, and builds the artifacts. ```bash cd ../ && git clone https://github.com/ProjectOpenSea/seaport-core && cd seaport-core git checkout 523097f ``` -------------------------------- ### Set Foundry Debug Environment Source: https://github.com/projectopensea/seaport/blob/main/README.md Example of setting the FOUNDRY_PROFILE environment variable for debugging Foundry tests. ```bash FOUNDRY_PROFILE=debug ``` -------------------------------- ### Build Seaport-core Artifacts with Forge Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md Builds the artifacts for Seaport-core using forge. ```bash forge build ``` -------------------------------- ### Verify Seaport 1.6 Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md Verifies the Seaport 1.6 contract using forge. ```bash forge verify-contract --chain {chain} 0x0000000000000068F116a894984e2DB1123eB395 src/Seaport.sol:Seaport ``` -------------------------------- ### Compile Forge Contracts for Deployment Source: https://github.com/projectopensea/seaport/blob/main/README.md Commands to compile contracts for deployment on networks. ```bash FOUNDRY_PROFILE=optimized forge build FOUNDRY_PROFILE=reference forge build ``` -------------------------------- ### Deploy KEYLESS_CREATE2_ADDRESS Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md Pre-signed transaction to create the KEYLESS_CREATE2_ADDRESS. ```bash cast publish --rpc-url ${RPC_URL} 0xf87e8085174876e800830186a08080ad601f80600e600039806000f350fe60003681823780368234f58015156014578182fd5b80825250506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222 ``` -------------------------------- ### Deploy IMMUTABLE_CREATE2_FACTORY_ADDRESS contract Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md Command to create the IMMUTABLE_CREATE2_FACTORY_ADDRESS contract at a specific address using cast send. ```bash cast send --rpc-url ${RPC_URL} --private-key ${PK} 0xcfa3a7637547094ff06246817a35b8333c315196 0x64e030870000000000000000000000000000000000000000f4b0218f13a6440a6f02000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000853608060405234801561001057600080fd5b50610833806100206000396000f3fe60806040526004361061003f5760003560e01c806308508b8f1461004457806364e030871461009857806385cf97ab14610138578063a49a7c90146101bc575b600080fd5b34801561005057600080fd5b506100846004803603602081101561006757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166101ec565b604080519115158252519081900360200190f35b61010f600480360360408110156100ae57600080fd5b813591908101906040810160208201356401000000008111156100d057600080fd5b8201836020820111156100e257600080fd5b8035906020019184600183028401116401000000008311171561010457600080fd5b509092509050610217565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561014457600080fd5b5061010f6004803603604081101561015b57600080fd5b8135919081019060408101602082013564010000000081111561017d57600080fd5b82018360208201111561018f57600080fd5b803590602001918460018302840111640100000000831117156101b157600080fd5b509092509050610592565b3480156101c857600080fd5b5061010f600480360360408110156101df57600080fd5b508035906020013561069e565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205460ff1690565b600083606081901c33148061024c57507fffffffffffffffffffffffffffffffffffffffff0000000000000000000000008116155b6102a1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260458152602001806107746045913960600191505060405180910390fd5b606084848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920182905250604051855195965090943094508b93508692506020918201918291908401908083835b6020831061033557805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016102f8565b51815160209384036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909216911617905260408051929094018281037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe00183528085528251928201929092207fff000000000000000000000000000000000000000000000000000000000000008383015260609890981b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602183015260358201969096526055808201979097528251808203909701875260750182525084519484019490942073ffffffffffffffffffffffffffffffffffffffff81166000908152938490529390922054929350505060ff909116156104a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603f815260200180610735603f913960400191505060405180910390fd5b81602001825188818334f5955050508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461053a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260468152602001806107b96046913960600191505060405180910390fd5b50505073ffffffffffffffffffffffffffffffffffffffff8116600090815260208190526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790559392505050565b6000308484846040516020018083838082843760408051919093018181037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001825280845281516020928301207fff000000000000000000000000000000000000000000000000000000000000008383015260609990991b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000166021820152603581019790975260558088019890985282518088039098018852607590960182525085519585019590952073ffffffffffffffffffffffffffffffffffffffff81166000908152948590529490932054939450505060ff909116159050610697575060005b9392505050565b604080517fff000000000000000000000000000000000000000000000000000000000000006020808301919091523060601b6021830152603582018590526055808301859052835180840390910181526075909201835281519181019190912073ffffffffffffffffffffffffffffffffffffffff81166000908152918290529190205460ff161561072e575060005b9291505056fe496e76616c696420636f6e7472616374206372656174696f6e202d20636f6e74726163742068617320616c7265616479206265656e206465706c6f7965642e496e76616c69642073616c74202d206669727374203230206279746573206f66207468652073616c74206d757374206d617463682063616c6c696e6720616464726573732e4661696c656420746f206465706c6f7920636f6e7472616374207573696e672070726f76696465642073616c7420616e6420696e697469616c697a6174696f6e20636f64652ea265627a7a723058202bdc55310d97c4088f18acf04253db593f0914059f0c781a9df3624dcef0d1cf64736f6c634300050a003200000000000000000000000000 ``` -------------------------------- ### Seaport Contract Bytecode Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md The bytecode for the Seaport contract. ```solidity 0x608152602090f35b8061027961010b6001938587610532565b0161022c565b503461000e5760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e5760043567ffffffffffffffff811161000e576102cf90369060040161017a565b33600052600060205260406000205415610316576102ec91610acb565b60206040517f8df25d920000000000000000000000000000000000000000000000000000000008152f35b7f93daadf2000000000000000000000000000000000000000000000000000000006000523360045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81160361000e57565b503461000e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e5760043561039e81610344565b6024359081151580830361000e5773ffffffffffffffffffffffffffffffffffffffff90817f000000000000000000000000000000000000000000000000000000001633036105085761041f6104188473ffffffffffffffffffffffffffffffffffffffff166000526000602052604060002090565b5460ff1690565b1515146104b657816104a6846104767fae63067d43ac07563b7eb8db6595635fc77f1578a2a5ea06ba91b63e2afa37e29573ffffffffffffffffffffffffffffffffffffffff166000526000602052604060002090565b9060ff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0083541691151516179055565b60405193151584521691602090a2005b506040517f924e341e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9190911660048201529015156024820152604490fd5b60046040517f6d5769be000000000000000000000000000000000000000000000000000000008152fd5b91908110156105425760c0020190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6004111561057b57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b35600481101561000e5790565b356105c181610344565b90565b60016105cf826105aa565b6105d881610571565b0361061357806105ed602061061193016105b7565b906105fa604082016105b7565b60a0610608606084016105b7565b92013592610712565b565b600261061e826105aa565b61062781610571565b0361069657600160a08201350361066c5780610648602061061193016105b7565b90610655604082016105b7565b6080610663606084016105b7565b92013592610882565b60046040517fefcc00b1000000000000000000000000000000000000000000000000000000008152fd5b60036106a1826105aa565b6106aa81610571565b036106e857806106bf602061061193016105b7565b6106cb604083016105b7565b6106d7606084016105b7565b90608060a085013594013592610990565b60046040517f7932f1fc000000000000000000000000000000000000000000000000000000008152fd5b9092604051926000947f23b872dd00000000000000000000000000000000000000000000000000000000865280600452816024528260445260208660648180885af1803d15601f3d1160018a51141617163d151581161561077c575b5050505050604052606052565b80863b15151661076e579087959691156107bc57602486887f5f15d672000000000000000000000000000000000000000000000000000000008252600452fd5b156107f657506084947f98891923000000000000000000000000000000000000000000000000000000008552600452602452604452606452fd5b3d610835575b5060a4947ff486bc87000000000000000000000000000000000000000000000000000000008552600452602452604452606452608452fd5b601f3d0160051c9060051c908060030291808211610869575b505060205a91011061086057856107fc565b833d81803e3d90fd5b8080600392028380020360091c9203020101868061084e565b9092813b1561096257604051926000947f23b872dd000000000000000000000000000000000000000000000000000000008652806004528160245282604452858060648180885af1156108db5750505050604052606052565b8593943d61091e575b5060a4947ff486bc87000000000000000000000000000000000000000000000000000000008552600452602452604452606452608452fd5b601f3d0160051c9060051c908060030291808211610949575b505060205a91011061086057856108e4565b8080600392028380020360091c92030201018680610937565b507f5f15d6720000000000000000000000000000000000000000000000000000000060005260045260246000fd5b929093833b15610a9d57604051936080519160a0519360c051956000987ff242432a000000000000000000000000000000000000000000000000000000008a528060045281602452826044528360645260a06084528960a452898060c48180895af115610a0d57505050505060805260a05260c052604052606052565b89949550883d610a50575b5060a4957ff486bc87000000000000000000000000000000000000000000000000000000008652600452602452604452606452608452fd5b601f3d0160051c9060051c908060030291808211610a84575b505060205a910110610a7b5786610a18565b843d81803e3d90fd5b8080600392028380020360091c92030201018780610a69565b837f5f15d6720000000000000000000000000000000000000000000000000000000060005260045260246000fd5b90816020907f2eb2c2d600000000000000000000000000000000000000000000000000000000825260005b838110610b095750505050506080604052565b8435820194853590813b156109625760a09182880192833560059181831b948b60c08097608094818301868501351490606085013514169201013584141615610c165789019a890160243760061b9360e0850160a452610104850194600086526040019060c437600080858982865af115610b8a5750505050600101610af6565b869394503d610bcb575b507fafc445e20000000000000000000000000000000000000000000000000000000060005260045260645260849081510190526000fd5b84601f3d01821c911c9060 ``` -------------------------------- ### Seaport and ConduitController Deployment Source: https://github.com/projectopensea/seaport/blob/main/docs/Deployment.md Solidity bytecode for deploying Seaport and ConduitController. ```solidity 000000000000000000000000000000000000000000600052603260045260246000fd5b6004111561057b57565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b35600481101561000e5790565b356105c181610344565b90565b60016105cf826105aa565b6105d881610571565b0361061357806105ed602061061193016105b7565b906105fa604082016105b7565b60a0610608606084016105b7565b92013592610712565b565b600261061e826105aa565b61062781610571565b0361069657600160a08201350361066c5780610648602061061193016105b7565b90610655604082016105b7565b6080610663606084016105b7565b92013592610882565b60046040517fefcc00b1000000000000000000000000000000000000000000000000000000008152fd5b60036106a1826105aa565b6106aa81610571565b036106e857806106bf602061061193016105b7565b6106cb604083016105b7565b6106d7606084016105b7565b90608060a085013594013592610990565b60046040517f7932f1fc000000000000000000000000000000000000000000000000000000008152fd5b9092604051926000947f23b872dd00000000000000000000000000000000000000000000000000000000865280600452816024528260445260208660648180885af1803d15601f3d1160018a51141617163d151581161561077c575b505050505050604052606052565b80863b15151661076e579087959691156107bc57602486887f5f15d672000000000000000000000000000000000000000000000000000000008252600452fd5b156107f657506084947f98891923000000000000000000000000000000000000000000000000000000008552600452602452604452606452fd5b3d610835575b5060a4947ff486bc8700000000000000000000000000000000000000000000000000000000855260045260245260445281606452608452fd5b601f3d0160051c9060051c908060030291808211610869575b505060205a91011061086057856107fc565b833d81803e3d90fd5b8080600392028380020360091c9203020101868061084e565b9092813b1561096257604051926000947f23b872dd000000000000000000000000000000000000000000000000000000008652806004528160245282604452858060648180885af1156108db5750505050604052606052565b8593943d61091e575b5060a4947ff486bc87000000000000000000000000000000000000000000000000000000008552600452602452604452606452608452fd5b601f3d0160051c9060051c908060030291808211610949575b505060205a91011061086057856108e4565b8080600392028380020360091c92030201018680610937565b507f5f15d6720000000000000000000000000000000000000000000000000000000060005260045260246000fd5b929093833b15610a9d57604051936080519160a0519360c051956000987ff242432a000000000000000000000000000000000000000000000000000000008a528060045281602452826044528360645260a06084528960a452898060c48180895af115610a0d57505050505060805260a05260c052604052606052565b89949550883d610a50575b5060a4957ff486bc87000000000000000000000000000000000000000000000000000000008652600452602452604452606452608452fd5b601f3d0160051c9060051c908060030291808211610a84575b505060205a910110610a7b5786610a18565b843d81803e3d90fd5b8080600392028380020360091c92030201018780610a69565b837f5f15d6720000000000000000000000000000000000000000000000000000000060005260045260246000fd5b90816020907f2eb2c2d600000000000000000000000000000000000000000000000000000000825260005b838110610b095750505050506080604052565b8435820194853590813b156109625760a09182880192833560059181831b948b60c08097608094818301868501351490606085013514169201013584141615610c165789019a890160243760061b9360e0850160a452610104850194600086526040019060c437600080858982865af115610b8a5750505050600101610af6565b869394503d610bcb575b507fafc445e20000000000000000000000000000000000000000000000000000000060005260045260645260849081510190526000fd5b84601f3d01821c911c90600381810292808311610bff575b505050835a910110610bf55784610b94565b3d6000803e3d6000fd5b8080028380020360091c9203020101858080610be3565b7feba2084c0000000000000000000000000000000000000000000000000000000060005260046000fdfea2646970667358221220c5c8d054d9d5df7c3530eab1c32506aad1fcb6772c1457f0da5443ad9e91b4a364736f6c634300080e0033a264697066735822122031e2de61a9e35e9e87d5eef6a36b045a0bab54c4031fd01a0f8138afce3cec3164736f6c634300080e003360a080604052346100235733608052610c7690816100298239608051816103c50152f35b600080fdfe60806040526004361015610013575b600080fd5b6000803560e01c9081634ce34aa21461006657508063899e104c1461005d5780638df25d92146100545763c4e8fcb51461004c57600080fd5b61000e610362565b5061000e61027f565b5061000e6101ab565b346101465760207ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101465760043567ffffffffffffffff8111610142576100b5903690600401610149565b9133815280602052604081205415610116575b8281106100fa576040517f4ce34aa2000000000000000000000000000000000000000000000000000000008152602090f35b8061011061010b6001938686610532565b6105c4565b016100c8565b807f93daadf2000000000000000000000000000000000000000000000000000000006024925233600452fd5b5080fd5b80fd5b9181601f8401121561000e5782359167ffffffffffffffff831161000e5760208085019460c0850201011161000e57565b9181601f8401121561000e5782359167ffffffffffffffff831161000e576020808501948460051b01011161000e57565b503461000e5760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261000e5767ffffffffffffffff60043581811161000e576101fc903690600401610149565b9160243590811161000e5761021590369060040161017a565b91909260003381528060205260408120541561 ```