Skip to content

Instantly share code, notes, and snippets.

@joejordan
Created June 23, 2023 20:15
Show Gist options
  • Save joejordan/371ef53cd44caac0f27edfd519ce4aa9 to your computer and use it in GitHub Desktop.
Save joejordan/371ef53cd44caac0f27edfd519ce4aa9 to your computer and use it in GitHub Desktop.
Seaport Order Validator -- Convert SeaportValidator Errors and Warnings into a readable error message
/**
* Converts a SeaportValidator error/warning code to a human readable string
* @param code number indicating the error/warning code
* @returns readable string
*/
export function getErrorMessage(code: number): string {
switch (code) {
case 100:
return "Invalid order format. Ensure offer/consideration follow requirements";
case 200:
return "ERC20 identifier must be zero";
case 201:
return "ERC20 invalid token";
case 202:
return "ERC20 insufficient allowance to conduit";
case 203:
return "ERC20 insufficient balance";
case 300:
return "ERC721 amount must be one";
case 301:
return "ERC721 token is invalid";
case 302:
return "ERC721 token with identifier does not exist";
case 303:
return "ERC721 not owner of token";
case 304:
return "ERC721 conduit not approved";
case 305:
return "ERC721 offer item using criteria and more than amount of one requires partial fills";
case 400:
return "ERC1155 invalid token";
case 401:
return "ERC1155 conduit not approved";
case 402:
return "ERC1155 insufficient balance";
case 500:
return "Consideration amount must not be zero";
case 501:
return "Consideration recipient must not be null address";
case 502:
return "Consideration contains extra items";
case 503:
return "Private sale cannot be to self";
case 504:
return "Zero consideration items";
case 505:
return "Duplicate consideration items";
case 506:
return "Offerer is not receiving at least one item";
case 507:
return "Private Sale Order. Be careful on fulfillment";
case 508:
return "Amount velocity is too high. Amount changes over 5% per 30 min if warning and over 50% per 30 min if error";
case 509:
return "Amount step large. The steps between each step may be more than expected. Offer items are rounded down and consideration items are rounded up.";
case 600:
return "Zero offer items";
case 601:
return "Offer amount must not be zero";
case 602:
return "More than one offer item";
case 603:
return "Native offer item";
case 604:
return "Duplicate offer item";
case 605:
return "Amount velocity is too high. Amount changes over 5% per 30 min if warning and over 50% per 30 min if error";
case 606:
return "Amount step large. The steps between each step may be more than expected. Offer items are rounded down and consideration items are rounded up.";
case 700:
return "Primary fee missing";
case 701:
return "Primary fee item type incorrect";
case 702:
return "Primary fee token incorrect";
case 703:
return "Primary fee start amount too low";
case 704:
return "Primary fee end amount too low";
case 705:
return "Primary fee recipient incorrect";
case 800:
return "Order cancelled";
case 801:
return "Order fully filled";
case 802:
return "Cannot validate status of contract order";
case 900:
return "End time is before start time";
case 901:
return "Order expired";
case 902:
return "Order expiration in too long (default 26 weeks)";
case 903:
return "Order not active";
case 904:
return "Short order duration (default 30 min)";
case 1000:
return "Conduit key invalid";
case 1001:
return "Conduit does not have canonical Seaport as an open channel";
case 1100:
return "Signature invalid";
case 1101:
return "Contract orders do not have signatures";
case 1102:
return "Signature counter below current counter";
case 1103:
return "Signature counter above current counter";
case 1104:
return "Signature may be invalid since `totalOriginalConsiderationItems` is not set correctly";
case 1200:
return "Creator fee missing";
case 1201:
return "Creator fee item type incorrect";
case 1202:
return "Creator fee token incorrect";
case 1203:
return "Creator fee start amount too low";
case 1204:
return "Creator fee end amount too low";
case 1205:
return "Creator fee recipient incorrect";
case 1300:
return "Native token address must be null address";
case 1301:
return "Native token identifier must be zero";
case 1302:
return "Native token insufficient balance";
case 1400:
return "Zone is invalid";
case 1401:
return "Zone rejected order. This order must be fulfilled by the zone.";
case 1402:
return "Zone not set. Order unfulfillable";
case 1500:
return "Merkle input only has one leaf";
case 1501:
return "Merkle input not sorted correctly";
case 1600:
return "Contract offerer is invalid";
default:
return "Unknown error or warning code";
}
}
@joejordan
Copy link
Author

Fully aligned with the latest Validator contract, available on-chain here: https://etherscan.io/address/0x00e5F120f500006757E984F1DED400fc00370000

Latest docs on the SeaportValidator contract should be available here: https://github.com/ProjectOpenSea/seaport/blob/main/docs/OrderValidator.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment