From a14918333e8a259118d87b2fc223f87d87d13694 Mon Sep 17 00:00:00 2001 From: Rodrigo <95635797+poly-rodr@users.noreply.github.com> Date: Fri, 23 Sep 2022 16:35:28 -0300 Subject: [PATCH] last contract deploy --- py_order_utils/abi/Exchange.json | 1058 +++++++++++++++++++++++++----- py_order_utils/config.py | 4 +- tests/test_config.py | 6 + tests/test_order_builder.py | 6 +- 4 files changed, 901 insertions(+), 173 deletions(-) diff --git a/py_order_utils/abi/Exchange.json b/py_order_utils/abi/Exchange.json index 8083ebf..93e5b86 100644 --- a/py_order_utils/abi/Exchange.json +++ b/py_order_utils/abi/Exchange.json @@ -1,31 +1,115 @@ [ { "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" } + { + "internalType": "address", + "name": "_collateral", + "type": "address" + }, + { + "internalType": "address", + "name": "_ctf", + "type": "address" + }, + { + "internalType": "address", + "name": "_proxyFactory", + "type": "address" + }, + { + "internalType": "address", + "name": "_safeFactory", + "type": "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" }, - { "inputs": [], "name": "TooLittleTokensReceived", "type": "error" }, + { + "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" + }, + { + "inputs": [], + "name": "TooLittleTokensReceived", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -114,7 +198,13 @@ { "indexed": true, "internalType": "address", - "name": "filler", + "name": "maker", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "taker", "type": "address" }, { @@ -162,12 +252,18 @@ }, { "indexed": true, + "internalType": "address", + "name": "takerOrderMaker", + "type": "address" + }, + { + "indexed": false, "internalType": "uint256", "name": "makerAssetId", "type": "uint256" }, { - "indexed": true, + "indexed": false, "internalType": "uint256", "name": "takerAssetId", "type": "uint256" @@ -317,7 +413,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "admin_", "type": "address" } + { + "internalType": "address", + "name": "admin_", + "type": "address" + } ], "name": "addAdmin", "outputs": [], @@ -326,7 +426,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "operator_", "type": "address" } + { + "internalType": "address", + "name": "operator_", + "type": "address" + } ], "name": "addOperator", "outputs": [], @@ -334,9 +438,21 @@ "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "admins", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, @@ -344,11 +460,31 @@ "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": "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", @@ -364,19 +500,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order", "name": "order", @@ -392,11 +540,31 @@ "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": "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", @@ -412,19 +580,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order[]", "name": "orders", @@ -439,7 +619,13 @@ { "inputs": [], "name": "domainSeparator", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, @@ -447,11 +633,31 @@ "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": "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", @@ -467,25 +673,41 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order", "name": "order", "type": "tuple" }, - { "internalType": "uint256", "name": "fillAmount", "type": "uint256" } + { + "internalType": "uint256", + "name": "fillAmount", + "type": "uint256" + } ], "name": "fillOrder", "outputs": [], @@ -496,11 +718,31 @@ "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": "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", @@ -516,19 +758,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order[]", "name": "orders", @@ -548,45 +802,87 @@ { "inputs": [], "name": "getCollateral", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "token", "type": "uint256" } + { + "internalType": "uint256", + "name": "token", + "type": "uint256" + } ], "name": "getComplement", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "token", "type": "uint256" } + { + "internalType": "uint256", + "name": "token", + "type": "uint256" + } ], "name": "getConditionId", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getCtf", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getMaxFeeRate", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "pure", "type": "function" }, { "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" } + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + } ], "name": "getOrderStatus", "outputs": [ @@ -597,7 +893,11 @@ "name": "isFilledOrCancelled", "type": "bool" }, - { "internalType": "uint256", "name": "remaining", "type": "uint256" } + { + "internalType": "uint256", + "name": "remaining", + "type": "uint256" + } ], "internalType": "struct OrderStatus", "name": "", @@ -610,46 +910,90 @@ { "inputs": [], "name": "getPolyProxyFactoryImplementation", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_addr", "type": "address" } + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } ], "name": "getPolyProxyWalletAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getProxyFactory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "_addr", "type": "address" } + { + "internalType": "address", + "name": "_addr", + "type": "address" + } ], "name": "getSafeAddress", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getSafeFactory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "getSafeFactoryImplementation", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -657,11 +1001,31 @@ "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": "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", @@ -677,19 +1041,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order", "name": "order", @@ -697,7 +1073,13 @@ } ], "name": "hashOrder", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, @@ -709,26 +1091,64 @@ "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "usr", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "usr", + "type": "address" + } + ], "name": "isAdmin", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "usr", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "usr", + "type": "address" + } + ], "name": "isOperator", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "usr", "type": "address" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" } + { + "internalType": "address", + "name": "usr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + } ], "name": "isValidNonce", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -736,11 +1156,31 @@ "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": "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", @@ -756,19 +1196,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order", "name": "takerOrder", @@ -776,11 +1228,31 @@ }, { "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": "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", @@ -796,19 +1268,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order[]", "name": "makerOrders", @@ -831,51 +1315,141 @@ "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, - { "internalType": "uint256[]", "name": "", "type": "uint256[]" }, - { "internalType": "bytes", "name": "", "type": "bytes" } + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } ], "name": "onERC1155BatchReceived", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "uint256", "name": "", "type": "uint256" }, - { "internalType": "bytes", "name": "", "type": "bytes" } + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } ], "name": "onERC1155Received", - "outputs": [{ "internalType": "bytes4", "name": "", "type": "bytes4" }], + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], "stateMutability": "nonpayable", "type": "function" }, { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "name": "operators", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "stateMutability": "view", "type": "function" }, { - "inputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "name": "orderStatus", "outputs": [ - { "internalType": "bool", "name": "isFilledOrCancelled", "type": "bool" }, - { "internalType": "uint256", "name": "remaining", "type": "uint256" } + { + "internalType": "bool", + "name": "isFilledOrCancelled", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "remaining", + "type": "uint256" + } ], "stateMutability": "view", "type": "function" @@ -883,7 +1457,13 @@ { "inputs": [], "name": "parentCollectionId", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], "stateMutability": "view", "type": "function" }, @@ -897,22 +1477,46 @@ { "inputs": [], "name": "paused", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [], "name": "proxyFactory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "uint256", "name": "token", "type": "uint256" }, - { "internalType": "uint256", "name": "complement", "type": "uint256" }, - { "internalType": "bytes32", "name": "conditionId", "type": "bytes32" } + { + "internalType": "uint256", + "name": "token", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "complement", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "conditionId", + "type": "bytes32" + } ], "name": "registerToken", "outputs": [], @@ -920,18 +1524,36 @@ "type": "function" }, { - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], "name": "registry", "outputs": [ - { "internalType": "uint256", "name": "complement", "type": "uint256" }, - { "internalType": "bytes32", "name": "conditionId", "type": "bytes32" } + { + "internalType": "uint256", + "name": "complement", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "conditionId", + "type": "bytes32" + } ], "stateMutability": "view", "type": "function" }, { "inputs": [ - { "internalType": "address", "name": "admin", "type": "address" } + { + "internalType": "address", + "name": "admin", + "type": "address" + } ], "name": "removeAdmin", "outputs": [], @@ -940,7 +1562,11 @@ }, { "inputs": [ - { "internalType": "address", "name": "operator", "type": "address" } + { + "internalType": "address", + "name": "operator", + "type": "address" + } ], "name": "removeOperator", "outputs": [], @@ -964,7 +1590,13 @@ { "inputs": [], "name": "safeFactory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], "stateMutability": "view", "type": "function" }, @@ -996,10 +1628,20 @@ }, { "inputs": [ - { "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" } + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } ], "name": "supportsInterface", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], "stateMutability": "view", "type": "function" }, @@ -1012,8 +1654,16 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "token", "type": "uint256" }, - { "internalType": "uint256", "name": "complement", "type": "uint256" } + { + "internalType": "uint256", + "name": "token", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "complement", + "type": "uint256" + } ], "name": "validateComplement", "outputs": [], @@ -1024,11 +1674,31 @@ "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": "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", @@ -1044,19 +1714,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order", "name": "order", @@ -1070,14 +1752,38 @@ }, { "inputs": [ - { "internalType": "bytes32", "name": "orderHash", "type": "bytes32" }, + { + "internalType": "bytes32", + "name": "orderHash", + "type": "bytes32" + }, { "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": "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", @@ -1093,19 +1799,31 @@ "name": "expiration", "type": "uint256" }, - { "internalType": "uint256", "name": "nonce", "type": "uint256" }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, { "internalType": "uint256", "name": "feeRateBps", "type": "uint256" }, - { "internalType": "enum Side", "name": "side", "type": "uint8" }, + { + "internalType": "enum Side", + "name": "side", + "type": "uint8" + }, { "internalType": "enum SignatureType", "name": "signatureType", "type": "uint8" }, - { "internalType": "bytes", "name": "signature", "type": "bytes" } + { + "internalType": "bytes", + "name": "signature", + "type": "bytes" + } ], "internalType": "struct Order", "name": "order", @@ -1119,7 +1837,11 @@ }, { "inputs": [ - { "internalType": "uint256", "name": "tokenId", "type": "uint256" } + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } ], "name": "validateTokenId", "outputs": [], diff --git a/py_order_utils/config.py b/py_order_utils/config.py index 97926b6..49309f2 100644 --- a/py_order_utils/config.py +++ b/py_order_utils/config.py @@ -24,13 +24,13 @@ def get_contract_config(chainID: int) -> ContractConfig: """ CONFIG = { 137: ContractConfig( - exchange="0x0000000000000000000000000000000000000000", # TODO: Complete me + exchange="0xfffd6f0dB1ec30A58884B23546B4F1bB333f818f", executor="0xb2a29463Df393a4CAef36541544715e6B48b80B7", collateral="0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", conditional="0x4D97DCd97eC945f40cF65F87097ACe5EA0476045", ), 80001: ContractConfig( - exchange="0xdFE02Eb6733538f8Ea35D585af8DE5958AD99E40", + exchange="0xfffd6f0dB1ec30A58884B23546B4F1bB333f818f", executor="0xb2a29463Df393a4CAef36541544715e6B48b80B7", collateral="0x2E8DCfE708D44ae2e406a1c02DFE2Fa13012f961", conditional="0x7D8610E9567d2a6C9FBf66a5A13E9Ba8bb120d43", diff --git a/tests/test_config.py b/tests/test_config.py index d9ccaa0..d74b48a 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -10,6 +10,12 @@ def test_get_config(self): self.assertIsNotNone(valid_config.get_executor()) self.assertIsNotNone(valid_config.get_collateral()) + valid_config = get_contract_config(137) + self.assertIsNotNone(valid_config) + self.assertIsNotNone(valid_config.get_exchange()) + self.assertIsNotNone(valid_config.get_executor()) + self.assertIsNotNone(valid_config.get_collateral()) + # invalid config with self.assertRaises(Exception): get_contract_config(2190239023902) diff --git a/tests/test_order_builder.py b/tests/test_order_builder.py index b262149..bb3f1d9 100644 --- a/tests/test_order_builder.py +++ b/tests/test_order_builder.py @@ -112,12 +112,12 @@ def test_build_prder_signature(self): # Ensure struct hash is expected(generated via ethers) expected_struct_hash = ( - "0xffe5ee610bb27006448785a9af0b8b24c729632cc9ed78a5d571cf053cd2eba3" + "0x41ae598a16959ad2f14e9a610f7861948ad502479ca7a49d1c744de310f7be88" ) struct_hash = builder._create_struct_hash(_order) self.assertEqual(expected_struct_hash, struct_hash.hex()) - expected_signature = "0x8388a5ebe31745a3225612cece129a494122f924e60691c9893901d10e996a01372f1dbde25952cb07719af209bf6b96592c513239aac82ec775846e4b09ee191c" + expected_signature = "0x748008725feeb87db204b2b237869f09176a756abfcb03f9b66e833e80effbcf22c1564cbf18bf8daa88db2ea95eeb6057938bf6bdee7e3708655aa34842db3d1c" sig = builder.build_order_signature(_order) self.assertEqual(expected_signature, sig) @@ -128,7 +128,7 @@ def test_build_signed_order(self): signed_order = builder.build_signed_order(self.generate_data()) - expected_signature = "0x8388a5ebe31745a3225612cece129a494122f924e60691c9893901d10e996a01372f1dbde25952cb07719af209bf6b96592c513239aac82ec775846e4b09ee191c" + expected_signature = "0x748008725feeb87db204b2b237869f09176a756abfcb03f9b66e833e80effbcf22c1564cbf18bf8daa88db2ea95eeb6057938bf6bdee7e3708655aa34842db3d1c" self.assertEqual(expected_signature, signed_order.signature) self.assertTrue(isinstance(signed_order.order["salt"], int)) self.assertEqual(salt, signed_order.order["salt"])