Files
protocol/lib/generated-artifacts/IZeroEx.json
T
Michael Zhu dd132c611c gitpkg
2021-03-16 10:53:37 -07:00

4334 lines
363 KiB
JSON

{
"schemaVersion": "2.0.0",
"contractName": "IZeroEx",
"compilerOutput": {
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"indexed": false,
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
}
],
"name": "ExpiredRfqOrder",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "makerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "takerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "takerTokenFeeFilledAmount",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint256",
"name": "protocolFeePaid",
"type": "uint256"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
}
],
"name": "LimitOrderFilled",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "inputToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "outputToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "inputTokenAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "outputTokenAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "address",
"name": "provider",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "recipient",
"type": "address"
}
],
"name": "LiquidityProviderSwap",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "hash",
"type": "bytes32"
},
{
"indexed": true,
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
},
{
"indexed": false,
"internalType": "address",
"name": "signer",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "MetaTransactionExecuted",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "caller",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "migrator",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "Migrated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "maker",
"type": "address"
}
],
"name": "OrderCancelled",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "makerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "takerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "minValidSalt",
"type": "uint256"
}
],
"name": "PairCancelledLimitOrders",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "makerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "takerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "minValidSalt",
"type": "uint256"
}
],
"name": "PairCancelledRfqOrders",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
},
{
"indexed": false,
"internalType": "address",
"name": "oldImpl",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "newImpl",
"type": "address"
}
],
"name": "ProxyFunctionUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "quoteSigner",
"type": "address"
}
],
"name": "QuoteSignerUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"indexed": false,
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "makerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "takerToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
},
{
"indexed": false,
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
},
{
"indexed": false,
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
}
],
"name": "RfqOrderFilled",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "origin",
"type": "address"
},
{
"indexed": false,
"internalType": "address[]",
"name": "addrs",
"type": "address[]"
},
{
"indexed": false,
"internalType": "bool",
"name": "allowed",
"type": "bool"
}
],
"name": "RfqOrderOriginsAllowed",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "inputToken",
"type": "address"
},
{
"indexed": false,
"internalType": "address",
"name": "outputToken",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "inputTokenAmount",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "outputTokenAmount",
"type": "uint256"
}
],
"name": "TransformedERC20",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "address",
"name": "transformerDeployer",
"type": "address"
}
],
"name": "TransformerDeployerUpdated",
"type": "event"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "takerTokenFillAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
}
],
"name": "_fillLimitOrder",
"outputs": [
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "takerTokenFillAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
}
],
"name": "_fillRfqOrder",
"outputs": [
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"internalType": "address",
"name": "to",
"type": "address"
},
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "_spendERC20Tokens",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address payable",
"name": "taker",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "inputToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "outputToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "inputTokenAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minOutputTokenAmount",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint32",
"name": "deploymentNonce",
"type": "uint32"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"internalType": "struct ITransformERC20Feature.Transformation[]",
"name": "transformations",
"type": "tuple[]"
}
],
"internalType": "struct ITransformERC20Feature.TransformERC20Args",
"name": "args",
"type": "tuple"
}
],
"name": "_transformERC20",
"outputs": [
{
"internalType": "uint256",
"name": "outputTokenAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder[]",
"name": "orders",
"type": "tuple[]"
}
],
"name": "batchCancelLimitOrders",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06[]",
"name": "makerTokens",
"type": "address[]"
},
{
"internalType": "contract IERC20TokenV06[]",
"name": "takerTokens",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "minValidSalts",
"type": "uint256[]"
}
],
"name": "batchCancelPairLimitOrders",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06[]",
"name": "makerTokens",
"type": "address[]"
},
{
"internalType": "contract IERC20TokenV06[]",
"name": "takerTokens",
"type": "address[]"
},
{
"internalType": "uint256[]",
"name": "minValidSalts",
"type": "uint256[]"
}
],
"name": "batchCancelPairRfqOrders",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder[]",
"name": "orders",
"type": "tuple[]"
}
],
"name": "batchCancelRfqOrders",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address payable",
"name": "signer",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "minGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "maxGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "expirationTimeSeconds",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "contract IERC20TokenV06",
"name": "feeToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "feeAmount",
"type": "uint256"
}
],
"internalType": "struct IMetaTransactionsFeature.MetaTransactionData[]",
"name": "mtxs",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature[]",
"name": "signatures",
"type": "tuple[]"
}
],
"name": "batchExecuteMetaTransactions",
"outputs": [
{
"internalType": "bytes[]",
"name": "returnResults",
"type": "bytes[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "inputToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "outputToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "sellAmount",
"type": "uint256"
},
{
"components": [
{
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
},
{
"internalType": "uint256",
"name": "sellAmount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"internalType": "struct IMultiplexFeature.WrappedBatchCall[]",
"name": "calls",
"type": "tuple[]"
}
],
"internalType": "struct IMultiplexFeature.BatchFillData",
"name": "fillData",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "minBuyAmount",
"type": "uint256"
}
],
"name": "batchFill",
"outputs": [
{
"internalType": "uint256",
"name": "outputTokenAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder[]",
"name": "orders",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature[]",
"name": "signatures",
"type": "tuple[]"
},
{
"internalType": "uint128[]",
"name": "takerTokenFillAmounts",
"type": "uint128[]"
},
{
"internalType": "bool",
"name": "revertIfIncomplete",
"type": "bool"
}
],
"name": "batchFillLimitOrders",
"outputs": [
{
"internalType": "uint128[]",
"name": "takerTokenFilledAmounts",
"type": "uint128[]"
},
{
"internalType": "uint128[]",
"name": "makerTokenFilledAmounts",
"type": "uint128[]"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder[]",
"name": "orders",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature[]",
"name": "signatures",
"type": "tuple[]"
},
{
"internalType": "uint128[]",
"name": "takerTokenFillAmounts",
"type": "uint128[]"
},
{
"internalType": "bool",
"name": "revertIfIncomplete",
"type": "bool"
}
],
"name": "batchFillRfqOrders",
"outputs": [
{
"internalType": "uint128[]",
"name": "takerTokenFilledAmounts",
"type": "uint128[]"
},
{
"internalType": "uint128[]",
"name": "makerTokenFilledAmounts",
"type": "uint128[]"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder[]",
"name": "orders",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature[]",
"name": "signatures",
"type": "tuple[]"
}
],
"name": "batchGetLimitOrderRelevantStates",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"internalType": "enum LibNativeOrder.OrderStatus",
"name": "status",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
}
],
"internalType": "struct LibNativeOrder.OrderInfo[]",
"name": "orderInfos",
"type": "tuple[]"
},
{
"internalType": "uint128[]",
"name": "actualFillableTakerTokenAmounts",
"type": "uint128[]"
},
{
"internalType": "bool[]",
"name": "isSignatureValids",
"type": "bool[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder[]",
"name": "orders",
"type": "tuple[]"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature[]",
"name": "signatures",
"type": "tuple[]"
}
],
"name": "batchGetRfqOrderRelevantStates",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"internalType": "enum LibNativeOrder.OrderStatus",
"name": "status",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
}
],
"internalType": "struct LibNativeOrder.OrderInfo[]",
"name": "orderInfos",
"type": "tuple[]"
},
{
"internalType": "uint128[]",
"name": "actualFillableTakerTokenAmounts",
"type": "uint128[]"
},
{
"internalType": "bool[]",
"name": "isSignatureValids",
"type": "bool[]"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder",
"name": "order",
"type": "tuple"
}
],
"name": "cancelLimitOrder",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "minValidSalt",
"type": "uint256"
}
],
"name": "cancelPairLimitOrders",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "minValidSalt",
"type": "uint256"
}
],
"name": "cancelPairRfqOrders",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder",
"name": "order",
"type": "tuple"
}
],
"name": "cancelRfqOrder",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "createTransformWallet",
"outputs": [
{
"internalType": "contract IFlashWallet",
"name": "wallet",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address payable",
"name": "signer",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "minGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "maxGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "expirationTimeSeconds",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "contract IERC20TokenV06",
"name": "feeToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "feeAmount",
"type": "uint256"
}
],
"internalType": "struct IMetaTransactionsFeature.MetaTransactionData",
"name": "mtx",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
}
],
"name": "executeMetaTransaction",
"outputs": [
{
"internalType": "bytes",
"name": "returnResult",
"type": "bytes"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
},
{
"internalType": "address",
"name": "impl",
"type": "address"
}
],
"name": "extend",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "takerTokenFillAmount",
"type": "uint128"
}
],
"name": "fillLimitOrder",
"outputs": [
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "takerTokenFillAmount",
"type": "uint128"
}
],
"name": "fillOrKillLimitOrder",
"outputs": [
{
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "takerTokenFillAmount",
"type": "uint128"
}
],
"name": "fillOrKillRfqOrder",
"outputs": [
{
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "takerTokenFillAmount",
"type": "uint128"
}
],
"name": "fillRfqOrder",
"outputs": [
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "makerTokenFilledAmount",
"type": "uint128"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getAllowanceTarget",
"outputs": [
{
"internalType": "address",
"name": "target",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder",
"name": "order",
"type": "tuple"
}
],
"name": "getLimitOrderHash",
"outputs": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder",
"name": "order",
"type": "tuple"
}
],
"name": "getLimitOrderInfo",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"internalType": "enum LibNativeOrder.OrderStatus",
"name": "status",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
}
],
"internalType": "struct LibNativeOrder.OrderInfo",
"name": "orderInfo",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerTokenFeeAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "address",
"name": "feeRecipient",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.LimitOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
}
],
"name": "getLimitOrderRelevantState",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"internalType": "enum LibNativeOrder.OrderStatus",
"name": "status",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
}
],
"internalType": "struct LibNativeOrder.OrderInfo",
"name": "orderInfo",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "actualFillableTakerTokenAmount",
"type": "uint128"
},
{
"internalType": "bool",
"name": "isSignatureValid",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address payable",
"name": "signer",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "minGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "maxGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "expirationTimeSeconds",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "contract IERC20TokenV06",
"name": "feeToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "feeAmount",
"type": "uint256"
}
],
"internalType": "struct IMetaTransactionsFeature.MetaTransactionData",
"name": "mtx",
"type": "tuple"
}
],
"name": "getMetaTransactionExecutedBlock",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address payable",
"name": "signer",
"type": "address"
},
{
"internalType": "address",
"name": "sender",
"type": "address"
},
{
"internalType": "uint256",
"name": "minGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "maxGasPrice",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "expirationTimeSeconds",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "callData",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "value",
"type": "uint256"
},
{
"internalType": "contract IERC20TokenV06",
"name": "feeToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "feeAmount",
"type": "uint256"
}
],
"internalType": "struct IMetaTransactionsFeature.MetaTransactionData",
"name": "mtx",
"type": "tuple"
}
],
"name": "getMetaTransactionHash",
"outputs": [
{
"internalType": "bytes32",
"name": "mtxHash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32",
"name": "mtxHash",
"type": "bytes32"
}
],
"name": "getMetaTransactionHashExecutedBlock",
"outputs": [
{
"internalType": "uint256",
"name": "blockNumber",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getProtocolFeeMultiplier",
"outputs": [
{
"internalType": "uint32",
"name": "multiplier",
"type": "uint32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getQuoteSigner",
"outputs": [
{
"internalType": "address",
"name": "signer",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder",
"name": "order",
"type": "tuple"
}
],
"name": "getRfqOrderHash",
"outputs": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder",
"name": "order",
"type": "tuple"
}
],
"name": "getRfqOrderInfo",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"internalType": "enum LibNativeOrder.OrderStatus",
"name": "status",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
}
],
"internalType": "struct LibNativeOrder.OrderInfo",
"name": "orderInfo",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "contract IERC20TokenV06",
"name": "makerToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "takerToken",
"type": "address"
},
{
"internalType": "uint128",
"name": "makerAmount",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "takerAmount",
"type": "uint128"
},
{
"internalType": "address",
"name": "maker",
"type": "address"
},
{
"internalType": "address",
"name": "taker",
"type": "address"
},
{
"internalType": "address",
"name": "txOrigin",
"type": "address"
},
{
"internalType": "bytes32",
"name": "pool",
"type": "bytes32"
},
{
"internalType": "uint64",
"name": "expiry",
"type": "uint64"
},
{
"internalType": "uint256",
"name": "salt",
"type": "uint256"
}
],
"internalType": "struct LibNativeOrder.RfqOrder",
"name": "order",
"type": "tuple"
},
{
"components": [
{
"internalType": "enum LibSignature.SignatureType",
"name": "signatureType",
"type": "uint8"
},
{
"internalType": "uint8",
"name": "v",
"type": "uint8"
},
{
"internalType": "bytes32",
"name": "r",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "s",
"type": "bytes32"
}
],
"internalType": "struct LibSignature.Signature",
"name": "signature",
"type": "tuple"
}
],
"name": "getRfqOrderRelevantState",
"outputs": [
{
"components": [
{
"internalType": "bytes32",
"name": "orderHash",
"type": "bytes32"
},
{
"internalType": "enum LibNativeOrder.OrderStatus",
"name": "status",
"type": "uint8"
},
{
"internalType": "uint128",
"name": "takerTokenFilledAmount",
"type": "uint128"
}
],
"internalType": "struct LibNativeOrder.OrderInfo",
"name": "orderInfo",
"type": "tuple"
},
{
"internalType": "uint128",
"name": "actualFillableTakerTokenAmount",
"type": "uint128"
},
{
"internalType": "bool",
"name": "isSignatureValid",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
},
{
"internalType": "uint256",
"name": "idx",
"type": "uint256"
}
],
"name": "getRollbackEntryAtIndex",
"outputs": [
{
"internalType": "address",
"name": "impl",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
}
],
"name": "getRollbackLength",
"outputs": [
{
"internalType": "uint256",
"name": "rollbackLength",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06",
"name": "token",
"type": "address"
},
{
"internalType": "address",
"name": "owner",
"type": "address"
}
],
"name": "getSpendableERC20BalanceOf",
"outputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getTransformWallet",
"outputs": [
{
"internalType": "contract IFlashWallet",
"name": "wallet",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "getTransformerDeployer",
"outputs": [
{
"internalType": "address",
"name": "deployer",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "target",
"type": "address"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
},
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "migrate",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"components": [
{
"internalType": "address[]",
"name": "tokens",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "sellAmount",
"type": "uint256"
},
{
"components": [
{
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"internalType": "struct IMultiplexFeature.WrappedMultiHopCall[]",
"name": "calls",
"type": "tuple[]"
}
],
"internalType": "struct IMultiplexFeature.MultiHopFillData",
"name": "fillData",
"type": "tuple"
},
{
"internalType": "uint256",
"name": "minBuyAmount",
"type": "uint256"
}
],
"name": "multiHopFill",
"outputs": [
{
"internalType": "uint256",
"name": "outputTokenAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "ownerAddress",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "origins",
"type": "address[]"
},
{
"internalType": "bool",
"name": "allowed",
"type": "bool"
}
],
"name": "registerAllowedRfqOrigins",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes4",
"name": "selector",
"type": "bytes4"
},
{
"internalType": "address",
"name": "targetImpl",
"type": "address"
}
],
"name": "rollback",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06",
"name": "inputToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "outputToken",
"type": "address"
},
{
"internalType": "contract ILiquidityProvider",
"name": "provider",
"type": "address"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint256",
"name": "sellAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minBuyAmount",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "auxiliaryData",
"type": "bytes"
}
],
"name": "sellToLiquidityProvider",
"outputs": [
{
"internalType": "uint256",
"name": "boughtAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06[]",
"name": "tokens",
"type": "address[]"
},
{
"internalType": "uint256",
"name": "sellAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minBuyAmount",
"type": "uint256"
},
{
"internalType": "bool",
"name": "isSushi",
"type": "bool"
}
],
"name": "sellToUniswap",
"outputs": [
{
"internalType": "uint256",
"name": "buyAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "quoteSigner",
"type": "address"
}
],
"name": "setQuoteSigner",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "transformerDeployer",
"type": "address"
}
],
"name": "setTransformerDeployer",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32[]",
"name": "poolIds",
"type": "bytes32[]"
}
],
"name": "transferProtocolFeesForPools",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "contract IERC20TokenV06",
"name": "inputToken",
"type": "address"
},
{
"internalType": "contract IERC20TokenV06",
"name": "outputToken",
"type": "address"
},
{
"internalType": "uint256",
"name": "inputTokenAmount",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "minOutputTokenAmount",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint32",
"name": "deploymentNonce",
"type": "uint32"
},
{
"internalType": "bytes",
"name": "data",
"type": "bytes"
}
],
"internalType": "struct ITransformERC20Feature.Transformation[]",
"name": "transformations",
"type": "tuple[]"
}
],
"name": "transformERC20",
"outputs": [
{
"internalType": "uint256",
"name": "outputTokenAmount",
"type": "uint256"
}
],
"stateMutability": "payable",
"type": "function"
}
],
"devdoc": {
"details": "Interface for a fully featured Exchange Proxy.",
"kind": "dev",
"methods": {
"_fillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128,address,address)": {
"details": "Fill a limit order. Internal variant. ETH protocol fees can be attached to this call. Any unspent ETH will be refunded to `msg.sender` (not `sender`).",
"params": {
"order": "The limit order.",
"sender": "The order sender.",
"signature": "The order signature.",
"taker": "The order taker.",
"takerTokenFillAmount": "Maximum taker token to fill this order with."
},
"returns": {
"makerTokenFilledAmount": "How much maker token was filled.",
"takerTokenFilledAmount": "How much maker token was filled."
}
},
"_fillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128,address)": {
"details": "Fill an RFQ order. Internal variant.",
"params": {
"order": "The RFQ order.",
"signature": "The order signature.",
"taker": "The order taker.",
"takerTokenFillAmount": "Maximum taker token to fill this order with."
},
"returns": {
"makerTokenFilledAmount": "How much maker token was filled.",
"takerTokenFilledAmount": "How much maker token was filled."
}
},
"_spendERC20Tokens(address,address,address,uint256)": {
"details": "Transfers ERC20 tokens from `owner` to `to`. Only callable from within.",
"params": {
"amount": "The amount of `token` to transfer.",
"owner": "The owner of the tokens.",
"to": "The recipient of the tokens.",
"token": "The token to spend."
}
},
"_transformERC20((address,address,address,uint256,uint256,(uint32,bytes)[]))": {
"details": "Internal version of `transformERC20()`. Only callable from within.",
"params": {
"args": "A `TransformERC20Args` struct."
},
"returns": {
"outputTokenAmount": "The amount of `outputToken` received by the taker."
}
},
"batchCancelLimitOrders((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[])": {
"details": "Cancel multiple limit orders. The caller must be the maker. Silently succeeds if the order has already been cancelled.",
"params": {
"orders": "The limit orders."
}
},
"batchCancelPairLimitOrders(address[],address[],uint256[])": {
"details": "Cancel all limit orders for a given maker and pair with a salt less than the value provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.",
"params": {
"makerTokens": "The maker tokens.",
"minValidSalts": "The new minimum valid salts.",
"takerTokens": "The taker tokens."
}
},
"batchCancelPairRfqOrders(address[],address[],uint256[])": {
"details": "Cancel all RFQ orders for a given maker and pair with a salt less than the value provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.",
"params": {
"makerTokens": "The maker tokens.",
"minValidSalts": "The new minimum valid salts.",
"takerTokens": "The taker tokens."
}
},
"batchCancelRfqOrders((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[])": {
"details": "Cancel multiple RFQ orders. The caller must be the maker. Silently succeeds if the order has already been cancelled.",
"params": {
"orders": "The RFQ orders."
}
},
"batchExecuteMetaTransactions((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256)[],(uint8,uint8,bytes32,bytes32)[])": {
"details": "Execute multiple meta-transactions.",
"params": {
"mtxs": "The meta-transactions.",
"signatures": "The signature by each respective `mtx.signer`."
},
"returns": {
"returnResults": "The ABI-encoded results of the underlying calls."
}
},
"batchFill((address,address,uint256,(bytes4,uint256,bytes)[]),uint256)": {
"details": "Executes a batch of fills selling `fillData.inputToken` for `fillData.outputToken` in sequence. Refer to the internal variant `_batchFill` for the allowed nested operations.",
"params": {
"fillData": "Encodes the input/output tokens, the sell amount, and the nested operations for this batch fill.",
"minBuyAmount": "The minimum amount of `fillData.outputToken` to buy. Reverts if this amount is not met."
},
"returns": {
"outputTokenAmount": "The amount of the output token bought."
}
},
"batchFillLimitOrders((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[],uint128[],bool)": {
"details": "Fills multiple limit orders.",
"params": {
"orders": "Array of limit orders.",
"revertIfIncomplete": "If true, reverts if this function fails to fill the full fill amount for any individual order.",
"signatures": "Array of signatures corresponding to each order.",
"takerTokenFillAmounts": "Array of desired amounts to fill each order."
},
"returns": {
"makerTokenFilledAmounts": "Array of amounts filled, in maker token.",
"takerTokenFilledAmounts": "Array of amounts filled, in taker token."
}
},
"batchFillRfqOrders((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[],uint128[],bool)": {
"details": "Fills multiple RFQ orders.",
"params": {
"orders": "Array of RFQ orders.",
"revertIfIncomplete": "If true, reverts if this function fails to fill the full fill amount for any individual order.",
"signatures": "Array of signatures corresponding to each order.",
"takerTokenFillAmounts": "Array of desired amounts to fill each order."
},
"returns": {
"makerTokenFilledAmounts": "Array of amounts filled, in maker token.",
"takerTokenFilledAmounts": "Array of amounts filled, in taker token."
}
},
"batchGetLimitOrderRelevantStates((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": {
"details": "Batch version of `getLimitOrderRelevantState()`, without reverting. Orders that would normally cause `getLimitOrderRelevantState()` to revert will have empty results.",
"params": {
"orders": "The limit orders.",
"signatures": "The order signatures."
},
"returns": {
"actualFillableTakerTokenAmounts": "How much of each order is fillable based on maker funds, in taker tokens.",
"isSignatureValids": "Whether each signature is valid for the order.",
"orderInfos": "Info about the orders."
}
},
"batchGetRfqOrderRelevantStates((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": {
"details": "Batch version of `getRfqOrderRelevantState()`, without reverting. Orders that would normally cause `getRfqOrderRelevantState()` to revert will have empty results.",
"params": {
"orders": "The RFQ orders.",
"signatures": "The order signatures."
},
"returns": {
"actualFillableTakerTokenAmounts": "How much of each order is fillable based on maker funds, in taker tokens.",
"isSignatureValids": "Whether each signature is valid for the order.",
"orderInfos": "Info about the orders."
}
},
"cancelLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": {
"details": "Cancel a single limit order. The caller must be the maker. Silently succeeds if the order has already been cancelled.",
"params": {
"order": "The limit order."
}
},
"cancelPairLimitOrders(address,address,uint256)": {
"details": "Cancel all limit orders for a given maker and pair with a salt less than the value provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.",
"params": {
"makerToken": "The maker token.",
"minValidSalt": "The new minimum valid salt.",
"takerToken": "The taker token."
}
},
"cancelPairRfqOrders(address,address,uint256)": {
"details": "Cancel all RFQ orders for a given maker and pair with a salt less than the value provided. The caller must be the maker. Subsequent calls to this function with the same caller and pair require the new salt to be >= the old salt.",
"params": {
"makerToken": "The maker token.",
"minValidSalt": "The new minimum valid salt.",
"takerToken": "The taker token."
}
},
"cancelRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": {
"details": "Cancel a single RFQ order. The caller must be the maker. Silently succeeds if the order has already been cancelled.",
"params": {
"order": "The RFQ order."
}
},
"createTransformWallet()": {
"details": "Deploy a new flash wallet instance and replace the current one with it. Useful if we somehow break the current wallet instance. Only callable by the owner.",
"returns": {
"wallet": "The new wallet instance."
}
},
"executeMetaTransaction((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256),(uint8,uint8,bytes32,bytes32))": {
"details": "Execute a single meta-transaction.",
"params": {
"mtx": "The meta-transaction.",
"signature": "The signature by `mtx.signer`."
},
"returns": {
"returnResult": "The ABI-encoded result of the underlying call."
}
},
"extend(bytes4,address)": {
"details": "Register or replace a function.",
"params": {
"impl": "The implementation contract for the function.",
"selector": "The function selector."
}
},
"fillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": {
"details": "Fill a limit order. The taker and sender will be the caller.",
"params": {
"order": "The limit order. ETH protocol fees can be attached to this call. Any unspent ETH will be refunded to the caller.",
"signature": "The order signature.",
"takerTokenFillAmount": "Maximum taker token amount to fill this order with."
},
"returns": {
"makerTokenFilledAmount": "How much maker token was filled.",
"takerTokenFilledAmount": "How much maker token was filled."
}
},
"fillOrKillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": {
"details": "Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens. The taker will be the caller. ETH protocol fees can be attached to this call. Any unspent ETH will be refunded to the caller.",
"params": {
"order": "The limit order.",
"signature": "The order signature.",
"takerTokenFillAmount": "How much taker token to fill this order with."
},
"returns": {
"makerTokenFilledAmount": "How much maker token was filled."
}
},
"fillOrKillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": {
"details": "Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens. The taker will be the caller.",
"params": {
"order": "The RFQ order.",
"signature": "The order signature.",
"takerTokenFillAmount": "How much taker token to fill this order with."
},
"returns": {
"makerTokenFilledAmount": "How much maker token was filled."
}
},
"fillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": {
"details": "Fill an RFQ order for up to `takerTokenFillAmount` taker tokens. The taker will be the caller.",
"params": {
"order": "The RFQ order.",
"signature": "The order signature.",
"takerTokenFillAmount": "Maximum taker token amount to fill this order with."
},
"returns": {
"makerTokenFilledAmount": "How much maker token was filled.",
"takerTokenFilledAmount": "How much maker token was filled."
}
},
"getAllowanceTarget()": {
"details": "Get the address of the allowance target.",
"returns": {
"target": "The target of token allowances."
}
},
"getLimitOrderHash((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": {
"details": "Get the canonical hash of a limit order.",
"params": {
"order": "The limit order."
},
"returns": {
"orderHash": "The order hash."
}
},
"getLimitOrderInfo((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": {
"details": "Get the order info for a limit order.",
"params": {
"order": "The limit order."
},
"returns": {
"orderInfo": "Info about the order."
}
},
"getLimitOrderRelevantState((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": {
"details": "Get order info, fillable amount, and signature validity for a limit order. Fillable amount is determined using balances and allowances of the maker.",
"params": {
"order": "The limit order.",
"signature": "The order signature."
},
"returns": {
"actualFillableTakerTokenAmount": "How much of the order is fillable based on maker funds, in taker tokens.",
"isSignatureValid": "Whether the signature is valid.",
"orderInfo": "Info about the order."
}
},
"getMetaTransactionExecutedBlock((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256))": {
"details": "Get the block at which a meta-transaction has been executed.",
"params": {
"mtx": "The meta-transaction."
},
"returns": {
"blockNumber": "The block height when the meta-transactioin was executed."
}
},
"getMetaTransactionHash((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256))": {
"details": "Get the EIP712 hash of a meta-transaction.",
"params": {
"mtx": "The meta-transaction."
},
"returns": {
"mtxHash": "The EIP712 hash of `mtx`."
}
},
"getMetaTransactionHashExecutedBlock(bytes32)": {
"details": "Get the block at which a meta-transaction hash has been executed.",
"params": {
"mtxHash": "The meta-transaction hash."
},
"returns": {
"blockNumber": "The block height when the meta-transactioin was executed."
}
},
"getProtocolFeeMultiplier()": {
"details": "Get the protocol fee multiplier. This should be multiplied by the gas price to arrive at the required protocol fee to fill a native order.",
"returns": {
"multiplier": "The protocol fee multiplier."
}
},
"getQuoteSigner()": {
"details": "Return the optional signer for `transformERC20()` calldata.",
"returns": {
"signer": "The transform deployer address."
}
},
"getRfqOrderHash((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": {
"details": "Get the canonical hash of an RFQ order.",
"params": {
"order": "The RFQ order."
},
"returns": {
"orderHash": "The order hash."
}
},
"getRfqOrderInfo((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": {
"details": "Get the order info for an RFQ order.",
"params": {
"order": "The RFQ order."
},
"returns": {
"orderInfo": "Info about the order."
}
},
"getRfqOrderRelevantState((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": {
"details": "Get order info, fillable amount, and signature validity for an RFQ order. Fillable amount is determined using balances and allowances of the maker.",
"params": {
"order": "The RFQ order.",
"signature": "The order signature."
},
"returns": {
"actualFillableTakerTokenAmount": "How much of the order is fillable based on maker funds, in taker tokens.",
"isSignatureValid": "Whether the signature is valid.",
"orderInfo": "Info about the order."
}
},
"getRollbackEntryAtIndex(bytes4,uint256)": {
"details": "Retrieve an entry in the rollback history for a function.",
"params": {
"idx": "The index in the rollback history.",
"selector": "The function selector."
},
"returns": {
"impl": "An implementation address for the function at index `idx`."
}
},
"getRollbackLength(bytes4)": {
"details": "Retrieve the length of the rollback history for a function.",
"params": {
"selector": "The function selector."
},
"returns": {
"rollbackLength": "The number of items in the rollback history for the function."
}
},
"getSpendableERC20BalanceOf(address,address)": {
"details": "Gets the maximum amount of an ERC20 token `token` that can be pulled from `owner`.",
"params": {
"owner": "The owner of the tokens.",
"token": "The token to spend."
},
"returns": {
"amount": "The amount of tokens that can be pulled."
}
},
"getTransformWallet()": {
"details": "Return the current wallet instance that will serve as the execution context for transformations.",
"returns": {
"wallet": "The wallet instance."
}
},
"getTransformerDeployer()": {
"details": "Return the allowed deployer for transformers.",
"returns": {
"deployer": "The transform deployer address."
}
},
"migrate(address,bytes,address)": {
"details": "Execute a migration function in the context of the ZeroEx contract. The result of the function being called should be the magic bytes 0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner. The owner will be temporarily set to `address(this)` inside the call. Before returning, the owner will be set to `newOwner`.",
"params": {
"data": "The call data.",
"newOwner": "The address of the new owner.",
"target": "The migrator contract address."
}
},
"multiHopFill((address[],uint256,(bytes4,bytes)[]),uint256)": {
"details": "Executes a sequence of fills \"hopping\" through the path of tokens given by `fillData.tokens`. Refer to the internal variant `_multiHopFill` for the allowed nested operations.",
"params": {
"fillData": "Encodes the path of tokens, the sell amount, and the nested operations for this multi-hop fill.",
"minBuyAmount": "The minimum amount of the output token to buy. Reverts if this amount is not met."
},
"returns": {
"outputTokenAmount": "The amount of the output token bought."
}
},
"owner()": {
"details": "The owner of this contract.",
"returns": {
"ownerAddress": "The owner address."
}
},
"registerAllowedRfqOrigins(address[],bool)": {
"details": "Mark what tx.origin addresses are allowed to fill an order that specifies the message sender as its txOrigin.",
"params": {
"allowed": "True to register, false to unregister.",
"origins": "An array of origin addresses to update."
}
},
"rollback(bytes4,address)": {
"details": "Roll back to a prior implementation of a function.",
"params": {
"selector": "The function selector.",
"targetImpl": "The address of an older implementation of the function."
}
},
"sellToLiquidityProvider(address,address,address,address,uint256,uint256,bytes)": {
"details": "Sells `sellAmount` of `inputToken` to the liquidity provider at the given `provider` address.",
"params": {
"auxiliaryData": "Auxiliary data supplied to the `provider` contract.",
"inputToken": "The token being sold.",
"minBuyAmount": "The minimum acceptable amount of `outputToken` to buy. Reverts if this amount is not satisfied.",
"outputToken": "The token being bought.",
"provider": "The address of the on-chain liquidity provider to trade with.",
"recipient": "The recipient of the bought tokens. If equal to address(0), `msg.sender` is assumed to be the recipient.",
"sellAmount": "The amount of `inputToken` to sell."
},
"returns": {
"boughtAmount": "The amount of `outputToken` bought."
}
},
"sellToUniswap(address[],uint256,uint256,bool)": {
"details": "Efficiently sell directly to uniswap/sushiswap.",
"params": {
"isSushi": "Use sushiswap if true.",
"minBuyAmount": "Minimum amount of `tokens[-1]` to buy.",
"sellAmount": "of `tokens[0]` Amount to sell.",
"tokens": "Sell path."
},
"returns": {
"buyAmount": "Amount of `tokens[-1]` bought."
}
},
"setQuoteSigner(address)": {
"details": "Replace the optional signer for `transformERC20()` calldata. Only callable by the owner.",
"params": {
"quoteSigner": "The address of the new calldata signer."
}
},
"setTransformerDeployer(address)": {
"details": "Replace the allowed deployer for transformers. Only callable by the owner.",
"params": {
"transformerDeployer": "The address of the new trusted deployer for transformers."
}
},
"transferOwnership(address)": {
"details": "Transfers ownership of the contract to a new address.",
"params": {
"newOwner": "The address that will become the owner."
}
},
"transferProtocolFeesForPools(bytes32[])": {
"details": "Transfers protocol fees from the `FeeCollector` pools into the staking contract.",
"params": {
"poolIds": "Staking pool IDs"
}
},
"transformERC20(address,address,uint256,uint256,(uint32,bytes)[])": {
"details": "Executes a series of transformations to convert an ERC20 `inputToken` to an ERC20 `outputToken`.",
"params": {
"inputToken": "The token being provided by the sender. If `0xeee...`, ETH is implied and should be provided with the call.`",
"inputTokenAmount": "The amount of `inputToken` to take from the sender.",
"minOutputTokenAmount": "The minimum amount of `outputToken` the sender must receive for the entire transformation to succeed.",
"outputToken": "The token to be acquired by the sender. `0xeee...` implies ETH.",
"transformations": "The transformations to execute on the token balance(s) in sequence."
},
"returns": {
"outputTokenAmount": "The amount of `outputToken` received by the sender."
}
}
},
"version": 1
},
"evm": {
"bytecode": {
"linkReferences": {},
"object": "0x",
"opcodes": "",
"sourceMap": ""
},
"deployedBytecode": {
"immutableReferences": {},
"linkReferences": {},
"object": "0x",
"opcodes": "",
"sourceMap": ""
},
"methodIdentifiers": {
"_fillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128,address,address)": "414e4ccf",
"_fillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128,address)": "a656186b",
"_spendERC20Tokens(address,address,address,uint256)": "89dd02e7",
"_transformERC20((address,address,address,uint256,uint256,(uint32,bytes)[]))": "62597192",
"batchCancelLimitOrders((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[])": "9baa45a8",
"batchCancelPairLimitOrders(address[],address[],uint256[])": "86a0c8d7",
"batchCancelPairRfqOrders(address[],address[],uint256[])": "0f0e8cf7",
"batchCancelRfqOrders((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[])": "f6e0f6a5",
"batchExecuteMetaTransactions((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256)[],(uint8,uint8,bytes32,bytes32)[])": "c5579ec8",
"batchFill((address,address,uint256,(bytes4,uint256,bytes)[]),uint256)": "afc6728e",
"batchFillLimitOrders((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[],uint128[],bool)": "1baaa00b",
"batchFillRfqOrders((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[],uint128[],bool)": "75103cb9",
"batchGetLimitOrderRelevantStates((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": "b4658bfb",
"batchGetRfqOrderRelevantStates((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256)[],(uint8,uint8,bytes32,bytes32)[])": "ad354eeb",
"cancelLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": "7d49ec1a",
"cancelPairLimitOrders(address,address,uint256)": "d0a55fb0",
"cancelPairRfqOrders(address,address,uint256)": "9a4f809c",
"cancelRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": "fe55a3ef",
"createTransformWallet()": "287b071b",
"executeMetaTransaction((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256),(uint8,uint8,bytes32,bytes32))": "3d61ed3e",
"extend(bytes4,address)": "6eb224cb",
"fillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": "f6274f66",
"fillOrKillLimitOrder((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": "9240529c",
"fillOrKillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": "438cdfc5",
"fillRfqOrder((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32),uint128)": "aa77476c",
"getAllowanceTarget()": "f7c3a33b",
"getLimitOrderHash((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": "dd11d225",
"getLimitOrderInfo((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256))": "95480889",
"getLimitOrderRelevantState((address,address,uint128,uint128,uint128,address,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": "1fb09795",
"getMetaTransactionExecutedBlock((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256))": "3fb2da38",
"getMetaTransactionHash((address,address,uint256,uint256,uint256,uint256,bytes,uint256,address,uint256))": "ae550497",
"getMetaTransactionHashExecutedBlock(bytes32)": "72d17d03",
"getProtocolFeeMultiplier()": "487b5c20",
"getQuoteSigner()": "9f1ec78b",
"getRfqOrderHash((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": "016a6d65",
"getRfqOrderInfo((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256))": "346693c5",
"getRfqOrderRelevantState((address,address,uint128,uint128,address,address,address,bytes32,uint64,uint256),(uint8,uint8,bytes32,bytes32))": "37f381d8",
"getRollbackEntryAtIndex(bytes4,uint256)": "6ba6bbc2",
"getRollbackLength(bytes4)": "dfd00749",
"getSpendableERC20BalanceOf(address,address)": "496f471e",
"getTransformWallet()": "f028e9be",
"getTransformerDeployer()": "4d54cdb6",
"migrate(address,bytes,address)": "261fe679",
"multiHopFill((address[],uint256,(bytes4,bytes)[]),uint256)": "21c184b6",
"owner()": "8da5cb5b",
"registerAllowedRfqOrigins(address[],bool)": "b09f1fb1",
"rollback(bytes4,address)": "9db64a40",
"sellToLiquidityProvider(address,address,address,address,uint256,uint256,bytes)": "f7fcd384",
"sellToUniswap(address[],uint256,uint256,bool)": "d9627aa4",
"setQuoteSigner(address)": "56ce180a",
"setTransformerDeployer(address)": "87c96419",
"transferOwnership(address)": "f2fde38b",
"transferProtocolFeesForPools(bytes32[])": "3cd2f026",
"transformERC20(address,address,uint256,uint256,(uint32,bytes)[])": "415565b0"
}
}
},
"sourceTreeHashHex": "0xde27313162fedf2f6a3716ee309df91954659f9b384dfc99bd2335172844dd73",
"sources": {
"./IZeroEx.sol": {
"id": 0,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"./features/interfaces/IOwnableFeature.sol\";\nimport \"./features/interfaces/ISimpleFunctionRegistryFeature.sol\";\nimport \"./features/interfaces/ITokenSpenderFeature.sol\";\nimport \"./features/interfaces/ITransformERC20Feature.sol\";\nimport \"./features/interfaces/IMetaTransactionsFeature.sol\";\nimport \"./features/interfaces/IUniswapFeature.sol\";\nimport \"./features/interfaces/ILiquidityProviderFeature.sol\";\nimport \"./features/interfaces/INativeOrdersFeature.sol\";\nimport \"./features/interfaces/IBatchFillNativeOrdersFeature.sol\";\nimport \"./features/interfaces/IMultiplexFeature.sol\";\n\n\n/// @dev Interface for a fully featured Exchange Proxy.\ninterface IZeroEx is\n IOwnableFeature,\n ISimpleFunctionRegistryFeature,\n ITokenSpenderFeature,\n ITransformERC20Feature,\n IMetaTransactionsFeature,\n IUniswapFeature,\n ILiquidityProviderFeature,\n INativeOrdersFeature,\n IBatchFillNativeOrdersFeature,\n IMultiplexFeature\n{\n // solhint-disable state-visibility\n\n /// @dev Fallback for just receiving ether.\n receive() external payable;\n}\n"
},
"./features/interfaces/IOwnableFeature.sol": {
"id": 10,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol\";\n\n\n// solhint-disable no-empty-blocks\n/// @dev Owner management and migration features.\ninterface IOwnableFeature is\n IOwnableV06\n{\n /// @dev Emitted when `migrate()` is called.\n /// @param caller The caller of `migrate()`.\n /// @param migrator The migration contract.\n /// @param newOwner The address of the new owner.\n event Migrated(address caller, address migrator, address newOwner);\n\n /// @dev Execute a migration function in the context of the ZeroEx contract.\n /// The result of the function being called should be the magic bytes\n /// 0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner.\n /// The owner will be temporarily set to `address(this)` inside the call.\n /// Before returning, the owner will be set to `newOwner`.\n /// @param target The migrator contract address.\n /// @param newOwner The address of the new owner.\n /// @param data The call data.\n function migrate(address target, bytes calldata data, address newOwner) external;\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol": {
"id": 23,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\ninterface IOwnableV06 {\n\n /// @dev Emitted by Ownable when ownership is transferred.\n /// @param previousOwner The previous owner of the contract.\n /// @param newOwner The new owner of the contract.\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /// @dev Transfers ownership of the contract to a new address.\n /// @param newOwner The address that will become the owner.\n function transferOwnership(address newOwner) external;\n\n /// @dev The owner of this contract.\n /// @return ownerAddress The owner address.\n function owner() external view returns (address ownerAddress);\n}\n"
},
"./features/interfaces/ISimpleFunctionRegistryFeature.sol": {
"id": 11,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\n\n/// @dev Basic registry management features.\ninterface ISimpleFunctionRegistryFeature {\n\n /// @dev A function implementation was updated via `extend()` or `rollback()`.\n /// @param selector The function selector.\n /// @param oldImpl The implementation contract address being replaced.\n /// @param newImpl The replacement implementation contract address.\n event ProxyFunctionUpdated(bytes4 indexed selector, address oldImpl, address newImpl);\n\n /// @dev Roll back to a prior implementation of a function.\n /// @param selector The function selector.\n /// @param targetImpl The address of an older implementation of the function.\n function rollback(bytes4 selector, address targetImpl) external;\n\n /// @dev Register or replace a function.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function extend(bytes4 selector, address impl) external;\n\n /// @dev Retrieve the length of the rollback history for a function.\n /// @param selector The function selector.\n /// @return rollbackLength The number of items in the rollback history for\n /// the function.\n function getRollbackLength(bytes4 selector)\n external\n view\n returns (uint256 rollbackLength);\n\n /// @dev Retrieve an entry in the rollback history for a function.\n /// @param selector The function selector.\n /// @param idx The index in the rollback history.\n /// @return impl An implementation address for the function at\n /// index `idx`.\n function getRollbackEntryAtIndex(bytes4 selector, uint256 idx)\n external\n view\n returns (address impl);\n}\n"
},
"./features/interfaces/ITokenSpenderFeature.sol": {
"id": 12,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\n/// @dev Feature that allows spending token allowances.\ninterface ITokenSpenderFeature {\n\n /// @dev Transfers ERC20 tokens from `owner` to `to`.\n /// Only callable from within.\n /// @param token The token to spend.\n /// @param owner The owner of the tokens.\n /// @param to The recipient of the tokens.\n /// @param amount The amount of `token` to transfer.\n function _spendERC20Tokens(\n IERC20TokenV06 token,\n address owner,\n address to,\n uint256 amount\n )\n external;\n\n /// @dev Gets the maximum amount of an ERC20 token `token` that can be\n /// pulled from `owner`.\n /// @param token The token to spend.\n /// @param owner The owner of the tokens.\n /// @return amount The amount of tokens that can be pulled.\n function getSpendableERC20BalanceOf(IERC20TokenV06 token, address owner)\n external\n view\n returns (uint256 amount);\n\n /// @dev Get the address of the allowance target.\n /// @return target The target of token allowances.\n function getAllowanceTarget() external view returns (address target);\n}\n"
},
"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol": {
"id": 19,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\ninterface IERC20TokenV06 {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 value\n );\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param to The address of the recipient\n /// @param value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address to, uint256 value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param from The address of the sender\n /// @param to The address of the recipient\n /// @param value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address from,\n address to,\n uint256 value\n )\n external\n returns (bool);\n\n /// @dev `msg.sender` approves `spender` to spend `value` tokens\n /// @param spender The address of the account able to transfer the tokens\n /// @param value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address spender, uint256 value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n\n /// @dev Get the balance of `owner`.\n /// @param owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address owner)\n external\n view\n returns (uint256);\n\n /// @dev Get the allowance for `spender` to spend from `owner`.\n /// @param owner The address of the account owning tokens\n /// @param spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n /// @dev Get the number of decimals this token has.\n function decimals()\n external\n view\n returns (uint8);\n}\n"
},
"./features/interfaces/ITransformERC20Feature.sol": {
"id": 13,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../../transformers/IERC20Transformer.sol\";\nimport \"../../external/IFlashWallet.sol\";\n\n\n/// @dev Feature to composably transform between ERC20 tokens.\ninterface ITransformERC20Feature {\n\n /// @dev Defines a transformation to run in `transformERC20()`.\n struct Transformation {\n // The deployment nonce for the transformer.\n // The address of the transformer contract will be derived from this\n // value.\n uint32 deploymentNonce;\n // Arbitrary data to pass to the transformer.\n bytes data;\n }\n\n /// @dev Arguments for `_transformERC20()`.\n struct TransformERC20Args {\n // The taker address.\n address payable taker;\n // The token being provided by the taker.\n // If `0xeee...`, ETH is implied and should be provided with the call.`\n IERC20TokenV06 inputToken;\n // The token to be acquired by the taker.\n // `0xeee...` implies ETH.\n IERC20TokenV06 outputToken;\n // The amount of `inputToken` to take from the taker.\n // If set to `uint256(-1)`, the entire spendable balance of the taker\n // will be solt.\n uint256 inputTokenAmount;\n // The minimum amount of `outputToken` the taker\n // must receive for the entire transformation to succeed. If set to zero,\n // the minimum output token transfer will not be asserted.\n uint256 minOutputTokenAmount;\n // The transformations to execute on the token balance(s)\n // in sequence.\n Transformation[] transformations;\n }\n\n /// @dev Raised upon a successful `transformERC20`.\n /// @param taker The taker (caller) address.\n /// @param inputToken The token being provided by the taker.\n /// If `0xeee...`, ETH is implied and should be provided with the call.`\n /// @param outputToken The token to be acquired by the taker.\n /// `0xeee...` implies ETH.\n /// @param inputTokenAmount The amount of `inputToken` to take from the taker.\n /// @param outputTokenAmount The amount of `outputToken` received by the taker.\n event TransformedERC20(\n address indexed taker,\n address inputToken,\n address outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount\n );\n\n /// @dev Raised when `setTransformerDeployer()` is called.\n /// @param transformerDeployer The new deployer address.\n event TransformerDeployerUpdated(address transformerDeployer);\n\n /// @dev Raised when `setQuoteSigner()` is called.\n /// @param quoteSigner The new quote signer.\n event QuoteSignerUpdated(address quoteSigner);\n\n /// @dev Replace the allowed deployer for transformers.\n /// Only callable by the owner.\n /// @param transformerDeployer The address of the new trusted deployer\n /// for transformers.\n function setTransformerDeployer(address transformerDeployer)\n external;\n\n /// @dev Replace the optional signer for `transformERC20()` calldata.\n /// Only callable by the owner.\n /// @param quoteSigner The address of the new calldata signer.\n function setQuoteSigner(address quoteSigner)\n external;\n\n /// @dev Deploy a new flash wallet instance and replace the current one with it.\n /// Useful if we somehow break the current wallet instance.\n /// Only callable by the owner.\n /// @return wallet The new wallet instance.\n function createTransformWallet()\n external\n returns (IFlashWallet wallet);\n\n /// @dev Executes a series of transformations to convert an ERC20 `inputToken`\n /// to an ERC20 `outputToken`.\n /// @param inputToken The token being provided by the sender.\n /// If `0xeee...`, ETH is implied and should be provided with the call.`\n /// @param outputToken The token to be acquired by the sender.\n /// `0xeee...` implies ETH.\n /// @param inputTokenAmount The amount of `inputToken` to take from the sender.\n /// @param minOutputTokenAmount The minimum amount of `outputToken` the sender\n /// must receive for the entire transformation to succeed.\n /// @param transformations The transformations to execute on the token balance(s)\n /// in sequence.\n /// @return outputTokenAmount The amount of `outputToken` received by the sender.\n function transformERC20(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 inputTokenAmount,\n uint256 minOutputTokenAmount,\n Transformation[] calldata transformations\n )\n external\n payable\n returns (uint256 outputTokenAmount);\n\n /// @dev Internal version of `transformERC20()`. Only callable from within.\n /// @param args A `TransformERC20Args` struct.\n /// @return outputTokenAmount The amount of `outputToken` received by the taker.\n function _transformERC20(TransformERC20Args calldata args)\n external\n payable\n returns (uint256 outputTokenAmount);\n\n /// @dev Return the current wallet instance that will serve as the execution\n /// context for transformations.\n /// @return wallet The wallet instance.\n function getTransformWallet()\n external\n view\n returns (IFlashWallet wallet);\n\n /// @dev Return the allowed deployer for transformers.\n /// @return deployer The transform deployer address.\n function getTransformerDeployer()\n external\n view\n returns (address deployer);\n\n /// @dev Return the optional signer for `transformERC20()` calldata.\n /// @return signer The transform deployer address.\n function getQuoteSigner()\n external\n view\n returns (address signer);\n}\n"
},
"./transformers/IERC20Transformer.sol": {
"id": 17,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\n/// @dev A transformation callback used in `TransformERC20.transformERC20()`.\ninterface IERC20Transformer {\n\n /// @dev Context information to pass into `transform()` by `TransformERC20.transformERC20()`.\n struct TransformContext {\n // The caller of `TransformERC20.transformERC20()`.\n address payable sender;\n // taker The taker address, which may be distinct from `sender` in the case\n // meta-transactions.\n address payable taker;\n // Arbitrary data to pass to the transformer.\n bytes data;\n }\n\n /// @dev Called from `TransformERC20.transformERC20()`. This will be\n /// delegatecalled in the context of the FlashWallet instance being used.\n /// @param context Context information.\n /// @return success The success bytes (`LibERC20Transformer.TRANSFORMER_SUCCESS`).\n function transform(TransformContext calldata context)\n external\n returns (bytes4 success);\n}\n"
},
"./external/IFlashWallet.sol": {
"id": 3,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol\";\n\n\n/// @dev A contract that can execute arbitrary calls from its owner.\ninterface IFlashWallet {\n\n /// @dev Execute an arbitrary call. Only an authority can call this.\n /// @param target The call target.\n /// @param callData The call data.\n /// @param value Ether to attach to the call.\n /// @return resultData The data returned by the call.\n function executeCall(\n address payable target,\n bytes calldata callData,\n uint256 value\n )\n external\n payable\n returns (bytes memory resultData);\n\n /// @dev Execute an arbitrary delegatecall, in the context of this puppet.\n /// Only an authority can call this.\n /// @param target The call target.\n /// @param callData The call data.\n /// @return resultData The data returned by the call.\n function executeDelegateCall(\n address payable target,\n bytes calldata callData\n )\n external\n payable\n returns (bytes memory resultData);\n\n /// @dev Allows the puppet to receive ETH.\n receive() external payable;\n\n /// @dev Fetch the immutable owner/deployer of this contract.\n /// @return owner_ The immutable owner/deployer/\n function owner() external view returns (address owner_);\n}\n"
},
"./features/interfaces/IMetaTransactionsFeature.sol": {
"id": 6,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../libs/LibSignature.sol\";\n\n/// @dev Meta-transactions feature.\ninterface IMetaTransactionsFeature {\n /// @dev Describes an exchange proxy meta transaction.\n struct MetaTransactionData {\n // Signer of meta-transaction. On whose behalf to execute the MTX.\n address payable signer;\n // Required sender, or NULL for anyone.\n address sender;\n // Minimum gas price.\n uint256 minGasPrice;\n // Maximum gas price.\n uint256 maxGasPrice;\n // MTX is invalid after this time.\n uint256 expirationTimeSeconds;\n // Nonce to make this MTX unique.\n uint256 salt;\n // Encoded call data to a function on the exchange proxy.\n bytes callData;\n // Amount of ETH to attach to the call.\n uint256 value;\n // ERC20 fee `signer` pays `sender`.\n IERC20TokenV06 feeToken;\n // ERC20 fee amount.\n uint256 feeAmount;\n }\n\n /// @dev Emitted whenever a meta-transaction is executed via\n /// `executeMetaTransaction()` or `executeMetaTransactions()`.\n /// @param hash The meta-transaction hash.\n /// @param selector The selector of the function being executed.\n /// @param signer Who to execute the meta-transaction on behalf of.\n /// @param sender Who executed the meta-transaction.\n event MetaTransactionExecuted(\n bytes32 hash,\n bytes4 indexed selector,\n address signer,\n address sender\n );\n\n /// @dev Execute a single meta-transaction.\n /// @param mtx The meta-transaction.\n /// @param signature The signature by `mtx.signer`.\n /// @return returnResult The ABI-encoded result of the underlying call.\n function executeMetaTransaction(\n MetaTransactionData calldata mtx,\n LibSignature.Signature calldata signature\n )\n external\n payable\n returns (bytes memory returnResult);\n\n /// @dev Execute multiple meta-transactions.\n /// @param mtxs The meta-transactions.\n /// @param signatures The signature by each respective `mtx.signer`.\n /// @return returnResults The ABI-encoded results of the underlying calls.\n function batchExecuteMetaTransactions(\n MetaTransactionData[] calldata mtxs,\n LibSignature.Signature[] calldata signatures\n )\n external\n payable\n returns (bytes[] memory returnResults);\n\n /// @dev Get the block at which a meta-transaction has been executed.\n /// @param mtx The meta-transaction.\n /// @return blockNumber The block height when the meta-transactioin was executed.\n function getMetaTransactionExecutedBlock(MetaTransactionData calldata mtx)\n external\n view\n returns (uint256 blockNumber);\n\n /// @dev Get the block at which a meta-transaction hash has been executed.\n /// @param mtxHash The meta-transaction hash.\n /// @return blockNumber The block height when the meta-transactioin was executed.\n function getMetaTransactionHashExecutedBlock(bytes32 mtxHash)\n external\n view\n returns (uint256 blockNumber);\n\n /// @dev Get the EIP712 hash of a meta-transaction.\n /// @param mtx The meta-transaction.\n /// @return mtxHash The EIP712 hash of `mtx`.\n function getMetaTransactionHash(MetaTransactionData calldata mtx)\n external\n view\n returns (bytes32 mtxHash);\n}\n"
},
"./features/libs/LibSignature.sol": {
"id": 16,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"../../errors/LibSignatureRichErrors.sol\";\n\n\n/// @dev A library for validating signatures.\nlibrary LibSignature {\n using LibRichErrorsV06 for bytes;\n\n // '\\x19Ethereum Signed Message:\\n32\\x00\\x00\\x00\\x00' in a word.\n uint256 private constant ETH_SIGN_HASH_PREFIX =\n 0x19457468657265756d205369676e6564204d6573736167653a0a333200000000;\n /// @dev Exclusive upper limit on ECDSA signatures 'R' values.\n /// The valid range is given by fig (282) of the yellow paper.\n uint256 private constant ECDSA_SIGNATURE_R_LIMIT =\n uint256(0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141);\n /// @dev Exclusive upper limit on ECDSA signatures 'S' values.\n /// The valid range is given by fig (283) of the yellow paper.\n uint256 private constant ECDSA_SIGNATURE_S_LIMIT = ECDSA_SIGNATURE_R_LIMIT / 2 + 1;\n\n /// @dev Allowed signature types.\n enum SignatureType {\n ILLEGAL,\n INVALID,\n EIP712,\n ETHSIGN\n }\n\n /// @dev Encoded EC signature.\n struct Signature {\n // How to validate the signature.\n SignatureType signatureType;\n // EC Signature data.\n uint8 v;\n // EC Signature data.\n bytes32 r;\n // EC Signature data.\n bytes32 s;\n }\n\n /// @dev Retrieve the signer of a signature.\n /// Throws if the signature can't be validated.\n /// @param hash The hash that was signed.\n /// @param signature The signature.\n /// @return recovered The recovered signer address.\n function getSignerOfHash(\n bytes32 hash,\n Signature memory signature\n )\n internal\n pure\n returns (address recovered)\n {\n // Ensure this is a signature type that can be validated against a hash.\n _validateHashCompatibleSignature(hash, signature);\n\n if (signature.signatureType == SignatureType.EIP712) {\n // Signed using EIP712\n recovered = ecrecover(\n hash,\n signature.v,\n signature.r,\n signature.s\n );\n } else if (signature.signatureType == SignatureType.ETHSIGN) {\n // Signed using `eth_sign`\n // Need to hash `hash` with \"\\x19Ethereum Signed Message:\\n32\" prefix\n // in packed encoding.\n bytes32 ethSignHash;\n assembly {\n // Use scratch space\n mstore(0, ETH_SIGN_HASH_PREFIX) // length of 28 bytes\n mstore(28, hash) // length of 32 bytes\n ethSignHash := keccak256(0, 60)\n }\n recovered = ecrecover(\n ethSignHash,\n signature.v,\n signature.r,\n signature.s\n );\n }\n // `recovered` can be null if the signature values are out of range.\n if (recovered == address(0)) {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.BAD_SIGNATURE_DATA,\n hash\n ).rrevert();\n }\n }\n\n /// @dev Validates that a signature is compatible with a hash signee.\n /// @param hash The hash that was signed.\n /// @param signature The signature.\n function _validateHashCompatibleSignature(\n bytes32 hash,\n Signature memory signature\n )\n private\n pure\n {\n // Ensure the r and s are within malleability limits.\n if (uint256(signature.r) >= ECDSA_SIGNATURE_R_LIMIT ||\n uint256(signature.s) >= ECDSA_SIGNATURE_S_LIMIT)\n {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.BAD_SIGNATURE_DATA,\n hash\n ).rrevert();\n }\n\n // Always illegal signature.\n if (signature.signatureType == SignatureType.ILLEGAL) {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.ILLEGAL,\n hash\n ).rrevert();\n }\n\n // Always invalid.\n if (signature.signatureType == SignatureType.INVALID) {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.ALWAYS_INVALID,\n hash\n ).rrevert();\n }\n\n // Solidity should check that the signature type is within enum range for us\n // when abi-decoding.\n }\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol": {
"id": 21,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibRichErrorsV06 {\n\n // bytes4(keccak256(\"Error(string)\"))\n bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0;\n\n // solhint-disable func-name-mixedcase\n /// @dev ABI encode a standard, string revert error payload.\n /// This is the same payload that would be included by a `revert(string)`\n /// solidity statement. It has the function signature `Error(string)`.\n /// @param message The error string.\n /// @return The ABI encoded error.\n function StandardError(string memory message)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n STANDARD_ERROR_SELECTOR,\n bytes(message)\n );\n }\n // solhint-enable func-name-mixedcase\n\n /// @dev Reverts an encoded rich revert reason `errorData`.\n /// @param errorData ABI encoded error data.\n function rrevert(bytes memory errorData)\n internal\n pure\n {\n assembly {\n revert(add(errorData, 0x20), mload(errorData))\n }\n }\n}\n"
},
"./errors/LibSignatureRichErrors.sol": {
"id": 2,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibSignatureRichErrors {\n\n enum SignatureValidationErrorCodes {\n ALWAYS_INVALID,\n INVALID_LENGTH,\n UNSUPPORTED,\n ILLEGAL,\n WRONG_SIGNER,\n BAD_SIGNATURE_DATA\n }\n\n // solhint-disable func-name-mixedcase\n\n function SignatureValidationError(\n SignatureValidationErrorCodes code,\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"SignatureValidationError(uint8,bytes32,address,bytes)\")),\n code,\n hash,\n signerAddress,\n signature\n );\n }\n\n function SignatureValidationError(\n SignatureValidationErrorCodes code,\n bytes32 hash\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"SignatureValidationError(uint8,bytes32)\")),\n code,\n hash\n );\n }\n}\n"
},
"./features/interfaces/IUniswapFeature.sol": {
"id": 14,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\n/// @dev VIP uniswap fill functions.\ninterface IUniswapFeature {\n\n /// @dev Efficiently sell directly to uniswap/sushiswap.\n /// @param tokens Sell path.\n /// @param sellAmount of `tokens[0]` Amount to sell.\n /// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.\n /// @param isSushi Use sushiswap if true.\n /// @return buyAmount Amount of `tokens[-1]` bought.\n function sellToUniswap(\n IERC20TokenV06[] calldata tokens,\n uint256 sellAmount,\n uint256 minBuyAmount,\n bool isSushi\n )\n external\n payable\n returns (uint256 buyAmount);\n}\n"
},
"./features/interfaces/ILiquidityProviderFeature.sol": {
"id": 5,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../../vendor/ILiquidityProvider.sol\";\n\n\n/// @dev Feature to swap directly with an on-chain liquidity provider.\ninterface ILiquidityProviderFeature {\n\n /// @dev Event for data pipeline.\n event LiquidityProviderSwap(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount,\n ILiquidityProvider provider,\n address recipient\n );\n\n /// @dev Sells `sellAmount` of `inputToken` to the liquidity provider\n /// at the given `provider` address.\n /// @param inputToken The token being sold.\n /// @param outputToken The token being bought.\n /// @param provider The address of the on-chain liquidity provider\n /// to trade with.\n /// @param recipient The recipient of the bought tokens. If equal to\n /// address(0), `msg.sender` is assumed to be the recipient.\n /// @param sellAmount The amount of `inputToken` to sell.\n /// @param minBuyAmount The minimum acceptable amount of `outputToken` to\n /// buy. Reverts if this amount is not satisfied.\n /// @param auxiliaryData Auxiliary data supplied to the `provider` contract.\n /// @return boughtAmount The amount of `outputToken` bought.\n function sellToLiquidityProvider(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n ILiquidityProvider provider,\n address recipient,\n uint256 sellAmount,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n payable\n returns (uint256 boughtAmount);\n}\n"
},
"./vendor/ILiquidityProvider.sol": {
"id": 18,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\ninterface ILiquidityProvider {\n\n /// @dev An optional event an LP can emit for each fill against a source.\n /// @param inputToken The input token.\n /// @param outputToken The output token.\n /// @param inputTokenAmount How much input token was sold.\n /// @param outputTokenAmount How much output token was bought.\n /// @param sourceId A bytes32 encoded ascii source ID. E.g., `bytes32('Curve')`/\n /// @param sourceAddress An optional address associated with the source (e.g, a curve pool).\n /// @param sourceId A bytes32 encoded ascii source ID. E.g., `bytes32('Curve')`/\n /// @param sourceAddress An optional address associated with the source (e.g, a curve pool).\n /// @param sender The caller of the LP.\n /// @param recipient The recipient of the output tokens.\n event LiquidityProviderFill(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount,\n bytes32 sourceId,\n address sourceAddress,\n address sender,\n address recipient\n );\n\n /// @dev Trades `inputToken` for `outputToken`. The amount of `inputToken`\n /// to sell must be transferred to the contract prior to calling this\n /// function to trigger the trade.\n /// @param inputToken The token being sold.\n /// @param outputToken The token being bought.\n /// @param recipient The recipient of the bought tokens.\n /// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.\n /// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.\n /// @return boughtAmount The amount of `outputToken` bought.\n function sellTokenForToken(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n address recipient,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n returns (uint256 boughtAmount);\n\n /// @dev Trades ETH for token. ETH must either be attached to this function\n /// call or sent to the contract prior to calling this function to\n /// trigger the trade.\n /// @param outputToken The token being bought.\n /// @param recipient The recipient of the bought tokens.\n /// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.\n /// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.\n /// @return boughtAmount The amount of `outputToken` bought.\n function sellEthForToken(\n IERC20TokenV06 outputToken,\n address recipient,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n payable\n returns (uint256 boughtAmount);\n\n /// @dev Trades token for ETH. The token must be sent to the contract prior\n /// to calling this function to trigger the trade.\n /// @param inputToken The token being sold.\n /// @param recipient The recipient of the bought tokens.\n /// @param minBuyAmount The minimum acceptable amount of ETH to buy.\n /// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.\n /// @return boughtAmount The amount of ETH bought.\n function sellTokenForEth(\n IERC20TokenV06 inputToken,\n address payable recipient,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n returns (uint256 boughtAmount);\n\n /// @dev Quotes the amount of `outputToken` that would be obtained by\n /// selling `sellAmount` of `inputToken`.\n /// @param inputToken Address of the taker token (what to sell). Use\n /// the wETH address if selling ETH.\n /// @param outputToken Address of the maker token (what to buy). Use\n /// the wETH address if buying ETH.\n /// @param sellAmount Amount of `inputToken` to sell.\n /// @return outputTokenAmount Amount of `outputToken` that would be obtained.\n function getSellQuote(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 sellAmount\n )\n external\n view\n returns (uint256 outputTokenAmount);\n}\n"
},
"./features/interfaces/INativeOrdersFeature.sol": {
"id": 9,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../libs/LibSignature.sol\";\nimport \"../libs/LibNativeOrder.sol\";\nimport \"./INativeOrdersEvents.sol\";\n\n\n/// @dev Feature for interacting with limit orders.\ninterface INativeOrdersFeature is\n INativeOrdersEvents\n{\n\n /// @dev Transfers protocol fees from the `FeeCollector` pools into\n /// the staking contract.\n /// @param poolIds Staking pool IDs\n function transferProtocolFeesForPools(bytes32[] calldata poolIds)\n external;\n\n /// @dev Fill a limit order. The taker and sender will be the caller.\n /// @param order The limit order. ETH protocol fees can be\n /// attached to this call. Any unspent ETH will be refunded to\n /// the caller.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token amount to fill this order with.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillLimitOrder(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n payable\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order for up to `takerTokenFillAmount` taker tokens.\n /// The taker will be the caller.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token amount to fill this order with.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillRfqOrder(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.\n /// The taker will be the caller. ETH protocol fees can be\n /// attached to this call. Any unspent ETH will be refunded to\n /// the caller.\n /// @param order The limit order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount How much taker token to fill this order with.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillOrKillLimitOrder(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n payable\n returns (uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.\n /// The taker will be the caller.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount How much taker token to fill this order with.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillOrKillRfqOrder(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n returns (uint128 makerTokenFilledAmount);\n\n /// @dev Fill a limit order. Internal variant. ETH protocol fees can be\n /// attached to this call. Any unspent ETH will be refunded to\n /// `msg.sender` (not `sender`).\n /// @param order The limit order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token to fill this order with.\n /// @param taker The order taker.\n /// @param sender The order sender.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function _fillLimitOrder(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount,\n address taker,\n address sender\n )\n external\n payable\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order. Internal variant.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token to fill this order with.\n /// @param taker The order taker.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function _fillRfqOrder(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount,\n address taker\n )\n external\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Cancel a single limit order. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param order The limit order.\n function cancelLimitOrder(LibNativeOrder.LimitOrder calldata order)\n external;\n\n /// @dev Cancel a single RFQ order. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param order The RFQ order.\n function cancelRfqOrder(LibNativeOrder.RfqOrder calldata order)\n external;\n\n /// @dev Mark what tx.origin addresses are allowed to fill an order that\n /// specifies the message sender as its txOrigin.\n /// @param origins An array of origin addresses to update.\n /// @param allowed True to register, false to unregister.\n function registerAllowedRfqOrigins(address[] memory origins, bool allowed)\n external;\n\n /// @dev Cancel multiple limit orders. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param orders The limit orders.\n function batchCancelLimitOrders(LibNativeOrder.LimitOrder[] calldata orders)\n external;\n\n /// @dev Cancel multiple RFQ orders. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param orders The RFQ orders.\n function batchCancelRfqOrders(LibNativeOrder.RfqOrder[] calldata orders)\n external;\n\n /// @dev Cancel all limit orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerToken The maker token.\n /// @param takerToken The taker token.\n /// @param minValidSalt The new minimum valid salt.\n function cancelPairLimitOrders(\n IERC20TokenV06 makerToken,\n IERC20TokenV06 takerToken,\n uint256 minValidSalt\n )\n external;\n\n /// @dev Cancel all limit orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerTokens The maker tokens.\n /// @param takerTokens The taker tokens.\n /// @param minValidSalts The new minimum valid salts.\n function batchCancelPairLimitOrders(\n IERC20TokenV06[] calldata makerTokens,\n IERC20TokenV06[] calldata takerTokens,\n uint256[] calldata minValidSalts\n )\n external;\n\n /// @dev Cancel all RFQ orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerToken The maker token.\n /// @param takerToken The taker token.\n /// @param minValidSalt The new minimum valid salt.\n function cancelPairRfqOrders(\n IERC20TokenV06 makerToken,\n IERC20TokenV06 takerToken,\n uint256 minValidSalt\n )\n external;\n\n /// @dev Cancel all RFQ orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerTokens The maker tokens.\n /// @param takerTokens The taker tokens.\n /// @param minValidSalts The new minimum valid salts.\n function batchCancelPairRfqOrders(\n IERC20TokenV06[] calldata makerTokens,\n IERC20TokenV06[] calldata takerTokens,\n uint256[] calldata minValidSalts\n )\n external;\n\n /// @dev Get the order info for a limit order.\n /// @param order The limit order.\n /// @return orderInfo Info about the order.\n function getLimitOrderInfo(LibNativeOrder.LimitOrder calldata order)\n external\n view\n returns (LibNativeOrder.OrderInfo memory orderInfo);\n\n /// @dev Get the order info for an RFQ order.\n /// @param order The RFQ order.\n /// @return orderInfo Info about the order.\n function getRfqOrderInfo(LibNativeOrder.RfqOrder calldata order)\n external\n view\n returns (LibNativeOrder.OrderInfo memory orderInfo);\n\n /// @dev Get the canonical hash of a limit order.\n /// @param order The limit order.\n /// @return orderHash The order hash.\n function getLimitOrderHash(LibNativeOrder.LimitOrder calldata order)\n external\n view\n returns (bytes32 orderHash);\n\n /// @dev Get the canonical hash of an RFQ order.\n /// @param order The RFQ order.\n /// @return orderHash The order hash.\n function getRfqOrderHash(LibNativeOrder.RfqOrder calldata order)\n external\n view\n returns (bytes32 orderHash);\n\n /// @dev Get the protocol fee multiplier. This should be multiplied by the\n /// gas price to arrive at the required protocol fee to fill a native order.\n /// @return multiplier The protocol fee multiplier.\n function getProtocolFeeMultiplier()\n external\n view\n returns (uint32 multiplier);\n\n /// @dev Get order info, fillable amount, and signature validity for a limit order.\n /// Fillable amount is determined using balances and allowances of the maker.\n /// @param order The limit order.\n /// @param signature The order signature.\n /// @return orderInfo Info about the order.\n /// @return actualFillableTakerTokenAmount How much of the order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValid Whether the signature is valid.\n function getLimitOrderRelevantState(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo memory orderInfo,\n uint128 actualFillableTakerTokenAmount,\n bool isSignatureValid\n );\n\n /// @dev Get order info, fillable amount, and signature validity for an RFQ order.\n /// Fillable amount is determined using balances and allowances of the maker.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @return orderInfo Info about the order.\n /// @return actualFillableTakerTokenAmount How much of the order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValid Whether the signature is valid.\n function getRfqOrderRelevantState(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo memory orderInfo,\n uint128 actualFillableTakerTokenAmount,\n bool isSignatureValid\n );\n\n /// @dev Batch version of `getLimitOrderRelevantState()`, without reverting.\n /// Orders that would normally cause `getLimitOrderRelevantState()`\n /// to revert will have empty results.\n /// @param orders The limit orders.\n /// @param signatures The order signatures.\n /// @return orderInfos Info about the orders.\n /// @return actualFillableTakerTokenAmounts How much of each order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValids Whether each signature is valid for the order.\n function batchGetLimitOrderRelevantStates(\n LibNativeOrder.LimitOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo[] memory orderInfos,\n uint128[] memory actualFillableTakerTokenAmounts,\n bool[] memory isSignatureValids\n );\n\n /// @dev Batch version of `getRfqOrderRelevantState()`, without reverting.\n /// Orders that would normally cause `getRfqOrderRelevantState()`\n /// to revert will have empty results.\n /// @param orders The RFQ orders.\n /// @param signatures The order signatures.\n /// @return orderInfos Info about the orders.\n /// @return actualFillableTakerTokenAmounts How much of each order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValids Whether each signature is valid for the order.\n function batchGetRfqOrderRelevantStates(\n LibNativeOrder.RfqOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo[] memory orderInfos,\n uint128[] memory actualFillableTakerTokenAmounts,\n bool[] memory isSignatureValids\n );\n}\n"
},
"./features/libs/LibNativeOrder.sol": {
"id": 15,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol\";\nimport \"../../errors/LibNativeOrdersRichErrors.sol\";\n\n\n/// @dev A library for common native order operations.\nlibrary LibNativeOrder {\n using LibSafeMathV06 for uint256;\n using LibRichErrorsV06 for bytes;\n\n enum OrderStatus {\n INVALID,\n FILLABLE,\n FILLED,\n CANCELLED,\n EXPIRED\n }\n\n /// @dev A standard OTC or OO limit order.\n struct LimitOrder {\n IERC20TokenV06 makerToken;\n IERC20TokenV06 takerToken;\n uint128 makerAmount;\n uint128 takerAmount;\n uint128 takerTokenFeeAmount;\n address maker;\n address taker;\n address sender;\n address feeRecipient;\n bytes32 pool;\n uint64 expiry;\n uint256 salt;\n }\n\n /// @dev An RFQ limit order.\n struct RfqOrder {\n IERC20TokenV06 makerToken;\n IERC20TokenV06 takerToken;\n uint128 makerAmount;\n uint128 takerAmount;\n address maker;\n address taker;\n address txOrigin;\n bytes32 pool;\n uint64 expiry;\n uint256 salt;\n }\n\n /// @dev Info on a limit or RFQ order.\n struct OrderInfo {\n bytes32 orderHash;\n OrderStatus status;\n uint128 takerTokenFilledAmount;\n }\n\n uint256 private constant UINT_128_MASK = (1 << 128) - 1;\n uint256 private constant UINT_64_MASK = (1 << 64) - 1;\n uint256 private constant ADDRESS_MASK = (1 << 160) - 1;\n\n // The type hash for limit orders, which is:\n // keccak256(abi.encodePacked(\n // \"LimitOrder(\",\n // \"address makerToken,\",\n // \"address takerToken,\",\n // \"uint128 makerAmount,\",\n // \"uint128 takerAmount,\",\n // \"uint128 takerTokenFeeAmount,\",\n // \"address maker,\",\n // \"address taker,\",\n // \"address sender,\",\n // \"address feeRecipient,\",\n // \"bytes32 pool,\",\n // \"uint64 expiry,\",\n // \"uint256 salt\"\n // \")\"\n // ))\n uint256 private constant _LIMIT_ORDER_TYPEHASH =\n 0xce918627cb55462ddbb85e73de69a8b322f2bc88f4507c52fcad6d4c33c29d49;\n\n // The type hash for RFQ orders, which is:\n // keccak256(abi.encodePacked(\n // \"RfqOrder(\",\n // \"address makerToken,\",\n // \"address takerToken,\",\n // \"uint128 makerAmount,\",\n // \"uint128 takerAmount,\",\n // \"address maker,\",\n // \"address taker,\",\n // \"address txOrigin,\",\n // \"bytes32 pool,\",\n // \"uint64 expiry,\",\n // \"uint256 salt\"\n // \")\"\n // ))\n uint256 private constant _RFQ_ORDER_TYPEHASH =\n 0xe593d3fdfa8b60e5e17a1b2204662ecbe15c23f2084b9ad5bae40359540a7da9;\n\n /// @dev Get the struct hash of a limit order.\n /// @param order The limit order.\n /// @return structHash The struct hash of the order.\n function getLimitOrderStructHash(LimitOrder memory order)\n internal\n pure\n returns (bytes32 structHash)\n {\n // The struct hash is:\n // keccak256(abi.encode(\n // TYPE_HASH,\n // order.makerToken,\n // order.takerToken,\n // order.makerAmount,\n // order.takerAmount,\n // order.takerTokenFeeAmount,\n // order.maker,\n // order.taker,\n // order.sender,\n // order.feeRecipient,\n // order.pool,\n // order.expiry,\n // order.salt,\n // ))\n assembly {\n let mem := mload(0x40)\n mstore(mem, _LIMIT_ORDER_TYPEHASH)\n // order.makerToken;\n mstore(add(mem, 0x20), and(ADDRESS_MASK, mload(order)))\n // order.takerToken;\n mstore(add(mem, 0x40), and(ADDRESS_MASK, mload(add(order, 0x20))))\n // order.makerAmount;\n mstore(add(mem, 0x60), and(UINT_128_MASK, mload(add(order, 0x40))))\n // order.takerAmount;\n mstore(add(mem, 0x80), and(UINT_128_MASK, mload(add(order, 0x60))))\n // order.takerTokenFeeAmount;\n mstore(add(mem, 0xA0), and(UINT_128_MASK, mload(add(order, 0x80))))\n // order.maker;\n mstore(add(mem, 0xC0), and(ADDRESS_MASK, mload(add(order, 0xA0))))\n // order.taker;\n mstore(add(mem, 0xE0), and(ADDRESS_MASK, mload(add(order, 0xC0))))\n // order.sender;\n mstore(add(mem, 0x100), and(ADDRESS_MASK, mload(add(order, 0xE0))))\n // order.feeRecipient;\n mstore(add(mem, 0x120), and(ADDRESS_MASK, mload(add(order, 0x100))))\n // order.pool;\n mstore(add(mem, 0x140), mload(add(order, 0x120)))\n // order.expiry;\n mstore(add(mem, 0x160), and(UINT_64_MASK, mload(add(order, 0x140))))\n // order.salt;\n mstore(add(mem, 0x180), mload(add(order, 0x160)))\n structHash := keccak256(mem, 0x1A0)\n }\n }\n\n /// @dev Get the struct hash of a RFQ order.\n /// @param order The RFQ order.\n /// @return structHash The struct hash of the order.\n function getRfqOrderStructHash(RfqOrder memory order)\n internal\n pure\n returns (bytes32 structHash)\n {\n // The struct hash is:\n // keccak256(abi.encode(\n // TYPE_HASH,\n // order.makerToken,\n // order.takerToken,\n // order.makerAmount,\n // order.takerAmount,\n // order.maker,\n // order.taker,\n // order.txOrigin,\n // order.pool,\n // order.expiry,\n // order.salt,\n // ))\n assembly {\n let mem := mload(0x40)\n mstore(mem, _RFQ_ORDER_TYPEHASH)\n // order.makerToken;\n mstore(add(mem, 0x20), and(ADDRESS_MASK, mload(order)))\n // order.takerToken;\n mstore(add(mem, 0x40), and(ADDRESS_MASK, mload(add(order, 0x20))))\n // order.makerAmount;\n mstore(add(mem, 0x60), and(UINT_128_MASK, mload(add(order, 0x40))))\n // order.takerAmount;\n mstore(add(mem, 0x80), and(UINT_128_MASK, mload(add(order, 0x60))))\n // order.maker;\n mstore(add(mem, 0xA0), and(ADDRESS_MASK, mload(add(order, 0x80))))\n // order.taker;\n mstore(add(mem, 0xC0), and(ADDRESS_MASK, mload(add(order, 0xA0))))\n // order.txOrigin;\n mstore(add(mem, 0xE0), and(ADDRESS_MASK, mload(add(order, 0xC0))))\n // order.pool;\n mstore(add(mem, 0x100), mload(add(order, 0xE0)))\n // order.expiry;\n mstore(add(mem, 0x120), and(UINT_64_MASK, mload(add(order, 0x100))))\n // order.salt;\n mstore(add(mem, 0x140), mload(add(order, 0x120)))\n structHash := keccak256(mem, 0x160)\n }\n }\n\n /// @dev Refund any leftover protocol fees in `msg.value` to `msg.sender`.\n /// @param ethProtocolFeePaid How much ETH was paid in protocol fees.\n function refundExcessProtocolFeeToSender(uint256 ethProtocolFeePaid)\n internal\n {\n if (msg.value > ethProtocolFeePaid && msg.sender != address(this)) {\n uint256 refundAmount = msg.value.safeSub(ethProtocolFeePaid);\n (bool success,) = msg\n .sender\n .call{value: refundAmount}(\"\");\n if (!success) {\n LibNativeOrdersRichErrors.ProtocolFeeRefundFailed(\n msg.sender,\n refundAmount\n ).rrevert();\n }\n }\n }\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol": {
"id": 20,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\nimport \"./errors/LibRichErrorsV06.sol\";\nimport \"./errors/LibSafeMathRichErrorsV06.sol\";\n\n\nlibrary LibSafeMathV06 {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n if (c / a != b) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.MULTIPLICATION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (b == 0) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.DIVISION_BY_ZERO,\n a,\n b\n ));\n }\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (b > a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.SUBTRACTION_UNDERFLOW,\n a,\n b\n ));\n }\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n if (c < a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.ADDITION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function safeMul128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n if (a == 0) {\n return 0;\n }\n uint128 c = a * b;\n if (c / a != b) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.MULTIPLICATION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function safeDiv128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n if (b == 0) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.DIVISION_BY_ZERO,\n a,\n b\n ));\n }\n uint128 c = a / b;\n return c;\n }\n\n function safeSub128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n if (b > a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.SUBTRACTION_UNDERFLOW,\n a,\n b\n ));\n }\n return a - b;\n }\n\n function safeAdd128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n uint128 c = a + b;\n if (c < a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.ADDITION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function max128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n return a >= b ? a : b;\n }\n\n function min128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n return a < b ? a : b;\n }\n\n function safeDowncastToUint128(uint256 a)\n internal\n pure\n returns (uint128)\n {\n if (a > type(uint128).max) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256DowncastError(\n LibSafeMathRichErrorsV06.DowncastErrorCodes.VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128,\n a\n ));\n }\n return uint128(a);\n }\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/errors/LibSafeMathRichErrorsV06.sol": {
"id": 22,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibSafeMathRichErrorsV06 {\n\n // bytes4(keccak256(\"Uint256BinOpError(uint8,uint256,uint256)\"))\n bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR =\n 0xe946c1bb;\n\n // bytes4(keccak256(\"Uint256DowncastError(uint8,uint256)\"))\n bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR =\n 0xc996af7b;\n\n enum BinOpErrorCodes {\n ADDITION_OVERFLOW,\n MULTIPLICATION_OVERFLOW,\n SUBTRACTION_UNDERFLOW,\n DIVISION_BY_ZERO\n }\n\n enum DowncastErrorCodes {\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT32,\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT64,\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96,\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128\n }\n\n // solhint-disable func-name-mixedcase\n function Uint256BinOpError(\n BinOpErrorCodes errorCode,\n uint256 a,\n uint256 b\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n UINT256_BINOP_ERROR_SELECTOR,\n errorCode,\n a,\n b\n );\n }\n\n function Uint256DowncastError(\n DowncastErrorCodes errorCode,\n uint256 a\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n UINT256_DOWNCAST_ERROR_SELECTOR,\n errorCode,\n a\n );\n }\n}\n"
},
"./errors/LibNativeOrdersRichErrors.sol": {
"id": 1,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibNativeOrdersRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function ProtocolFeeRefundFailed(\n address receiver,\n uint256 refundAmount\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"ProtocolFeeRefundFailed(address,uint256)\")),\n receiver,\n refundAmount\n );\n }\n\n function OrderNotFillableByOriginError(\n bytes32 orderHash,\n address txOrigin,\n address orderTxOrigin\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableByOriginError(bytes32,address,address)\")),\n orderHash,\n txOrigin,\n orderTxOrigin\n );\n }\n\n function OrderNotFillableError(\n bytes32 orderHash,\n uint8 orderStatus\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableError(bytes32,uint8)\")),\n orderHash,\n orderStatus\n );\n }\n\n function OrderNotSignedByMakerError(\n bytes32 orderHash,\n address signer,\n address maker\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotSignedByMakerError(bytes32,address,address)\")),\n orderHash,\n signer,\n maker\n );\n }\n\n function OrderNotFillableBySenderError(\n bytes32 orderHash,\n address sender,\n address orderSender\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableBySenderError(bytes32,address,address)\")),\n orderHash,\n sender,\n orderSender\n );\n }\n\n function OrderNotFillableByTakerError(\n bytes32 orderHash,\n address taker,\n address orderTaker\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableByTakerError(bytes32,address,address)\")),\n orderHash,\n taker,\n orderTaker\n );\n }\n\n function CancelSaltTooLowError(\n uint256 minValidSalt,\n uint256 oldMinValidSalt\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"CancelSaltTooLowError(uint256,uint256)\")),\n minValidSalt,\n oldMinValidSalt\n );\n }\n\n function FillOrKillFailedError(\n bytes32 orderHash,\n uint256 takerTokenFilledAmount,\n uint256 takerTokenFillAmount\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"FillOrKillFailedError(bytes32,uint256,uint256)\")),\n orderHash,\n takerTokenFilledAmount,\n takerTokenFillAmount\n );\n }\n\n function OnlyOrderMakerAllowed(\n bytes32 orderHash,\n address sender,\n address maker\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OnlyOrderMakerAllowed(bytes32,address,address)\")),\n orderHash,\n sender,\n maker\n );\n }\n\n function BatchFillIncompleteError(\n bytes32 orderHash,\n uint256 takerTokenFilledAmount,\n uint256 takerTokenFillAmount\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"BatchFillIncompleteError(bytes32,uint256,uint256)\")),\n orderHash,\n takerTokenFilledAmount,\n takerTokenFillAmount\n );\n }\n}\n"
},
"./features/interfaces/INativeOrdersEvents.sol": {
"id": 8,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2021 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../libs/LibSignature.sol\";\nimport \"../libs/LibNativeOrder.sol\";\n\n\n/// @dev Events emitted by NativeOrdersFeature.\ninterface INativeOrdersEvents {\n\n /// @dev Emitted whenever a `LimitOrder` is filled.\n /// @param orderHash The canonical hash of the order.\n /// @param maker The maker of the order.\n /// @param taker The taker of the order.\n /// @param feeRecipient Fee recipient of the order.\n /// @param takerTokenFilledAmount How much taker token was filled.\n /// @param makerTokenFilledAmount How much maker token was filled.\n /// @param protocolFeePaid How much protocol fee was paid.\n /// @param pool The fee pool associated with this order.\n event LimitOrderFilled(\n bytes32 orderHash,\n address maker,\n address taker,\n address feeRecipient,\n address makerToken,\n address takerToken,\n uint128 takerTokenFilledAmount,\n uint128 makerTokenFilledAmount,\n uint128 takerTokenFeeFilledAmount,\n uint256 protocolFeePaid,\n bytes32 pool\n );\n\n /// @dev Emitted whenever an `RfqOrder` is filled.\n /// @param orderHash The canonical hash of the order.\n /// @param maker The maker of the order.\n /// @param taker The taker of the order.\n /// @param takerTokenFilledAmount How much taker token was filled.\n /// @param makerTokenFilledAmount How much maker token was filled.\n /// @param pool The fee pool associated with this order.\n event RfqOrderFilled(\n bytes32 orderHash,\n address maker,\n address taker,\n address makerToken,\n address takerToken,\n uint128 takerTokenFilledAmount,\n uint128 makerTokenFilledAmount,\n bytes32 pool\n );\n\n /// @dev Emitted whenever a limit or RFQ order is cancelled.\n /// @param orderHash The canonical hash of the order.\n /// @param maker The order maker.\n event OrderCancelled(\n bytes32 orderHash,\n address maker\n );\n\n /// @dev Emitted whenever Limit orders are cancelled by pair by a maker.\n /// @param maker The maker of the order.\n /// @param makerToken The maker token in a pair for the orders cancelled.\n /// @param takerToken The taker token in a pair for the orders cancelled.\n /// @param minValidSalt The new minimum valid salt an order with this pair must\n /// have.\n event PairCancelledLimitOrders(\n address maker,\n address makerToken,\n address takerToken,\n uint256 minValidSalt\n );\n\n /// @dev Emitted whenever RFQ orders are cancelled by pair by a maker.\n /// @param maker The maker of the order.\n /// @param makerToken The maker token in a pair for the orders cancelled.\n /// @param takerToken The taker token in a pair for the orders cancelled.\n /// @param minValidSalt The new minimum valid salt an order with this pair must\n /// have.\n event PairCancelledRfqOrders(\n address maker,\n address makerToken,\n address takerToken,\n uint256 minValidSalt\n );\n\n /// @dev Emitted when new addresses are allowed or disallowed to fill\n /// orders with a given txOrigin.\n /// @param origin The address doing the allowing.\n /// @param addrs The address being allowed/disallowed.\n /// @param allowed Indicates whether the address should be allowed.\n event RfqOrderOriginsAllowed(\n address origin,\n address[] addrs,\n bool allowed\n );\n}\n"
},
"./features/interfaces/IBatchFillNativeOrdersFeature.sol": {
"id": 4,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2021 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibNativeOrder.sol\";\nimport \"../libs/LibSignature.sol\";\n\n\n/// @dev Feature for batch/market filling limit and RFQ orders.\ninterface IBatchFillNativeOrdersFeature {\n\n /// @dev Fills multiple limit orders.\n /// @param orders Array of limit orders.\n /// @param signatures Array of signatures corresponding to each order.\n /// @param takerTokenFillAmounts Array of desired amounts to fill each order.\n /// @param revertIfIncomplete If true, reverts if this function fails to\n /// fill the full fill amount for any individual order.\n /// @return takerTokenFilledAmounts Array of amounts filled, in taker token.\n /// @return makerTokenFilledAmounts Array of amounts filled, in maker token.\n function batchFillLimitOrders(\n LibNativeOrder.LimitOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures,\n uint128[] calldata takerTokenFillAmounts,\n bool revertIfIncomplete\n )\n external\n payable\n returns (\n uint128[] memory takerTokenFilledAmounts,\n uint128[] memory makerTokenFilledAmounts\n );\n\n /// @dev Fills multiple RFQ orders.\n /// @param orders Array of RFQ orders.\n /// @param signatures Array of signatures corresponding to each order.\n /// @param takerTokenFillAmounts Array of desired amounts to fill each order.\n /// @param revertIfIncomplete If true, reverts if this function fails to\n /// fill the full fill amount for any individual order.\n /// @return takerTokenFilledAmounts Array of amounts filled, in taker token.\n /// @return makerTokenFilledAmounts Array of amounts filled, in maker token.\n function batchFillRfqOrders(\n LibNativeOrder.RfqOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures,\n uint128[] calldata takerTokenFillAmounts,\n bool revertIfIncomplete\n )\n external\n returns (\n uint128[] memory takerTokenFilledAmounts,\n uint128[] memory makerTokenFilledAmounts\n );\n}\n"
},
"./features/interfaces/IMultiplexFeature.sol": {
"id": 7,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2021 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\ninterface IMultiplexFeature {\n\n // Parameters for `batchFill`.\n struct BatchFillData {\n // The token being sold.\n IERC20TokenV06 inputToken;\n // The token being bought.\n IERC20TokenV06 outputToken;\n // The amount of `inputToken` to sell.\n uint256 sellAmount;\n // The nested calls to perform.\n WrappedBatchCall[] calls;\n }\n\n // Represents a call nested within a `batchFill`.\n struct WrappedBatchCall {\n // The selector of the function to call.\n bytes4 selector;\n // Amount of `inputToken` to sell.\n uint256 sellAmount;\n // ABI-encoded parameters needed to perform the call.\n bytes data;\n }\n\n // Parameters for `multiHopFill`.\n struct MultiHopFillData {\n // The sell path, i.e.\n // tokens = [inputToken, hopToken1, ..., hopTokenN, outputToken]\n address[] tokens;\n // The amount of `tokens[0]` to sell.\n uint256 sellAmount;\n // The nested calls to perform.\n WrappedMultiHopCall[] calls;\n }\n\n // Represents a call nested within a `multiHopFill`.\n struct WrappedMultiHopCall {\n // The selector of the function to call.\n bytes4 selector;\n // ABI-encoded parameters needed to perform the call.\n bytes data;\n }\n\n event LiquidityProviderSwap(\n address inputToken,\n address outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount,\n address provider,\n address recipient\n );\n\n event ExpiredRfqOrder(\n bytes32 orderHash,\n address maker,\n uint64 expiry\n );\n\n /// @dev Executes a batch of fills selling `fillData.inputToken`\n /// for `fillData.outputToken` in sequence. Refer to the\n /// internal variant `_batchFill` for the allowed nested\n /// operations.\n /// @param fillData Encodes the input/output tokens, the sell\n /// amount, and the nested operations for this batch fill.\n /// @param minBuyAmount The minimum amount of `fillData.outputToken`\n /// to buy. Reverts if this amount is not met.\n /// @return outputTokenAmount The amount of the output token bought.\n function batchFill(\n BatchFillData calldata fillData,\n uint256 minBuyAmount\n )\n external\n payable\n returns (uint256 outputTokenAmount);\n\n /// @dev Executes a sequence of fills \"hopping\" through the\n /// path of tokens given by `fillData.tokens`. Refer to the\n /// internal variant `_multiHopFill` for the allowed nested\n /// operations.\n /// @param fillData Encodes the path of tokens, the sell amount,\n /// and the nested operations for this multi-hop fill.\n /// @param minBuyAmount The minimum amount of the output token\n /// to buy. Reverts if this amount is not met.\n /// @return outputTokenAmount The amount of the output token bought.\n function multiHopFill(\n MultiHopFillData calldata fillData,\n uint256 minBuyAmount\n )\n external\n payable\n returns (uint256 outputTokenAmount);\n}\n"
}
},
"sourceCodes": {
"./IZeroEx.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"./features/interfaces/IOwnableFeature.sol\";\nimport \"./features/interfaces/ISimpleFunctionRegistryFeature.sol\";\nimport \"./features/interfaces/ITokenSpenderFeature.sol\";\nimport \"./features/interfaces/ITransformERC20Feature.sol\";\nimport \"./features/interfaces/IMetaTransactionsFeature.sol\";\nimport \"./features/interfaces/IUniswapFeature.sol\";\nimport \"./features/interfaces/ILiquidityProviderFeature.sol\";\nimport \"./features/interfaces/INativeOrdersFeature.sol\";\nimport \"./features/interfaces/IBatchFillNativeOrdersFeature.sol\";\nimport \"./features/interfaces/IMultiplexFeature.sol\";\n\n\n/// @dev Interface for a fully featured Exchange Proxy.\ninterface IZeroEx is\n IOwnableFeature,\n ISimpleFunctionRegistryFeature,\n ITokenSpenderFeature,\n ITransformERC20Feature,\n IMetaTransactionsFeature,\n IUniswapFeature,\n ILiquidityProviderFeature,\n INativeOrdersFeature,\n IBatchFillNativeOrdersFeature,\n IMultiplexFeature\n{\n // solhint-disable state-visibility\n\n /// @dev Fallback for just receiving ether.\n receive() external payable;\n}\n",
"./features/interfaces/IOwnableFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol\";\n\n\n// solhint-disable no-empty-blocks\n/// @dev Owner management and migration features.\ninterface IOwnableFeature is\n IOwnableV06\n{\n /// @dev Emitted when `migrate()` is called.\n /// @param caller The caller of `migrate()`.\n /// @param migrator The migration contract.\n /// @param newOwner The address of the new owner.\n event Migrated(address caller, address migrator, address newOwner);\n\n /// @dev Execute a migration function in the context of the ZeroEx contract.\n /// The result of the function being called should be the magic bytes\n /// 0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner.\n /// The owner will be temporarily set to `address(this)` inside the call.\n /// Before returning, the owner will be set to `newOwner`.\n /// @param target The migrator contract address.\n /// @param newOwner The address of the new owner.\n /// @param data The call data.\n function migrate(address target, bytes calldata data, address newOwner) external;\n}\n",
"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\ninterface IOwnableV06 {\n\n /// @dev Emitted by Ownable when ownership is transferred.\n /// @param previousOwner The previous owner of the contract.\n /// @param newOwner The new owner of the contract.\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /// @dev Transfers ownership of the contract to a new address.\n /// @param newOwner The address that will become the owner.\n function transferOwnership(address newOwner) external;\n\n /// @dev The owner of this contract.\n /// @return ownerAddress The owner address.\n function owner() external view returns (address ownerAddress);\n}\n",
"./features/interfaces/ISimpleFunctionRegistryFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\n\n/// @dev Basic registry management features.\ninterface ISimpleFunctionRegistryFeature {\n\n /// @dev A function implementation was updated via `extend()` or `rollback()`.\n /// @param selector The function selector.\n /// @param oldImpl The implementation contract address being replaced.\n /// @param newImpl The replacement implementation contract address.\n event ProxyFunctionUpdated(bytes4 indexed selector, address oldImpl, address newImpl);\n\n /// @dev Roll back to a prior implementation of a function.\n /// @param selector The function selector.\n /// @param targetImpl The address of an older implementation of the function.\n function rollback(bytes4 selector, address targetImpl) external;\n\n /// @dev Register or replace a function.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function extend(bytes4 selector, address impl) external;\n\n /// @dev Retrieve the length of the rollback history for a function.\n /// @param selector The function selector.\n /// @return rollbackLength The number of items in the rollback history for\n /// the function.\n function getRollbackLength(bytes4 selector)\n external\n view\n returns (uint256 rollbackLength);\n\n /// @dev Retrieve an entry in the rollback history for a function.\n /// @param selector The function selector.\n /// @param idx The index in the rollback history.\n /// @return impl An implementation address for the function at\n /// index `idx`.\n function getRollbackEntryAtIndex(bytes4 selector, uint256 idx)\n external\n view\n returns (address impl);\n}\n",
"./features/interfaces/ITokenSpenderFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\n/// @dev Feature that allows spending token allowances.\ninterface ITokenSpenderFeature {\n\n /// @dev Transfers ERC20 tokens from `owner` to `to`.\n /// Only callable from within.\n /// @param token The token to spend.\n /// @param owner The owner of the tokens.\n /// @param to The recipient of the tokens.\n /// @param amount The amount of `token` to transfer.\n function _spendERC20Tokens(\n IERC20TokenV06 token,\n address owner,\n address to,\n uint256 amount\n )\n external;\n\n /// @dev Gets the maximum amount of an ERC20 token `token` that can be\n /// pulled from `owner`.\n /// @param token The token to spend.\n /// @param owner The owner of the tokens.\n /// @return amount The amount of tokens that can be pulled.\n function getSpendableERC20BalanceOf(IERC20TokenV06 token, address owner)\n external\n view\n returns (uint256 amount);\n\n /// @dev Get the address of the allowance target.\n /// @return target The target of token allowances.\n function getAllowanceTarget() external view returns (address target);\n}\n",
"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\ninterface IERC20TokenV06 {\n\n // solhint-disable no-simple-event-func-name\n event Transfer(\n address indexed from,\n address indexed to,\n uint256 value\n );\n\n event Approval(\n address indexed owner,\n address indexed spender,\n uint256 value\n );\n\n /// @dev send `value` token to `to` from `msg.sender`\n /// @param to The address of the recipient\n /// @param value The amount of token to be transferred\n /// @return True if transfer was successful\n function transfer(address to, uint256 value)\n external\n returns (bool);\n\n /// @dev send `value` token to `to` from `from` on the condition it is approved by `from`\n /// @param from The address of the sender\n /// @param to The address of the recipient\n /// @param value The amount of token to be transferred\n /// @return True if transfer was successful\n function transferFrom(\n address from,\n address to,\n uint256 value\n )\n external\n returns (bool);\n\n /// @dev `msg.sender` approves `spender` to spend `value` tokens\n /// @param spender The address of the account able to transfer the tokens\n /// @param value The amount of wei to be approved for transfer\n /// @return Always true if the call has enough gas to complete execution\n function approve(address spender, uint256 value)\n external\n returns (bool);\n\n /// @dev Query total supply of token\n /// @return Total supply of token\n function totalSupply()\n external\n view\n returns (uint256);\n\n /// @dev Get the balance of `owner`.\n /// @param owner The address from which the balance will be retrieved\n /// @return Balance of owner\n function balanceOf(address owner)\n external\n view\n returns (uint256);\n\n /// @dev Get the allowance for `spender` to spend from `owner`.\n /// @param owner The address of the account owning tokens\n /// @param spender The address of the account able to transfer the tokens\n /// @return Amount of remaining tokens allowed to spent\n function allowance(address owner, address spender)\n external\n view\n returns (uint256);\n\n /// @dev Get the number of decimals this token has.\n function decimals()\n external\n view\n returns (uint8);\n}\n",
"./features/interfaces/ITransformERC20Feature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../../transformers/IERC20Transformer.sol\";\nimport \"../../external/IFlashWallet.sol\";\n\n\n/// @dev Feature to composably transform between ERC20 tokens.\ninterface ITransformERC20Feature {\n\n /// @dev Defines a transformation to run in `transformERC20()`.\n struct Transformation {\n // The deployment nonce for the transformer.\n // The address of the transformer contract will be derived from this\n // value.\n uint32 deploymentNonce;\n // Arbitrary data to pass to the transformer.\n bytes data;\n }\n\n /// @dev Arguments for `_transformERC20()`.\n struct TransformERC20Args {\n // The taker address.\n address payable taker;\n // The token being provided by the taker.\n // If `0xeee...`, ETH is implied and should be provided with the call.`\n IERC20TokenV06 inputToken;\n // The token to be acquired by the taker.\n // `0xeee...` implies ETH.\n IERC20TokenV06 outputToken;\n // The amount of `inputToken` to take from the taker.\n // If set to `uint256(-1)`, the entire spendable balance of the taker\n // will be solt.\n uint256 inputTokenAmount;\n // The minimum amount of `outputToken` the taker\n // must receive for the entire transformation to succeed. If set to zero,\n // the minimum output token transfer will not be asserted.\n uint256 minOutputTokenAmount;\n // The transformations to execute on the token balance(s)\n // in sequence.\n Transformation[] transformations;\n }\n\n /// @dev Raised upon a successful `transformERC20`.\n /// @param taker The taker (caller) address.\n /// @param inputToken The token being provided by the taker.\n /// If `0xeee...`, ETH is implied and should be provided with the call.`\n /// @param outputToken The token to be acquired by the taker.\n /// `0xeee...` implies ETH.\n /// @param inputTokenAmount The amount of `inputToken` to take from the taker.\n /// @param outputTokenAmount The amount of `outputToken` received by the taker.\n event TransformedERC20(\n address indexed taker,\n address inputToken,\n address outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount\n );\n\n /// @dev Raised when `setTransformerDeployer()` is called.\n /// @param transformerDeployer The new deployer address.\n event TransformerDeployerUpdated(address transformerDeployer);\n\n /// @dev Raised when `setQuoteSigner()` is called.\n /// @param quoteSigner The new quote signer.\n event QuoteSignerUpdated(address quoteSigner);\n\n /// @dev Replace the allowed deployer for transformers.\n /// Only callable by the owner.\n /// @param transformerDeployer The address of the new trusted deployer\n /// for transformers.\n function setTransformerDeployer(address transformerDeployer)\n external;\n\n /// @dev Replace the optional signer for `transformERC20()` calldata.\n /// Only callable by the owner.\n /// @param quoteSigner The address of the new calldata signer.\n function setQuoteSigner(address quoteSigner)\n external;\n\n /// @dev Deploy a new flash wallet instance and replace the current one with it.\n /// Useful if we somehow break the current wallet instance.\n /// Only callable by the owner.\n /// @return wallet The new wallet instance.\n function createTransformWallet()\n external\n returns (IFlashWallet wallet);\n\n /// @dev Executes a series of transformations to convert an ERC20 `inputToken`\n /// to an ERC20 `outputToken`.\n /// @param inputToken The token being provided by the sender.\n /// If `0xeee...`, ETH is implied and should be provided with the call.`\n /// @param outputToken The token to be acquired by the sender.\n /// `0xeee...` implies ETH.\n /// @param inputTokenAmount The amount of `inputToken` to take from the sender.\n /// @param minOutputTokenAmount The minimum amount of `outputToken` the sender\n /// must receive for the entire transformation to succeed.\n /// @param transformations The transformations to execute on the token balance(s)\n /// in sequence.\n /// @return outputTokenAmount The amount of `outputToken` received by the sender.\n function transformERC20(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 inputTokenAmount,\n uint256 minOutputTokenAmount,\n Transformation[] calldata transformations\n )\n external\n payable\n returns (uint256 outputTokenAmount);\n\n /// @dev Internal version of `transformERC20()`. Only callable from within.\n /// @param args A `TransformERC20Args` struct.\n /// @return outputTokenAmount The amount of `outputToken` received by the taker.\n function _transformERC20(TransformERC20Args calldata args)\n external\n payable\n returns (uint256 outputTokenAmount);\n\n /// @dev Return the current wallet instance that will serve as the execution\n /// context for transformations.\n /// @return wallet The wallet instance.\n function getTransformWallet()\n external\n view\n returns (IFlashWallet wallet);\n\n /// @dev Return the allowed deployer for transformers.\n /// @return deployer The transform deployer address.\n function getTransformerDeployer()\n external\n view\n returns (address deployer);\n\n /// @dev Return the optional signer for `transformERC20()` calldata.\n /// @return signer The transform deployer address.\n function getQuoteSigner()\n external\n view\n returns (address signer);\n}\n",
"./transformers/IERC20Transformer.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\n/// @dev A transformation callback used in `TransformERC20.transformERC20()`.\ninterface IERC20Transformer {\n\n /// @dev Context information to pass into `transform()` by `TransformERC20.transformERC20()`.\n struct TransformContext {\n // The caller of `TransformERC20.transformERC20()`.\n address payable sender;\n // taker The taker address, which may be distinct from `sender` in the case\n // meta-transactions.\n address payable taker;\n // Arbitrary data to pass to the transformer.\n bytes data;\n }\n\n /// @dev Called from `TransformERC20.transformERC20()`. This will be\n /// delegatecalled in the context of the FlashWallet instance being used.\n /// @param context Context information.\n /// @return success The success bytes (`LibERC20Transformer.TRANSFORMER_SUCCESS`).\n function transform(TransformContext calldata context)\n external\n returns (bytes4 success);\n}\n",
"./external/IFlashWallet.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol\";\n\n\n/// @dev A contract that can execute arbitrary calls from its owner.\ninterface IFlashWallet {\n\n /// @dev Execute an arbitrary call. Only an authority can call this.\n /// @param target The call target.\n /// @param callData The call data.\n /// @param value Ether to attach to the call.\n /// @return resultData The data returned by the call.\n function executeCall(\n address payable target,\n bytes calldata callData,\n uint256 value\n )\n external\n payable\n returns (bytes memory resultData);\n\n /// @dev Execute an arbitrary delegatecall, in the context of this puppet.\n /// Only an authority can call this.\n /// @param target The call target.\n /// @param callData The call data.\n /// @return resultData The data returned by the call.\n function executeDelegateCall(\n address payable target,\n bytes calldata callData\n )\n external\n payable\n returns (bytes memory resultData);\n\n /// @dev Allows the puppet to receive ETH.\n receive() external payable;\n\n /// @dev Fetch the immutable owner/deployer of this contract.\n /// @return owner_ The immutable owner/deployer/\n function owner() external view returns (address owner_);\n}\n",
"./features/interfaces/IMetaTransactionsFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../libs/LibSignature.sol\";\n\n/// @dev Meta-transactions feature.\ninterface IMetaTransactionsFeature {\n /// @dev Describes an exchange proxy meta transaction.\n struct MetaTransactionData {\n // Signer of meta-transaction. On whose behalf to execute the MTX.\n address payable signer;\n // Required sender, or NULL for anyone.\n address sender;\n // Minimum gas price.\n uint256 minGasPrice;\n // Maximum gas price.\n uint256 maxGasPrice;\n // MTX is invalid after this time.\n uint256 expirationTimeSeconds;\n // Nonce to make this MTX unique.\n uint256 salt;\n // Encoded call data to a function on the exchange proxy.\n bytes callData;\n // Amount of ETH to attach to the call.\n uint256 value;\n // ERC20 fee `signer` pays `sender`.\n IERC20TokenV06 feeToken;\n // ERC20 fee amount.\n uint256 feeAmount;\n }\n\n /// @dev Emitted whenever a meta-transaction is executed via\n /// `executeMetaTransaction()` or `executeMetaTransactions()`.\n /// @param hash The meta-transaction hash.\n /// @param selector The selector of the function being executed.\n /// @param signer Who to execute the meta-transaction on behalf of.\n /// @param sender Who executed the meta-transaction.\n event MetaTransactionExecuted(\n bytes32 hash,\n bytes4 indexed selector,\n address signer,\n address sender\n );\n\n /// @dev Execute a single meta-transaction.\n /// @param mtx The meta-transaction.\n /// @param signature The signature by `mtx.signer`.\n /// @return returnResult The ABI-encoded result of the underlying call.\n function executeMetaTransaction(\n MetaTransactionData calldata mtx,\n LibSignature.Signature calldata signature\n )\n external\n payable\n returns (bytes memory returnResult);\n\n /// @dev Execute multiple meta-transactions.\n /// @param mtxs The meta-transactions.\n /// @param signatures The signature by each respective `mtx.signer`.\n /// @return returnResults The ABI-encoded results of the underlying calls.\n function batchExecuteMetaTransactions(\n MetaTransactionData[] calldata mtxs,\n LibSignature.Signature[] calldata signatures\n )\n external\n payable\n returns (bytes[] memory returnResults);\n\n /// @dev Get the block at which a meta-transaction has been executed.\n /// @param mtx The meta-transaction.\n /// @return blockNumber The block height when the meta-transactioin was executed.\n function getMetaTransactionExecutedBlock(MetaTransactionData calldata mtx)\n external\n view\n returns (uint256 blockNumber);\n\n /// @dev Get the block at which a meta-transaction hash has been executed.\n /// @param mtxHash The meta-transaction hash.\n /// @return blockNumber The block height when the meta-transactioin was executed.\n function getMetaTransactionHashExecutedBlock(bytes32 mtxHash)\n external\n view\n returns (uint256 blockNumber);\n\n /// @dev Get the EIP712 hash of a meta-transaction.\n /// @param mtx The meta-transaction.\n /// @return mtxHash The EIP712 hash of `mtx`.\n function getMetaTransactionHash(MetaTransactionData calldata mtx)\n external\n view\n returns (bytes32 mtxHash);\n}\n",
"./features/libs/LibSignature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"../../errors/LibSignatureRichErrors.sol\";\n\n\n/// @dev A library for validating signatures.\nlibrary LibSignature {\n using LibRichErrorsV06 for bytes;\n\n // '\\x19Ethereum Signed Message:\\n32\\x00\\x00\\x00\\x00' in a word.\n uint256 private constant ETH_SIGN_HASH_PREFIX =\n 0x19457468657265756d205369676e6564204d6573736167653a0a333200000000;\n /// @dev Exclusive upper limit on ECDSA signatures 'R' values.\n /// The valid range is given by fig (282) of the yellow paper.\n uint256 private constant ECDSA_SIGNATURE_R_LIMIT =\n uint256(0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141);\n /// @dev Exclusive upper limit on ECDSA signatures 'S' values.\n /// The valid range is given by fig (283) of the yellow paper.\n uint256 private constant ECDSA_SIGNATURE_S_LIMIT = ECDSA_SIGNATURE_R_LIMIT / 2 + 1;\n\n /// @dev Allowed signature types.\n enum SignatureType {\n ILLEGAL,\n INVALID,\n EIP712,\n ETHSIGN\n }\n\n /// @dev Encoded EC signature.\n struct Signature {\n // How to validate the signature.\n SignatureType signatureType;\n // EC Signature data.\n uint8 v;\n // EC Signature data.\n bytes32 r;\n // EC Signature data.\n bytes32 s;\n }\n\n /// @dev Retrieve the signer of a signature.\n /// Throws if the signature can't be validated.\n /// @param hash The hash that was signed.\n /// @param signature The signature.\n /// @return recovered The recovered signer address.\n function getSignerOfHash(\n bytes32 hash,\n Signature memory signature\n )\n internal\n pure\n returns (address recovered)\n {\n // Ensure this is a signature type that can be validated against a hash.\n _validateHashCompatibleSignature(hash, signature);\n\n if (signature.signatureType == SignatureType.EIP712) {\n // Signed using EIP712\n recovered = ecrecover(\n hash,\n signature.v,\n signature.r,\n signature.s\n );\n } else if (signature.signatureType == SignatureType.ETHSIGN) {\n // Signed using `eth_sign`\n // Need to hash `hash` with \"\\x19Ethereum Signed Message:\\n32\" prefix\n // in packed encoding.\n bytes32 ethSignHash;\n assembly {\n // Use scratch space\n mstore(0, ETH_SIGN_HASH_PREFIX) // length of 28 bytes\n mstore(28, hash) // length of 32 bytes\n ethSignHash := keccak256(0, 60)\n }\n recovered = ecrecover(\n ethSignHash,\n signature.v,\n signature.r,\n signature.s\n );\n }\n // `recovered` can be null if the signature values are out of range.\n if (recovered == address(0)) {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.BAD_SIGNATURE_DATA,\n hash\n ).rrevert();\n }\n }\n\n /// @dev Validates that a signature is compatible with a hash signee.\n /// @param hash The hash that was signed.\n /// @param signature The signature.\n function _validateHashCompatibleSignature(\n bytes32 hash,\n Signature memory signature\n )\n private\n pure\n {\n // Ensure the r and s are within malleability limits.\n if (uint256(signature.r) >= ECDSA_SIGNATURE_R_LIMIT ||\n uint256(signature.s) >= ECDSA_SIGNATURE_S_LIMIT)\n {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.BAD_SIGNATURE_DATA,\n hash\n ).rrevert();\n }\n\n // Always illegal signature.\n if (signature.signatureType == SignatureType.ILLEGAL) {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.ILLEGAL,\n hash\n ).rrevert();\n }\n\n // Always invalid.\n if (signature.signatureType == SignatureType.INVALID) {\n LibSignatureRichErrors.SignatureValidationError(\n LibSignatureRichErrors.SignatureValidationErrorCodes.ALWAYS_INVALID,\n hash\n ).rrevert();\n }\n\n // Solidity should check that the signature type is within enum range for us\n // when abi-decoding.\n }\n}\n",
"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibRichErrorsV06 {\n\n // bytes4(keccak256(\"Error(string)\"))\n bytes4 internal constant STANDARD_ERROR_SELECTOR = 0x08c379a0;\n\n // solhint-disable func-name-mixedcase\n /// @dev ABI encode a standard, string revert error payload.\n /// This is the same payload that would be included by a `revert(string)`\n /// solidity statement. It has the function signature `Error(string)`.\n /// @param message The error string.\n /// @return The ABI encoded error.\n function StandardError(string memory message)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n STANDARD_ERROR_SELECTOR,\n bytes(message)\n );\n }\n // solhint-enable func-name-mixedcase\n\n /// @dev Reverts an encoded rich revert reason `errorData`.\n /// @param errorData ABI encoded error data.\n function rrevert(bytes memory errorData)\n internal\n pure\n {\n assembly {\n revert(add(errorData, 0x20), mload(errorData))\n }\n }\n}\n",
"./errors/LibSignatureRichErrors.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibSignatureRichErrors {\n\n enum SignatureValidationErrorCodes {\n ALWAYS_INVALID,\n INVALID_LENGTH,\n UNSUPPORTED,\n ILLEGAL,\n WRONG_SIGNER,\n BAD_SIGNATURE_DATA\n }\n\n // solhint-disable func-name-mixedcase\n\n function SignatureValidationError(\n SignatureValidationErrorCodes code,\n bytes32 hash,\n address signerAddress,\n bytes memory signature\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"SignatureValidationError(uint8,bytes32,address,bytes)\")),\n code,\n hash,\n signerAddress,\n signature\n );\n }\n\n function SignatureValidationError(\n SignatureValidationErrorCodes code,\n bytes32 hash\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"SignatureValidationError(uint8,bytes32)\")),\n code,\n hash\n );\n }\n}\n",
"./features/interfaces/IUniswapFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\n/// @dev VIP uniswap fill functions.\ninterface IUniswapFeature {\n\n /// @dev Efficiently sell directly to uniswap/sushiswap.\n /// @param tokens Sell path.\n /// @param sellAmount of `tokens[0]` Amount to sell.\n /// @param minBuyAmount Minimum amount of `tokens[-1]` to buy.\n /// @param isSushi Use sushiswap if true.\n /// @return buyAmount Amount of `tokens[-1]` bought.\n function sellToUniswap(\n IERC20TokenV06[] calldata tokens,\n uint256 sellAmount,\n uint256 minBuyAmount,\n bool isSushi\n )\n external\n payable\n returns (uint256 buyAmount);\n}\n",
"./features/interfaces/ILiquidityProviderFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../../vendor/ILiquidityProvider.sol\";\n\n\n/// @dev Feature to swap directly with an on-chain liquidity provider.\ninterface ILiquidityProviderFeature {\n\n /// @dev Event for data pipeline.\n event LiquidityProviderSwap(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount,\n ILiquidityProvider provider,\n address recipient\n );\n\n /// @dev Sells `sellAmount` of `inputToken` to the liquidity provider\n /// at the given `provider` address.\n /// @param inputToken The token being sold.\n /// @param outputToken The token being bought.\n /// @param provider The address of the on-chain liquidity provider\n /// to trade with.\n /// @param recipient The recipient of the bought tokens. If equal to\n /// address(0), `msg.sender` is assumed to be the recipient.\n /// @param sellAmount The amount of `inputToken` to sell.\n /// @param minBuyAmount The minimum acceptable amount of `outputToken` to\n /// buy. Reverts if this amount is not satisfied.\n /// @param auxiliaryData Auxiliary data supplied to the `provider` contract.\n /// @return boughtAmount The amount of `outputToken` bought.\n function sellToLiquidityProvider(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n ILiquidityProvider provider,\n address recipient,\n uint256 sellAmount,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n payable\n returns (uint256 boughtAmount);\n}\n",
"./vendor/ILiquidityProvider.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\ninterface ILiquidityProvider {\n\n /// @dev An optional event an LP can emit for each fill against a source.\n /// @param inputToken The input token.\n /// @param outputToken The output token.\n /// @param inputTokenAmount How much input token was sold.\n /// @param outputTokenAmount How much output token was bought.\n /// @param sourceId A bytes32 encoded ascii source ID. E.g., `bytes32('Curve')`/\n /// @param sourceAddress An optional address associated with the source (e.g, a curve pool).\n /// @param sourceId A bytes32 encoded ascii source ID. E.g., `bytes32('Curve')`/\n /// @param sourceAddress An optional address associated with the source (e.g, a curve pool).\n /// @param sender The caller of the LP.\n /// @param recipient The recipient of the output tokens.\n event LiquidityProviderFill(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount,\n bytes32 sourceId,\n address sourceAddress,\n address sender,\n address recipient\n );\n\n /// @dev Trades `inputToken` for `outputToken`. The amount of `inputToken`\n /// to sell must be transferred to the contract prior to calling this\n /// function to trigger the trade.\n /// @param inputToken The token being sold.\n /// @param outputToken The token being bought.\n /// @param recipient The recipient of the bought tokens.\n /// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.\n /// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.\n /// @return boughtAmount The amount of `outputToken` bought.\n function sellTokenForToken(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n address recipient,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n returns (uint256 boughtAmount);\n\n /// @dev Trades ETH for token. ETH must either be attached to this function\n /// call or sent to the contract prior to calling this function to\n /// trigger the trade.\n /// @param outputToken The token being bought.\n /// @param recipient The recipient of the bought tokens.\n /// @param minBuyAmount The minimum acceptable amount of `outputToken` to buy.\n /// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.\n /// @return boughtAmount The amount of `outputToken` bought.\n function sellEthForToken(\n IERC20TokenV06 outputToken,\n address recipient,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n payable\n returns (uint256 boughtAmount);\n\n /// @dev Trades token for ETH. The token must be sent to the contract prior\n /// to calling this function to trigger the trade.\n /// @param inputToken The token being sold.\n /// @param recipient The recipient of the bought tokens.\n /// @param minBuyAmount The minimum acceptable amount of ETH to buy.\n /// @param auxiliaryData Arbitrary auxiliary data supplied to the contract.\n /// @return boughtAmount The amount of ETH bought.\n function sellTokenForEth(\n IERC20TokenV06 inputToken,\n address payable recipient,\n uint256 minBuyAmount,\n bytes calldata auxiliaryData\n )\n external\n returns (uint256 boughtAmount);\n\n /// @dev Quotes the amount of `outputToken` that would be obtained by\n /// selling `sellAmount` of `inputToken`.\n /// @param inputToken Address of the taker token (what to sell). Use\n /// the wETH address if selling ETH.\n /// @param outputToken Address of the maker token (what to buy). Use\n /// the wETH address if buying ETH.\n /// @param sellAmount Amount of `inputToken` to sell.\n /// @return outputTokenAmount Amount of `outputToken` that would be obtained.\n function getSellQuote(\n IERC20TokenV06 inputToken,\n IERC20TokenV06 outputToken,\n uint256 sellAmount\n )\n external\n view\n returns (uint256 outputTokenAmount);\n}\n",
"./features/interfaces/INativeOrdersFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../libs/LibSignature.sol\";\nimport \"../libs/LibNativeOrder.sol\";\nimport \"./INativeOrdersEvents.sol\";\n\n\n/// @dev Feature for interacting with limit orders.\ninterface INativeOrdersFeature is\n INativeOrdersEvents\n{\n\n /// @dev Transfers protocol fees from the `FeeCollector` pools into\n /// the staking contract.\n /// @param poolIds Staking pool IDs\n function transferProtocolFeesForPools(bytes32[] calldata poolIds)\n external;\n\n /// @dev Fill a limit order. The taker and sender will be the caller.\n /// @param order The limit order. ETH protocol fees can be\n /// attached to this call. Any unspent ETH will be refunded to\n /// the caller.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token amount to fill this order with.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillLimitOrder(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n payable\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order for up to `takerTokenFillAmount` taker tokens.\n /// The taker will be the caller.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token amount to fill this order with.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillRfqOrder(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.\n /// The taker will be the caller. ETH protocol fees can be\n /// attached to this call. Any unspent ETH will be refunded to\n /// the caller.\n /// @param order The limit order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount How much taker token to fill this order with.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillOrKillLimitOrder(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n payable\n returns (uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order for exactly `takerTokenFillAmount` taker tokens.\n /// The taker will be the caller.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount How much taker token to fill this order with.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function fillOrKillRfqOrder(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount\n )\n external\n returns (uint128 makerTokenFilledAmount);\n\n /// @dev Fill a limit order. Internal variant. ETH protocol fees can be\n /// attached to this call. Any unspent ETH will be refunded to\n /// `msg.sender` (not `sender`).\n /// @param order The limit order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token to fill this order with.\n /// @param taker The order taker.\n /// @param sender The order sender.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function _fillLimitOrder(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount,\n address taker,\n address sender\n )\n external\n payable\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Fill an RFQ order. Internal variant.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @param takerTokenFillAmount Maximum taker token to fill this order with.\n /// @param taker The order taker.\n /// @return takerTokenFilledAmount How much maker token was filled.\n /// @return makerTokenFilledAmount How much maker token was filled.\n function _fillRfqOrder(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature,\n uint128 takerTokenFillAmount,\n address taker\n )\n external\n returns (uint128 takerTokenFilledAmount, uint128 makerTokenFilledAmount);\n\n /// @dev Cancel a single limit order. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param order The limit order.\n function cancelLimitOrder(LibNativeOrder.LimitOrder calldata order)\n external;\n\n /// @dev Cancel a single RFQ order. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param order The RFQ order.\n function cancelRfqOrder(LibNativeOrder.RfqOrder calldata order)\n external;\n\n /// @dev Mark what tx.origin addresses are allowed to fill an order that\n /// specifies the message sender as its txOrigin.\n /// @param origins An array of origin addresses to update.\n /// @param allowed True to register, false to unregister.\n function registerAllowedRfqOrigins(address[] memory origins, bool allowed)\n external;\n\n /// @dev Cancel multiple limit orders. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param orders The limit orders.\n function batchCancelLimitOrders(LibNativeOrder.LimitOrder[] calldata orders)\n external;\n\n /// @dev Cancel multiple RFQ orders. The caller must be the maker.\n /// Silently succeeds if the order has already been cancelled.\n /// @param orders The RFQ orders.\n function batchCancelRfqOrders(LibNativeOrder.RfqOrder[] calldata orders)\n external;\n\n /// @dev Cancel all limit orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerToken The maker token.\n /// @param takerToken The taker token.\n /// @param minValidSalt The new minimum valid salt.\n function cancelPairLimitOrders(\n IERC20TokenV06 makerToken,\n IERC20TokenV06 takerToken,\n uint256 minValidSalt\n )\n external;\n\n /// @dev Cancel all limit orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerTokens The maker tokens.\n /// @param takerTokens The taker tokens.\n /// @param minValidSalts The new minimum valid salts.\n function batchCancelPairLimitOrders(\n IERC20TokenV06[] calldata makerTokens,\n IERC20TokenV06[] calldata takerTokens,\n uint256[] calldata minValidSalts\n )\n external;\n\n /// @dev Cancel all RFQ orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerToken The maker token.\n /// @param takerToken The taker token.\n /// @param minValidSalt The new minimum valid salt.\n function cancelPairRfqOrders(\n IERC20TokenV06 makerToken,\n IERC20TokenV06 takerToken,\n uint256 minValidSalt\n )\n external;\n\n /// @dev Cancel all RFQ orders for a given maker and pair with a salt less\n /// than the value provided. The caller must be the maker. Subsequent\n /// calls to this function with the same caller and pair require the\n /// new salt to be >= the old salt.\n /// @param makerTokens The maker tokens.\n /// @param takerTokens The taker tokens.\n /// @param minValidSalts The new minimum valid salts.\n function batchCancelPairRfqOrders(\n IERC20TokenV06[] calldata makerTokens,\n IERC20TokenV06[] calldata takerTokens,\n uint256[] calldata minValidSalts\n )\n external;\n\n /// @dev Get the order info for a limit order.\n /// @param order The limit order.\n /// @return orderInfo Info about the order.\n function getLimitOrderInfo(LibNativeOrder.LimitOrder calldata order)\n external\n view\n returns (LibNativeOrder.OrderInfo memory orderInfo);\n\n /// @dev Get the order info for an RFQ order.\n /// @param order The RFQ order.\n /// @return orderInfo Info about the order.\n function getRfqOrderInfo(LibNativeOrder.RfqOrder calldata order)\n external\n view\n returns (LibNativeOrder.OrderInfo memory orderInfo);\n\n /// @dev Get the canonical hash of a limit order.\n /// @param order The limit order.\n /// @return orderHash The order hash.\n function getLimitOrderHash(LibNativeOrder.LimitOrder calldata order)\n external\n view\n returns (bytes32 orderHash);\n\n /// @dev Get the canonical hash of an RFQ order.\n /// @param order The RFQ order.\n /// @return orderHash The order hash.\n function getRfqOrderHash(LibNativeOrder.RfqOrder calldata order)\n external\n view\n returns (bytes32 orderHash);\n\n /// @dev Get the protocol fee multiplier. This should be multiplied by the\n /// gas price to arrive at the required protocol fee to fill a native order.\n /// @return multiplier The protocol fee multiplier.\n function getProtocolFeeMultiplier()\n external\n view\n returns (uint32 multiplier);\n\n /// @dev Get order info, fillable amount, and signature validity for a limit order.\n /// Fillable amount is determined using balances and allowances of the maker.\n /// @param order The limit order.\n /// @param signature The order signature.\n /// @return orderInfo Info about the order.\n /// @return actualFillableTakerTokenAmount How much of the order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValid Whether the signature is valid.\n function getLimitOrderRelevantState(\n LibNativeOrder.LimitOrder calldata order,\n LibSignature.Signature calldata signature\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo memory orderInfo,\n uint128 actualFillableTakerTokenAmount,\n bool isSignatureValid\n );\n\n /// @dev Get order info, fillable amount, and signature validity for an RFQ order.\n /// Fillable amount is determined using balances and allowances of the maker.\n /// @param order The RFQ order.\n /// @param signature The order signature.\n /// @return orderInfo Info about the order.\n /// @return actualFillableTakerTokenAmount How much of the order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValid Whether the signature is valid.\n function getRfqOrderRelevantState(\n LibNativeOrder.RfqOrder calldata order,\n LibSignature.Signature calldata signature\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo memory orderInfo,\n uint128 actualFillableTakerTokenAmount,\n bool isSignatureValid\n );\n\n /// @dev Batch version of `getLimitOrderRelevantState()`, without reverting.\n /// Orders that would normally cause `getLimitOrderRelevantState()`\n /// to revert will have empty results.\n /// @param orders The limit orders.\n /// @param signatures The order signatures.\n /// @return orderInfos Info about the orders.\n /// @return actualFillableTakerTokenAmounts How much of each order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValids Whether each signature is valid for the order.\n function batchGetLimitOrderRelevantStates(\n LibNativeOrder.LimitOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo[] memory orderInfos,\n uint128[] memory actualFillableTakerTokenAmounts,\n bool[] memory isSignatureValids\n );\n\n /// @dev Batch version of `getRfqOrderRelevantState()`, without reverting.\n /// Orders that would normally cause `getRfqOrderRelevantState()`\n /// to revert will have empty results.\n /// @param orders The RFQ orders.\n /// @param signatures The order signatures.\n /// @return orderInfos Info about the orders.\n /// @return actualFillableTakerTokenAmounts How much of each order is fillable\n /// based on maker funds, in taker tokens.\n /// @return isSignatureValids Whether each signature is valid for the order.\n function batchGetRfqOrderRelevantStates(\n LibNativeOrder.RfqOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures\n )\n external\n view\n returns (\n LibNativeOrder.OrderInfo[] memory orderInfos,\n uint128[] memory actualFillableTakerTokenAmounts,\n bool[] memory isSignatureValids\n );\n}\n",
"./features/libs/LibNativeOrder.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol\";\nimport \"../../errors/LibNativeOrdersRichErrors.sol\";\n\n\n/// @dev A library for common native order operations.\nlibrary LibNativeOrder {\n using LibSafeMathV06 for uint256;\n using LibRichErrorsV06 for bytes;\n\n enum OrderStatus {\n INVALID,\n FILLABLE,\n FILLED,\n CANCELLED,\n EXPIRED\n }\n\n /// @dev A standard OTC or OO limit order.\n struct LimitOrder {\n IERC20TokenV06 makerToken;\n IERC20TokenV06 takerToken;\n uint128 makerAmount;\n uint128 takerAmount;\n uint128 takerTokenFeeAmount;\n address maker;\n address taker;\n address sender;\n address feeRecipient;\n bytes32 pool;\n uint64 expiry;\n uint256 salt;\n }\n\n /// @dev An RFQ limit order.\n struct RfqOrder {\n IERC20TokenV06 makerToken;\n IERC20TokenV06 takerToken;\n uint128 makerAmount;\n uint128 takerAmount;\n address maker;\n address taker;\n address txOrigin;\n bytes32 pool;\n uint64 expiry;\n uint256 salt;\n }\n\n /// @dev Info on a limit or RFQ order.\n struct OrderInfo {\n bytes32 orderHash;\n OrderStatus status;\n uint128 takerTokenFilledAmount;\n }\n\n uint256 private constant UINT_128_MASK = (1 << 128) - 1;\n uint256 private constant UINT_64_MASK = (1 << 64) - 1;\n uint256 private constant ADDRESS_MASK = (1 << 160) - 1;\n\n // The type hash for limit orders, which is:\n // keccak256(abi.encodePacked(\n // \"LimitOrder(\",\n // \"address makerToken,\",\n // \"address takerToken,\",\n // \"uint128 makerAmount,\",\n // \"uint128 takerAmount,\",\n // \"uint128 takerTokenFeeAmount,\",\n // \"address maker,\",\n // \"address taker,\",\n // \"address sender,\",\n // \"address feeRecipient,\",\n // \"bytes32 pool,\",\n // \"uint64 expiry,\",\n // \"uint256 salt\"\n // \")\"\n // ))\n uint256 private constant _LIMIT_ORDER_TYPEHASH =\n 0xce918627cb55462ddbb85e73de69a8b322f2bc88f4507c52fcad6d4c33c29d49;\n\n // The type hash for RFQ orders, which is:\n // keccak256(abi.encodePacked(\n // \"RfqOrder(\",\n // \"address makerToken,\",\n // \"address takerToken,\",\n // \"uint128 makerAmount,\",\n // \"uint128 takerAmount,\",\n // \"address maker,\",\n // \"address taker,\",\n // \"address txOrigin,\",\n // \"bytes32 pool,\",\n // \"uint64 expiry,\",\n // \"uint256 salt\"\n // \")\"\n // ))\n uint256 private constant _RFQ_ORDER_TYPEHASH =\n 0xe593d3fdfa8b60e5e17a1b2204662ecbe15c23f2084b9ad5bae40359540a7da9;\n\n /// @dev Get the struct hash of a limit order.\n /// @param order The limit order.\n /// @return structHash The struct hash of the order.\n function getLimitOrderStructHash(LimitOrder memory order)\n internal\n pure\n returns (bytes32 structHash)\n {\n // The struct hash is:\n // keccak256(abi.encode(\n // TYPE_HASH,\n // order.makerToken,\n // order.takerToken,\n // order.makerAmount,\n // order.takerAmount,\n // order.takerTokenFeeAmount,\n // order.maker,\n // order.taker,\n // order.sender,\n // order.feeRecipient,\n // order.pool,\n // order.expiry,\n // order.salt,\n // ))\n assembly {\n let mem := mload(0x40)\n mstore(mem, _LIMIT_ORDER_TYPEHASH)\n // order.makerToken;\n mstore(add(mem, 0x20), and(ADDRESS_MASK, mload(order)))\n // order.takerToken;\n mstore(add(mem, 0x40), and(ADDRESS_MASK, mload(add(order, 0x20))))\n // order.makerAmount;\n mstore(add(mem, 0x60), and(UINT_128_MASK, mload(add(order, 0x40))))\n // order.takerAmount;\n mstore(add(mem, 0x80), and(UINT_128_MASK, mload(add(order, 0x60))))\n // order.takerTokenFeeAmount;\n mstore(add(mem, 0xA0), and(UINT_128_MASK, mload(add(order, 0x80))))\n // order.maker;\n mstore(add(mem, 0xC0), and(ADDRESS_MASK, mload(add(order, 0xA0))))\n // order.taker;\n mstore(add(mem, 0xE0), and(ADDRESS_MASK, mload(add(order, 0xC0))))\n // order.sender;\n mstore(add(mem, 0x100), and(ADDRESS_MASK, mload(add(order, 0xE0))))\n // order.feeRecipient;\n mstore(add(mem, 0x120), and(ADDRESS_MASK, mload(add(order, 0x100))))\n // order.pool;\n mstore(add(mem, 0x140), mload(add(order, 0x120)))\n // order.expiry;\n mstore(add(mem, 0x160), and(UINT_64_MASK, mload(add(order, 0x140))))\n // order.salt;\n mstore(add(mem, 0x180), mload(add(order, 0x160)))\n structHash := keccak256(mem, 0x1A0)\n }\n }\n\n /// @dev Get the struct hash of a RFQ order.\n /// @param order The RFQ order.\n /// @return structHash The struct hash of the order.\n function getRfqOrderStructHash(RfqOrder memory order)\n internal\n pure\n returns (bytes32 structHash)\n {\n // The struct hash is:\n // keccak256(abi.encode(\n // TYPE_HASH,\n // order.makerToken,\n // order.takerToken,\n // order.makerAmount,\n // order.takerAmount,\n // order.maker,\n // order.taker,\n // order.txOrigin,\n // order.pool,\n // order.expiry,\n // order.salt,\n // ))\n assembly {\n let mem := mload(0x40)\n mstore(mem, _RFQ_ORDER_TYPEHASH)\n // order.makerToken;\n mstore(add(mem, 0x20), and(ADDRESS_MASK, mload(order)))\n // order.takerToken;\n mstore(add(mem, 0x40), and(ADDRESS_MASK, mload(add(order, 0x20))))\n // order.makerAmount;\n mstore(add(mem, 0x60), and(UINT_128_MASK, mload(add(order, 0x40))))\n // order.takerAmount;\n mstore(add(mem, 0x80), and(UINT_128_MASK, mload(add(order, 0x60))))\n // order.maker;\n mstore(add(mem, 0xA0), and(ADDRESS_MASK, mload(add(order, 0x80))))\n // order.taker;\n mstore(add(mem, 0xC0), and(ADDRESS_MASK, mload(add(order, 0xA0))))\n // order.txOrigin;\n mstore(add(mem, 0xE0), and(ADDRESS_MASK, mload(add(order, 0xC0))))\n // order.pool;\n mstore(add(mem, 0x100), mload(add(order, 0xE0)))\n // order.expiry;\n mstore(add(mem, 0x120), and(UINT_64_MASK, mload(add(order, 0x100))))\n // order.salt;\n mstore(add(mem, 0x140), mload(add(order, 0x120)))\n structHash := keccak256(mem, 0x160)\n }\n }\n\n /// @dev Refund any leftover protocol fees in `msg.value` to `msg.sender`.\n /// @param ethProtocolFeePaid How much ETH was paid in protocol fees.\n function refundExcessProtocolFeeToSender(uint256 ethProtocolFeePaid)\n internal\n {\n if (msg.value > ethProtocolFeePaid && msg.sender != address(this)) {\n uint256 refundAmount = msg.value.safeSub(ethProtocolFeePaid);\n (bool success,) = msg\n .sender\n .call{value: refundAmount}(\"\");\n if (!success) {\n LibNativeOrdersRichErrors.ProtocolFeeRefundFailed(\n msg.sender,\n refundAmount\n ).rrevert();\n }\n }\n }\n}\n",
"@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\nimport \"./errors/LibRichErrorsV06.sol\";\nimport \"./errors/LibSafeMathRichErrorsV06.sol\";\n\n\nlibrary LibSafeMathV06 {\n\n function safeMul(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (a == 0) {\n return 0;\n }\n uint256 c = a * b;\n if (c / a != b) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.MULTIPLICATION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function safeDiv(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (b == 0) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.DIVISION_BY_ZERO,\n a,\n b\n ));\n }\n uint256 c = a / b;\n return c;\n }\n\n function safeSub(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n if (b > a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.SUBTRACTION_UNDERFLOW,\n a,\n b\n ));\n }\n return a - b;\n }\n\n function safeAdd(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n uint256 c = a + b;\n if (c < a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.ADDITION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function max256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a >= b ? a : b;\n }\n\n function min256(uint256 a, uint256 b)\n internal\n pure\n returns (uint256)\n {\n return a < b ? a : b;\n }\n\n function safeMul128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n if (a == 0) {\n return 0;\n }\n uint128 c = a * b;\n if (c / a != b) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.MULTIPLICATION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function safeDiv128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n if (b == 0) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.DIVISION_BY_ZERO,\n a,\n b\n ));\n }\n uint128 c = a / b;\n return c;\n }\n\n function safeSub128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n if (b > a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.SUBTRACTION_UNDERFLOW,\n a,\n b\n ));\n }\n return a - b;\n }\n\n function safeAdd128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n uint128 c = a + b;\n if (c < a) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256BinOpError(\n LibSafeMathRichErrorsV06.BinOpErrorCodes.ADDITION_OVERFLOW,\n a,\n b\n ));\n }\n return c;\n }\n\n function max128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n return a >= b ? a : b;\n }\n\n function min128(uint128 a, uint128 b)\n internal\n pure\n returns (uint128)\n {\n return a < b ? a : b;\n }\n\n function safeDowncastToUint128(uint256 a)\n internal\n pure\n returns (uint128)\n {\n if (a > type(uint128).max) {\n LibRichErrorsV06.rrevert(LibSafeMathRichErrorsV06.Uint256DowncastError(\n LibSafeMathRichErrorsV06.DowncastErrorCodes.VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128,\n a\n ));\n }\n return uint128(a);\n }\n}\n",
"@0x/contracts-utils/contracts/src/v06/errors/LibSafeMathRichErrorsV06.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibSafeMathRichErrorsV06 {\n\n // bytes4(keccak256(\"Uint256BinOpError(uint8,uint256,uint256)\"))\n bytes4 internal constant UINT256_BINOP_ERROR_SELECTOR =\n 0xe946c1bb;\n\n // bytes4(keccak256(\"Uint256DowncastError(uint8,uint256)\"))\n bytes4 internal constant UINT256_DOWNCAST_ERROR_SELECTOR =\n 0xc996af7b;\n\n enum BinOpErrorCodes {\n ADDITION_OVERFLOW,\n MULTIPLICATION_OVERFLOW,\n SUBTRACTION_UNDERFLOW,\n DIVISION_BY_ZERO\n }\n\n enum DowncastErrorCodes {\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT32,\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT64,\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT96,\n VALUE_TOO_LARGE_TO_DOWNCAST_TO_UINT128\n }\n\n // solhint-disable func-name-mixedcase\n function Uint256BinOpError(\n BinOpErrorCodes errorCode,\n uint256 a,\n uint256 b\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n UINT256_BINOP_ERROR_SELECTOR,\n errorCode,\n a,\n b\n );\n }\n\n function Uint256DowncastError(\n DowncastErrorCodes errorCode,\n uint256 a\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n UINT256_DOWNCAST_ERROR_SELECTOR,\n errorCode,\n a\n );\n }\n}\n",
"./errors/LibNativeOrdersRichErrors.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary LibNativeOrdersRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function ProtocolFeeRefundFailed(\n address receiver,\n uint256 refundAmount\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"ProtocolFeeRefundFailed(address,uint256)\")),\n receiver,\n refundAmount\n );\n }\n\n function OrderNotFillableByOriginError(\n bytes32 orderHash,\n address txOrigin,\n address orderTxOrigin\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableByOriginError(bytes32,address,address)\")),\n orderHash,\n txOrigin,\n orderTxOrigin\n );\n }\n\n function OrderNotFillableError(\n bytes32 orderHash,\n uint8 orderStatus\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableError(bytes32,uint8)\")),\n orderHash,\n orderStatus\n );\n }\n\n function OrderNotSignedByMakerError(\n bytes32 orderHash,\n address signer,\n address maker\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotSignedByMakerError(bytes32,address,address)\")),\n orderHash,\n signer,\n maker\n );\n }\n\n function OrderNotFillableBySenderError(\n bytes32 orderHash,\n address sender,\n address orderSender\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableBySenderError(bytes32,address,address)\")),\n orderHash,\n sender,\n orderSender\n );\n }\n\n function OrderNotFillableByTakerError(\n bytes32 orderHash,\n address taker,\n address orderTaker\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OrderNotFillableByTakerError(bytes32,address,address)\")),\n orderHash,\n taker,\n orderTaker\n );\n }\n\n function CancelSaltTooLowError(\n uint256 minValidSalt,\n uint256 oldMinValidSalt\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"CancelSaltTooLowError(uint256,uint256)\")),\n minValidSalt,\n oldMinValidSalt\n );\n }\n\n function FillOrKillFailedError(\n bytes32 orderHash,\n uint256 takerTokenFilledAmount,\n uint256 takerTokenFillAmount\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"FillOrKillFailedError(bytes32,uint256,uint256)\")),\n orderHash,\n takerTokenFilledAmount,\n takerTokenFillAmount\n );\n }\n\n function OnlyOrderMakerAllowed(\n bytes32 orderHash,\n address sender,\n address maker\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OnlyOrderMakerAllowed(bytes32,address,address)\")),\n orderHash,\n sender,\n maker\n );\n }\n\n function BatchFillIncompleteError(\n bytes32 orderHash,\n uint256 takerTokenFilledAmount,\n uint256 takerTokenFillAmount\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"BatchFillIncompleteError(bytes32,uint256,uint256)\")),\n orderHash,\n takerTokenFilledAmount,\n takerTokenFillAmount\n );\n }\n}\n",
"./features/interfaces/INativeOrdersEvents.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2021 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"../libs/LibSignature.sol\";\nimport \"../libs/LibNativeOrder.sol\";\n\n\n/// @dev Events emitted by NativeOrdersFeature.\ninterface INativeOrdersEvents {\n\n /// @dev Emitted whenever a `LimitOrder` is filled.\n /// @param orderHash The canonical hash of the order.\n /// @param maker The maker of the order.\n /// @param taker The taker of the order.\n /// @param feeRecipient Fee recipient of the order.\n /// @param takerTokenFilledAmount How much taker token was filled.\n /// @param makerTokenFilledAmount How much maker token was filled.\n /// @param protocolFeePaid How much protocol fee was paid.\n /// @param pool The fee pool associated with this order.\n event LimitOrderFilled(\n bytes32 orderHash,\n address maker,\n address taker,\n address feeRecipient,\n address makerToken,\n address takerToken,\n uint128 takerTokenFilledAmount,\n uint128 makerTokenFilledAmount,\n uint128 takerTokenFeeFilledAmount,\n uint256 protocolFeePaid,\n bytes32 pool\n );\n\n /// @dev Emitted whenever an `RfqOrder` is filled.\n /// @param orderHash The canonical hash of the order.\n /// @param maker The maker of the order.\n /// @param taker The taker of the order.\n /// @param takerTokenFilledAmount How much taker token was filled.\n /// @param makerTokenFilledAmount How much maker token was filled.\n /// @param pool The fee pool associated with this order.\n event RfqOrderFilled(\n bytes32 orderHash,\n address maker,\n address taker,\n address makerToken,\n address takerToken,\n uint128 takerTokenFilledAmount,\n uint128 makerTokenFilledAmount,\n bytes32 pool\n );\n\n /// @dev Emitted whenever a limit or RFQ order is cancelled.\n /// @param orderHash The canonical hash of the order.\n /// @param maker The order maker.\n event OrderCancelled(\n bytes32 orderHash,\n address maker\n );\n\n /// @dev Emitted whenever Limit orders are cancelled by pair by a maker.\n /// @param maker The maker of the order.\n /// @param makerToken The maker token in a pair for the orders cancelled.\n /// @param takerToken The taker token in a pair for the orders cancelled.\n /// @param minValidSalt The new minimum valid salt an order with this pair must\n /// have.\n event PairCancelledLimitOrders(\n address maker,\n address makerToken,\n address takerToken,\n uint256 minValidSalt\n );\n\n /// @dev Emitted whenever RFQ orders are cancelled by pair by a maker.\n /// @param maker The maker of the order.\n /// @param makerToken The maker token in a pair for the orders cancelled.\n /// @param takerToken The taker token in a pair for the orders cancelled.\n /// @param minValidSalt The new minimum valid salt an order with this pair must\n /// have.\n event PairCancelledRfqOrders(\n address maker,\n address makerToken,\n address takerToken,\n uint256 minValidSalt\n );\n\n /// @dev Emitted when new addresses are allowed or disallowed to fill\n /// orders with a given txOrigin.\n /// @param origin The address doing the allowing.\n /// @param addrs The address being allowed/disallowed.\n /// @param allowed Indicates whether the address should be allowed.\n event RfqOrderOriginsAllowed(\n address origin,\n address[] addrs,\n bool allowed\n );\n}\n",
"./features/interfaces/IBatchFillNativeOrdersFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2021 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"../libs/LibNativeOrder.sol\";\nimport \"../libs/LibSignature.sol\";\n\n\n/// @dev Feature for batch/market filling limit and RFQ orders.\ninterface IBatchFillNativeOrdersFeature {\n\n /// @dev Fills multiple limit orders.\n /// @param orders Array of limit orders.\n /// @param signatures Array of signatures corresponding to each order.\n /// @param takerTokenFillAmounts Array of desired amounts to fill each order.\n /// @param revertIfIncomplete If true, reverts if this function fails to\n /// fill the full fill amount for any individual order.\n /// @return takerTokenFilledAmounts Array of amounts filled, in taker token.\n /// @return makerTokenFilledAmounts Array of amounts filled, in maker token.\n function batchFillLimitOrders(\n LibNativeOrder.LimitOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures,\n uint128[] calldata takerTokenFillAmounts,\n bool revertIfIncomplete\n )\n external\n payable\n returns (\n uint128[] memory takerTokenFilledAmounts,\n uint128[] memory makerTokenFilledAmounts\n );\n\n /// @dev Fills multiple RFQ orders.\n /// @param orders Array of RFQ orders.\n /// @param signatures Array of signatures corresponding to each order.\n /// @param takerTokenFillAmounts Array of desired amounts to fill each order.\n /// @param revertIfIncomplete If true, reverts if this function fails to\n /// fill the full fill amount for any individual order.\n /// @return takerTokenFilledAmounts Array of amounts filled, in taker token.\n /// @return makerTokenFilledAmounts Array of amounts filled, in maker token.\n function batchFillRfqOrders(\n LibNativeOrder.RfqOrder[] calldata orders,\n LibSignature.Signature[] calldata signatures,\n uint128[] calldata takerTokenFillAmounts,\n bool revertIfIncomplete\n )\n external\n returns (\n uint128[] memory takerTokenFilledAmounts,\n uint128[] memory makerTokenFilledAmounts\n );\n}\n",
"./features/interfaces/IMultiplexFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2021 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\n\n\ninterface IMultiplexFeature {\n\n // Parameters for `batchFill`.\n struct BatchFillData {\n // The token being sold.\n IERC20TokenV06 inputToken;\n // The token being bought.\n IERC20TokenV06 outputToken;\n // The amount of `inputToken` to sell.\n uint256 sellAmount;\n // The nested calls to perform.\n WrappedBatchCall[] calls;\n }\n\n // Represents a call nested within a `batchFill`.\n struct WrappedBatchCall {\n // The selector of the function to call.\n bytes4 selector;\n // Amount of `inputToken` to sell.\n uint256 sellAmount;\n // ABI-encoded parameters needed to perform the call.\n bytes data;\n }\n\n // Parameters for `multiHopFill`.\n struct MultiHopFillData {\n // The sell path, i.e.\n // tokens = [inputToken, hopToken1, ..., hopTokenN, outputToken]\n address[] tokens;\n // The amount of `tokens[0]` to sell.\n uint256 sellAmount;\n // The nested calls to perform.\n WrappedMultiHopCall[] calls;\n }\n\n // Represents a call nested within a `multiHopFill`.\n struct WrappedMultiHopCall {\n // The selector of the function to call.\n bytes4 selector;\n // ABI-encoded parameters needed to perform the call.\n bytes data;\n }\n\n event LiquidityProviderSwap(\n address inputToken,\n address outputToken,\n uint256 inputTokenAmount,\n uint256 outputTokenAmount,\n address provider,\n address recipient\n );\n\n event ExpiredRfqOrder(\n bytes32 orderHash,\n address maker,\n uint64 expiry\n );\n\n /// @dev Executes a batch of fills selling `fillData.inputToken`\n /// for `fillData.outputToken` in sequence. Refer to the\n /// internal variant `_batchFill` for the allowed nested\n /// operations.\n /// @param fillData Encodes the input/output tokens, the sell\n /// amount, and the nested operations for this batch fill.\n /// @param minBuyAmount The minimum amount of `fillData.outputToken`\n /// to buy. Reverts if this amount is not met.\n /// @return outputTokenAmount The amount of the output token bought.\n function batchFill(\n BatchFillData calldata fillData,\n uint256 minBuyAmount\n )\n external\n payable\n returns (uint256 outputTokenAmount);\n\n /// @dev Executes a sequence of fills \"hopping\" through the\n /// path of tokens given by `fillData.tokens`. Refer to the\n /// internal variant `_multiHopFill` for the allowed nested\n /// operations.\n /// @param fillData Encodes the path of tokens, the sell amount,\n /// and the nested operations for this multi-hop fill.\n /// @param minBuyAmount The minimum amount of the output token\n /// to buy. Reverts if this amount is not met.\n /// @return outputTokenAmount The amount of the output token bought.\n function multiHopFill(\n MultiHopFillData calldata fillData,\n uint256 minBuyAmount\n )\n external\n payable\n returns (uint256 outputTokenAmount);\n}\n"
},
"compiler": {
"name": "solc",
"version": "0.6.12+commit.27d51765",
"settings": {
"remappings": [
"@0x/contracts-utils=/Users/michaelzhu/protocol/node_modules/@0x/contracts-utils",
"@0x/contracts-erc20=/Users/michaelzhu/protocol/contracts/zero-ex/node_modules/@0x/contracts-erc20"
],
"optimizer": {
"enabled": true,
"runs": 1000000,
"details": {
"yul": true,
"deduplicate": true,
"cse": true,
"constantOptimizer": true
}
},
"outputSelection": {
"*": {
"*": [
"abi",
"devdoc",
"evm.bytecode.object",
"evm.bytecode.sourceMap",
"evm.deployedBytecode.object",
"evm.deployedBytecode.sourceMap",
"evm.methodIdentifiers"
]
}
},
"evmVersion": "istanbul"
}
},
"chains": {}
}