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);
encodeAcceptOfferCalldata
Used to encode calldata for Payment Processor acceptOffer function.
function encodeAcceptOfferCalldata(
address paymentProcessorAddress,
bool isCollectionLevelOffer,
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, isCollectionLevelOffer MUST be set to false, and tokenSetProof MUST be set to the empty TokenSetProof({rootHash: bytes32(0), proof: bytes32[](0)}).
*Note: When filling a collection offer, isCollectionLevelOffer MUST be set to true, and tokenSetProof MUST be set to the empty TokenSetProof({rootHash: bytes32(0), proof: bytes32[](0)}).
*Note: When filling a token set offer, isCollectionLevelOffer MUST be set to true, and tokenSetProof MUST contain the root hash of the merkle tree signed by the offer maker, and the proof must be the valid merkle proof for the collection and token id being filled.
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.
encodeBulkAcceptOffersCalldata
Used to encode calldata for Payment Processor bulkAcceptOffers function.
function encodeBulkAcceptOffersCalldata(
address paymentProcessorAddress,
bool[] memory isCollectionLevelOfferArray,
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, isCollectionLevelOfferArray, cosignatures, and feesOnTopArray MUST match and MUST be non-zero. saleDetailsArray[index] MUST correspond to signatures[index], tokenSetProofsArray[index], isCollectionLevelOfferArray[index], cosignatures[index], and feesOnTopArray[index].
*Note: When filling an item offer, isCollectionLevelOfferArray[index] MUST be set to false, and tokenSetProofsArray[index] MUST be set to the empty TokenSetProof({rootHash: bytes32(0), proof: bytes32[](0)}).
*Note: When filling a collection offer, isCollectionLevelOfferArray[index] MUST be set to true, and tokenSetProofsArray[index] MUST be set to the empty TokenSetProof({rootHash: bytes32(0), proof: bytes32[](0)}).
*Note: When filling a token set offer, isCollectionLevelOfferArray[index] MUST be set to true, and tokenSetProofsArray[index] MUST contain the root hash of the merkle tree signed by the offer maker, and the proof must be 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.
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.
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);
