Encoding Function Call Parameters
In order to not overflow smart contract bytecode size limits, Payment Processor is split into smaller library modules. When making calls to Payment Processor, these calls are forwarded to the corresponding module and implementation function using DELEGATECALL. For gas efficiency purposes, the function calldata must be passed in as a raw calldata byte array. Payment Processor is deployed with a helper contract called the PaymentProcessorEncoder. It accepts the expected function implementation parameters and encodes them as a single calldata byte array that should be passed into Payment Processor when making calls to fill orders. The subsections below detail each PaymentProcessorEncoder function.
encodeBuyListingCalldata
Used to encode calldata for Payment Processor buyListing function.
function encodeBuyListingCalldata(
address paymentProcessorAddress,
Order memory saleDetails,
SignatureECDSA memory signature,
Cosignature memory cosignature,
FeeOnTop memory feeOnTop
) external view returns (bytes memory);
encodeBuyListingAdvancedCalldata
Used to encode calldata for PaymentProcessor buyListingAdvanced function.
function encodeBuyListingAdvancedCalldata(
address paymentProcessorAddress,
AdvancedOrder memory advancedListing,
BulkOrderProof memory bulkOrderProof,
FeeOnTop memory feeOnTop
) external view returns (bytes memory);
encodeAcceptOfferCalldata
Used to encode calldata for Payment Processor acceptOffer function.
function encodeAcceptOfferCalldata(
address paymentProcessorAddress,
uint256 offerType,
Order memory saleDetails,
SignatureECDSA memory signature,
TokenSetProof memory tokenSetProof,
Cosignature memory cosignature,
FeeOnTop memory feeOnTop
) external view returns (bytes memory);
*Note: When filling an item offer, offerType MUST be set to 1, and tokenSetProof MUST be set to the empty TokenSetProof({proof: bytes32[](0)}).
*Note: When filling a collection offer, offerType MUST be set to 0, and tokenSetProof MUST be set to the empty TokenSetProof({proof: bytes32[](0)}).
*Note: When filling a token set offer, offerType MUST be set to 2, and tokenSetProof MUST contain the valid merkle proof for the collection and token id being filled.
encodeAcceptOfferAdvancedCalldata
Used to encode calldata for the PaymentProcessor acceptOfferAdvanced function.
function encodeAcceptOfferAdvancedCalldata(
address paymentProcessorAddress,
AdvancedBidOrder memory advancedBid,
BulkOrderProof memory bulkOrderProof,
FeeOnTop memory feeOnTop,
TokenSetProof memory tokenSetProof) external view returns (bytes memory)
Note: If the maker did not use a permit processor, advancedBid.permitContext MUST be set to the empty PermitContext({permitProcessor: address(0), permitNonce: 0}).
Note: If the order being filled is not associated with a merkle root, bulkOrderProof MUST be set to the empty BulkOrderProof({orderIndex: 0, proof: []}).
Note: If the order being filled does not have fees on top, feeOnTop MUST be set to the empty FeeOnTop({recipient: address(0), amount: 0}).
encodeBulkBuyListingsCalldata
Used to encode calldata for Payment Processor bulkBuyListings function.
function encodeBulkBuyListingsCalldata(
address paymentProcessorAddress,
Order[] calldata saleDetailsArray,
SignatureECDSA[] calldata signatures,
Cosignature[] calldata cosignatures,
FeeOnTop[] calldata feesOnTop
) external view returns (bytes memory);
Note: The length of the saleDetailsArray, signatures, cosignatures, and feesOnTop MUST match and MUST be non-zero. saleDetailsArray[index] MUST correspond to signatures[index], cosignatures[index], and feesOnTop[index].
Note: As co-signatures may not apply to all orders being filled, cosignatures[index] MUST be set to the empty Cosignature({signer: address(0), taker: address(0), expiration: 0, v: 0, r: bytes32(0), s: bytes32(0)}) for any order that is not co-signed.
Note: As fees on top may not apply to all orders being filled, feesOnTop[index] MUST be set to the empty FeeOnTop({recipient: address(0), amount: 0}) for any order that is not subject to a fee on top.
encodeBulkBuyListingsAdvancedCalldata
Used to encode calldata for PaymentProcessor bulkBuyListingsAdvanced function.
function encodeBulkBuyListingsAdvancedCalldata(
address paymentProcessorAddress,
AdvancedOrder[] memory advancedListingsArray,
BulkOrderProof[] memory bulkOrderProofs,
FeeOnTop[] memory feesOnTop) external view returns (bytes memory)
Note: The length of the advancedListingsArray, bulkOrderProofs and feesOnTop MUST match and MUST be non-zero. advancedListingsArray[index] MUST correspond to bulkOrderProofs[index] and feesOnTop[index].
Note: If the maker did not use a permit processor, advancedListingsArray[index].permitContext MUST be set to the empty PermitContext({permitProcessor: address(0), permitNonce: 0}).
Note: If the order being filled is not be associated with a merkle root, bulkOrderProofs[index] MUST be set to BulkOrderProof({orderIndex: 0, proof: []}).
Note: If the order being filled does not have fees on top, feesOnTop[index] MUST be set to the empty FeeOnTop({recipient: address(0), amount: 0}).
encodeBulkAcceptOffersCalldata
Used to encode calldata for Payment Processor bulkAcceptOffers function.
function encodeBulkAcceptOffersCalldata(
address paymentProcessorAddress,
uint256[] memory offerTypeArray,
Order[] memory saleDetailsArray,
SignatureECDSA[] memory signatures,
TokenSetProof[] memory tokenSetProofsArray,
Cosignature[] memory cosignaturesArray,
FeeOnTop[] memory feesOnTopArray
) external view returns (bytes memory);
Note: The length of the saleDetailsArray, signatures, tokenSetProofsArray, offerTypeArray, cosignatures, and feesOnTopArray MUST match and MUST be non-zero. saleDetailsArray[index] MUST correspond to signatures[index], tokenSetProofsArray[index], offerTypeArray[index], cosignatures[index], and feesOnTopArray[index].
*Note: When filling an item offer, offerTypeArray[index] MUST be set to 1, and tokenSetProofsArray[index] MUST be set to the empty TokenSetProof({proof: bytes32[](0)}).
*Note: When filling a collection offer, offerTypeArray[index] MUST be set to 0, and tokenSetProofsArray[index] MUST be set to the empty TokenSetProof({proof: bytes32[](0)}).
*Note: When filling a token set offer, offerTypeArray[index] MUST be set to 2, and tokenSetProofsArray[index] MUST contain the valid merkle proof for the collection and token id being filled.
Note: As co-signatures may not apply to all orders being filled, cosignatures[index] MUST be set to the empty Cosignature({signer: address(0), taker: address(0), expiration: 0, v: 0, r: bytes32(0), s: bytes32(0)}) for any order that is not co-signed.
Note: As fees on top may not apply to all orders being filled, feesOnTop[index] MUST be set to the empty FeeOnTop({recipient: address(0), amount: 0}) for any order that is not subject to a fee on top.
encodeBulkAcceptOffersAdvancedCalldata
Used to encode calldata for PaymentProcessor bulkAcceptOffersAdvanced function.
function encodeBulkAcceptOffersAdvancedCalldata(
address paymentProcessorAddress,
AdvancedBidOrder[] memory advancedBidsArray,
BulkOrderProof[] memory bulkOrderProofs,
FeeOnTop[] memory feesOnTop,
TokenSetProof[] memory tokenSetProofs) external view returns (bytes memory)
Note: The length of the advancedBidsArray, bulkOrderProofs, feesOnTop, and tokenSetProofs MUST match and MUST be non-zero. advancedBidsArray[index] MUST correspond to bulkOrderProofs[index], feesOnTop[index], and tokenSetProofs[index].
Note: If the maker did not use a permit processor, advancedBidsArray[index].permitContext MUST be set to the empty PermitContext({permitProcessor: address(0), permitNonce: 0}).
Note: If the order being filled is not be associated with a merkle root, bulkOrderProofs[index] MUST be set to the empty BulkOrderProof({orderIndex: 0, proof: []}).
Note: As fees on top may not apply to all orders being filled, feesOnTop[index] MUST be set to the empty FeeOnTop({recipient: address(0), amount: 0}) for any order that is not subject to a fee on top.
Note: When filling a token set offer, tokenSetProofs[index] MUST be set to the empty TokenSetProof({proof: bytes32[](0)}).
encodeSweepCollectionCalldata
Used to encode calldata for Payment Processor sweepCollection function.
function encodeSweepCollectionCalldata(
address paymentProcessorAddress,
FeeOnTop memory feeOnTop,
SweepOrder memory sweepOrder,
SweepItem[] calldata items,
SignatureECDSA[] calldata signatures,
Cosignature[] calldata cosignatures
) external view returns (bytes memory);
Note: The length of the items, signatures, and cosignatures MUST match and MUST be non-zero. items[index] MUST correspond to signatures[index] and cosignatures[index].
Note: As co-signatures may not apply to all orders being filled, cosignatures[index] MUST be set to the empty Cosignature({signer: address(0), taker: address(0), expiration: 0, v: 0, r: bytes32(0), s: bytes32(0)}) for any order that is not co-signed.
Note: A single fee on top may be applied to the entire sweep order.
encodeSweepCollectionAdvancedCalldata
Used to encode calldata for PaymentProcessor sweepCollectionAdvanced fucntion.
function encodeSweepCollectionAdvancedCalldata(
address paymentProcessorAddress,
AdvancedSweep memory advancedSweep) external view returns (bytes memory)
Note: If the maker did not use a permit processor, advancedSweep.items[index].permitContext MUST be set to the empty PermitContext({permitProcessor: address(0), permitNonce: 0}).
Note: If the order being filled is not be associated with a merkle root, advancedSweep.items[index].bulkOrderProof MUST be set to the empty BulkOrderProof({orderIndex: 0, proof: []}).
Note: If the order being filled does not have fees on top, advancedSweep.feeOnTop MUST be set to the empty FeeOnTop({recipient: address(0), amount: 0}).
encodeRevokeSingleNonceCalldata
Used to encode calldata for Payment Processor revokeSingleNonce function (on-chain order cancellation).
function encodeRevokeSingleNonceCalldata(address paymentProcessorAddress, uint256 nonce) external view returns (bytes memory);
encodeRevokeOrderDigestCalldata
Used to encode calldata for Payment Processor revokeOrderDigest function (on-chain order cancellation).
function encodeRevokeOrderDigestCalldata(address paymentProcessorAddress, bytes32 digest) external view returns (bytes memory);
encodeDestroyCosignerCalldata
Used to encode calldata for Payment Processor destroyCosignerCalldata function.
function encodeDestroyCosignerCalldata(
address paymentProcessorAddress,
address cosigner,
SignatureECDSA memory signature
) external view returns (bytes memory);
