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

354 lines
199 KiB
JSON

{
"schemaVersion": "2.0.0",
"contractName": "TokenSpenderFeature",
"compilerOutput": {
"abi": [
{
"inputs": [],
"name": "FEATURE_NAME",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "FEATURE_VERSION",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"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": [],
"name": "getAllowanceTarget",
"outputs": [
{
"internalType": "address",
"name": "target",
"type": "address"
}
],
"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": [
{
"internalType": "contract IAllowanceTarget",
"name": "allowanceTarget",
"type": "address"
}
],
"name": "migrate",
"outputs": [
{
"internalType": "bytes4",
"name": "success",
"type": "bytes4"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"details": "Feature that allows spending token allowances.",
"kind": "dev",
"methods": {
"_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."
}
},
"getAllowanceTarget()": {
"details": "Get the address of the allowance target.",
"returns": {
"target": "The target of token allowances."
}
},
"getSpendableERC20BalanceOf(address,address)": {
"details": "Gets the maximum amount of an ERC20 token `token` that can be pulled from `owner` by the token spender.",
"params": {
"owner": "The owner of the tokens.",
"token": "The token to spend."
},
"returns": {
"amount": "The amount of tokens that can be pulled."
}
},
"migrate(address)": {
"details": "Initialize and register this feature. Should be delegatecalled into during a `Migrate.migrate()`.",
"params": {
"allowanceTarget": "An `allowanceTarget` instance, configured to have the ZeroeEx contract as an authority."
},
"returns": {
"success": "`MIGRATE_SUCCESS` on success."
}
}
},
"stateVariables": {
"FEATURE_NAME": {
"details": "Name of this feature."
},
"FEATURE_VERSION": {
"details": "Version of this feature."
}
},
"version": 1
},
"evm": {
"bytecode": {
"linkReferences": {},
"object": "0x60c0604052610011600160008061002d565b60a05234801561002057600080fd5b503060601b60805261005f565b6bffffffff0000000000000000604084901b1667ffffffff00000000602084901b161763ffffffff8216179392505050565b60805160601c60a051610dd0610085600039806101095250806108675250610dd06000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c806389dd02e71161005057806389dd02e7146100bd578063ce5494bb146100d2578063f7c3a33b146100f257610072565b8063031b905c14610077578063496f471e146100955780636ae4b4f7146100a8575b600080fd5b61007f610107565b60405161008c9190610d3c565b60405180910390f35b61007f6100a3366004610a8a565b61012b565b6100b06102a4565b60405161008c9190610d29565b6100d06100cb366004610ac2565b6102dd565b005b6100e56100e0366004610a6e565b610528565b60405161008c9190610c92565b6100fa610619565b60405161008c9190610b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061029d8373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e8461015561063f565b546040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526101a6929173ffffffffffffffffffffffffffffffffffffffff1690600401610bb1565b60206040518083038186803b1580156101be57600080fd5b505afa1580156101d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f69190610b12565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610248908790600401610b90565b60206040518083038186803b15801561026057600080fd5b505afa158015610274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102989190610b12565b610652565b9392505050565b6040518060400160405280600c81526020017f546f6b656e5370656e646572000000000000000000000000000000000000000081525081565b3330146102f5576102f56102f033610668565b610720565b60006102ff61063f565b5460405173ffffffffffffffffffffffffffffffffffffffff909116915060009060609083907fbca8c7b5000000000000000000000000000000000000000000000000000000009089907f23b872dd000000000000000000000000000000000000000000000000000000009061037d908b908b908b90602401610c2a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090941693909317909252905161040a929190602401610c5b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516104939190610b74565b6000604051808303816000865af19150503d80600081146104d0576040519150601f19603f3d011682016040523d82523d6000602084013e6104d5565b606091505b509150915081156104f757808060200190518101906104f491906109b5565b90505b81158061050a575061050881610728565b155b1561051f5761051f6102f0888888888661076d565b50505050505050565b60008161053361063f565b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905561059f7ff7c3a33b00000000000000000000000000000000000000000000000000000000610831565b6105c87f89dd02e700000000000000000000000000000000000000000000000000000000610831565b6105f17f496f471e00000000000000000000000000000000000000000000000000000000610831565b507f2c64c5ef000000000000000000000000000000000000000000000000000000005b919050565b600061062361063f565b5473ffffffffffffffffffffffffffffffffffffffff16905090565b60008061064c60036108c4565b92915050565b6000818310610661578161029d565b5090919050565b60607ff0ec779b0bcda6d84abf99ee2c67647d1100ebbb553a9c2d1c2ba1579592832c8260405160240161069c9190610b90565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b805160208201fd5b600081516000141561073c57506001610614565b60208251106106145760006107528360006108df565b90508060011415610767576001915050610614565b50919050565b60607fdfdc6f57cf82bede92bcfdd44fedb82b2d5cecabf56ec21964db6ee2c3e82cf486868686866040516024016107a9959493929190610bd8565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905095945050505050565b6040517f6eb224cb0000000000000000000000000000000000000000000000000000000081523090636eb224cb9061088f9084907f000000000000000000000000000000000000000000000000000000000000000090600401610cbf565b600060405180830381600087803b1580156108a957600080fd5b505af11580156108bd573d6000803e3d6000fd5b5050505050565b600060808260078111156108d457fe5b600101901b92915050565b600061029d838360008160200183511015610907576109076102f06005855185602001610910565b50016020015190565b6060632800659560e01b84848460405160240161092f93929190610d07565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b6000602082840312156109c6578081fd5b815167ffffffffffffffff808211156109dd578283fd5b818401915084601f8301126109f0578283fd5b8151818111156109fe578384fd5b60405160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401168201018181108482111715610a3c578586fd5b604052818152838201602001871015610a53578485fd5b610a64826020830160208701610d45565b9695505050505050565b600060208284031215610a7f578081fd5b813561029d81610d75565b60008060408385031215610a9c578081fd5b8235610aa781610d75565b91506020830135610ab781610d75565b809150509250929050565b60008060008060808587031215610ad7578182fd5b8435610ae281610d75565b93506020850135610af281610d75565b92506040850135610b0281610d75565b9396929550929360600135925050565b600060208284031215610b23578081fd5b5051919050565b60008151808452610b42816020860160208601610d45565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251610b86818460208701610d45565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015280861660408401525083606083015260a06080830152610c1f60a0830184610b2a565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff8416825260406020830152610c8a6040830184610b2a565b949350505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b6060810160088510610d1557fe5b938152602081019290925260409091015290565b60006020825261029d6020830184610b2a565b90815260200190565b60005b83811015610d60578181015183820152602001610d48565b83811115610d6f576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610d9757600080fd5b5056fea264697066735822122079af49d5f20054e773ecf811fa9d46dcdfe73b9605db4afd5063663716b39ddf64736f6c634300060c0033",
"opcodes": "PUSH1 0xC0 PUSH1 0x40 MSTORE PUSH2 0x11 PUSH1 0x1 PUSH1 0x0 DUP1 PUSH2 0x2D JUMP JUMPDEST PUSH1 0xA0 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x20 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP ADDRESS PUSH1 0x60 SHL PUSH1 0x80 MSTORE PUSH2 0x5F JUMP JUMPDEST PUSH12 0xFFFFFFFF0000000000000000 PUSH1 0x40 DUP5 SWAP1 SHL AND PUSH8 0xFFFFFFFF00000000 PUSH1 0x20 DUP5 SWAP1 SHL AND OR PUSH4 0xFFFFFFFF DUP3 AND OR SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH1 0x60 SHR PUSH1 0xA0 MLOAD PUSH2 0xDD0 PUSH2 0x85 PUSH1 0x0 CODECOPY DUP1 PUSH2 0x109 MSTORE POP DUP1 PUSH2 0x867 MSTORE POP PUSH2 0xDD0 PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x72 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x89DD02E7 GT PUSH2 0x50 JUMPI DUP1 PUSH4 0x89DD02E7 EQ PUSH2 0xBD JUMPI DUP1 PUSH4 0xCE5494BB EQ PUSH2 0xD2 JUMPI DUP1 PUSH4 0xF7C3A33B EQ PUSH2 0xF2 JUMPI PUSH2 0x72 JUMP JUMPDEST DUP1 PUSH4 0x31B905C EQ PUSH2 0x77 JUMPI DUP1 PUSH4 0x496F471E EQ PUSH2 0x95 JUMPI DUP1 PUSH4 0x6AE4B4F7 EQ PUSH2 0xA8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x7F PUSH2 0x107 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xD3C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x7F PUSH2 0xA3 CALLDATASIZE PUSH1 0x4 PUSH2 0xA8A JUMP JUMPDEST PUSH2 0x12B JUMP JUMPDEST PUSH2 0xB0 PUSH2 0x2A4 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xD29 JUMP JUMPDEST PUSH2 0xD0 PUSH2 0xCB CALLDATASIZE PUSH1 0x4 PUSH2 0xAC2 JUMP JUMPDEST PUSH2 0x2DD JUMP JUMPDEST STOP JUMPDEST PUSH2 0xE5 PUSH2 0xE0 CALLDATASIZE PUSH1 0x4 PUSH2 0xA6E JUMP JUMPDEST PUSH2 0x528 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xC92 JUMP JUMPDEST PUSH2 0xFA PUSH2 0x619 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xB90 JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x29D DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xDD62ED3E DUP5 PUSH2 0x155 PUSH2 0x63F JUMP JUMPDEST SLOAD PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0xE0 DUP6 SWAP1 SHL AND DUP2 MSTORE PUSH2 0x1A6 SWAP3 SWAP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x4 ADD PUSH2 0xBB1 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x1D2 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1F6 SWAP2 SWAP1 PUSH2 0xB12 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x70A0823100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0x70A08231 SWAP1 PUSH2 0x248 SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0xB90 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x260 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x274 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x298 SWAP2 SWAP1 PUSH2 0xB12 JUMP JUMPDEST PUSH2 0x652 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0xC DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x546F6B656E5370656E6465720000000000000000000000000000000000000000 DUP2 MSTORE POP DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x2F5 JUMPI PUSH2 0x2F5 PUSH2 0x2F0 CALLER PUSH2 0x668 JUMP JUMPDEST PUSH2 0x720 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2FF PUSH2 0x63F JUMP JUMPDEST SLOAD PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP2 POP PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 DUP4 SWAP1 PUSH32 0xBCA8C7B500000000000000000000000000000000000000000000000000000000 SWAP1 DUP10 SWAP1 PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x37D SWAP1 DUP12 SWAP1 DUP12 SWAP1 DUP12 SWAP1 PUSH1 0x24 ADD PUSH2 0xC2A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE SWAP1 MLOAD PUSH2 0x40A SWAP3 SWAP2 SWAP1 PUSH1 0x24 ADD PUSH2 0xC5B JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE SWAP1 MLOAD PUSH2 0x493 SWAP2 SWAP1 PUSH2 0xB74 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP7 GAS CALL SWAP2 POP POP RETURNDATASIZE DUP1 PUSH1 0x0 DUP2 EQ PUSH2 0x4D0 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH1 0x0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x4D5 JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP2 POP SWAP2 POP DUP2 ISZERO PUSH2 0x4F7 JUMPI DUP1 DUP1 PUSH1 0x20 ADD SWAP1 MLOAD DUP2 ADD SWAP1 PUSH2 0x4F4 SWAP2 SWAP1 PUSH2 0x9B5 JUMP JUMPDEST SWAP1 POP JUMPDEST DUP2 ISZERO DUP1 PUSH2 0x50A JUMPI POP PUSH2 0x508 DUP2 PUSH2 0x728 JUMP JUMPDEST ISZERO JUMPDEST ISZERO PUSH2 0x51F JUMPI PUSH2 0x51F PUSH2 0x2F0 DUP9 DUP9 DUP9 DUP9 DUP7 PUSH2 0x76D JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH2 0x533 PUSH2 0x63F JUMP JUMPDEST DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH2 0x59F PUSH32 0xF7C3A33B00000000000000000000000000000000000000000000000000000000 PUSH2 0x831 JUMP JUMPDEST PUSH2 0x5C8 PUSH32 0x89DD02E700000000000000000000000000000000000000000000000000000000 PUSH2 0x831 JUMP JUMPDEST PUSH2 0x5F1 PUSH32 0x496F471E00000000000000000000000000000000000000000000000000000000 PUSH2 0x831 JUMP JUMPDEST POP PUSH32 0x2C64C5EF00000000000000000000000000000000000000000000000000000000 JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x623 PUSH2 0x63F JUMP JUMPDEST SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x64C PUSH1 0x3 PUSH2 0x8C4 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP4 LT PUSH2 0x661 JUMPI DUP2 PUSH2 0x29D JUMP JUMPDEST POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH32 0xF0EC779B0BCDA6D84ABF99EE2C67647D1100EBBB553A9C2D1C2BA1579592832C DUP3 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x69C SWAP2 SWAP1 PUSH2 0xB90 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP3 ADD REVERT JUMPDEST PUSH1 0x0 DUP2 MLOAD PUSH1 0x0 EQ ISZERO PUSH2 0x73C JUMPI POP PUSH1 0x1 PUSH2 0x614 JUMP JUMPDEST PUSH1 0x20 DUP3 MLOAD LT PUSH2 0x614 JUMPI PUSH1 0x0 PUSH2 0x752 DUP4 PUSH1 0x0 PUSH2 0x8DF JUMP JUMPDEST SWAP1 POP DUP1 PUSH1 0x1 EQ ISZERO PUSH2 0x767 JUMPI PUSH1 0x1 SWAP2 POP POP PUSH2 0x614 JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH32 0xDFDC6F57CF82BEDE92BCFDD44FEDB82B2D5CECABF56EC21964DB6EE2C3E82CF4 DUP7 DUP7 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x7A9 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0xBD8 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 POP SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x6EB224CB00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP1 PUSH4 0x6EB224CB SWAP1 PUSH2 0x88F SWAP1 DUP5 SWAP1 PUSH32 0x0 SWAP1 PUSH1 0x4 ADD PUSH2 0xCBF JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x8A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x8BD JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x8D4 JUMPI INVALID JUMPDEST PUSH1 0x1 ADD SWAP1 SHL SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x29D DUP4 DUP4 PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO PUSH2 0x907 JUMPI PUSH2 0x907 PUSH2 0x2F0 PUSH1 0x5 DUP6 MLOAD DUP6 PUSH1 0x20 ADD PUSH2 0x910 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH4 0x28006595 PUSH1 0xE0 SHL DUP5 DUP5 DUP5 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x92F SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0xD07 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x9C6 JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP1 DUP3 GT ISZERO PUSH2 0x9DD JUMPI DUP3 DUP4 REVERT JUMPDEST DUP2 DUP5 ADD SWAP2 POP DUP5 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x9F0 JUMPI DUP3 DUP4 REVERT JUMPDEST DUP2 MLOAD DUP2 DUP2 GT ISZERO PUSH2 0x9FE JUMPI DUP4 DUP5 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x20 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 PUSH1 0x1F DUP5 ADD AND DUP3 ADD ADD DUP2 DUP2 LT DUP5 DUP3 GT OR ISZERO PUSH2 0xA3C JUMPI DUP6 DUP7 REVERT JUMPDEST PUSH1 0x40 MSTORE DUP2 DUP2 MSTORE DUP4 DUP3 ADD PUSH1 0x20 ADD DUP8 LT ISZERO PUSH2 0xA53 JUMPI DUP5 DUP6 REVERT JUMPDEST PUSH2 0xA64 DUP3 PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP8 ADD PUSH2 0xD45 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xA7F JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x29D DUP2 PUSH2 0xD75 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xA9C JUMPI DUP1 DUP2 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH2 0xAA7 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP2 POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH2 0xAB7 DUP2 PUSH2 0xD75 JUMP JUMPDEST DUP1 SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xAD7 JUMPI DUP2 DUP3 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH2 0xAE2 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP4 POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH2 0xAF2 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP3 POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH2 0xB02 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP4 SWAP7 SWAP3 SWAP6 POP SWAP3 SWAP4 PUSH1 0x60 ADD CALLDATALOAD SWAP3 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xB23 JUMPI DUP1 DUP2 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP1 DUP5 MSTORE PUSH2 0xB42 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0xD45 JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP3 SWAP1 SWAP3 ADD PUSH1 0x20 ADD SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 MLOAD PUSH2 0xB86 DUP2 DUP5 PUSH1 0x20 DUP8 ADD PUSH2 0xD45 JUMP JUMPDEST SWAP2 SWAP1 SWAP2 ADD SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 DUP4 AND DUP2 MSTORE SWAP2 AND PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP9 AND DUP4 MSTORE DUP1 DUP8 AND PUSH1 0x20 DUP5 ADD MSTORE DUP1 DUP7 AND PUSH1 0x40 DUP5 ADD MSTORE POP DUP4 PUSH1 0x60 DUP4 ADD MSTORE PUSH1 0xA0 PUSH1 0x80 DUP4 ADD MSTORE PUSH2 0xC1F PUSH1 0xA0 DUP4 ADD DUP5 PUSH2 0xB2A JUMP JUMPDEST SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP4 DUP5 AND DUP2 MSTORE SWAP2 SWAP1 SWAP3 AND PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND DUP3 MSTORE PUSH1 0x40 PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0xC8A PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0xB2A JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP2 SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP3 SWAP1 SWAP3 AND DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH1 0x8 DUP6 LT PUSH2 0xD15 JUMPI INVALID JUMPDEST SWAP4 DUP2 MSTORE PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 ADD MSTORE SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 MSTORE PUSH2 0x29D PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0xB2A JUMP JUMPDEST SWAP1 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xD60 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xD48 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0xD6F JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND DUP2 EQ PUSH2 0xD97 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH26 0xAF49D5F20054E773ECF811FA9D46DCDFE73B9605DB4AFD506366 CALLDATACOPY AND 0xB3 SWAP14 0xDF PUSH5 0x736F6C6343 STOP MOD 0xC STOP CALLER ",
"sourceMap": "1310:3561:4:-:0;;;1619:23;1634:1;1637;;1619:14;:23::i;:::-;1567:75;;1310:3561;;;;;;;;;-1:-1:-1;1920:4:9;1894:31;;;;1310:3561:4;;2672:235:9;2834:20;2852:2;2834:20;;;;2859;2877:2;2859:20;;;;2833:47;2883:17;;;2833:67;2672:235;;;;;:::o;1310:3561:4:-;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"immutableReferences": {
"193": [
{
"length": 32,
"start": 265
}
],
"514": [
{
"length": 32,
"start": 2151
}
]
},
"linkReferences": {},
"object": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c806389dd02e71161005057806389dd02e7146100bd578063ce5494bb146100d2578063f7c3a33b146100f257610072565b8063031b905c14610077578063496f471e146100955780636ae4b4f7146100a8575b600080fd5b61007f610107565b60405161008c9190610d3c565b60405180910390f35b61007f6100a3366004610a8a565b61012b565b6100b06102a4565b60405161008c9190610d29565b6100d06100cb366004610ac2565b6102dd565b005b6100e56100e0366004610a6e565b610528565b60405161008c9190610c92565b6100fa610619565b60405161008c9190610b90565b7f000000000000000000000000000000000000000000000000000000000000000081565b600061029d8373ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e8461015561063f565b546040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b1681526101a6929173ffffffffffffffffffffffffffffffffffffffff1690600401610bb1565b60206040518083038186803b1580156101be57600080fd5b505afa1580156101d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f69190610b12565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616906370a0823190610248908790600401610b90565b60206040518083038186803b15801561026057600080fd5b505afa158015610274573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102989190610b12565b610652565b9392505050565b6040518060400160405280600c81526020017f546f6b656e5370656e646572000000000000000000000000000000000000000081525081565b3330146102f5576102f56102f033610668565b610720565b60006102ff61063f565b5460405173ffffffffffffffffffffffffffffffffffffffff909116915060009060609083907fbca8c7b5000000000000000000000000000000000000000000000000000000009089907f23b872dd000000000000000000000000000000000000000000000000000000009061037d908b908b908b90602401610c2a565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090941693909317909252905161040a929190602401610c5b565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009094169390931790925290516104939190610b74565b6000604051808303816000865af19150503d80600081146104d0576040519150601f19603f3d011682016040523d82523d6000602084013e6104d5565b606091505b509150915081156104f757808060200190518101906104f491906109b5565b90505b81158061050a575061050881610728565b155b1561051f5761051f6102f0888888888661076d565b50505050505050565b60008161053361063f565b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905561059f7ff7c3a33b00000000000000000000000000000000000000000000000000000000610831565b6105c87f89dd02e700000000000000000000000000000000000000000000000000000000610831565b6105f17f496f471e00000000000000000000000000000000000000000000000000000000610831565b507f2c64c5ef000000000000000000000000000000000000000000000000000000005b919050565b600061062361063f565b5473ffffffffffffffffffffffffffffffffffffffff16905090565b60008061064c60036108c4565b92915050565b6000818310610661578161029d565b5090919050565b60607ff0ec779b0bcda6d84abf99ee2c67647d1100ebbb553a9c2d1c2ba1579592832c8260405160240161069c9190610b90565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b805160208201fd5b600081516000141561073c57506001610614565b60208251106106145760006107528360006108df565b90508060011415610767576001915050610614565b50919050565b60607fdfdc6f57cf82bede92bcfdd44fedb82b2d5cecabf56ec21964db6ee2c3e82cf486868686866040516024016107a9959493929190610bd8565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905095945050505050565b6040517f6eb224cb0000000000000000000000000000000000000000000000000000000081523090636eb224cb9061088f9084907f000000000000000000000000000000000000000000000000000000000000000090600401610cbf565b600060405180830381600087803b1580156108a957600080fd5b505af11580156108bd573d6000803e3d6000fd5b5050505050565b600060808260078111156108d457fe5b600101901b92915050565b600061029d838360008160200183511015610907576109076102f06005855185602001610910565b50016020015190565b6060632800659560e01b84848460405160240161092f93929190610d07565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b6000602082840312156109c6578081fd5b815167ffffffffffffffff808211156109dd578283fd5b818401915084601f8301126109f0578283fd5b8151818111156109fe578384fd5b60405160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401168201018181108482111715610a3c578586fd5b604052818152838201602001871015610a53578485fd5b610a64826020830160208701610d45565b9695505050505050565b600060208284031215610a7f578081fd5b813561029d81610d75565b60008060408385031215610a9c578081fd5b8235610aa781610d75565b91506020830135610ab781610d75565b809150509250929050565b60008060008060808587031215610ad7578182fd5b8435610ae281610d75565b93506020850135610af281610d75565b92506040850135610b0281610d75565b9396929550929360600135925050565b600060208284031215610b23578081fd5b5051919050565b60008151808452610b42816020860160208601610d45565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251610b86818460208701610d45565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8088168352808716602084015280861660408401525083606083015260a06080830152610c1f60a0830184610b2a565b979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff8416825260406020830152610c8a6040830184610b2a565b949350505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b6060810160088510610d1557fe5b938152602081019290925260409091015290565b60006020825261029d6020830184610b2a565b90815260200190565b60005b83811015610d60578181015183820152602001610d48565b83811115610d6f576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610d9757600080fd5b5056fea264697066735822122079af49d5f20054e773ecf811fa9d46dcdfe73b9605db4afd5063663716b39ddf64736f6c634300060c0033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x72 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x89DD02E7 GT PUSH2 0x50 JUMPI DUP1 PUSH4 0x89DD02E7 EQ PUSH2 0xBD JUMPI DUP1 PUSH4 0xCE5494BB EQ PUSH2 0xD2 JUMPI DUP1 PUSH4 0xF7C3A33B EQ PUSH2 0xF2 JUMPI PUSH2 0x72 JUMP JUMPDEST DUP1 PUSH4 0x31B905C EQ PUSH2 0x77 JUMPI DUP1 PUSH4 0x496F471E EQ PUSH2 0x95 JUMPI DUP1 PUSH4 0x6AE4B4F7 EQ PUSH2 0xA8 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x7F PUSH2 0x107 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xD3C JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x7F PUSH2 0xA3 CALLDATASIZE PUSH1 0x4 PUSH2 0xA8A JUMP JUMPDEST PUSH2 0x12B JUMP JUMPDEST PUSH2 0xB0 PUSH2 0x2A4 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xD29 JUMP JUMPDEST PUSH2 0xD0 PUSH2 0xCB CALLDATASIZE PUSH1 0x4 PUSH2 0xAC2 JUMP JUMPDEST PUSH2 0x2DD JUMP JUMPDEST STOP JUMPDEST PUSH2 0xE5 PUSH2 0xE0 CALLDATASIZE PUSH1 0x4 PUSH2 0xA6E JUMP JUMPDEST PUSH2 0x528 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xC92 JUMP JUMPDEST PUSH2 0xFA PUSH2 0x619 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x8C SWAP2 SWAP1 PUSH2 0xB90 JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x29D DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0xDD62ED3E DUP5 PUSH2 0x155 PUSH2 0x63F JUMP JUMPDEST SLOAD PUSH1 0x40 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 PUSH1 0xE0 DUP6 SWAP1 SHL AND DUP2 MSTORE PUSH2 0x1A6 SWAP3 SWAP2 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 PUSH1 0x4 ADD PUSH2 0xBB1 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1BE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x1D2 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x1F6 SWAP2 SWAP1 PUSH2 0xB12 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x70A0823100000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP7 AND SWAP1 PUSH4 0x70A08231 SWAP1 PUSH2 0x248 SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0xB90 JUMP JUMPDEST PUSH1 0x20 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP7 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x260 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS STATICCALL ISZERO DUP1 ISZERO PUSH2 0x274 JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP PUSH1 0x40 MLOAD RETURNDATASIZE PUSH1 0x1F NOT PUSH1 0x1F DUP3 ADD AND DUP3 ADD DUP1 PUSH1 0x40 MSTORE POP DUP2 ADD SWAP1 PUSH2 0x298 SWAP2 SWAP1 PUSH2 0xB12 JUMP JUMPDEST PUSH2 0x652 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 PUSH1 0x40 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0xC DUP2 MSTORE PUSH1 0x20 ADD PUSH32 0x546F6B656E5370656E6465720000000000000000000000000000000000000000 DUP2 MSTORE POP DUP2 JUMP JUMPDEST CALLER ADDRESS EQ PUSH2 0x2F5 JUMPI PUSH2 0x2F5 PUSH2 0x2F0 CALLER PUSH2 0x668 JUMP JUMPDEST PUSH2 0x720 JUMP JUMPDEST PUSH1 0x0 PUSH2 0x2FF PUSH2 0x63F JUMP JUMPDEST SLOAD PUSH1 0x40 MLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP1 SWAP2 AND SWAP2 POP PUSH1 0x0 SWAP1 PUSH1 0x60 SWAP1 DUP4 SWAP1 PUSH32 0xBCA8C7B500000000000000000000000000000000000000000000000000000000 SWAP1 DUP10 SWAP1 PUSH32 0x23B872DD00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x37D SWAP1 DUP12 SWAP1 DUP12 SWAP1 DUP12 SWAP1 PUSH1 0x24 ADD PUSH2 0xC2A JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE SWAP1 MLOAD PUSH2 0x40A SWAP3 SWAP2 SWAP1 PUSH1 0x24 ADD PUSH2 0xC5B JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 DUP2 MSTORE PUSH1 0x20 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP5 AND SWAP4 SWAP1 SWAP4 OR SWAP1 SWAP3 MSTORE SWAP1 MLOAD PUSH2 0x493 SWAP2 SWAP1 PUSH2 0xB74 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP7 GAS CALL SWAP2 POP POP RETURNDATASIZE DUP1 PUSH1 0x0 DUP2 EQ PUSH2 0x4D0 JUMPI PUSH1 0x40 MLOAD SWAP2 POP PUSH1 0x1F NOT PUSH1 0x3F RETURNDATASIZE ADD AND DUP3 ADD PUSH1 0x40 MSTORE RETURNDATASIZE DUP3 MSTORE RETURNDATASIZE PUSH1 0x0 PUSH1 0x20 DUP5 ADD RETURNDATACOPY PUSH2 0x4D5 JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP2 POP SWAP2 POP DUP2 ISZERO PUSH2 0x4F7 JUMPI DUP1 DUP1 PUSH1 0x20 ADD SWAP1 MLOAD DUP2 ADD SWAP1 PUSH2 0x4F4 SWAP2 SWAP1 PUSH2 0x9B5 JUMP JUMPDEST SWAP1 POP JUMPDEST DUP2 ISZERO DUP1 PUSH2 0x50A JUMPI POP PUSH2 0x508 DUP2 PUSH2 0x728 JUMP JUMPDEST ISZERO JUMPDEST ISZERO PUSH2 0x51F JUMPI PUSH2 0x51F PUSH2 0x2F0 DUP9 DUP9 DUP9 DUP9 DUP7 PUSH2 0x76D JUMP JUMPDEST POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 PUSH2 0x533 PUSH2 0x63F JUMP JUMPDEST DUP1 SLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000 AND PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 SWAP1 SWAP3 AND SWAP2 SWAP1 SWAP2 OR SWAP1 SSTORE PUSH2 0x59F PUSH32 0xF7C3A33B00000000000000000000000000000000000000000000000000000000 PUSH2 0x831 JUMP JUMPDEST PUSH2 0x5C8 PUSH32 0x89DD02E700000000000000000000000000000000000000000000000000000000 PUSH2 0x831 JUMP JUMPDEST PUSH2 0x5F1 PUSH32 0x496F471E00000000000000000000000000000000000000000000000000000000 PUSH2 0x831 JUMP JUMPDEST POP PUSH32 0x2C64C5EF00000000000000000000000000000000000000000000000000000000 JUMPDEST SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x623 PUSH2 0x63F JUMP JUMPDEST SLOAD PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SWAP1 POP SWAP1 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH2 0x64C PUSH1 0x3 PUSH2 0x8C4 JUMP JUMPDEST SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP2 DUP4 LT PUSH2 0x661 JUMPI DUP2 PUSH2 0x29D JUMP JUMPDEST POP SWAP1 SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH32 0xF0EC779B0BCDA6D84ABF99EE2C67647D1100EBBB553A9C2D1C2BA1579592832C DUP3 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x69C SWAP2 SWAP1 PUSH2 0xB90 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 POP SWAP2 SWAP1 POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP3 ADD REVERT JUMPDEST PUSH1 0x0 DUP2 MLOAD PUSH1 0x0 EQ ISZERO PUSH2 0x73C JUMPI POP PUSH1 0x1 PUSH2 0x614 JUMP JUMPDEST PUSH1 0x20 DUP3 MLOAD LT PUSH2 0x614 JUMPI PUSH1 0x0 PUSH2 0x752 DUP4 PUSH1 0x0 PUSH2 0x8DF JUMP JUMPDEST SWAP1 POP DUP1 PUSH1 0x1 EQ ISZERO PUSH2 0x767 JUMPI PUSH1 0x1 SWAP2 POP POP PUSH2 0x614 JUMP JUMPDEST POP SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x60 PUSH32 0xDFDC6F57CF82BEDE92BCFDD44FEDB82B2D5CECABF56EC21964DB6EE2C3E82CF4 DUP7 DUP7 DUP7 DUP7 DUP7 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x7A9 SWAP6 SWAP5 SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0xBD8 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 POP SWAP6 SWAP5 POP POP POP POP POP JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x6EB224CB00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP1 PUSH4 0x6EB224CB SWAP1 PUSH2 0x88F SWAP1 DUP5 SWAP1 PUSH32 0x0 SWAP1 PUSH1 0x4 ADD PUSH2 0xCBF JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x8A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x8BD JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x80 DUP3 PUSH1 0x7 DUP2 GT ISZERO PUSH2 0x8D4 JUMPI INVALID JUMPDEST PUSH1 0x1 ADD SWAP1 SHL SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH2 0x29D DUP4 DUP4 PUSH1 0x0 DUP2 PUSH1 0x20 ADD DUP4 MLOAD LT ISZERO PUSH2 0x907 JUMPI PUSH2 0x907 PUSH2 0x2F0 PUSH1 0x5 DUP6 MLOAD DUP6 PUSH1 0x20 ADD PUSH2 0x910 JUMP JUMPDEST POP ADD PUSH1 0x20 ADD MLOAD SWAP1 JUMP JUMPDEST PUSH1 0x60 PUSH4 0x28006595 PUSH1 0xE0 SHL DUP5 DUP5 DUP5 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x92F SWAP4 SWAP3 SWAP2 SWAP1 PUSH2 0xD07 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 DUP2 DUP5 SUB ADD DUP2 MSTORE SWAP2 SWAP1 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP1 SWAP4 AND SWAP3 SWAP1 SWAP3 OR SWAP1 SWAP2 MSTORE SWAP1 POP SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x9C6 JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 MLOAD PUSH8 0xFFFFFFFFFFFFFFFF DUP1 DUP3 GT ISZERO PUSH2 0x9DD JUMPI DUP3 DUP4 REVERT JUMPDEST DUP2 DUP5 ADD SWAP2 POP DUP5 PUSH1 0x1F DUP4 ADD SLT PUSH2 0x9F0 JUMPI DUP3 DUP4 REVERT JUMPDEST DUP2 MLOAD DUP2 DUP2 GT ISZERO PUSH2 0x9FE JUMPI DUP4 DUP5 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x20 PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 PUSH1 0x1F DUP5 ADD AND DUP3 ADD ADD DUP2 DUP2 LT DUP5 DUP3 GT OR ISZERO PUSH2 0xA3C JUMPI DUP6 DUP7 REVERT JUMPDEST PUSH1 0x40 MSTORE DUP2 DUP2 MSTORE DUP4 DUP3 ADD PUSH1 0x20 ADD DUP8 LT ISZERO PUSH2 0xA53 JUMPI DUP5 DUP6 REVERT JUMPDEST PUSH2 0xA64 DUP3 PUSH1 0x20 DUP4 ADD PUSH1 0x20 DUP8 ADD PUSH2 0xD45 JUMP JUMPDEST SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xA7F JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x29D DUP2 PUSH2 0xD75 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x40 DUP4 DUP6 SUB SLT ISZERO PUSH2 0xA9C JUMPI DUP1 DUP2 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH2 0xAA7 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP2 POP PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH2 0xAB7 DUP2 PUSH2 0xD75 JUMP JUMPDEST DUP1 SWAP2 POP POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 DUP1 PUSH1 0x80 DUP6 DUP8 SUB SLT ISZERO PUSH2 0xAD7 JUMPI DUP2 DUP3 REVERT JUMPDEST DUP5 CALLDATALOAD PUSH2 0xAE2 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP4 POP PUSH1 0x20 DUP6 ADD CALLDATALOAD PUSH2 0xAF2 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP3 POP PUSH1 0x40 DUP6 ADD CALLDATALOAD PUSH2 0xB02 DUP2 PUSH2 0xD75 JUMP JUMPDEST SWAP4 SWAP7 SWAP3 SWAP6 POP SWAP3 SWAP4 PUSH1 0x60 ADD CALLDATALOAD SWAP3 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0xB23 JUMPI DUP1 DUP2 REVERT JUMPDEST POP MLOAD SWAP2 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 DUP2 MLOAD DUP1 DUP5 MSTORE PUSH2 0xB42 DUP2 PUSH1 0x20 DUP7 ADD PUSH1 0x20 DUP7 ADD PUSH2 0xD45 JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP3 SWAP1 SWAP3 ADD PUSH1 0x20 ADD SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 DUP3 MLOAD PUSH2 0xB86 DUP2 DUP5 PUSH1 0x20 DUP8 ADD PUSH2 0xD45 JUMP JUMPDEST SWAP2 SWAP1 SWAP2 ADD SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP2 SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP3 DUP4 AND DUP2 MSTORE SWAP2 AND PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP1 DUP9 AND DUP4 MSTORE DUP1 DUP8 AND PUSH1 0x20 DUP5 ADD MSTORE DUP1 DUP7 AND PUSH1 0x40 DUP5 ADD MSTORE POP DUP4 PUSH1 0x60 DUP4 ADD MSTORE PUSH1 0xA0 PUSH1 0x80 DUP4 ADD MSTORE PUSH2 0xC1F PUSH1 0xA0 DUP4 ADD DUP5 PUSH2 0xB2A JUMP JUMPDEST SWAP8 SWAP7 POP POP POP POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF SWAP4 DUP5 AND DUP2 MSTORE SWAP2 SWAP1 SWAP3 AND PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 DUP2 ADD SWAP2 SWAP1 SWAP2 MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND DUP3 MSTORE PUSH1 0x40 PUSH1 0x20 DUP4 ADD MSTORE PUSH2 0xC8A PUSH1 0x40 DUP4 ADD DUP5 PUSH2 0xB2A JUMP JUMPDEST SWAP5 SWAP4 POP POP POP POP JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP2 SWAP1 SWAP2 AND DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 SWAP3 SWAP1 SWAP3 AND DUP3 MSTORE PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH1 0x20 DUP3 ADD MSTORE PUSH1 0x40 ADD SWAP1 JUMP JUMPDEST PUSH1 0x60 DUP2 ADD PUSH1 0x8 DUP6 LT PUSH2 0xD15 JUMPI INVALID JUMPDEST SWAP4 DUP2 MSTORE PUSH1 0x20 DUP2 ADD SWAP3 SWAP1 SWAP3 MSTORE PUSH1 0x40 SWAP1 SWAP2 ADD MSTORE SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 MSTORE PUSH2 0x29D PUSH1 0x20 DUP4 ADD DUP5 PUSH2 0xB2A JUMP JUMPDEST SWAP1 DUP2 MSTORE PUSH1 0x20 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0xD60 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0xD48 JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0xD6F JUMPI PUSH1 0x0 DUP5 DUP5 ADD MSTORE JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND DUP2 EQ PUSH2 0xD97 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 PUSH26 0xAF49D5F20054E773ECF811FA9D46DCDFE73B9605DB4AFD506366 CALLDATACOPY AND 0xB3 SWAP14 0xDF PUSH5 0x736F6C6343 STOP MOD 0xC STOP CALLER ",
"sourceMap": "1310:3561:4:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1567:75;;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;4210:346;;;;;;:::i;:::-;;:::i;1462:61::-;;;:::i;:::-;;;;;;;:::i;2749:1174::-;;;;;;:::i;:::-;;:::i;:::-;;2022:445;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;4671:198::-;;;:::i;:::-;;;;;;;:::i;1567:75::-;;;:::o;4210:346::-;4347:14;4384:165;4419:5;:15;;;4435:5;4450:35;:33;:35::i;:::-;:51;4419:84;;;;;;;;;;;;;4450:51;;;4419:84;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4517:22;;;;;:15;;;;;;:22;;4533:5;;4517:22;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;4384:21;:165::i;:::-;4377:172;4210:346;-1:-1:-1;;;4210:346:4:o;1462:61::-;;;;;;;;;;;;;;;;;;;:::o;2749:1174::-;1272:10:9;1294:4;1272:27;1268:123;;1315:65;:55;1359:10;1315:43;:55::i;:::-;:63;:65::i;:::-;2944:24:4::1;2971:35;:33;:35::i;:::-;:51:::0;3311:177:::1;::::0;2971:51:::1;::::0;;::::1;::::0;-1:-1:-1;2971:51:4::1;::::0;3122:23:::1;::::0;2971:51;;3224:37;;3287:5;;3355:36;;3311:177:::1;::::0;3413:5;;3440:2;;3464:6;;3311:177:::1;;;:::i;:::-;;::::0;;;;;::::1;::::0;;;;;;::::1;::::0;::::1;::::0;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;;3184:318;;::::1;::::0;;3311:177;3184:318:::1;;;:::i;:::-;;::::0;;;;;::::1;::::0;;;;;;::::1;::::0;::::1;::::0;;::::1;;::::0;;;::::1;::::0;;;::::1;::::0;;;3149:363;;::::1;::::0;3184:318;3149:363:::1;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3104:408;;;;3526:10;3522:85;;;3576:10;3565:31;;;;;;;;;;;;:::i;:::-;3552:44;;3522:85;3621:10;3620:11;:63;;;;3636:47;3672:10;3636:35;:47::i;:::-;3635:48;3620:63;3616:301;;;3699:207;:197;3781:5;3805;3828:2;3848:6;3872:10;3699:56;:197::i;:207::-;1400:1:9;;;2749:1174:4::0;;;;:::o;2022:445::-;2107:14;2191:15;2137:35;:33;:35::i;:::-;:69;;;;;;;;;;;;;;;2216:58;2241:32;2216:24;:58::i;:::-;2284:57;2309:31;2284:24;:57::i;:::-;2351:66;2376:40;2351:24;:66::i;:::-;-1:-1:-1;2434:26:4;2022:445;;;;:::o;4671:198::-;4765:14;4810:35;:33;:35::i;:::-;:51;;;;-1:-1:-1;4671:198:4;:::o;1054:473:12:-;1099:20;1131:19;1153:82;1192:33;1153:25;:82::i;:::-;1131:104;1493:28;-1:-1:-1;;1493:28:12:o;2544:135:16:-;2629:7;2663:1;2659;:5;:13;;2671:1;2659:13;;;-1:-1:-1;2667:1:16;;2544:135;-1:-1:-1;2544:135:16:o;724:257:0:-;820:12;898:45;958:6;855:119;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;724:257:0;;;:::o;1531:170:18:-;1674:9;1668:16;1661:4;1650:9;1646:20;1639:46;6237:395:14;6337:17;6374:10;:17;6395:1;6374:22;6370:64;;;-1:-1:-1;6419:4:14;6412:11;;6370:64;6468:2;6447:10;:17;:23;6443:183;;6486:14;6503:38;6527:10;6539:1;6503:23;:38::i;:::-;6486:55;;6559:6;6569:1;6559:11;6555:61;;;6597:4;6590:11;;;;;6555:61;6443:183;6237:395;;;:::o;725:500:2:-;945:12;1023:87;1125:5;1144;1163:2;1179:6;1199:9;980:238;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;725:500:2;;;;;;;:::o;2201:168:9:-;2283:79;;;;;2322:4;;2283:52;;:79;;2336:8;;2346:15;;2283:79;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2201:168;:::o;1606:335:11:-;1698:12;922:3;1899:9;1891:18;;;;;;;;1912:1;1891:22;1890:44;;;1606:335;-1:-1:-1;;1606:335:11:o;16122:220:15:-;16243:14;16290:21;16302:1;16305:5;14422:14;14467:5;14475:2;14467:10;14456:1;:8;:21;14452:306;;;14493:254;14518:228;14583:95;14696:1;:8;14722:5;14730:2;14722:10;14518:47;:228::i;14493:254::-;-1:-1:-1;14936:13:15;14838:2;14936:13;14930:20;;14301:688::o;1334:378:17:-;1522:12;1274:10;1593:37;;1644:9;1667:6;1687:8;1557:148;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1334:378:17;;;;;:::o;1237:360:-1:-;;1361:2;1349:9;1340:7;1336:23;1332:32;1329:2;;;-1:-1;;1367:12;1329:2;1418:17;1412:24;1456:18;;1448:6;1445:30;1442:2;;;-1:-1;;1478:12;1442:2;1564:6;1553:9;1549:22;;;255:3;248:4;240:6;236:17;232:27;222:2;;-1:-1;;263:12;222:2;303:6;297:13;1456:18;9381:6;9378:30;9375:2;;;-1:-1;;9411:12;9375:2;9045;9039:9;1361:2;9484:9;248:4;9469:6;9465:17;9461:33;9075:6;9071:17;;9182:6;9170:10;9167:22;1456:18;9134:10;9131:34;9128:62;9125:2;;;-1:-1;;9193:12;9125:2;9045;9212:22;395:21;;;495:16;;;1361:2;495:16;492:25;-1:-1;489:2;;;-1:-1;;520:12;489:2;540:39;572:6;1361:2;471:5;467:16;1361:2;437:6;433:17;540:39;:::i;:::-;1498:83;1323:274;-1:-1;;;;;;1323:274::o;1604:289::-;;1732:2;1720:9;1711:7;1707:23;1703:32;1700:2;;;-1:-1;;1738:12;1700:2;697:6;684:20;709:57;760:5;709:57;:::i;1900:410::-;;;2043:2;2031:9;2022:7;2018:23;2014:32;2011:2;;;-1:-1;;2049:12;2011:2;880:6;867:20;892:55;941:5;892:55;:::i;:::-;2101:85;-1:-1;2223:2;2262:22;;72:20;97:33;72:20;97:33;:::i;:::-;2231:63;;;;2005:305;;;;;:::o;2317:661::-;;;;;2494:3;2482:9;2473:7;2469:23;2465:33;2462:2;;;-1:-1;;2501:12;2462:2;880:6;867:20;892:55;941:5;892:55;:::i;:::-;2553:85;-1:-1;2675:2;2714:22;;72:20;97:33;72:20;97:33;:::i;:::-;2683:63;-1:-1;2783:2;2822:22;;72:20;97:33;72:20;97:33;:::i;:::-;2456:522;;;;-1:-1;2791:63;;2891:2;2930:22;1026:20;;-1:-1;;2456:522::o;2985:263::-;;3100:2;3088:9;3079:7;3075:23;3071:32;3068:2;;;-1:-1;;3106:12;3068:2;-1:-1;1174:13;;3062:186;-1:-1;3062:186::o;3492:343::-;;3634:5;9661:12;9946:6;9941:3;9934:19;3727:52;3772:6;9983:4;9978:3;9974:14;9983:4;3753:5;3749:16;3727:52;:::i;:::-;11756:2;11736:14;11752:7;11732:28;3791:39;;;;9983:4;3791:39;;3582:253;-1:-1;;3582:253::o;4878:271::-;;4002:5;9661:12;4113:52;4158:6;4153:3;4146:4;4139:5;4135:16;4113:52;:::i;:::-;4177:16;;;;;5012:137;-1:-1;;5012:137::o;5156:222::-;11074:42;11063:54;;;;3326:37;;5283:2;5268:18;;5254:124::o;5385:333::-;11074:42;11063:54;;;3326:37;;11063:54;;5704:2;5689:18;;3326:37;5540:2;5525:18;;5511:207::o;5725:752::-;;11074:42;;3356:5;11063:54;3333:3;3326:37;11074:42;3356:5;11063:54;6147:2;6136:9;6132:18;3326:37;11074:42;3356:5;11063:54;6230:2;6219:9;6215:18;3326:37;;4859:5;6313:2;6302:9;6298:18;4829:37;5982:3;6350;6339:9;6335:19;6328:49;6391:76;5982:3;5971:9;5967:19;6453:6;6391:76;:::i;:::-;6383:84;5953:524;-1:-1;;;;;;;5953:524::o;6484:444::-;11074:42;11063:54;;;3326:37;;11063:54;;;;6831:2;6816:18;;3326:37;6914:2;6899:18;;4829:37;;;;6667:2;6652:18;;6638:290::o;6935:417::-;;11074:42;11067:5;11063:54;3333:3;3326:37;7108:2;7226;7215:9;7211:18;7204:48;7266:76;7108:2;7097:9;7093:18;7328:6;7266:76;:::i;:::-;7258:84;7079:273;-1:-1;;;;7079:273::o;7359:218::-;10497:66;10486:78;;;;3444:36;;7484:2;7469:18;;7455:122::o;7584:329::-;10497:66;10486:78;;;;3444:36;;11074:42;11063:54;7899:2;7884:18;;3326:37;7737:2;7722:18;;7708:205::o;7920:510::-;8136:2;8121:18;;11877:1;11867:12;;11857:2;;11883:9;11857:2;4309:83;;;8333:2;8318:18;;4829:37;;;;8416:2;8401:18;;;4829:37;8107:323;:::o;8437:310::-;;8584:2;8605:17;8598:47;8659:78;8584:2;8573:9;8569:18;8723:6;8659:78;:::i;8754:222::-;4829:37;;;8881:2;8866:18;;8852:124::o;11392:268::-;11457:1;11464:101;11478:6;11475:1;11472:13;11464:101;;;11545:11;;;11539:18;11526:11;;;11519:39;11500:2;11493:10;11464:101;;;11580:6;11577:1;11574:13;11571:2;;;11457:1;11636:6;11631:3;11627:16;11620:27;11571:2;;11441:219;;;:::o;11906:117::-;11074:42;11993:5;11063:54;11968:5;11965:35;11955:2;;12014:1;;12004:12;11955:2;11949:74;:::o"
},
"methodIdentifiers": {
"FEATURE_NAME()": "6ae4b4f7",
"FEATURE_VERSION()": "031b905c",
"_spendERC20Tokens(address,address,address,uint256)": "89dd02e7",
"getAllowanceTarget()": "f7c3a33b",
"getSpendableERC20BalanceOf(address,address)": "496f471e",
"migrate(address)": "ce5494bb"
}
}
},
"sourceTreeHashHex": "0x3b706958b5b68983b2af444d21d56f9c9ae0c92e4ea6824ebb81e7f7ac768a0c",
"sources": {
"./TokenSpenderFeature.sol": {
"id": 4,
"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 \"@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol\";\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol\";\nimport \"../errors/LibSpenderRichErrors.sol\";\nimport \"../fixins/FixinCommon.sol\";\nimport \"../migrations/LibMigrate.sol\";\nimport \"../external/IAllowanceTarget.sol\";\nimport \"../storage/LibTokenSpenderStorage.sol\";\nimport \"./interfaces/IFeature.sol\";\nimport \"./interfaces/ITokenSpenderFeature.sol\";\n\n\n/// @dev Feature that allows spending token allowances.\ncontract TokenSpenderFeature is\n IFeature,\n ITokenSpenderFeature,\n FixinCommon\n{\n // solhint-disable\n /// @dev Name of this feature.\n string public constant override FEATURE_NAME = \"TokenSpender\";\n /// @dev Version of this feature.\n uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);\n // solhint-enable\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Initialize and register this feature. Should be delegatecalled\n /// into during a `Migrate.migrate()`.\n /// @param allowanceTarget An `allowanceTarget` instance, configured to have\n /// the ZeroeEx contract as an authority.\n /// @return success `MIGRATE_SUCCESS` on success.\n function migrate(IAllowanceTarget allowanceTarget)\n external\n returns (bytes4 success)\n {\n LibTokenSpenderStorage.getStorage().allowanceTarget = allowanceTarget;\n _registerFeatureFunction(this.getAllowanceTarget.selector);\n _registerFeatureFunction(this._spendERC20Tokens.selector);\n _registerFeatureFunction(this.getSpendableERC20BalanceOf.selector);\n return LibMigrate.MIGRATE_SUCCESS;\n }\n\n /// @dev Transfers ERC20 tokens from `owner` to `to`. 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 override\n onlySelf\n {\n IAllowanceTarget spender = LibTokenSpenderStorage.getStorage().allowanceTarget;\n // Have the allowance target execute an ERC20 `transferFrom()`.\n (bool didSucceed, bytes memory resultData) = address(spender).call(\n abi.encodeWithSelector(\n IAllowanceTarget.executeCall.selector,\n address(token),\n abi.encodeWithSelector(\n IERC20TokenV06.transferFrom.selector,\n owner,\n to,\n amount\n )\n )\n );\n if (didSucceed) {\n resultData = abi.decode(resultData, (bytes));\n }\n if (!didSucceed || !LibERC20TokenV06.isSuccessfulResult(resultData)) {\n LibSpenderRichErrors.SpenderERC20TransferFromFailedError(\n address(token),\n owner,\n to,\n amount,\n resultData\n ).rrevert();\n }\n }\n\n /// @dev Gets the maximum amount of an ERC20 token `token` that can be\n /// pulled from `owner` by the token spender.\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 override\n view\n returns (uint256 amount)\n {\n return LibSafeMathV06.min256(\n token.allowance(owner, address(LibTokenSpenderStorage.getStorage().allowanceTarget)),\n token.balanceOf(owner)\n );\n }\n\n /// @dev Get the address of the allowance target.\n /// @return target The target of token allowances.\n function getAllowanceTarget()\n external\n override\n view\n returns (address target)\n {\n return address(LibTokenSpenderStorage.getStorage().allowanceTarget);\n }\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.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\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"
},
"@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.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;\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": 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\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"
},
"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.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;\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"
},
"@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.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;\n\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol\";\nimport \"./IERC20TokenV06.sol\";\n\n\nlibrary LibERC20TokenV06 {\n bytes constant private DECIMALS_CALL_DATA = hex\"313ce567\";\n\n /// @dev Calls `IERC20TokenV06(token).approve()`.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param spender The address that receives an allowance.\n /// @param allowance The allowance to set.\n function compatApprove(\n IERC20TokenV06 token,\n address spender,\n uint256 allowance\n )\n internal\n {\n bytes memory callData = abi.encodeWithSelector(\n token.approve.selector,\n spender,\n allowance\n );\n _callWithOptionalBooleanResult(address(token), callData);\n }\n\n /// @dev Calls `IERC20TokenV06(token).approve()` and sets the allowance to the\n /// maximum if the current approval is not already >= an amount.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param spender The address that receives an allowance.\n /// @param amount The minimum allowance needed.\n function approveIfBelow(\n IERC20TokenV06 token,\n address spender,\n uint256 amount\n )\n internal\n {\n if (token.allowance(address(this), spender) < amount) {\n compatApprove(token, spender, uint256(-1));\n }\n }\n\n /// @dev Calls `IERC20TokenV06(token).transfer()`.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param to The address that receives the tokens\n /// @param amount Number of tokens to transfer.\n function compatTransfer(\n IERC20TokenV06 token,\n address to,\n uint256 amount\n )\n internal\n {\n bytes memory callData = abi.encodeWithSelector(\n token.transfer.selector,\n to,\n amount\n );\n _callWithOptionalBooleanResult(address(token), callData);\n }\n\n /// @dev Calls `IERC20TokenV06(token).transferFrom()`.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param from The owner of the tokens.\n /// @param to The address that receives the tokens\n /// @param amount Number of tokens to transfer.\n function compatTransferFrom(\n IERC20TokenV06 token,\n address from,\n address to,\n uint256 amount\n )\n internal\n {\n bytes memory callData = abi.encodeWithSelector(\n token.transferFrom.selector,\n from,\n to,\n amount\n );\n _callWithOptionalBooleanResult(address(token), callData);\n }\n\n /// @dev Retrieves the number of decimals for a token.\n /// Returns `18` if the call reverts.\n /// @param token The address of the token contract.\n /// @return tokenDecimals The number of decimals places for the token.\n function compatDecimals(IERC20TokenV06 token)\n internal\n view\n returns (uint8 tokenDecimals)\n {\n tokenDecimals = 18;\n (bool didSucceed, bytes memory resultData) = address(token).staticcall(DECIMALS_CALL_DATA);\n if (didSucceed && resultData.length >= 32) {\n tokenDecimals = uint8(LibBytesV06.readUint256(resultData, 0));\n }\n }\n\n /// @dev Retrieves the allowance for a token, owner, and spender.\n /// Returns `0` if the call reverts.\n /// @param token The address of the token contract.\n /// @param owner The owner of the tokens.\n /// @param spender The address the spender.\n /// @return allowance_ The allowance for a token, owner, and spender.\n function compatAllowance(IERC20TokenV06 token, address owner, address spender)\n internal\n view\n returns (uint256 allowance_)\n {\n (bool didSucceed, bytes memory resultData) = address(token).staticcall(\n abi.encodeWithSelector(\n token.allowance.selector,\n owner,\n spender\n )\n );\n if (didSucceed && resultData.length >= 32) {\n allowance_ = LibBytesV06.readUint256(resultData, 0);\n }\n }\n\n /// @dev Retrieves the balance for a token owner.\n /// Returns `0` if the call reverts.\n /// @param token The address of the token contract.\n /// @param owner The owner of the tokens.\n /// @return balance The token balance of an owner.\n function compatBalanceOf(IERC20TokenV06 token, address owner)\n internal\n view\n returns (uint256 balance)\n {\n (bool didSucceed, bytes memory resultData) = address(token).staticcall(\n abi.encodeWithSelector(\n token.balanceOf.selector,\n owner\n )\n );\n if (didSucceed && resultData.length >= 32) {\n balance = LibBytesV06.readUint256(resultData, 0);\n }\n }\n\n /// @dev Check if the data returned by a non-static call to an ERC20 token\n /// is a successful result. Supported functions are `transfer()`,\n /// `transferFrom()`, and `approve()`.\n /// @param resultData The raw data returned by a non-static call to the ERC20 token.\n /// @return isSuccessful Whether the result data indicates success.\n function isSuccessfulResult(bytes memory resultData)\n internal\n pure\n returns (bool isSuccessful)\n {\n if (resultData.length == 0) {\n return true;\n }\n if (resultData.length >= 32) {\n uint256 result = LibBytesV06.readUint256(resultData, 0);\n if (result == 1) {\n return true;\n }\n }\n }\n\n /// @dev Executes a call on address `target` with calldata `callData`\n /// and asserts that either nothing was returned or a single boolean\n /// was returned equal to `true`.\n /// @param target The call target.\n /// @param callData The abi-encoded call data.\n function _callWithOptionalBooleanResult(\n address target,\n bytes memory callData\n )\n private\n {\n (bool didSucceed, bytes memory resultData) = target.call(callData);\n if (didSucceed && isSuccessfulResult(resultData)) {\n return;\n }\n LibRichErrorsV06.rrevert(resultData);\n }\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/LibBytesV06.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;\n\nimport \"./errors/LibBytesRichErrorsV06.sol\";\nimport \"./errors/LibRichErrorsV06.sol\";\n\n\nlibrary LibBytesV06 {\n\n using LibBytesV06 for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n\n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n\n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n\n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Ensure that the from and to positions are valid positions for a slice within\n // the byte array that is being used.\n if (from > to) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,\n from,\n to\n ));\n }\n if (to > b.length) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,\n to,\n b.length\n ));\n }\n\n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n\n /// @dev Returns a slice from a byte array without preserving the input.\n /// When `from == 0`, the original array will match the slice.\n /// In other cases its state will be corrupted.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Ensure that the from and to positions are valid positions for a slice within\n // the byte array that is being used.\n if (from > to) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,\n from,\n to\n ));\n }\n if (to > b.length) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,\n to,\n b.length\n ));\n }\n\n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return result The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n if (b.length == 0) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanZeroRequired,\n b.length,\n 0\n ));\n }\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return equal True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return result address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n if (b.length < index + 20) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,\n b.length,\n index + 20 // 20 is length of address\n ));\n }\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n if (b.length < index + 20) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,\n b.length,\n index + 20 // 20 is length of address\n ));\n }\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n\n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return result bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n if (b.length < index + 32) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,\n b.length,\n index + 32\n ));\n }\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n if (b.length < index + 32) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,\n b.length,\n index + 32\n ));\n }\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return result uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return result bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n if (b.length < index + 4) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsFourRequired,\n b.length,\n index + 4\n ));\n }\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Writes a new length to a byte array.\n /// Decreasing length will lead to removing the corresponding lower order bytes from the byte array.\n /// Increasing length may lead to appending adjacent in-memory bytes to the end of the byte array.\n /// @param b Bytes array to write new length to.\n /// @param length New length of byte array.\n function writeLength(bytes memory b, uint256 length)\n internal\n pure\n {\n assembly {\n mstore(b, length)\n }\n }\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/errors/LibBytesRichErrorsV06.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;\n\n\nlibrary LibBytesRichErrorsV06 {\n\n enum InvalidByteOperationErrorCodes {\n FromLessThanOrEqualsToRequired,\n ToLessThanOrEqualsLengthRequired,\n LengthGreaterThanZeroRequired,\n LengthGreaterThanOrEqualsFourRequired,\n LengthGreaterThanOrEqualsTwentyRequired,\n LengthGreaterThanOrEqualsThirtyTwoRequired,\n LengthGreaterThanOrEqualsNestedBytesLengthRequired,\n DestinationLengthGreaterThanOrEqualSourceLengthRequired\n }\n\n // bytes4(keccak256(\"InvalidByteOperationError(uint8,uint256,uint256)\"))\n bytes4 internal constant INVALID_BYTE_OPERATION_ERROR_SELECTOR =\n 0x28006595;\n\n // solhint-disable func-name-mixedcase\n function InvalidByteOperationError(\n InvalidByteOperationErrorCodes errorCode,\n uint256 offset,\n uint256 required\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n INVALID_BYTE_OPERATION_ERROR_SELECTOR,\n errorCode,\n offset,\n required\n );\n }\n}\n"
},
"../errors/LibSpenderRichErrors.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 LibSpenderRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function SpenderERC20TransferFromFailedError(\n address token,\n address owner,\n address to,\n uint256 amount,\n bytes memory errorData\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"SpenderERC20TransferFromFailedError(address,address,address,uint256,bytes)\")),\n token,\n owner,\n to,\n amount,\n errorData\n );\n }\n}\n"
},
"../fixins/FixinCommon.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-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"../errors/LibCommonRichErrors.sol\";\nimport \"../errors/LibOwnableRichErrors.sol\";\nimport \"../features/interfaces/IOwnableFeature.sol\";\nimport \"../features/interfaces/ISimpleFunctionRegistryFeature.sol\";\n\n\n/// @dev Common feature utilities.\nabstract contract FixinCommon {\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev The implementation address of this feature.\n address internal immutable _implementation;\n\n /// @dev The caller must be this contract.\n modifier onlySelf() virtual {\n if (msg.sender != address(this)) {\n LibCommonRichErrors.OnlyCallableBySelfError(msg.sender).rrevert();\n }\n _;\n }\n\n /// @dev The caller of this function must be the owner.\n modifier onlyOwner() virtual {\n {\n address owner = IOwnableFeature(address(this)).owner();\n if (msg.sender != owner) {\n LibOwnableRichErrors.OnlyOwnerError(\n msg.sender,\n owner\n ).rrevert();\n }\n }\n _;\n }\n\n constructor() internal {\n // Remember this feature's original address.\n _implementation = address(this);\n }\n\n /// @dev Registers a function implemented by this feature at `_implementation`.\n /// Can and should only be called within a `migrate()`.\n /// @param selector The selector of the function whose implementation\n /// is at `_implementation`.\n function _registerFeatureFunction(bytes4 selector)\n internal\n {\n ISimpleFunctionRegistryFeature(address(this)).extend(selector, _implementation);\n }\n\n /// @dev Encode a feature version as a `uint256`.\n /// @param major The major version number of the feature.\n /// @param minor The minor version number of the feature.\n /// @param revision The revision number of the feature.\n /// @return encodedVersion The encoded version number.\n function _encodeVersion(uint32 major, uint32 minor, uint32 revision)\n internal\n pure\n returns (uint256 encodedVersion)\n {\n return (uint256(major) << 64) | (uint256(minor) << 32) | uint256(revision);\n }\n}\n"
},
"../errors/LibCommonRichErrors.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;\n\n\nlibrary LibCommonRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function OnlyCallableBySelfError(address sender)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OnlyCallableBySelfError(address)\")),\n sender\n );\n }\n\n function IllegalReentrancyError(bytes4 selector, uint256 reentrancyFlags)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"IllegalReentrancyError(bytes4,uint256)\")),\n selector,\n reentrancyFlags\n );\n }\n}\n"
},
"../errors/LibOwnableRichErrors.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 LibOwnableRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function OnlyOwnerError(\n address sender,\n address owner\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OnlyOwnerError(address,address)\")),\n sender,\n owner\n );\n }\n\n function TransferOwnerToZeroError()\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"TransferOwnerToZeroError()\"))\n );\n }\n\n function MigrateCallFailedError(address target, bytes memory resultData)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"MigrateCallFailedError(address,bytes)\")),\n target,\n resultData\n );\n }\n}\n"
},
"./interfaces/IOwnableFeature.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-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": 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\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"
},
"./interfaces/ISimpleFunctionRegistryFeature.sol": {
"id": 7,
"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"
},
"../migrations/LibMigrate.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/errors/LibRichErrorsV06.sol\";\nimport \"../errors/LibOwnableRichErrors.sol\";\n\n\nlibrary LibMigrate {\n\n /// @dev Magic bytes returned by a migrator to indicate success.\n /// This is `keccack('MIGRATE_SUCCESS')`.\n bytes4 internal constant MIGRATE_SUCCESS = 0x2c64c5ef;\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Perform a delegatecall and ensure it returns the magic bytes.\n /// @param target The call target.\n /// @param data The call data.\n function delegatecallMigrateFunction(\n address target,\n bytes memory data\n )\n internal\n {\n (bool success, bytes memory resultData) = target.delegatecall(data);\n if (!success ||\n resultData.length != 32 ||\n abi.decode(resultData, (bytes4)) != MIGRATE_SUCCESS)\n {\n LibOwnableRichErrors.MigrateCallFailedError(target, resultData).rrevert();\n }\n }\n}\n"
},
"../external/IAllowanceTarget.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/IAuthorizableV06.sol\";\n\n\n/// @dev The allowance target for the TokenSpender feature.\ninterface IAllowanceTarget is\n IAuthorizableV06\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 /// @return resultData The data returned by the call.\n function executeCall(\n address payable target,\n bytes calldata callData\n )\n external\n returns (bytes memory resultData);\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/interfaces/IAuthorizableV06.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 \"./IOwnableV06.sol\";\n\n\ninterface IAuthorizableV06 is\n IOwnableV06\n{\n // Event logged when a new address is authorized.\n event AuthorizedAddressAdded(\n address indexed target,\n address indexed caller\n );\n\n // Event logged when a currently authorized address is unauthorized.\n event AuthorizedAddressRemoved(\n address indexed target,\n address indexed caller\n );\n\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n\n /// @dev Gets all authorized addresses.\n /// @return authorizedAddresses Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory authorizedAddresses);\n\n /// @dev Whether an adderss is authorized to call privileged functions.\n /// @param addr Address to query.\n /// @return isAuthorized Whether the address is authorized.\n function authorized(address addr) external view returns (bool isAuthorized);\n\n /// @dev All addresseses authorized to call privileged functions.\n /// @param idx Index of authorized address.\n /// @return addr Authorized address.\n function authorities(uint256 idx) external view returns (address addr);\n\n}\n"
},
"../storage/LibTokenSpenderStorage.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 \"./LibStorage.sol\";\nimport \"../external/IAllowanceTarget.sol\";\n\n\n/// @dev Storage helpers for the `TokenSpender` feature.\nlibrary LibTokenSpenderStorage {\n\n /// @dev Storage bucket for this feature.\n struct Storage {\n // Allowance target contract.\n IAllowanceTarget allowanceTarget;\n }\n\n /// @dev Get the storage bucket for this contract.\n function getStorage() internal pure returns (Storage storage stor) {\n uint256 storageSlot = LibStorage.getStorageSlot(\n LibStorage.StorageId.TokenSpender\n );\n // Dip into assembly to change the slot pointed to by the local\n // variable `stor`.\n // See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries\n assembly { stor_slot := storageSlot }\n }\n}\n"
},
"../storage/LibStorage.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 Common storage helpers\nlibrary LibStorage {\n\n /// @dev What to bit-shift a storage ID by to get its slot.\n /// This gives us a maximum of 2**128 inline fields in each bucket.\n uint256 private constant STORAGE_SLOT_EXP = 128;\n\n /// @dev Storage IDs for feature storage buckets.\n /// WARNING: APPEND-ONLY.\n enum StorageId {\n Proxy,\n SimpleFunctionRegistry,\n Ownable,\n TokenSpender,\n TransformERC20,\n MetaTransactions,\n ReentrancyGuard,\n NativeOrders\n }\n\n /// @dev Get the storage slot given a storage ID. We assign unique, well-spaced\n /// slots to storage bucket variables to ensure they do not overlap.\n /// See: https://solidity.readthedocs.io/en/v0.6.6/assembly.html#access-to-external-variables-functions-and-libraries\n /// @param storageId An entry in `StorageId`\n /// @return slot The storage slot.\n function getStorageSlot(StorageId storageId)\n internal\n pure\n returns (uint256 slot)\n {\n // This should never overflow with a reasonable `STORAGE_SLOT_EXP`\n // because Solidity will do a range check on `storageId` during the cast.\n return (uint256(storageId) + 1) << STORAGE_SLOT_EXP;\n }\n}\n"
},
"./interfaces/IFeature.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\n\n/// @dev Basic interface for a feature contract.\ninterface IFeature {\n\n // solhint-disable func-name-mixedcase\n\n /// @dev The name of this feature set.\n function FEATURE_NAME() external view returns (string memory name);\n\n /// @dev The version of this feature set.\n function FEATURE_VERSION() external view returns (uint256 version);\n}\n"
},
"./interfaces/ITokenSpenderFeature.sol": {
"id": 8,
"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"
}
},
"sourceCodes": {
"./TokenSpenderFeature.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 \"@0x/contracts-utils/contracts/src/v06/LibSafeMathV06.sol\";\nimport \"@0x/contracts-erc20/contracts/src/v06/IERC20TokenV06.sol\";\nimport \"@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.sol\";\nimport \"../errors/LibSpenderRichErrors.sol\";\nimport \"../fixins/FixinCommon.sol\";\nimport \"../migrations/LibMigrate.sol\";\nimport \"../external/IAllowanceTarget.sol\";\nimport \"../storage/LibTokenSpenderStorage.sol\";\nimport \"./interfaces/IFeature.sol\";\nimport \"./interfaces/ITokenSpenderFeature.sol\";\n\n\n/// @dev Feature that allows spending token allowances.\ncontract TokenSpenderFeature is\n IFeature,\n ITokenSpenderFeature,\n FixinCommon\n{\n // solhint-disable\n /// @dev Name of this feature.\n string public constant override FEATURE_NAME = \"TokenSpender\";\n /// @dev Version of this feature.\n uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);\n // solhint-enable\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Initialize and register this feature. Should be delegatecalled\n /// into during a `Migrate.migrate()`.\n /// @param allowanceTarget An `allowanceTarget` instance, configured to have\n /// the ZeroeEx contract as an authority.\n /// @return success `MIGRATE_SUCCESS` on success.\n function migrate(IAllowanceTarget allowanceTarget)\n external\n returns (bytes4 success)\n {\n LibTokenSpenderStorage.getStorage().allowanceTarget = allowanceTarget;\n _registerFeatureFunction(this.getAllowanceTarget.selector);\n _registerFeatureFunction(this._spendERC20Tokens.selector);\n _registerFeatureFunction(this.getSpendableERC20BalanceOf.selector);\n return LibMigrate.MIGRATE_SUCCESS;\n }\n\n /// @dev Transfers ERC20 tokens from `owner` to `to`. 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 override\n onlySelf\n {\n IAllowanceTarget spender = LibTokenSpenderStorage.getStorage().allowanceTarget;\n // Have the allowance target execute an ERC20 `transferFrom()`.\n (bool didSucceed, bytes memory resultData) = address(spender).call(\n abi.encodeWithSelector(\n IAllowanceTarget.executeCall.selector,\n address(token),\n abi.encodeWithSelector(\n IERC20TokenV06.transferFrom.selector,\n owner,\n to,\n amount\n )\n )\n );\n if (didSucceed) {\n resultData = abi.decode(resultData, (bytes));\n }\n if (!didSucceed || !LibERC20TokenV06.isSuccessfulResult(resultData)) {\n LibSpenderRichErrors.SpenderERC20TransferFromFailedError(\n address(token),\n owner,\n to,\n amount,\n resultData\n ).rrevert();\n }\n }\n\n /// @dev Gets the maximum amount of an ERC20 token `token` that can be\n /// pulled from `owner` by the token spender.\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 override\n view\n returns (uint256 amount)\n {\n return LibSafeMathV06.min256(\n token.allowance(owner, address(LibTokenSpenderStorage.getStorage().allowanceTarget)),\n token.balanceOf(owner)\n );\n }\n\n /// @dev Get the address of the allowance target.\n /// @return target The target of token allowances.\n function getAllowanceTarget()\n external\n override\n view\n returns (address target)\n {\n return address(LibTokenSpenderStorage.getStorage().allowanceTarget);\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",
"@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",
"@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",
"@0x/contracts-erc20/contracts/src/v06/LibERC20TokenV06.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-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol\";\nimport \"./IERC20TokenV06.sol\";\n\n\nlibrary LibERC20TokenV06 {\n bytes constant private DECIMALS_CALL_DATA = hex\"313ce567\";\n\n /// @dev Calls `IERC20TokenV06(token).approve()`.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param spender The address that receives an allowance.\n /// @param allowance The allowance to set.\n function compatApprove(\n IERC20TokenV06 token,\n address spender,\n uint256 allowance\n )\n internal\n {\n bytes memory callData = abi.encodeWithSelector(\n token.approve.selector,\n spender,\n allowance\n );\n _callWithOptionalBooleanResult(address(token), callData);\n }\n\n /// @dev Calls `IERC20TokenV06(token).approve()` and sets the allowance to the\n /// maximum if the current approval is not already >= an amount.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param spender The address that receives an allowance.\n /// @param amount The minimum allowance needed.\n function approveIfBelow(\n IERC20TokenV06 token,\n address spender,\n uint256 amount\n )\n internal\n {\n if (token.allowance(address(this), spender) < amount) {\n compatApprove(token, spender, uint256(-1));\n }\n }\n\n /// @dev Calls `IERC20TokenV06(token).transfer()`.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param to The address that receives the tokens\n /// @param amount Number of tokens to transfer.\n function compatTransfer(\n IERC20TokenV06 token,\n address to,\n uint256 amount\n )\n internal\n {\n bytes memory callData = abi.encodeWithSelector(\n token.transfer.selector,\n to,\n amount\n );\n _callWithOptionalBooleanResult(address(token), callData);\n }\n\n /// @dev Calls `IERC20TokenV06(token).transferFrom()`.\n /// Reverts if the result fails `isSuccessfulResult()` or the call reverts.\n /// @param token The address of the token contract.\n /// @param from The owner of the tokens.\n /// @param to The address that receives the tokens\n /// @param amount Number of tokens to transfer.\n function compatTransferFrom(\n IERC20TokenV06 token,\n address from,\n address to,\n uint256 amount\n )\n internal\n {\n bytes memory callData = abi.encodeWithSelector(\n token.transferFrom.selector,\n from,\n to,\n amount\n );\n _callWithOptionalBooleanResult(address(token), callData);\n }\n\n /// @dev Retrieves the number of decimals for a token.\n /// Returns `18` if the call reverts.\n /// @param token The address of the token contract.\n /// @return tokenDecimals The number of decimals places for the token.\n function compatDecimals(IERC20TokenV06 token)\n internal\n view\n returns (uint8 tokenDecimals)\n {\n tokenDecimals = 18;\n (bool didSucceed, bytes memory resultData) = address(token).staticcall(DECIMALS_CALL_DATA);\n if (didSucceed && resultData.length >= 32) {\n tokenDecimals = uint8(LibBytesV06.readUint256(resultData, 0));\n }\n }\n\n /// @dev Retrieves the allowance for a token, owner, and spender.\n /// Returns `0` if the call reverts.\n /// @param token The address of the token contract.\n /// @param owner The owner of the tokens.\n /// @param spender The address the spender.\n /// @return allowance_ The allowance for a token, owner, and spender.\n function compatAllowance(IERC20TokenV06 token, address owner, address spender)\n internal\n view\n returns (uint256 allowance_)\n {\n (bool didSucceed, bytes memory resultData) = address(token).staticcall(\n abi.encodeWithSelector(\n token.allowance.selector,\n owner,\n spender\n )\n );\n if (didSucceed && resultData.length >= 32) {\n allowance_ = LibBytesV06.readUint256(resultData, 0);\n }\n }\n\n /// @dev Retrieves the balance for a token owner.\n /// Returns `0` if the call reverts.\n /// @param token The address of the token contract.\n /// @param owner The owner of the tokens.\n /// @return balance The token balance of an owner.\n function compatBalanceOf(IERC20TokenV06 token, address owner)\n internal\n view\n returns (uint256 balance)\n {\n (bool didSucceed, bytes memory resultData) = address(token).staticcall(\n abi.encodeWithSelector(\n token.balanceOf.selector,\n owner\n )\n );\n if (didSucceed && resultData.length >= 32) {\n balance = LibBytesV06.readUint256(resultData, 0);\n }\n }\n\n /// @dev Check if the data returned by a non-static call to an ERC20 token\n /// is a successful result. Supported functions are `transfer()`,\n /// `transferFrom()`, and `approve()`.\n /// @param resultData The raw data returned by a non-static call to the ERC20 token.\n /// @return isSuccessful Whether the result data indicates success.\n function isSuccessfulResult(bytes memory resultData)\n internal\n pure\n returns (bool isSuccessful)\n {\n if (resultData.length == 0) {\n return true;\n }\n if (resultData.length >= 32) {\n uint256 result = LibBytesV06.readUint256(resultData, 0);\n if (result == 1) {\n return true;\n }\n }\n }\n\n /// @dev Executes a call on address `target` with calldata `callData`\n /// and asserts that either nothing was returned or a single boolean\n /// was returned equal to `true`.\n /// @param target The call target.\n /// @param callData The abi-encoded call data.\n function _callWithOptionalBooleanResult(\n address target,\n bytes memory callData\n )\n private\n {\n (bool didSucceed, bytes memory resultData) = target.call(callData);\n if (didSucceed && isSuccessfulResult(resultData)) {\n return;\n }\n LibRichErrorsV06.rrevert(resultData);\n }\n}\n",
"@0x/contracts-utils/contracts/src/v06/LibBytesV06.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/LibBytesRichErrorsV06.sol\";\nimport \"./errors/LibRichErrorsV06.sol\";\n\n\nlibrary LibBytesV06 {\n\n using LibBytesV06 for bytes;\n\n /// @dev Gets the memory address for a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of byte array. This\n /// points to the header of the byte array which contains\n /// the length.\n function rawAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := input\n }\n return memoryAddress;\n }\n\n /// @dev Gets the memory address for the contents of a byte array.\n /// @param input Byte array to lookup.\n /// @return memoryAddress Memory address of the contents of the byte array.\n function contentAddress(bytes memory input)\n internal\n pure\n returns (uint256 memoryAddress)\n {\n assembly {\n memoryAddress := add(input, 32)\n }\n return memoryAddress;\n }\n\n /// @dev Copies `length` bytes from memory location `source` to `dest`.\n /// @param dest memory address to copy bytes to.\n /// @param source memory address to copy bytes from.\n /// @param length number of bytes to copy.\n function memCopy(\n uint256 dest,\n uint256 source,\n uint256 length\n )\n internal\n pure\n {\n if (length < 32) {\n // Handle a partial word by reading destination and masking\n // off the bits we are interested in.\n // This correctly handles overlap, zero lengths and source == dest\n assembly {\n let mask := sub(exp(256, sub(32, length)), 1)\n let s := and(mload(source), not(mask))\n let d := and(mload(dest), mask)\n mstore(dest, or(s, d))\n }\n } else {\n // Skip the O(length) loop when source == dest.\n if (source == dest) {\n return;\n }\n\n // For large copies we copy whole words at a time. The final\n // word is aligned to the end of the range (instead of after the\n // previous) to handle partial words. So a copy will look like this:\n //\n // ####\n // ####\n // ####\n // ####\n //\n // We handle overlap in the source and destination range by\n // changing the copying direction. This prevents us from\n // overwriting parts of source that we still need to copy.\n //\n // This correctly handles source == dest\n //\n if (source > dest) {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because it\n // is easier to compare with in the loop, and these\n // are also the addresses we need for copying the\n // last bytes.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the last 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the last bytes in\n // source already due to overlap.\n let last := mload(sEnd)\n\n // Copy whole words front to back\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} lt(source, sEnd) {} {\n mstore(dest, mload(source))\n source := add(source, 32)\n dest := add(dest, 32)\n }\n\n // Write the last 32 bytes\n mstore(dEnd, last)\n }\n } else {\n assembly {\n // We subtract 32 from `sEnd` and `dEnd` because those\n // are the starting points when copying a word at the end.\n length := sub(length, 32)\n let sEnd := add(source, length)\n let dEnd := add(dest, length)\n\n // Remember the first 32 bytes of source\n // This needs to be done here and not after the loop\n // because we may have overwritten the first bytes in\n // source already due to overlap.\n let first := mload(source)\n\n // Copy whole words back to front\n // We use a signed comparisson here to allow dEnd to become\n // negative (happens when source and dest < 32). Valid\n // addresses in local memory will never be larger than\n // 2**255, so they can be safely re-interpreted as signed.\n // Note: the first check is always true,\n // this could have been a do-while loop.\n // solhint-disable-next-line no-empty-blocks\n for {} slt(dest, dEnd) {} {\n mstore(dEnd, mload(sEnd))\n sEnd := sub(sEnd, 32)\n dEnd := sub(dEnd, 32)\n }\n\n // Write the first 32 bytes\n mstore(dest, first)\n }\n }\n }\n }\n\n /// @dev Returns a slices from a byte array.\n /// @param b The byte array to take a slice from.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function slice(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Ensure that the from and to positions are valid positions for a slice within\n // the byte array that is being used.\n if (from > to) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,\n from,\n to\n ));\n }\n if (to > b.length) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,\n to,\n b.length\n ));\n }\n\n // Create a new bytes structure and copy contents\n result = new bytes(to - from);\n memCopy(\n result.contentAddress(),\n b.contentAddress() + from,\n result.length\n );\n return result;\n }\n\n /// @dev Returns a slice from a byte array without preserving the input.\n /// When `from == 0`, the original array will match the slice.\n /// In other cases its state will be corrupted.\n /// @param b The byte array to take a slice from. Will be destroyed in the process.\n /// @param from The starting index for the slice (inclusive).\n /// @param to The final index for the slice (exclusive).\n /// @return result The slice containing bytes at indices [from, to)\n function sliceDestructive(\n bytes memory b,\n uint256 from,\n uint256 to\n )\n internal\n pure\n returns (bytes memory result)\n {\n // Ensure that the from and to positions are valid positions for a slice within\n // the byte array that is being used.\n if (from > to) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.FromLessThanOrEqualsToRequired,\n from,\n to\n ));\n }\n if (to > b.length) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.ToLessThanOrEqualsLengthRequired,\n to,\n b.length\n ));\n }\n\n // Create a new bytes structure around [from, to) in-place.\n assembly {\n result := add(b, from)\n mstore(result, sub(to, from))\n }\n return result;\n }\n\n /// @dev Pops the last byte off of a byte array by modifying its length.\n /// @param b Byte array that will be modified.\n /// @return result The byte that was popped off.\n function popLastByte(bytes memory b)\n internal\n pure\n returns (bytes1 result)\n {\n if (b.length == 0) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanZeroRequired,\n b.length,\n 0\n ));\n }\n\n // Store last byte.\n result = b[b.length - 1];\n\n assembly {\n // Decrement length of byte array.\n let newLen := sub(mload(b), 1)\n mstore(b, newLen)\n }\n return result;\n }\n\n /// @dev Tests equality of two byte arrays.\n /// @param lhs First byte array to compare.\n /// @param rhs Second byte array to compare.\n /// @return equal True if arrays are the same. False otherwise.\n function equals(\n bytes memory lhs,\n bytes memory rhs\n )\n internal\n pure\n returns (bool equal)\n {\n // Keccak gas cost is 30 + numWords * 6. This is a cheap way to compare.\n // We early exit on unequal lengths, but keccak would also correctly\n // handle this.\n return lhs.length == rhs.length && keccak256(lhs) == keccak256(rhs);\n }\n\n /// @dev Reads an address from a position in a byte array.\n /// @param b Byte array containing an address.\n /// @param index Index in byte array of address.\n /// @return result address from byte array.\n function readAddress(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (address result)\n {\n if (b.length < index + 20) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,\n b.length,\n index + 20 // 20 is length of address\n ));\n }\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Read address from array memory\n assembly {\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 20-byte mask to obtain address\n result := and(mload(add(b, index)), 0xffffffffffffffffffffffffffffffffffffffff)\n }\n return result;\n }\n\n /// @dev Writes an address into a specific position in a byte array.\n /// @param b Byte array to insert address into.\n /// @param index Index in byte array of address.\n /// @param input Address to put into byte array.\n function writeAddress(\n bytes memory b,\n uint256 index,\n address input\n )\n internal\n pure\n {\n if (b.length < index + 20) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsTwentyRequired,\n b.length,\n index + 20 // 20 is length of address\n ));\n }\n\n // Add offset to index:\n // 1. Arrays are prefixed by 32-byte length parameter (add 32 to index)\n // 2. Account for size difference between address length and 32-byte storage word (subtract 12 from index)\n index += 20;\n\n // Store address into array memory\n assembly {\n // The address occupies 20 bytes and mstore stores 32 bytes.\n // First fetch the 32-byte word where we'll be storing the address, then\n // apply a mask so we have only the bytes in the word that the address will not occupy.\n // Then combine these bytes with the address and store the 32 bytes back to memory with mstore.\n\n // 1. Add index to address of bytes array\n // 2. Load 32-byte word from memory\n // 3. Apply 12-byte mask to obtain extra bytes occupying word of memory where we'll store the address\n let neighbors := and(\n mload(add(b, index)),\n 0xffffffffffffffffffffffff0000000000000000000000000000000000000000\n )\n\n // Make sure input address is clean.\n // (Solidity does not guarantee this)\n input := and(input, 0xffffffffffffffffffffffffffffffffffffffff)\n\n // Store the neighbors and address into memory\n mstore(add(b, index), xor(input, neighbors))\n }\n }\n\n /// @dev Reads a bytes32 value from a position in a byte array.\n /// @param b Byte array containing a bytes32 value.\n /// @param index Index in byte array of bytes32 value.\n /// @return result bytes32 value from byte array.\n function readBytes32(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes32 result)\n {\n if (b.length < index + 32) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,\n b.length,\n index + 32\n ));\n }\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n result := mload(add(b, index))\n }\n return result;\n }\n\n /// @dev Writes a bytes32 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input bytes32 to put into byte array.\n function writeBytes32(\n bytes memory b,\n uint256 index,\n bytes32 input\n )\n internal\n pure\n {\n if (b.length < index + 32) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsThirtyTwoRequired,\n b.length,\n index + 32\n ));\n }\n\n // Arrays are prefixed by a 256 bit length parameter\n index += 32;\n\n // Read the bytes32 from array memory\n assembly {\n mstore(add(b, index), input)\n }\n }\n\n /// @dev Reads a uint256 value from a position in a byte array.\n /// @param b Byte array containing a uint256 value.\n /// @param index Index in byte array of uint256 value.\n /// @return result uint256 value from byte array.\n function readUint256(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (uint256 result)\n {\n result = uint256(readBytes32(b, index));\n return result;\n }\n\n /// @dev Writes a uint256 into a specific position in a byte array.\n /// @param b Byte array to insert <input> into.\n /// @param index Index in byte array of <input>.\n /// @param input uint256 to put into byte array.\n function writeUint256(\n bytes memory b,\n uint256 index,\n uint256 input\n )\n internal\n pure\n {\n writeBytes32(b, index, bytes32(input));\n }\n\n /// @dev Reads an unpadded bytes4 value from a position in a byte array.\n /// @param b Byte array containing a bytes4 value.\n /// @param index Index in byte array of bytes4 value.\n /// @return result bytes4 value from byte array.\n function readBytes4(\n bytes memory b,\n uint256 index\n )\n internal\n pure\n returns (bytes4 result)\n {\n if (b.length < index + 4) {\n LibRichErrorsV06.rrevert(LibBytesRichErrorsV06.InvalidByteOperationError(\n LibBytesRichErrorsV06.InvalidByteOperationErrorCodes.LengthGreaterThanOrEqualsFourRequired,\n b.length,\n index + 4\n ));\n }\n\n // Arrays are prefixed by a 32 byte length field\n index += 32;\n\n // Read the bytes4 from array memory\n assembly {\n result := mload(add(b, index))\n // Solidity does not require us to clean the trailing bytes.\n // We do it anyway\n result := and(result, 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\n }\n return result;\n }\n\n /// @dev Writes a new length to a byte array.\n /// Decreasing length will lead to removing the corresponding lower order bytes from the byte array.\n /// Increasing length may lead to appending adjacent in-memory bytes to the end of the byte array.\n /// @param b Bytes array to write new length to.\n /// @param length New length of byte array.\n function writeLength(bytes memory b, uint256 length)\n internal\n pure\n {\n assembly {\n mstore(b, length)\n }\n }\n}\n",
"@0x/contracts-utils/contracts/src/v06/errors/LibBytesRichErrorsV06.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 LibBytesRichErrorsV06 {\n\n enum InvalidByteOperationErrorCodes {\n FromLessThanOrEqualsToRequired,\n ToLessThanOrEqualsLengthRequired,\n LengthGreaterThanZeroRequired,\n LengthGreaterThanOrEqualsFourRequired,\n LengthGreaterThanOrEqualsTwentyRequired,\n LengthGreaterThanOrEqualsThirtyTwoRequired,\n LengthGreaterThanOrEqualsNestedBytesLengthRequired,\n DestinationLengthGreaterThanOrEqualSourceLengthRequired\n }\n\n // bytes4(keccak256(\"InvalidByteOperationError(uint8,uint256,uint256)\"))\n bytes4 internal constant INVALID_BYTE_OPERATION_ERROR_SELECTOR =\n 0x28006595;\n\n // solhint-disable func-name-mixedcase\n function InvalidByteOperationError(\n InvalidByteOperationErrorCodes errorCode,\n uint256 offset,\n uint256 required\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n INVALID_BYTE_OPERATION_ERROR_SELECTOR,\n errorCode,\n offset,\n required\n );\n }\n}\n",
"../errors/LibSpenderRichErrors.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 LibSpenderRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function SpenderERC20TransferFromFailedError(\n address token,\n address owner,\n address to,\n uint256 amount,\n bytes memory errorData\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"SpenderERC20TransferFromFailedError(address,address,address,uint256,bytes)\")),\n token,\n owner,\n to,\n amount,\n errorData\n );\n }\n}\n",
"../fixins/FixinCommon.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/LibCommonRichErrors.sol\";\nimport \"../errors/LibOwnableRichErrors.sol\";\nimport \"../features/interfaces/IOwnableFeature.sol\";\nimport \"../features/interfaces/ISimpleFunctionRegistryFeature.sol\";\n\n\n/// @dev Common feature utilities.\nabstract contract FixinCommon {\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev The implementation address of this feature.\n address internal immutable _implementation;\n\n /// @dev The caller must be this contract.\n modifier onlySelf() virtual {\n if (msg.sender != address(this)) {\n LibCommonRichErrors.OnlyCallableBySelfError(msg.sender).rrevert();\n }\n _;\n }\n\n /// @dev The caller of this function must be the owner.\n modifier onlyOwner() virtual {\n {\n address owner = IOwnableFeature(address(this)).owner();\n if (msg.sender != owner) {\n LibOwnableRichErrors.OnlyOwnerError(\n msg.sender,\n owner\n ).rrevert();\n }\n }\n _;\n }\n\n constructor() internal {\n // Remember this feature's original address.\n _implementation = address(this);\n }\n\n /// @dev Registers a function implemented by this feature at `_implementation`.\n /// Can and should only be called within a `migrate()`.\n /// @param selector The selector of the function whose implementation\n /// is at `_implementation`.\n function _registerFeatureFunction(bytes4 selector)\n internal\n {\n ISimpleFunctionRegistryFeature(address(this)).extend(selector, _implementation);\n }\n\n /// @dev Encode a feature version as a `uint256`.\n /// @param major The major version number of the feature.\n /// @param minor The minor version number of the feature.\n /// @param revision The revision number of the feature.\n /// @return encodedVersion The encoded version number.\n function _encodeVersion(uint32 major, uint32 minor, uint32 revision)\n internal\n pure\n returns (uint256 encodedVersion)\n {\n return (uint256(major) << 64) | (uint256(minor) << 32) | uint256(revision);\n }\n}\n",
"../errors/LibCommonRichErrors.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 LibCommonRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function OnlyCallableBySelfError(address sender)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OnlyCallableBySelfError(address)\")),\n sender\n );\n }\n\n function IllegalReentrancyError(bytes4 selector, uint256 reentrancyFlags)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"IllegalReentrancyError(bytes4,uint256)\")),\n selector,\n reentrancyFlags\n );\n }\n}\n",
"../errors/LibOwnableRichErrors.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 LibOwnableRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function OnlyOwnerError(\n address sender,\n address owner\n )\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"OnlyOwnerError(address,address)\")),\n sender,\n owner\n );\n }\n\n function TransferOwnerToZeroError()\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"TransferOwnerToZeroError()\"))\n );\n }\n\n function MigrateCallFailedError(address target, bytes memory resultData)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"MigrateCallFailedError(address,bytes)\")),\n target,\n resultData\n );\n }\n}\n",
"./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",
"./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",
"../migrations/LibMigrate.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/LibOwnableRichErrors.sol\";\n\n\nlibrary LibMigrate {\n\n /// @dev Magic bytes returned by a migrator to indicate success.\n /// This is `keccack('MIGRATE_SUCCESS')`.\n bytes4 internal constant MIGRATE_SUCCESS = 0x2c64c5ef;\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Perform a delegatecall and ensure it returns the magic bytes.\n /// @param target The call target.\n /// @param data The call data.\n function delegatecallMigrateFunction(\n address target,\n bytes memory data\n )\n internal\n {\n (bool success, bytes memory resultData) = target.delegatecall(data);\n if (!success ||\n resultData.length != 32 ||\n abi.decode(resultData, (bytes4)) != MIGRATE_SUCCESS)\n {\n LibOwnableRichErrors.MigrateCallFailedError(target, resultData).rrevert();\n }\n }\n}\n",
"../external/IAllowanceTarget.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/IAuthorizableV06.sol\";\n\n\n/// @dev The allowance target for the TokenSpender feature.\ninterface IAllowanceTarget is\n IAuthorizableV06\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 /// @return resultData The data returned by the call.\n function executeCall(\n address payable target,\n bytes calldata callData\n )\n external\n returns (bytes memory resultData);\n}\n",
"@0x/contracts-utils/contracts/src/v06/interfaces/IAuthorizableV06.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 \"./IOwnableV06.sol\";\n\n\ninterface IAuthorizableV06 is\n IOwnableV06\n{\n // Event logged when a new address is authorized.\n event AuthorizedAddressAdded(\n address indexed target,\n address indexed caller\n );\n\n // Event logged when a currently authorized address is unauthorized.\n event AuthorizedAddressRemoved(\n address indexed target,\n address indexed caller\n );\n\n /// @dev Authorizes an address.\n /// @param target Address to authorize.\n function addAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n function removeAuthorizedAddress(address target)\n external;\n\n /// @dev Removes authorizion of an address.\n /// @param target Address to remove authorization from.\n /// @param index Index of target in authorities array.\n function removeAuthorizedAddressAtIndex(\n address target,\n uint256 index\n )\n external;\n\n /// @dev Gets all authorized addresses.\n /// @return authorizedAddresses Array of authorized addresses.\n function getAuthorizedAddresses()\n external\n view\n returns (address[] memory authorizedAddresses);\n\n /// @dev Whether an adderss is authorized to call privileged functions.\n /// @param addr Address to query.\n /// @return isAuthorized Whether the address is authorized.\n function authorized(address addr) external view returns (bool isAuthorized);\n\n /// @dev All addresseses authorized to call privileged functions.\n /// @param idx Index of authorized address.\n /// @return addr Authorized address.\n function authorities(uint256 idx) external view returns (address addr);\n\n}\n",
"../storage/LibTokenSpenderStorage.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 \"./LibStorage.sol\";\nimport \"../external/IAllowanceTarget.sol\";\n\n\n/// @dev Storage helpers for the `TokenSpender` feature.\nlibrary LibTokenSpenderStorage {\n\n /// @dev Storage bucket for this feature.\n struct Storage {\n // Allowance target contract.\n IAllowanceTarget allowanceTarget;\n }\n\n /// @dev Get the storage bucket for this contract.\n function getStorage() internal pure returns (Storage storage stor) {\n uint256 storageSlot = LibStorage.getStorageSlot(\n LibStorage.StorageId.TokenSpender\n );\n // Dip into assembly to change the slot pointed to by the local\n // variable `stor`.\n // See https://solidity.readthedocs.io/en/v0.6.8/assembly.html?highlight=slot#access-to-external-variables-functions-and-libraries\n assembly { stor_slot := storageSlot }\n }\n}\n",
"../storage/LibStorage.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 Common storage helpers\nlibrary LibStorage {\n\n /// @dev What to bit-shift a storage ID by to get its slot.\n /// This gives us a maximum of 2**128 inline fields in each bucket.\n uint256 private constant STORAGE_SLOT_EXP = 128;\n\n /// @dev Storage IDs for feature storage buckets.\n /// WARNING: APPEND-ONLY.\n enum StorageId {\n Proxy,\n SimpleFunctionRegistry,\n Ownable,\n TokenSpender,\n TransformERC20,\n MetaTransactions,\n ReentrancyGuard,\n NativeOrders\n }\n\n /// @dev Get the storage slot given a storage ID. We assign unique, well-spaced\n /// slots to storage bucket variables to ensure they do not overlap.\n /// See: https://solidity.readthedocs.io/en/v0.6.6/assembly.html#access-to-external-variables-functions-and-libraries\n /// @param storageId An entry in `StorageId`\n /// @return slot The storage slot.\n function getStorageSlot(StorageId storageId)\n internal\n pure\n returns (uint256 slot)\n {\n // This should never overflow with a reasonable `STORAGE_SLOT_EXP`\n // because Solidity will do a range check on `storageId` during the cast.\n return (uint256(storageId) + 1) << STORAGE_SLOT_EXP;\n }\n}\n",
"./interfaces/IFeature.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 interface for a feature contract.\ninterface IFeature {\n\n // solhint-disable func-name-mixedcase\n\n /// @dev The name of this feature set.\n function FEATURE_NAME() external view returns (string memory name);\n\n /// @dev The version of this feature set.\n function FEATURE_VERSION() external view returns (uint256 version);\n}\n",
"./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"
},
"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": {}
}