From 05f24c553994a222914ccfdc6648512ed2ba3f46 Mon Sep 17 00:00:00 2001 From: ibruno Date: Sun, 24 May 2026 10:28:06 -0300 Subject: [PATCH 1/5] feat: update order utils to v2 --- py_order_utils/abi/Exchange.json | 2757 ++++++++++++---------- py_order_utils/builders/base_builder.py | 2 +- py_order_utils/builders/order_builder.py | 27 +- py_order_utils/constants.py | 1 + py_order_utils/model/order.py | 72 +- setup.py | 2 +- tests/test_order_builder.py | 70 +- 7 files changed, 1573 insertions(+), 1358 deletions(-) diff --git a/py_order_utils/abi/Exchange.json b/py_order_utils/abi/Exchange.json index 8797d6e..72e06d3 100644 --- a/py_order_utils/abi/Exchange.json +++ b/py_order_utils/abi/Exchange.json @@ -1,1851 +1,2068 @@ [ { + "type": "constructor", "inputs": [ { - "internalType": "address", - "name": "_collateral", - "type": "address" - }, - { - "internalType": "address", - "name": "_ctf", - "type": "address" - }, - { - "internalType": "address", - "name": "_proxyFactory", - "type": "address" - }, - { - "internalType": "address", - "name": "_safeFactory", - "type": "address" + "name": "params", + "type": "tuple", + "internalType": "struct ExchangeInitParams", + "components": [ + { + "name": "admin", + "type": "address", + "internalType": "address" + }, + { + "name": "collateral", + "type": "address", + "internalType": "address" + }, + { + "name": "ctf", + "type": "address", + "internalType": "address" + }, + { + "name": "ctfCollateral", + "type": "address", + "internalType": "address" + }, + { + "name": "outcomeTokenFactory", + "type": "address", + "internalType": "address" + }, + { + "name": "proxyFactory", + "type": "address", + "internalType": "address" + }, + { + "name": "safeFactory", + "type": "address", + "internalType": "address" + }, + { + "name": "feeReceiver", + "type": "address", + "internalType": "address" + } + ] } ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AlreadyRegistered", - "type": "error" - }, - { - "inputs": [], - "name": "FeeTooHigh", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidComplement", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidNonce", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidSignature", - "type": "error" - }, - { - "inputs": [], - "name": "InvalidTokenId", - "type": "error" - }, - { - "inputs": [], - "name": "MakingGtRemaining", - "type": "error" - }, - { - "inputs": [], - "name": "MismatchedTokenIds", - "type": "error" - }, - { - "inputs": [], - "name": "NotAdmin", - "type": "error" - }, - { - "inputs": [], - "name": "NotCrossing", - "type": "error" - }, - { - "inputs": [], - "name": "NotOperator", - "type": "error" - }, - { - "inputs": [], - "name": "NotOwner", - "type": "error" - }, - { - "inputs": [], - "name": "NotTaker", - "type": "error" - }, - { - "inputs": [], - "name": "OrderExpired", - "type": "error" - }, - { - "inputs": [], - "name": "OrderFilledOrCancelled", - "type": "error" - }, - { - "inputs": [], - "name": "Paused", - "type": "error" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "PARENT_COLLECTION_ID", "inputs": [], - "name": "TooLittleTokensReceived", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "receiver", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" + "name": "", + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "FeeCharged", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "addAdmin", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "newAdminAddress", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "admin", - "type": "address" + "name": "_admin", + "type": "address", + "internalType": "address" } ], - "name": "NewAdmin", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "addOperator", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "newOperatorAddress", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "admin", - "type": "address" + "name": "_operator", + "type": "address", + "internalType": "address" } ], - "name": "NewOperator", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "builderFeeConfigs", "inputs": [ { - "indexed": true, - "internalType": "bytes32", - "name": "orderHash", - "type": "bytes32" + "name": "", + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "OrderCancelled", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "orderHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "maker", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "makerAssetId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "takerAssetId", - "type": "uint256" - }, + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "makerAmountFilled", - "type": "uint256" + "name": "builderTakerFeeRateBps", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "takerAmountFilled", - "type": "uint256" + "name": "builderMakerFeeRateBps", + "type": "uint256", + "internalType": "uint256" }, { - "indexed": false, - "internalType": "uint256", - "name": "fee", - "type": "uint256" + "name": "registered", + "type": "bool", + "internalType": "bool" } ], - "name": "OrderFilled", - "type": "event" + "stateMutability": "view" + }, + { + "type": "function", + "name": "claim", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "claimableFees", "inputs": [ { - "indexed": true, - "internalType": "bytes32", - "name": "takerOrderHash", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "takerOrderMaker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "makerAssetId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "takerAssetId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "makerAmountFilled", - "type": "uint256" - }, + "name": "", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ { - "indexed": false, - "internalType": "uint256", - "name": "takerAmountFilled", - "type": "uint256" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "OrdersMatched", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "clearBuilderFeeRates", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "oldProxyFactory", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newProxyFactory", - "type": "address" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "ProxyFactoryUpdated", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, + "type": "function", + "name": "clearReferral", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "removedAdmin", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "admin", - "type": "address" + "name": "maker", + "type": "address", + "internalType": "address" } ], - "name": "RemovedAdmin", - "type": "event" + "outputs": [], + "stateMutability": "nonpayable" }, { - "anonymous": false, - "inputs": [ + "type": "function", + "name": "eip712Domain", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "removedOperator", - "type": "address" + "name": "fields", + "type": "bytes1", + "internalType": "bytes1" }, { - "indexed": true, - "internalType": "address", - "name": "admin", - "type": "address" - } - ], - "name": "RemovedOperator", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ + "name": "name", + "type": "string", + "internalType": "string" + }, { - "indexed": true, - "internalType": "address", - "name": "oldSafeFactory", - "type": "address" + "name": "version", + "type": "string", + "internalType": "string" }, { - "indexed": true, - "internalType": "address", - "name": "newSafeFactory", - "type": "address" - } - ], - "name": "SafeFactoryUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ + "name": "chainId", + "type": "uint256", + "internalType": "uint256" + }, { - "indexed": true, - "internalType": "uint256", - "name": "token0", - "type": "uint256" + "name": "verifyingContract", + "type": "address", + "internalType": "address" }, { - "indexed": true, - "internalType": "uint256", - "name": "token1", - "type": "uint256" + "name": "salt", + "type": "bytes32", + "internalType": "bytes32" }, { - "indexed": true, - "internalType": "bytes32", - "name": "conditionId", - "type": "bytes32" + "name": "extensions", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "TokenRegistered", - "type": "event" + "stateMutability": "view" }, { - "anonymous": false, + "type": "function", + "name": "getBuilderAddress", "inputs": [ { - "indexed": true, - "internalType": "address", - "name": "pauser", - "type": "address" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "TradingPaused", - "type": "event" + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "pure" }, { - "anonymous": false, - "inputs": [ + "type": "function", + "name": "getCollateral", + "inputs": [], + "outputs": [ { - "indexed": true, - "internalType": "address", - "name": "pauser", - "type": "address" + "name": "", + "type": "address", + "internalType": "address" } ], - "name": "TradingUnpaused", - "type": "event" + "stateMutability": "view" }, { - "inputs": [ + "type": "function", + "name": "getCtf", + "inputs": [], + "outputs": [ { - "internalType": "address", - "name": "admin_", - "type": "address" + "name": "", + "type": "address", + "internalType": "address" } ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "view" }, { - "inputs": [ + "type": "function", + "name": "getCtfCollateral", + "inputs": [], + "outputs": [ { - "internalType": "address", - "name": "operator_", - "type": "address" + "name": "", + "type": "address", + "internalType": "address" } ], - "name": "addOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "view" }, { - "inputs": [ + "type": "function", + "name": "getFeeReceiver", + "inputs": [], + "outputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" } ], - "name": "admins", + "stateMutability": "view" + }, + { + "type": "function", + "name": "getMaxFeeRate", + "inputs": [], "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "getOrderStatus", "inputs": [ { - "components": [ - { - "internalType": "uint256", - "name": "salt", - "type": "uint256" - }, - { - "internalType": "address", - "name": "maker", - "type": "address" - }, - { - "internalType": "address", - "name": "signer", - "type": "address" - }, - { - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "makerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "takerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" - }, - { - "internalType": "enum Side", - "name": "side", - "type": "uint8" - }, + "name": "orderHash", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct OrderStatus", + "components": [ { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" + "name": "filled", + "type": "bool", + "internalType": "bool" }, { - "internalType": "bytes", - "name": "signature", - "type": "bytes" + "name": "remaining", + "type": "uint248", + "internalType": "uint248" } - ], - "internalType": "struct Order", - "name": "order", - "type": "tuple" + ] } ], - "name": "cancelOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "view" + }, + { + "type": "function", + "name": "getOutcomeTokenFactory", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProxyFactory", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getProxyImplementation", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "getProxyWalletAddress", "inputs": [ { + "name": "_addr", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSafeFactory", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSafeImplementation", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getSafeWalletAddress", + "inputs": [ + { + "name": "_addr", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "address", + "internalType": "address" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "hashOrder", + "inputs": [ + { + "name": "order", + "type": "tuple", + "internalType": "struct Order", "components": [ { - "internalType": "uint256", "name": "salt", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "maker", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "signer", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "makerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "takerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" + "name": "side", + "type": "uint8", + "internalType": "enum Side" }, { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" + "name": "signatureType", + "type": "uint8", + "internalType": "enum SignatureType" }, { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "enum Side", - "name": "side", - "type": "uint8" + "name": "metadata", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes", "name": "signature", - "type": "bytes" + "type": "bytes", + "internalType": "bytes" } - ], - "internalType": "struct Order[]", - "name": "orders", - "type": "tuple[]" + ] + } + ], + "outputs": [ + { + "name": "", + "type": "bytes32", + "internalType": "bytes32" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "invalidatePreapprovedOrder", + "inputs": [ + { + "name": "orderHash", + "type": "bytes32", + "internalType": "bytes32" } ], - "name": "cancelOrders", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "isAdmin", + "inputs": [ + { + "name": "_usr", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isOperator", + "inputs": [ + { + "name": "_usr", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isUserPaused", + "inputs": [ + { + "name": "user", + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "kuestMakerFeeRateBps", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256", + "internalType": "uint256" + } + ], + "stateMutability": "view" }, { + "type": "function", + "name": "kuestTakerFeeRateBps", "inputs": [], - "name": "domainSeparator", "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "matchOrders", "inputs": [ { + "name": "conditionId", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "takerOrder", + "type": "tuple", + "internalType": "struct Order", "components": [ { - "internalType": "uint256", "name": "salt", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "maker", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "signer", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "makerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "takerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" + "name": "side", + "type": "uint8", + "internalType": "enum Side" }, { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" + "name": "signatureType", + "type": "uint8", + "internalType": "enum SignatureType" }, { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "enum Side", - "name": "side", - "type": "uint8" + "name": "metadata", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes", "name": "signature", - "type": "bytes" + "type": "bytes", + "internalType": "bytes" } - ], - "internalType": "struct Order", - "name": "order", - "type": "tuple" + ] }, { - "internalType": "uint256", - "name": "fillAmount", - "type": "uint256" - } - ], - "name": "fillOrder", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { + "name": "makerOrders", + "type": "tuple[]", + "internalType": "struct Order[]", "components": [ { - "internalType": "uint256", "name": "salt", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "maker", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "signer", - "type": "address" - }, - { - "internalType": "address", - "name": "taker", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "makerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "takerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" + "name": "side", + "type": "uint8", + "internalType": "enum Side" }, { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" + "name": "signatureType", + "type": "uint8", + "internalType": "enum SignatureType" }, { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "enum Side", - "name": "side", - "type": "uint8" + "name": "metadata", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes", "name": "signature", - "type": "bytes" + "type": "bytes", + "internalType": "bytes" } - ], - "internalType": "struct Order[]", - "name": "orders", - "type": "tuple[]" + ] + }, + { + "name": "takerFillAmount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "makerFillAmounts", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "takerFeeAmount", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256[]", - "name": "fillAmounts", - "type": "uint256[]" + "name": "makerFeeAmounts", + "type": "uint256[]", + "internalType": "uint256[]" } ], - "name": "fillOrders", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "getCollateral", - "outputs": [ + "type": "function", + "name": "onERC1155BatchReceived", + "inputs": [ { - "internalType": "address", "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" + }, + { + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" + }, { - "internalType": "uint256", - "name": "token", - "type": "uint256" + "name": "", + "type": "bytes", + "internalType": "bytes" } ], - "name": "getComplement", "outputs": [ { - "internalType": "uint256", "name": "", - "type": "uint256" + "type": "bytes4", + "internalType": "bytes4" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "onERC1155Received", "inputs": [ { - "internalType": "uint256", - "name": "token", - "type": "uint256" + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "address", + "internalType": "address" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "", + "type": "bytes", + "internalType": "bytes" } ], - "name": "getConditionId", "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bytes4", + "internalType": "bytes4" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "getCtf", - "outputs": [ + "type": "function", + "name": "orderStatus", + "inputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "bytes32", + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxFeeRate", "outputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "filled", + "type": "bool", + "internalType": "bool" + }, + { + "name": "remaining", + "type": "uint248", + "internalType": "uint248" } ], - "stateMutability": "pure", - "type": "function" + "stateMutability": "view" }, { - "inputs": [ + "type": "function", + "name": "pauseTrading", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "pauseUser", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "paused", + "inputs": [], + "outputs": [ { - "internalType": "bytes32", - "name": "orderHash", - "type": "bytes32" + "name": "", + "type": "bool", + "internalType": "bool" } ], - "name": "getOrderStatus", - "outputs": [ + "stateMutability": "view" + }, + { + "type": "function", + "name": "preapproveOrder", + "inputs": [ { + "name": "order", + "type": "tuple", + "internalType": "struct Order", "components": [ { - "internalType": "bool", - "name": "isFilledOrCancelled", - "type": "bool" + "name": "salt", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "remaining", - "type": "uint256" + "name": "maker", + "type": "address", + "internalType": "address" + }, + { + "name": "signer", + "type": "address", + "internalType": "address" + }, + { + "name": "tokenId", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "makerAmount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "takerAmount", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "side", + "type": "uint8", + "internalType": "enum Side" + }, + { + "name": "signatureType", + "type": "uint8", + "internalType": "enum SignatureType" + }, + { + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "metadata", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "signature", + "type": "bytes", + "internalType": "bytes" } - ], - "internalType": "struct OrderStatus", - "name": "", - "type": "tuple" + ] } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "getPolyProxyFactoryImplementation", - "outputs": [ + "type": "function", + "name": "referrals", + "inputs": [ { - "internalType": "address", "name": "", - "type": "address" + "type": "address", + "internalType": "address" + } + ], + "outputs": [ + { + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "affiliate", + "type": "address", + "internalType": "address" + }, + { + "name": "affiliatePercentage", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "locked", + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "removeAdmin", "inputs": [ { - "internalType": "address", - "name": "_addr", - "type": "address" + "name": "_admin", + "type": "address", + "internalType": "address" } ], - "name": "getPolyProxyWalletAddress", - "outputs": [ + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "removeOperator", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "_operator", + "type": "address", + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "renounceOperatorRole", "inputs": [], - "name": "getProxyFactory", - "outputs": [ + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setBuilderFeeRates", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "builderTakerFeeRateBps", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "builderMakerFeeRateBps", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "setFeeReceiver", "inputs": [ { - "internalType": "address", - "name": "_addr", - "type": "address" + "name": "receiver", + "type": "address", + "internalType": "address" } ], - "name": "getSafeAddress", - "outputs": [ + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "setKuestFeeRates", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "kuestTakerFeeRateBps", + "type": "uint256", + "internalType": "uint256" + }, + { + "name": "kuestMakerFeeRateBps", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "getSafeFactory", - "outputs": [ + "type": "function", + "name": "setMaxFeeRate", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "rate", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { - "inputs": [], - "name": "getSafeFactoryImplementation", - "outputs": [ + "type": "function", + "name": "setReferral", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "affiliate", + "type": "address", + "internalType": "address" + }, + { + "name": "affiliatePercentage", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "nonpayable" }, { + "type": "function", + "name": "setUserPauseBlockInterval", "inputs": [ { - "components": [ - { - "internalType": "uint256", - "name": "salt", - "type": "uint256" - }, - { - "internalType": "address", - "name": "maker", - "type": "address" - }, - { - "internalType": "address", - "name": "signer", - "type": "address" - }, - { - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "makerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "takerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" - }, - { - "internalType": "enum Side", - "name": "side", - "type": "uint8" - }, - { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct Order", - "name": "order", - "type": "tuple" + "name": "_interval", + "type": "uint256", + "internalType": "uint256" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "supportsInterface", + "inputs": [ + { + "name": "interfaceId", + "type": "bytes4", + "internalType": "bytes4" } ], - "name": "hashOrder", "outputs": [ { - "internalType": "bytes32", "name": "", - "type": "bytes32" + "type": "bool", + "internalType": "bool" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "pure" }, { + "type": "function", + "name": "totalClaimableFees", "inputs": [], - "name": "incrementNonce", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ + "outputs": [ { - "internalType": "address", - "name": "usr", - "type": "address" + "name": "", + "type": "uint256", + "internalType": "uint256" } ], - "name": "isAdmin", + "stateMutability": "view" + }, + { + "type": "function", + "name": "unpauseTrading", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "unpauseUser", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "userPauseBlockInterval", + "inputs": [], "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "userPausedBlockAt", "inputs": [ { - "internalType": "address", - "name": "usr", - "type": "address" + "name": "", + "type": "address", + "internalType": "address" } ], - "name": "isOperator", "outputs": [ { - "internalType": "bool", "name": "", - "type": "bool" + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "stateMutability": "view" }, { + "type": "function", + "name": "validateFee", "inputs": [ { - "internalType": "address", - "name": "usr", - "type": "address" + "name": "fee", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - } - ], - "name": "isValidNonce", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" + "name": "cashValue", + "type": "uint256", + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "outputs": [], + "stateMutability": "view" }, { + "type": "function", + "name": "validateOrder", "inputs": [ { + "name": "order", + "type": "tuple", + "internalType": "struct Order", "components": [ { - "internalType": "uint256", "name": "salt", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "maker", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "signer", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "makerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "takerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" + "name": "side", + "type": "uint8", + "internalType": "enum Side" }, { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" + "name": "signatureType", + "type": "uint8", + "internalType": "enum SignatureType" }, { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "enum Side", - "name": "side", - "type": "uint8" + "name": "metadata", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes", "name": "signature", - "type": "bytes" + "type": "bytes", + "internalType": "bytes" } - ], - "internalType": "struct Order", - "name": "takerOrder", - "type": "tuple" + ] + } + ], + "outputs": [], + "stateMutability": "view" + }, + { + "type": "function", + "name": "validateOrderSignature", + "inputs": [ + { + "name": "orderHash", + "type": "bytes32", + "internalType": "bytes32" }, { + "name": "order", + "type": "tuple", + "internalType": "struct Order", "components": [ { - "internalType": "uint256", "name": "salt", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "address", "name": "maker", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "address", "name": "signer", - "type": "address" - }, - { - "internalType": "address", - "name": "taker", - "type": "address" + "type": "address", + "internalType": "address" }, { - "internalType": "uint256", "name": "tokenId", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "makerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", "name": "takerAmount", - "type": "uint256" + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" + "name": "side", + "type": "uint8", + "internalType": "enum Side" }, { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" + "name": "signatureType", + "type": "uint8", + "internalType": "enum SignatureType" }, { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" + "name": "timestamp", + "type": "uint256", + "internalType": "uint256" }, { - "internalType": "enum Side", - "name": "side", - "type": "uint8" + "name": "metadata", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" + "name": "builder", + "type": "bytes32", + "internalType": "bytes32" }, { - "internalType": "bytes", "name": "signature", - "type": "bytes" + "type": "bytes", + "internalType": "bytes" } - ], - "internalType": "struct Order[]", - "name": "makerOrders", - "type": "tuple[]" - }, - { - "internalType": "uint256", - "name": "takerFillAmount", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "makerFillAmounts", - "type": "uint256[]" + ] } ], - "name": "matchOrders", "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "stateMutability": "view" }, { + "type": "event", + "name": "BuilderFeeRatesCleared", "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ + "name": "builder", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "builderAddress", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "BuilderFeeRatesSet", "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" + "name": "builder", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" }, { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" + "name": "builderAddress", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" + "name": "builderTakerFeeRateBps", + "type": "uint256", + "indexed": false, + "internalType": "uint256" }, { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155BatchReceived", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" + "name": "builderMakerFeeRateBps", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "FeeAccrued", "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "receiver", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "feeType", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" }, { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC1155Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "FeeCharged", "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "operators", - "outputs": [ + "name": "receiver", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "FeeReceiverUpdated", "inputs": [ { - "internalType": "bytes32", - "name": "", - "type": "bytes32" + "name": "feeReceiver", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "name": "orderStatus", - "outputs": [ + "anonymous": false + }, + { + "type": "event", + "name": "FeesClaimed", + "inputs": [ { - "internalType": "bool", - "name": "isFilledOrCancelled", - "type": "bool" + "name": "receiver", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "uint256", - "name": "remaining", - "type": "uint256" + "name": "amount", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "parentCollectionId", - "outputs": [ + "type": "event", + "name": "KuestFeeRatesSet", + "inputs": [ { - "internalType": "bytes32", - "name": "", - "type": "bytes32" + "name": "kuestTakerFeeRateBps", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "kuestMakerFeeRateBps", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pauseTrading", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "paused", - "outputs": [ + "type": "event", + "name": "MaxFeeRateUpdated", + "inputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "name": "maxFeeRate", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "proxyFactory", - "outputs": [ + "type": "event", + "name": "NewAdmin", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "newAdminAddress", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "admin", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "NewOperator", "inputs": [ { - "internalType": "uint256", - "name": "token", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "complement", - "type": "uint256" + "name": "newOperatorAddress", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "bytes32", - "name": "conditionId", - "type": "bytes32" + "name": "admin", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "name": "registerToken", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "OrderFilled", "inputs": [ { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "registry", - "outputs": [ + "name": "orderHash", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "maker", + "type": "address", + "indexed": true, + "internalType": "address" + }, { - "internalType": "uint256", - "name": "complement", - "type": "uint256" + "name": "taker", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "internalType": "bytes32", - "name": "conditionId", - "type": "bytes32" + "name": "side", + "type": "uint8", + "indexed": false, + "internalType": "enum Side" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "makerAmountFilled", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "takerAmountFilled", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "fee", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "builder", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" + }, + { + "name": "metadata", + "type": "bytes32", + "indexed": false, + "internalType": "bytes32" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "OrderPreapprovalInvalidated", "inputs": [ { - "internalType": "address", - "name": "admin", - "type": "address" + "name": "orderHash", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" } ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "OrderPreapproved", "inputs": [ { - "internalType": "address", - "name": "operator", - "type": "address" + "name": "orderHash", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" } ], - "name": "removeOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceAdminRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "renounceOperatorRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "safeFactory", - "outputs": [ + "type": "event", + "name": "OrdersMatched", + "inputs": [ { - "internalType": "address", - "name": "", - "type": "address" + "name": "takerOrderHash", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "takerOrderMaker", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "side", + "type": "uint8", + "indexed": false, + "internalType": "enum Side" + }, + { + "name": "tokenId", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "makerAmountFilled", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "takerAmountFilled", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "ReferralCleared", "inputs": [ { - "internalType": "address", - "name": "_newProxyFactory", - "type": "address" + "name": "maker", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "name": "setProxyFactory", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "ReferralSet", "inputs": [ { - "internalType": "address", - "name": "_newSafeFactory", - "type": "address" + "name": "maker", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "builder", + "type": "bytes32", + "indexed": true, + "internalType": "bytes32" + }, + { + "name": "affiliate", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "builderAddress", + "type": "address", + "indexed": false, + "internalType": "address" + }, + { + "name": "affiliatePercentage", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "locked", + "type": "bool", + "indexed": false, + "internalType": "bool" } ], - "name": "setSafeFactory", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "RemovedAdmin", "inputs": [ { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" + "name": "removedAdmin", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "admin", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "name": "supportsInterface", - "outputs": [ + "anonymous": false + }, + { + "type": "event", + "name": "RemovedOperator", + "inputs": [ { - "internalType": "bool", - "name": "", - "type": "bool" + "name": "removedOperator", + "type": "address", + "indexed": true, + "internalType": "address" + }, + { + "name": "admin", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { - "inputs": [], - "name": "unpauseTrading", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" + "type": "event", + "name": "TradingPaused", + "inputs": [ + { + "name": "pauser", + "type": "address", + "indexed": true, + "internalType": "address" + } + ], + "anonymous": false }, { + "type": "event", + "name": "TradingUnpaused", "inputs": [ { - "internalType": "uint256", - "name": "token", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "complement", - "type": "uint256" + "name": "pauser", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "name": "validateComplement", - "outputs": [], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "UserPauseBlockIntervalUpdated", "inputs": [ { - "components": [ - { - "internalType": "uint256", - "name": "salt", - "type": "uint256" - }, - { - "internalType": "address", - "name": "maker", - "type": "address" - }, - { - "internalType": "address", - "name": "signer", - "type": "address" - }, - { - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "makerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "takerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" - }, - { - "internalType": "enum Side", - "name": "side", - "type": "uint8" - }, - { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct Order", - "name": "order", - "type": "tuple" + "name": "oldInterval", + "type": "uint256", + "indexed": false, + "internalType": "uint256" + }, + { + "name": "newInterval", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "validateOrder", - "outputs": [], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "UserPaused", "inputs": [ { - "internalType": "bytes32", - "name": "orderHash", - "type": "bytes32" + "name": "user", + "type": "address", + "indexed": true, + "internalType": "address" }, { - "components": [ - { - "internalType": "uint256", - "name": "salt", - "type": "uint256" - }, - { - "internalType": "address", - "name": "maker", - "type": "address" - }, - { - "internalType": "address", - "name": "signer", - "type": "address" - }, - { - "internalType": "address", - "name": "taker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "makerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "takerAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "feeRateBps", - "type": "uint256" - }, - { - "internalType": "enum Side", - "name": "side", - "type": "uint8" - }, - { - "internalType": "enum SignatureType", - "name": "signatureType", - "type": "uint8" - }, - { - "internalType": "bytes", - "name": "signature", - "type": "bytes" - } - ], - "internalType": "struct Order", - "name": "order", - "type": "tuple" + "name": "effectivePauseBlock", + "type": "uint256", + "indexed": false, + "internalType": "uint256" } ], - "name": "validateOrderSignature", - "outputs": [], - "stateMutability": "view", - "type": "function" + "anonymous": false }, { + "type": "event", + "name": "UserUnpaused", "inputs": [ { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" + "name": "user", + "type": "address", + "indexed": true, + "internalType": "address" } ], - "name": "validateTokenId", - "outputs": [], - "stateMutability": "view", - "type": "function" + "anonymous": false + }, + { + "type": "error", + "name": "AffiliatePercentageTooHigh", + "inputs": [] + }, + { + "type": "error", + "name": "AlreadyAdmin", + "inputs": [] + }, + { + "type": "error", + "name": "AlreadyOperator", + "inputs": [] + }, + { + "type": "error", + "name": "BuilderFeeRateExceedsCeiling", + "inputs": [] + }, + { + "type": "error", + "name": "ComplementaryFillExceedsTakerFill", + "inputs": [] + }, + { + "type": "error", + "name": "ExceedsMaxPauseInterval", + "inputs": [] + }, + { + "type": "error", + "name": "FeeExceedsMaxRate", + "inputs": [] + }, + { + "type": "error", + "name": "FeeExceedsProceeds", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAffiliate", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidAffiliatePercentage", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidBuilder", + "inputs": [] + }, + { + "type": "error", + "name": "InvalidSignature", + "inputs": [] + }, + { + "type": "error", + "name": "KuestFeeRateExceedsCeiling", + "inputs": [] + }, + { + "type": "error", + "name": "LastAdmin", + "inputs": [] + }, + { + "type": "error", + "name": "MakingGtRemaining", + "inputs": [] + }, + { + "type": "error", + "name": "MaxFeeRateExceedsCeiling", + "inputs": [] + }, + { + "type": "error", + "name": "MismatchedArrayLengths", + "inputs": [] + }, + { + "type": "error", + "name": "MismatchedTokenIds", + "inputs": [] + }, + { + "type": "error", + "name": "NoClaimableFees", + "inputs": [] + }, + { + "type": "error", + "name": "NoMakerOrders", + "inputs": [] + }, + { + "type": "error", + "name": "NotAdmin", + "inputs": [] + }, + { + "type": "error", + "name": "NotCrossing", + "inputs": [] + }, + { + "type": "error", + "name": "NotOperator", + "inputs": [] + }, + { + "type": "error", + "name": "OrderAlreadyFilled", + "inputs": [] + }, + { + "type": "error", + "name": "Paused", + "inputs": [] + }, + { + "type": "error", + "name": "ReentrantClaim", + "inputs": [] + }, + { + "type": "error", + "name": "ReferralLocked", + "inputs": [] + }, + { + "type": "error", + "name": "TooLittleTokensReceived", + "inputs": [] + }, + { + "type": "error", + "name": "UserAlreadyPaused", + "inputs": [] + }, + { + "type": "error", + "name": "UserIsPaused", + "inputs": [] + }, + { + "type": "error", + "name": "ZeroFeeReceiver", + "inputs": [] + }, + { + "type": "error", + "name": "ZeroMakerAmount", + "inputs": [] } -] \ No newline at end of file +] diff --git a/py_order_utils/builders/base_builder.py b/py_order_utils/builders/base_builder.py index 1b53890..68c95cc 100644 --- a/py_order_utils/builders/base_builder.py +++ b/py_order_utils/builders/base_builder.py @@ -21,7 +21,7 @@ def _get_domain_separator( ) -> EIP712Struct: return make_domain( name="CTF Exchange", - version="1", + version="2", chainId=str(chain_id), verifyingContract=verifying_contract, ) diff --git a/py_order_utils/builders/order_builder.py b/py_order_utils/builders/order_builder.py index 87671cb..843872d 100644 --- a/py_order_utils/builders/order_builder.py +++ b/py_order_utils/builders/order_builder.py @@ -1,6 +1,8 @@ from ..signer import Signer from .base_builder import BaseBuilder from .exception import ValidationException +from ..constants import ZERO_BYTES32 +from time import time_ns from ..utils import generate_seed, normalize_address, prepend_zx from ..model.order import Order, SignedOrder, OrderData from ..model.sides import BUY, SELL @@ -25,6 +27,9 @@ def build_order(self, data: OrderData) -> Order: """ Builds an order """ + if data.timestamp is None or str(data.timestamp) == "0": + data.timestamp = str(time_ns() // 1_000_000) + if not self._validate_inputs(data): raise ValidationException("Invalid order inputs") @@ -40,19 +45,24 @@ def build_order(self, data: OrderData) -> Order: if data.signatureType is None: data.signatureType = EOA + if data.metadata is None: + data.metadata = ZERO_BYTES32 + + if data.builder is None: + data.builder = ZERO_BYTES32 + return Order( salt=int(self.salt_generator()), maker=normalize_address(data.maker), signer=normalize_address(data.signer), - taker=normalize_address(data.taker), tokenId=int(data.tokenId), makerAmount=int(data.makerAmount), takerAmount=int(data.takerAmount), - expiration=int(data.expiration), - nonce=int(data.nonce), - feeRateBps=int(data.feeRateBps), side=int(data.side), signatureType=int(data.signatureType), + timestamp=int(data.timestamp), + metadata=data.metadata, + builder=data.builder, ) def build_order_signature(self, _order: Order) -> str: @@ -68,7 +78,7 @@ def build_signed_order(self, data: OrderData) -> SignedOrder: order = self.build_order(data) sig = self.build_order_signature(order) - return SignedOrder(order, sig) + return SignedOrder(order, sig, expiration=str(data.expiration or "0")) def _validate_inputs(self, data: OrderData) -> bool: return not ( @@ -79,12 +89,11 @@ def _validate_inputs(self, data: OrderData) -> bool: or data.takerAmount is None or data.side is None or data.side not in [BUY, SELL] - or not data.feeRateBps.isnumeric() - or int(data.feeRateBps) < 0 - or not data.nonce.isnumeric() - or int(data.nonce) < 0 or not data.expiration.isnumeric() or int(data.expiration) < 0 + or data.timestamp is None + or not str(data.timestamp).isnumeric() + or int(data.timestamp) < 0 or data.signatureType is None or data.signatureType not in [EOA, KUEST_GNOSIS_SAFE, KUEST_PROXY, KUEST_EIP1271] diff --git a/py_order_utils/constants.py b/py_order_utils/constants.py index 821cf1f..6e7c991 100644 --- a/py_order_utils/constants.py +++ b/py_order_utils/constants.py @@ -1,2 +1,3 @@ ZX = "0x" ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" +ZERO_BYTES32 = "0x0000000000000000000000000000000000000000000000000000000000000000" diff --git a/py_order_utils/model/order.py b/py_order_utils/model/order.py index dd551ff..5d6d0e1 100644 --- a/py_order_utils/model/order.py +++ b/py_order_utils/model/order.py @@ -1,8 +1,8 @@ from dataclasses import dataclass -from ..constants import ZERO_ADDRESS +from ..constants import ZERO_BYTES32 from .signatures import EOA -from kuest_eip712_structs import Address, EIP712Struct, Uint +from kuest_eip712_structs import Address, Bytes, EIP712Struct, Uint @dataclass @@ -16,11 +16,6 @@ class OrderData: Maker of the order, i.e the source of funds for the order """ - taker: str = ZERO_ADDRESS - """ - Address of the order taker. The zero address is used to indicate a public order - """ - tokenId: str = None """ Token Id of the CTF ERC1155 asset to be bought or sold. @@ -43,16 +38,6 @@ class OrderData: The side of the order, BUY or SELL """ - feeRateBps: str = None - """ - Fee rate, in basis points, charged to the order maker, charged on proceeds - """ - - nonce: str = "0" - """ - Nonce used for onchain cancellations - """ - signer: str = None """ Signer of the order. Optional, if it is not present the signer is the maker of the order. @@ -69,6 +54,21 @@ class OrderData: Signature type used by the Order. Default value 'EOA' """ + timestamp: str = None + """ + Millisecond timestamp included in the signed V2 order. Defaults at build time. + """ + + metadata: str = ZERO_BYTES32 + """ + Metadata bytes32 included in the signed V2 order. + """ + + builder: str = ZERO_BYTES32 + """ + Builder code bytes32 included in the signed V2 order. + """ + class Order(EIP712Struct): """ @@ -92,11 +92,6 @@ class Order(EIP712Struct): Signer of the order """ - taker = Address() - """ - Address of the order taker. The zero address is used to indicate a public order - """ - tokenId = Uint(256) """ Token Id of the CTF ERC1155 asset to be bought or sold. @@ -114,29 +109,29 @@ class Order(EIP712Struct): Taker amount, i.e the minimum amount of tokens to be received """ - expiration = Uint(256) + side = Uint(8) """ - Timestamp after which the order is expired + The side of the order, BUY or SELL """ - nonce = Uint(256) + signatureType = Uint(8) """ - Nonce used for onchain cancellations + Signature type used by the Order """ - feeRateBps = Uint(256) + timestamp = Uint(256) """ - Fee rate, in basis points, charged to the order maker, charged on proceeds + Millisecond timestamp included in the signed order. """ - side = Uint(8) + metadata = Bytes(32) """ - The side of the order, BUY or SELL + Metadata bytes32 included in the signed order. """ - signatureType = Uint(8) + builder = Bytes(32) """ - Signature type used by the Order + Builder code bytes32 included in the signed order. """ def dict(self): @@ -144,15 +139,14 @@ def dict(self): "salt": self["salt"], "maker": self["maker"], "signer": self["signer"], - "taker": self["taker"], "tokenId": self["tokenId"], "makerAmount": self["makerAmount"], "takerAmount": self["takerAmount"], - "expiration": self["expiration"], - "nonce": self["nonce"], - "feeRateBps": self["feeRateBps"], "side": self["side"], "signatureType": self["signatureType"], + "timestamp": self["timestamp"], + "metadata": self["metadata"], + "builder": self["builder"], } @@ -164,6 +158,7 @@ class SignedOrder: order: Order signature: str + expiration: str = "0" def dict(self): d = self.order.dict() @@ -172,9 +167,8 @@ def dict(self): d["side"] = "BUY" else: d["side"] = "SELL" - d["expiration"] = str(d["expiration"]) - d["nonce"] = str(d["nonce"]) - d["feeRateBps"] = str(d["feeRateBps"]) + d["expiration"] = str(self.expiration) + d["timestamp"] = str(d["timestamp"]) d["makerAmount"] = str(d["makerAmount"]) d["takerAmount"] = str(d["takerAmount"]) d["tokenId"] = str(d["tokenId"]) diff --git a/setup.py b/setup.py index bb173c1..57dc8a5 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="kuest-py-order-utils", - version="0.3.4", + version="0.3.5", author="Kuest Engineering", author_email="engineering@kuest.com", maintainer="Kuest Engineering", diff --git a/tests/test_order_builder.py b/tests/test_order_builder.py index 2cf9dba..a90264e 100644 --- a/tests/test_order_builder.py +++ b/tests/test_order_builder.py @@ -5,7 +5,7 @@ from py_order_utils.builders import OrderBuilder from py_order_utils.model.signatures import EOA from py_order_utils.signer import Signer -from py_order_utils.constants import ZERO_ADDRESS +from py_order_utils.constants import ZERO_ADDRESS, ZERO_BYTES32 # publicly known private key private_key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" @@ -14,8 +14,8 @@ salt = 479249096354 chain_id = 80002 amoy_contracts = { - "exchange": "0xB5592f7CccA122558D2201e190826276f3a661cb", - "negRiskExchange": "0xef02d1Ea5B42432C4E99C2785d1a4020d2FB24F5", + "exchange": "0x4bB1871fdaE80331ce5fF87547b8ff886D1695a5", + "negRiskExchange": "0xdb1E374a05130d7DE3F16677066553F225D2eE53", "collateral": "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582", "conditional": "0x4682048725865bf17067bd85fF518527A262A9C7", } @@ -40,7 +40,7 @@ def test_validate_order(self): # Invalid if any of the required fields are invalid data = self.generate_data() - data.nonce = "-1" + data.timestamp = "-1" self.assertFalse(builder._validate_inputs(data)) data = self.generate_data() @@ -66,7 +66,7 @@ def test_validate_order_neg_risk(self): # Invalid if any of the required fields are invalid data = self.generate_data() - data.nonce = "-1" + data.timestamp = "-1" self.assertFalse(builder._validate_inputs(data)) data = self.generate_data() @@ -101,15 +101,14 @@ def test_build_order(self): self.assertTrue(isinstance(_order["salt"], int)) self.assertEqual(maker_address, _order["maker"]) self.assertEqual(maker_address, _order["signer"]) - self.assertEqual(ZERO_ADDRESS, _order["taker"]) self.assertEqual(1234, _order["tokenId"]) self.assertEqual(100000000, _order["makerAmount"]) self.assertEqual(50000000, _order["takerAmount"]) - self.assertEqual(0, _order["expiration"]) - self.assertEqual(0, _order["nonce"]) - self.assertEqual(100, _order["feeRateBps"]) self.assertEqual(BUY, _order["side"]) self.assertEqual(EOA, _order["signatureType"]) + self.assertEqual(1234567890000, _order["timestamp"]) + self.assertEqual(ZERO_BYTES32, _order["metadata"]) + self.assertEqual(ZERO_BYTES32, _order["builder"]) # specific salt builder = OrderBuilder( @@ -123,15 +122,14 @@ def test_build_order(self): self.assertEqual(salt, _order["salt"]) self.assertEqual(maker_address, _order["maker"]) self.assertEqual(maker_address, _order["signer"]) - self.assertEqual(ZERO_ADDRESS, _order["taker"]) self.assertEqual(1234, _order["tokenId"]) self.assertEqual(100000000, _order["makerAmount"]) self.assertEqual(50000000, _order["takerAmount"]) - self.assertEqual(0, _order["expiration"]) - self.assertEqual(0, _order["nonce"]) - self.assertEqual(100, _order["feeRateBps"]) self.assertEqual(BUY, _order["side"]) self.assertEqual(EOA, _order["signatureType"]) + self.assertEqual(1234567890000, _order["timestamp"]) + self.assertEqual(ZERO_BYTES32, _order["metadata"]) + self.assertEqual(ZERO_BYTES32, _order["builder"]) def test_build_order_neg_risk(self): builder = OrderBuilder(amoy_contracts["negRiskExchange"], chain_id, signer) @@ -156,15 +154,14 @@ def test_build_order_neg_risk(self): self.assertTrue(isinstance(_order["salt"], int)) self.assertEqual(maker_address, _order["maker"]) self.assertEqual(maker_address, _order["signer"]) - self.assertEqual(ZERO_ADDRESS, _order["taker"]) self.assertEqual(1234, _order["tokenId"]) self.assertEqual(100000000, _order["makerAmount"]) self.assertEqual(50000000, _order["takerAmount"]) - self.assertEqual(0, _order["expiration"]) - self.assertEqual(0, _order["nonce"]) - self.assertEqual(100, _order["feeRateBps"]) self.assertEqual(BUY, _order["side"]) self.assertEqual(EOA, _order["signatureType"]) + self.assertEqual(1234567890000, _order["timestamp"]) + self.assertEqual(ZERO_BYTES32, _order["metadata"]) + self.assertEqual(ZERO_BYTES32, _order["builder"]) # specific salt builder = OrderBuilder( @@ -178,15 +175,14 @@ def test_build_order_neg_risk(self): self.assertEqual(salt, _order["salt"]) self.assertEqual(maker_address, _order["maker"]) self.assertEqual(maker_address, _order["signer"]) - self.assertEqual(ZERO_ADDRESS, _order["taker"]) self.assertEqual(1234, _order["tokenId"]) self.assertEqual(100000000, _order["makerAmount"]) self.assertEqual(50000000, _order["takerAmount"]) - self.assertEqual(0, _order["expiration"]) - self.assertEqual(0, _order["nonce"]) - self.assertEqual(100, _order["feeRateBps"]) self.assertEqual(BUY, _order["side"]) self.assertEqual(EOA, _order["signatureType"]) + self.assertEqual(1234567890000, _order["timestamp"]) + self.assertEqual(ZERO_BYTES32, _order["metadata"]) + self.assertEqual(ZERO_BYTES32, _order["builder"]) def test_build_order_signature(self): builder = OrderBuilder( @@ -197,12 +193,12 @@ def test_build_order_signature(self): # Ensure struct hash is expected(generated via ethers) expected_struct_hash = ( - "0x98070eb465b37a2557fe08abaf4f9d1432a1478a40dd04666254f68ae5444d44" + "0xb13efa2da1cf85e6afb56e42033b7d95ffb19edd33c6202c0c03c96d079ba05e" ) struct_hash = builder._create_struct_hash(_order) self.assertEqual(expected_struct_hash, struct_hash) - expected_signature = "0x42e0dfd451e933e4507b01cec24a5bf68355a6b554acc9d314367ef30da09ea66f5feab1f4ac6b279883824d5b31a9765762520873313745f78983ac97bf32891c" + expected_signature = "0xd120be386428c4949ad7b55c5cad6c01430abdffc3025ddafec83f040275b8ac7289c140f94481aa5df2449a0c95e254e00efb7e562503098692a9d28a0f1edf1c" sig = builder.build_order_signature(_order) self.assertEqual(expected_signature, sig) @@ -215,12 +211,12 @@ def test_build_order_signature_neg_risk(self): # Ensure struct hash is expected(generated via ethers) expected_struct_hash = ( - "0xf32754541f8eaa5f3fbf32f177157fc7309cb811bdbea495a8017e4fd5ed556b" + "0x147e15edb27e66e6fe90d966775ba2488a1772753f3c5132239776a94dc07543" ) struct_hash = builder._create_struct_hash(_order) self.assertEqual(expected_struct_hash, struct_hash) - expected_signature = "0x7fa4ca3bea4300028684d30fc65eacd6857744cd9eb305c2026c630828d9d6324c0b0e8f95c134c69ae388dbbabca52efa0ae80c6ac0834e09d2ce3f3f7682481b" + expected_signature = "0x5a50841d44661363e3d0d913c12423b487c19a613172d804892a0a45c9cc1a7f4f077b5a5073a23fb30571115fa524163a7b9cc859476001a7f46d0b86457dcf1b" sig = builder.build_order_signature(_order) self.assertEqual(expected_signature, sig) @@ -231,21 +227,20 @@ def test_build_signed_order(self): signed_order = builder.build_signed_order(self.generate_data()) - expected_signature = "0x42e0dfd451e933e4507b01cec24a5bf68355a6b554acc9d314367ef30da09ea66f5feab1f4ac6b279883824d5b31a9765762520873313745f78983ac97bf32891c" + expected_signature = "0xd120be386428c4949ad7b55c5cad6c01430abdffc3025ddafec83f040275b8ac7289c140f94481aa5df2449a0c95e254e00efb7e562503098692a9d28a0f1edf1c" self.assertEqual(expected_signature, signed_order.signature) self.assertTrue(isinstance(signed_order.order["salt"], int)) self.assertEqual(salt, signed_order.order["salt"]) self.assertEqual(maker_address, signed_order.order["maker"]) self.assertEqual(maker_address, signed_order.order["signer"]) - self.assertEqual(ZERO_ADDRESS, signed_order.order["taker"]) self.assertEqual(1234, signed_order.order["tokenId"]) self.assertEqual(100000000, signed_order.order["makerAmount"]) self.assertEqual(50000000, signed_order.order["takerAmount"]) - self.assertEqual(0, signed_order.order["expiration"]) - self.assertEqual(0, signed_order.order["nonce"]) - self.assertEqual(100, signed_order.order["feeRateBps"]) self.assertEqual(BUY, signed_order.order["side"]) self.assertEqual(EOA, signed_order.order["signatureType"]) + self.assertEqual(1234567890000, signed_order.order["timestamp"]) + self.assertEqual(ZERO_BYTES32, signed_order.order["metadata"]) + self.assertEqual(ZERO_BYTES32, signed_order.order["builder"]) def test_build_signed_order_neg_risk(self): builder = OrderBuilder( @@ -254,30 +249,29 @@ def test_build_signed_order_neg_risk(self): signed_order = builder.build_signed_order(self.generate_data()) - expected_signature = "0x7fa4ca3bea4300028684d30fc65eacd6857744cd9eb305c2026c630828d9d6324c0b0e8f95c134c69ae388dbbabca52efa0ae80c6ac0834e09d2ce3f3f7682481b" + expected_signature = "0x5a50841d44661363e3d0d913c12423b487c19a613172d804892a0a45c9cc1a7f4f077b5a5073a23fb30571115fa524163a7b9cc859476001a7f46d0b86457dcf1b" self.assertEqual(expected_signature, signed_order.signature) self.assertTrue(isinstance(signed_order.order["salt"], int)) self.assertEqual(salt, signed_order.order["salt"]) self.assertEqual(maker_address, signed_order.order["maker"]) self.assertEqual(maker_address, signed_order.order["signer"]) - self.assertEqual(ZERO_ADDRESS, signed_order.order["taker"]) self.assertEqual(1234, signed_order.order["tokenId"]) self.assertEqual(100000000, signed_order.order["makerAmount"]) self.assertEqual(50000000, signed_order.order["takerAmount"]) - self.assertEqual(0, signed_order.order["expiration"]) - self.assertEqual(0, signed_order.order["nonce"]) - self.assertEqual(100, signed_order.order["feeRateBps"]) self.assertEqual(BUY, signed_order.order["side"]) self.assertEqual(EOA, signed_order.order["signatureType"]) + self.assertEqual(1234567890000, signed_order.order["timestamp"]) + self.assertEqual(ZERO_BYTES32, signed_order.order["metadata"]) + self.assertEqual(ZERO_BYTES32, signed_order.order["builder"]) def generate_data(self) -> OrderData: return OrderData( maker=maker_address, - taker=ZERO_ADDRESS, tokenId="1234", makerAmount="100000000", takerAmount="50000000", side=BUY, - feeRateBps="100", - nonce="0", + timestamp="1234567890000", + metadata=ZERO_BYTES32, + builder=ZERO_BYTES32, ) From 60c8ca8e2bd5af3f24d98f9abb28aac97925ae5d Mon Sep 17 00:00:00 2001 From: ibruno Date: Sun, 24 May 2026 10:56:33 -0300 Subject: [PATCH 2/5] chore: bump eip712 dependency to 0.0.4 --- requirements.txt | 2 +- setup.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 8fc830c..501666c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ eth-account===0.13.0 eth-utils===4.1.1 -kuest-py-eip712-structs==0.0.3 +kuest-py-eip712-structs==0.0.4 pytest==8.2.2 diff --git a/setup.py b/setup.py index 57dc8a5..1bd76c6 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="kuest-py-order-utils", - version="0.3.5", + version="0.3.6", author="Kuest Engineering", author_email="engineering@kuest.com", maintainer="Kuest Engineering", @@ -17,7 +17,7 @@ install_requires=[ "eth-utils>=4.1.1", "eth-account>=0.13.0", - "kuest-py-eip712-structs==0.0.3", + "kuest-py-eip712-structs==0.0.4", "pytest", ], package_data={ From 02173814c51dbb540e9ea12f7ad64f62a098c1a5 Mon Sep 17 00:00:00 2001 From: ibruno Date: Sun, 24 May 2026 10:59:35 -0300 Subject: [PATCH 3/5] fix: use ubuntu 24.04 for ci --- .github/workflows/workflow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index c440199..cc8c21c 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -8,7 +8,7 @@ on: jobs: build-lint-test: name: Test - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 From 0cd0c59733919ff401d094213ebe6dfcb95a4637 Mon Sep 17 00:00:00 2001 From: ibruno Date: Sun, 24 May 2026 11:01:29 -0300 Subject: [PATCH 4/5] fix: use setup-python v5 --- .github/workflows/workflow.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index cc8c21c..d3c6dca 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -11,9 +11,9 @@ jobs: runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: - python-version: 3.9.10 + python-version: "3.9" - run: | python -m pip install --upgrade pip From 55b10a28eeee25947044c7bc5e6745e861d715fb Mon Sep 17 00:00:00 2001 From: ibruno Date: Sun, 24 May 2026 11:51:45 -0300 Subject: [PATCH 5/5] fix: update github actions to node24 --- .github/workflows/release.yaml | 2 +- .github/workflows/workflow.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index ff37771..5dc02e6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,7 +18,7 @@ jobs: with: persist-credentials: false - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 with: python-version: 3.9 diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index d3c6dca..ad9cd56 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -10,8 +10,8 @@ jobs: name: Test runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v5 + - uses: actions/checkout@v6 + - uses: actions/setup-python@v6 with: python-version: "3.9"