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

369 lines
192 KiB
JSON

{
"schemaVersion": "2.0.0",
"contractName": "InitialMigration",
"compilerOutput": {
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "initializeCaller_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [
{
"internalType": "address",
"name": "owner",
"type": "address"
},
{
"components": [
{
"internalType": "contract SimpleFunctionRegistryFeature",
"name": "registry",
"type": "address"
},
{
"internalType": "contract OwnableFeature",
"name": "ownable",
"type": "address"
}
],
"internalType": "struct InitialMigration.BootstrapFeatures",
"name": "features",
"type": "tuple"
}
],
"name": "bootstrap",
"outputs": [
{
"internalType": "bytes4",
"name": "success",
"type": "bytes4"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "ethRecipient",
"type": "address"
}
],
"name": "die",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "initializeCaller",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address payable",
"name": "owner",
"type": "address"
},
{
"internalType": "contract ZeroEx",
"name": "zeroEx",
"type": "address"
},
{
"components": [
{
"internalType": "contract SimpleFunctionRegistryFeature",
"name": "registry",
"type": "address"
},
{
"internalType": "contract OwnableFeature",
"name": "ownable",
"type": "address"
}
],
"internalType": "struct InitialMigration.BootstrapFeatures",
"name": "features",
"type": "tuple"
}
],
"name": "initializeZeroEx",
"outputs": [
{
"internalType": "contract ZeroEx",
"name": "_zeroEx",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
}
],
"devdoc": {
"details": "A contract for deploying and configuring a minimal ZeroEx contract.",
"kind": "dev",
"methods": {
"bootstrap(address,(address,address))": {
"details": "Sets up the initial state of the `ZeroEx` contract. The `ZeroEx` contract will delegatecall into this function.",
"params": {
"features": "Features to bootstrap into the proxy.",
"owner": "The new owner of the ZeroEx contract."
},
"returns": {
"success": "Magic bytes if successful."
}
},
"constructor": {
"details": "Instantiate this contract and set the allowed caller of `initializeZeroEx()` to `initializeCaller_`.",
"params": {
"initializeCaller_": "The allowed caller of `initializeZeroEx()`."
}
},
"die(address)": {
"details": "Self-destructs this contract. Only callable by this contract.",
"params": {
"ethRecipient": "Who to transfer outstanding ETH to."
}
},
"initializeZeroEx(address,address,(address,address))": {
"details": "Initialize the `ZeroEx` contract with the minimum feature set, transfers ownership to `owner`, then self-destructs. Only callable by `initializeCaller` set in the contstructor.",
"params": {
"features": "Features to bootstrap into the proxy.",
"owner": "The owner of the contract.",
"zeroEx": "The instance of the ZeroEx contract. ZeroEx should been constructed with this contract as the bootstrapper."
},
"returns": {
"_zeroEx": "The configured ZeroEx contract. Same as the `zeroEx` parameter."
}
}
},
"stateVariables": {
"_implementation": {
"details": "The real address of this contract."
},
"initializeCaller": {
"details": "The allowed caller of `initializeZeroEx()`. In production, this would be the governor."
}
},
"version": 1
},
"evm": {
"bytecode": {
"linkReferences": {},
"object": "0x60c060405234801561001057600080fd5b50604051610afa380380610afa83398101604081905261002f9161004c565b6001600160601b0319606091821b1660805230901b60a05261007a565b60006020828403121561005d578081fd5b81516001600160a01b0381168114610073578182fd5b9392505050565b60805160601c60a05160601c610a526100a8600039806104cf5250806102aa52806102e65250610a526000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806308cf7934146100515780635f136a4a1461007a578063a23ce6ce1461008f578063c9353cb5146100a2575b600080fd5b61006461005f3660046107c6565b6100b7565b604051610071919061091f565b60405180910390f35b6100826102a8565b6040516100719190610857565b61008261009d36600461077f565b6102cc565b6100b56100b036600461075c565b6104b7565b005b80516040805160048152602481019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167ffb969b0a0000000000000000000000000000000000000000000000000000000017905260009161011c9161053f565b60208083015160408051600481526024810190915291820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167ffb969b0a000000000000000000000000000000000000000000000000000000001790526101819161053f565b6040517f9db64a400000000000000000000000000000000000000000000000000000000081523090639db64a40906101e0907f0ee8be1b000000000000000000000000000000000000000000000000000000009060009060040161094c565b600060405180830381600087803b1580156101fa57600080fd5b505af115801561020e573d6000803e3d6000fd5b50506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815230925063f2fde38b915061024e908690600401610857565b600060405180830381600087803b15801561026857600080fd5b505af115801561027c573d6000803e3d6000fd5b507fd150751b000000000000000000000000000000000000000000000000000000009695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610346576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033d90610994565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff166373f208d5306308cf793460e01b878660405160240161037e929190610878565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009485161790525160e085901b909216825261040f92916004016108b1565b600060405180830381600087803b15801561042957600080fd5b505af115801561043d573d6000803e3d6000fd5b50506040517fc9353cb500000000000000000000000000000000000000000000000000000000815230925063c9353cb5915061047d908790600401610857565b600060405180830381600087803b15801561049757600080fd5b505af11580156104ab573d6000803e3d6000fd5b50949695505050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610526576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033d90610994565b8073ffffffffffffffffffffffffffffffffffffffff16ff5b600060608373ffffffffffffffffffffffffffffffffffffffff1683604051610568919061083b565b600060405180830381855af49150503d80600081146105a3576040519150601f19603f3d011682016040523d82523d6000602084013e6105a8565b606091505b50915091508115806105bc57508051602014155b8061061e575080517fd150751b00000000000000000000000000000000000000000000000000000000906105f990830160209081019084016107fb565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b1561063557610635610630858361063b565b6106f6565b50505050565b60607fd19d65df6830e3cb0da1e12b8e9738e2dc473f830d8af813bcc031eb5a1675d183836040516024016106719291906108b1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b60006040828403121561070f578081fd5b6040516040810181811067ffffffffffffffff8211171561072e578283fd5b604052905080823561073f816109f7565b8152602083013561074f816109f7565b6020919091015292915050565b60006020828403121561076d578081fd5b8135610778816109f7565b9392505050565b600080600060808486031215610793578182fd5b833561079e816109f7565b925060208401356107ae816109f7565b91506107bd85604086016106fe565b90509250925092565b600080606083850312156107d8578182fd5b82356107e3816109f7565b91506107f284602085016106fe565b90509250929050565b60006020828403121561080c578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610778578182fd5b6000825161084d8184602087016109cb565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681528151831660208083019190915290910151909116604082015260600190565b600073ffffffffffffffffffffffffffffffffffffffff841682526040602083015282518060408401526108ec8160608501602087016109cb565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016060019392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b6020808252601f908201527f496e697469616c4d6967726174696f6e2f494e56414c49445f53454e44455200604082015260600190565b60005b838110156109e65781810151838201526020016109ce565b838111156106355750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114610a1957600080fd5b5056fea2646970667358221220a16f740e3543e464fb7b9ec07ebb663ade6c4e8e73c8add2a24ea1b0d4d96f6664736f6c634300060c0033",
"opcodes": "PUSH1 0xC0 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x40 MLOAD PUSH2 0xAFA CODESIZE SUB DUP1 PUSH2 0xAFA DUP4 CODECOPY DUP2 ADD PUSH1 0x40 DUP2 SWAP1 MSTORE PUSH2 0x2F SWAP2 PUSH2 0x4C JUMP JUMPDEST PUSH1 0x1 PUSH1 0x1 PUSH1 0x60 SHL SUB NOT PUSH1 0x60 SWAP2 DUP3 SHL AND PUSH1 0x80 MSTORE ADDRESS SWAP1 SHL PUSH1 0xA0 MSTORE PUSH2 0x7A JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x5D JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 MLOAD PUSH1 0x1 PUSH1 0x1 PUSH1 0xA0 SHL SUB DUP2 AND DUP2 EQ PUSH2 0x73 JUMPI DUP2 DUP3 REVERT JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x80 MLOAD PUSH1 0x60 SHR PUSH1 0xA0 MLOAD PUSH1 0x60 SHR PUSH2 0xA52 PUSH2 0xA8 PUSH1 0x0 CODECOPY DUP1 PUSH2 0x4CF MSTORE POP DUP1 PUSH2 0x2AA MSTORE DUP1 PUSH2 0x2E6 MSTORE POP PUSH2 0xA52 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 0x4C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x8CF7934 EQ PUSH2 0x51 JUMPI DUP1 PUSH4 0x5F136A4A EQ PUSH2 0x7A JUMPI DUP1 PUSH4 0xA23CE6CE EQ PUSH2 0x8F JUMPI DUP1 PUSH4 0xC9353CB5 EQ PUSH2 0xA2 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x64 PUSH2 0x5F CALLDATASIZE PUSH1 0x4 PUSH2 0x7C6 JUMP JUMPDEST PUSH2 0xB7 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x71 SWAP2 SWAP1 PUSH2 0x91F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x82 PUSH2 0x2A8 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x71 SWAP2 SWAP1 PUSH2 0x857 JUMP JUMPDEST PUSH2 0x82 PUSH2 0x9D CALLDATASIZE PUSH1 0x4 PUSH2 0x77F JUMP JUMPDEST PUSH2 0x2CC JUMP JUMPDEST PUSH2 0xB5 PUSH2 0xB0 CALLDATASIZE PUSH1 0x4 PUSH2 0x75C JUMP JUMPDEST PUSH2 0x4B7 JUMP JUMPDEST STOP JUMPDEST DUP1 MLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x4 DUP2 MSTORE PUSH1 0x24 DUP2 ADD SWAP1 SWAP2 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFB969B0A00000000000000000000000000000000000000000000000000000000 OR SWAP1 MSTORE PUSH1 0x0 SWAP2 PUSH2 0x11C SWAP2 PUSH2 0x53F JUMP JUMPDEST PUSH1 0x20 DUP1 DUP4 ADD MLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x4 DUP2 MSTORE PUSH1 0x24 DUP2 ADD SWAP1 SWAP2 MSTORE SWAP2 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFB969B0A00000000000000000000000000000000000000000000000000000000 OR SWAP1 MSTORE PUSH2 0x181 SWAP2 PUSH2 0x53F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x9DB64A4000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP1 PUSH4 0x9DB64A40 SWAP1 PUSH2 0x1E0 SWAP1 PUSH32 0xEE8BE1B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH1 0x0 SWAP1 PUSH1 0x4 ADD PUSH2 0x94C JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1FA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x20E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xF2FDE38B00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP3 POP PUSH4 0xF2FDE38B SWAP2 POP PUSH2 0x24E SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x857 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x268 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x27C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP PUSH32 0xD150751B00000000000000000000000000000000000000000000000000000000 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH32 0x0 AND EQ PUSH2 0x346 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x33D SWAP1 PUSH2 0x994 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x73F208D5 ADDRESS PUSH4 0x8CF7934 PUSH1 0xE0 SHL DUP8 DUP7 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x37E SWAP3 SWAP2 SWAP1 PUSH2 0x878 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 SWAP5 DUP6 AND OR SWAP1 MSTORE MLOAD PUSH1 0xE0 DUP6 SWAP1 SHL SWAP1 SWAP3 AND DUP3 MSTORE PUSH2 0x40F SWAP3 SWAP2 PUSH1 0x4 ADD PUSH2 0x8B1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x429 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x43D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xC9353CB500000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP3 POP PUSH4 0xC9353CB5 SWAP2 POP PUSH2 0x47D SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x857 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x497 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4AB JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP SWAP5 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH32 0x0 AND EQ PUSH2 0x526 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x33D SWAP1 PUSH2 0x994 JUMP JUMPDEST DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH1 0x40 MLOAD PUSH2 0x568 SWAP2 SWAP1 PUSH2 0x83B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP RETURNDATASIZE DUP1 PUSH1 0x0 DUP2 EQ PUSH2 0x5A3 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 0x5A8 JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP2 POP SWAP2 POP DUP2 ISZERO DUP1 PUSH2 0x5BC JUMPI POP DUP1 MLOAD PUSH1 0x20 EQ ISZERO JUMPDEST DUP1 PUSH2 0x61E JUMPI POP DUP1 MLOAD PUSH32 0xD150751B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x5F9 SWAP1 DUP4 ADD PUSH1 0x20 SWAP1 DUP2 ADD SWAP1 DUP5 ADD PUSH2 0x7FB JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x635 JUMPI PUSH2 0x635 PUSH2 0x630 DUP6 DUP4 PUSH2 0x63B JUMP JUMPDEST PUSH2 0x6F6 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH32 0xD19D65DF6830E3CB0DA1E12B8E9738E2DC473F830D8AF813BCC031EB5A1675D1 DUP4 DUP4 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x671 SWAP3 SWAP2 SWAP1 PUSH2 0x8B1 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 SWAP3 SWAP2 POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP3 ADD REVERT JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x70F JUMPI DUP1 DUP2 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x40 DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x72E JUMPI DUP3 DUP4 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP1 POP DUP1 DUP3 CALLDATALOAD PUSH2 0x73F DUP2 PUSH2 0x9F7 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH2 0x74F DUP2 PUSH2 0x9F7 JUMP JUMPDEST PUSH1 0x20 SWAP2 SWAP1 SWAP2 ADD MSTORE SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x76D JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x778 DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x80 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x793 JUMPI DUP2 DUP3 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH2 0x79E DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP3 POP PUSH1 0x20 DUP5 ADD CALLDATALOAD PUSH2 0x7AE DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP2 POP PUSH2 0x7BD DUP6 PUSH1 0x40 DUP7 ADD PUSH2 0x6FE JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x60 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x7D8 JUMPI DUP2 DUP3 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH2 0x7E3 DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP2 POP PUSH2 0x7F2 DUP5 PUSH1 0x20 DUP6 ADD PUSH2 0x6FE JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x80C JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND DUP2 EQ PUSH2 0x778 JUMPI DUP2 DUP3 REVERT JUMPDEST PUSH1 0x0 DUP3 MLOAD PUSH2 0x84D DUP2 DUP5 PUSH1 0x20 DUP8 ADD PUSH2 0x9CB 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 DUP2 MLOAD DUP4 AND PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 ADD MLOAD SWAP1 SWAP2 AND PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND DUP3 MSTORE PUSH1 0x40 PUSH1 0x20 DUP4 ADD MSTORE DUP3 MLOAD DUP1 PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x8EC DUP2 PUSH1 0x60 DUP6 ADD PUSH1 0x20 DUP8 ADD PUSH2 0x9CB JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP2 SWAP1 SWAP2 ADD PUSH1 0x60 ADD SWAP4 SWAP3 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 0x20 DUP1 DUP3 MSTORE PUSH1 0x1F SWAP1 DUP3 ADD MSTORE PUSH32 0x496E697469616C4D6967726174696F6E2F494E56414C49445F53454E44455200 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x9E6 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x9CE JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x635 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND DUP2 EQ PUSH2 0xA19 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 LOG1 PUSH16 0x740E3543E464FB7B9EC07EBB663ADE6C 0x4E DUP15 PUSH20 0xC8ADD2A24EA1B0D4D96F6664736F6C634300060C STOP CALLER ",
"sourceMap": "962:3875:13:-:0;;;1637:140;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;-1:-1:-1;;;;;;1693:36:13;;;;;;;1765:4;1739:31;;;;962:3875;;146:263:-1;;261:2;249:9;240:7;236:23;232:32;229:2;;;-1:-1;;267:12;229:2;83:13;;-1:-1;;;;;576:54;;701:35;;691:2;;-1:-1;;740:12;691:2;319:74;223:186;-1:-1;;;223:186::o;:::-;962:3875:13;;;;;;;;;;;;;;;;"
},
"deployedBytecode": {
"immutableReferences": {
"1297": [
{
"length": 32,
"start": 682
},
{
"length": 32,
"start": 742
}
],
"1300": [
{
"length": 32,
"start": 1231
}
]
},
"linkReferences": {},
"object": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806308cf7934146100515780635f136a4a1461007a578063a23ce6ce1461008f578063c9353cb5146100a2575b600080fd5b61006461005f3660046107c6565b6100b7565b604051610071919061091f565b60405180910390f35b6100826102a8565b6040516100719190610857565b61008261009d36600461077f565b6102cc565b6100b56100b036600461075c565b6104b7565b005b80516040805160048152602481019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167ffb969b0a0000000000000000000000000000000000000000000000000000000017905260009161011c9161053f565b60208083015160408051600481526024810190915291820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167ffb969b0a000000000000000000000000000000000000000000000000000000001790526101819161053f565b6040517f9db64a400000000000000000000000000000000000000000000000000000000081523090639db64a40906101e0907f0ee8be1b000000000000000000000000000000000000000000000000000000009060009060040161094c565b600060405180830381600087803b1580156101fa57600080fd5b505af115801561020e573d6000803e3d6000fd5b50506040517ff2fde38b00000000000000000000000000000000000000000000000000000000815230925063f2fde38b915061024e908690600401610857565b600060405180830381600087803b15801561026857600080fd5b505af115801561027c573d6000803e3d6000fd5b507fd150751b000000000000000000000000000000000000000000000000000000009695505050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610346576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033d90610994565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff166373f208d5306308cf793460e01b878660405160240161037e929190610878565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009485161790525160e085901b909216825261040f92916004016108b1565b600060405180830381600087803b15801561042957600080fd5b505af115801561043d573d6000803e3d6000fd5b50506040517fc9353cb500000000000000000000000000000000000000000000000000000000815230925063c9353cb5915061047d908790600401610857565b600060405180830381600087803b15801561049757600080fd5b505af11580156104ab573d6000803e3d6000fd5b50949695505050505050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610526576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161033d90610994565b8073ffffffffffffffffffffffffffffffffffffffff16ff5b600060608373ffffffffffffffffffffffffffffffffffffffff1683604051610568919061083b565b600060405180830381855af49150503d80600081146105a3576040519150601f19603f3d011682016040523d82523d6000602084013e6105a8565b606091505b50915091508115806105bc57508051602014155b8061061e575080517fd150751b00000000000000000000000000000000000000000000000000000000906105f990830160209081019084016107fb565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b1561063557610635610630858361063b565b6106f6565b50505050565b60607fd19d65df6830e3cb0da1e12b8e9738e2dc473f830d8af813bcc031eb5a1675d183836040516024016106719291906108b1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b805160208201fd5b60006040828403121561070f578081fd5b6040516040810181811067ffffffffffffffff8211171561072e578283fd5b604052905080823561073f816109f7565b8152602083013561074f816109f7565b6020919091015292915050565b60006020828403121561076d578081fd5b8135610778816109f7565b9392505050565b600080600060808486031215610793578182fd5b833561079e816109f7565b925060208401356107ae816109f7565b91506107bd85604086016106fe565b90509250925092565b600080606083850312156107d8578182fd5b82356107e3816109f7565b91506107f284602085016106fe565b90509250929050565b60006020828403121561080c578081fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610778578182fd5b6000825161084d8184602087016109cb565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681528151831660208083019190915290910151909116604082015260600190565b600073ffffffffffffffffffffffffffffffffffffffff841682526040602083015282518060408401526108ec8160608501602087016109cb565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016060019392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b6020808252601f908201527f496e697469616c4d6967726174696f6e2f494e56414c49445f53454e44455200604082015260600190565b60005b838110156109e65781810151838201526020016109ce565b838111156106355750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114610a1957600080fd5b5056fea2646970667358221220a16f740e3543e464fb7b9ec07ebb663ade6c4e8e73c8add2a24ea1b0d4d96f6664736f6c634300060c0033",
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x4C JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH4 0x8CF7934 EQ PUSH2 0x51 JUMPI DUP1 PUSH4 0x5F136A4A EQ PUSH2 0x7A JUMPI DUP1 PUSH4 0xA23CE6CE EQ PUSH2 0x8F JUMPI DUP1 PUSH4 0xC9353CB5 EQ PUSH2 0xA2 JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x64 PUSH2 0x5F CALLDATASIZE PUSH1 0x4 PUSH2 0x7C6 JUMP JUMPDEST PUSH2 0xB7 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x71 SWAP2 SWAP1 PUSH2 0x91F JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x82 PUSH2 0x2A8 JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH2 0x71 SWAP2 SWAP1 PUSH2 0x857 JUMP JUMPDEST PUSH2 0x82 PUSH2 0x9D CALLDATASIZE PUSH1 0x4 PUSH2 0x77F JUMP JUMPDEST PUSH2 0x2CC JUMP JUMPDEST PUSH2 0xB5 PUSH2 0xB0 CALLDATASIZE PUSH1 0x4 PUSH2 0x75C JUMP JUMPDEST PUSH2 0x4B7 JUMP JUMPDEST STOP JUMPDEST DUP1 MLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x4 DUP2 MSTORE PUSH1 0x24 DUP2 ADD SWAP1 SWAP2 MSTORE PUSH1 0x20 DUP2 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFB969B0A00000000000000000000000000000000000000000000000000000000 OR SWAP1 MSTORE PUSH1 0x0 SWAP2 PUSH2 0x11C SWAP2 PUSH2 0x53F JUMP JUMPDEST PUSH1 0x20 DUP1 DUP4 ADD MLOAD PUSH1 0x40 DUP1 MLOAD PUSH1 0x4 DUP2 MSTORE PUSH1 0x24 DUP2 ADD SWAP1 SWAP2 MSTORE SWAP2 DUP3 ADD DUP1 MLOAD PUSH28 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH32 0xFB969B0A00000000000000000000000000000000000000000000000000000000 OR SWAP1 MSTORE PUSH2 0x181 SWAP2 PUSH2 0x53F JUMP JUMPDEST PUSH1 0x40 MLOAD PUSH32 0x9DB64A4000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP1 PUSH4 0x9DB64A40 SWAP1 PUSH2 0x1E0 SWAP1 PUSH32 0xEE8BE1B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH1 0x0 SWAP1 PUSH1 0x4 ADD PUSH2 0x94C JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x1FA JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x20E JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xF2FDE38B00000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP3 POP PUSH4 0xF2FDE38B SWAP2 POP PUSH2 0x24E SWAP1 DUP7 SWAP1 PUSH1 0x4 ADD PUSH2 0x857 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x268 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x27C JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP PUSH32 0xD150751B00000000000000000000000000000000000000000000000000000000 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST PUSH32 0x0 DUP2 JUMP JUMPDEST PUSH1 0x0 CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH32 0x0 AND EQ PUSH2 0x346 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x33D SWAP1 PUSH2 0x994 JUMP JUMPDEST PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 REVERT JUMPDEST DUP3 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND PUSH4 0x73F208D5 ADDRESS PUSH4 0x8CF7934 PUSH1 0xE0 SHL DUP8 DUP7 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x37E SWAP3 SWAP2 SWAP1 PUSH2 0x878 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 SWAP5 DUP6 AND OR SWAP1 MSTORE MLOAD PUSH1 0xE0 DUP6 SWAP1 SHL SWAP1 SWAP3 AND DUP3 MSTORE PUSH2 0x40F SWAP3 SWAP2 PUSH1 0x4 ADD PUSH2 0x8B1 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x429 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x43D JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP POP PUSH1 0x40 MLOAD PUSH32 0xC9353CB500000000000000000000000000000000000000000000000000000000 DUP2 MSTORE ADDRESS SWAP3 POP PUSH4 0xC9353CB5 SWAP2 POP PUSH2 0x47D SWAP1 DUP8 SWAP1 PUSH1 0x4 ADD PUSH2 0x857 JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 PUSH1 0x0 DUP8 DUP1 EXTCODESIZE ISZERO DUP1 ISZERO PUSH2 0x497 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP GAS CALL ISZERO DUP1 ISZERO PUSH2 0x4AB JUMPI RETURNDATASIZE PUSH1 0x0 DUP1 RETURNDATACOPY RETURNDATASIZE PUSH1 0x0 REVERT JUMPDEST POP SWAP5 SWAP7 SWAP6 POP POP POP POP POP POP JUMP JUMPDEST CALLER PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF PUSH32 0x0 AND EQ PUSH2 0x526 JUMPI PUSH1 0x40 MLOAD PUSH32 0x8C379A000000000000000000000000000000000000000000000000000000000 DUP2 MSTORE PUSH1 0x4 ADD PUSH2 0x33D SWAP1 PUSH2 0x994 JUMP JUMPDEST DUP1 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND SELFDESTRUCT JUMPDEST PUSH1 0x0 PUSH1 0x60 DUP4 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF AND DUP4 PUSH1 0x40 MLOAD PUSH2 0x568 SWAP2 SWAP1 PUSH2 0x83B JUMP JUMPDEST PUSH1 0x0 PUSH1 0x40 MLOAD DUP1 DUP4 SUB DUP2 DUP6 GAS DELEGATECALL SWAP2 POP POP RETURNDATASIZE DUP1 PUSH1 0x0 DUP2 EQ PUSH2 0x5A3 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 0x5A8 JUMP JUMPDEST PUSH1 0x60 SWAP2 POP JUMPDEST POP SWAP2 POP SWAP2 POP DUP2 ISZERO DUP1 PUSH2 0x5BC JUMPI POP DUP1 MLOAD PUSH1 0x20 EQ ISZERO JUMPDEST DUP1 PUSH2 0x61E JUMPI POP DUP1 MLOAD PUSH32 0xD150751B00000000000000000000000000000000000000000000000000000000 SWAP1 PUSH2 0x5F9 SWAP1 DUP4 ADD PUSH1 0x20 SWAP1 DUP2 ADD SWAP1 DUP5 ADD PUSH2 0x7FB JUMP JUMPDEST PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 AND EQ ISZERO JUMPDEST ISZERO PUSH2 0x635 JUMPI PUSH2 0x635 PUSH2 0x630 DUP6 DUP4 PUSH2 0x63B JUMP JUMPDEST PUSH2 0x6F6 JUMP JUMPDEST POP POP POP POP JUMP JUMPDEST PUSH1 0x60 PUSH32 0xD19D65DF6830E3CB0DA1E12B8E9738E2DC473F830D8AF813BCC031EB5A1675D1 DUP4 DUP4 PUSH1 0x40 MLOAD PUSH1 0x24 ADD PUSH2 0x671 SWAP3 SWAP2 SWAP1 PUSH2 0x8B1 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 SWAP3 SWAP2 POP POP JUMP JUMPDEST DUP1 MLOAD PUSH1 0x20 DUP3 ADD REVERT JUMPDEST PUSH1 0x0 PUSH1 0x40 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x70F JUMPI DUP1 DUP2 REVERT JUMPDEST PUSH1 0x40 MLOAD PUSH1 0x40 DUP2 ADD DUP2 DUP2 LT PUSH8 0xFFFFFFFFFFFFFFFF DUP3 GT OR ISZERO PUSH2 0x72E JUMPI DUP3 DUP4 REVERT JUMPDEST PUSH1 0x40 MSTORE SWAP1 POP DUP1 DUP3 CALLDATALOAD PUSH2 0x73F DUP2 PUSH2 0x9F7 JUMP JUMPDEST DUP2 MSTORE PUSH1 0x20 DUP4 ADD CALLDATALOAD PUSH2 0x74F DUP2 PUSH2 0x9F7 JUMP JUMPDEST PUSH1 0x20 SWAP2 SWAP1 SWAP2 ADD MSTORE SWAP3 SWAP2 POP POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x76D JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 CALLDATALOAD PUSH2 0x778 DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP4 SWAP3 POP POP POP JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x0 PUSH1 0x80 DUP5 DUP7 SUB SLT ISZERO PUSH2 0x793 JUMPI DUP2 DUP3 REVERT JUMPDEST DUP4 CALLDATALOAD PUSH2 0x79E DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP3 POP PUSH1 0x20 DUP5 ADD CALLDATALOAD PUSH2 0x7AE DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP2 POP PUSH2 0x7BD DUP6 PUSH1 0x40 DUP7 ADD PUSH2 0x6FE JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 POP SWAP3 JUMP JUMPDEST PUSH1 0x0 DUP1 PUSH1 0x60 DUP4 DUP6 SUB SLT ISZERO PUSH2 0x7D8 JUMPI DUP2 DUP3 REVERT JUMPDEST DUP3 CALLDATALOAD PUSH2 0x7E3 DUP2 PUSH2 0x9F7 JUMP JUMPDEST SWAP2 POP PUSH2 0x7F2 DUP5 PUSH1 0x20 DUP6 ADD PUSH2 0x6FE JUMP JUMPDEST SWAP1 POP SWAP3 POP SWAP3 SWAP1 POP JUMP JUMPDEST PUSH1 0x0 PUSH1 0x20 DUP3 DUP5 SUB SLT ISZERO PUSH2 0x80C JUMPI DUP1 DUP2 REVERT JUMPDEST DUP2 MLOAD PUSH32 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000 DUP2 AND DUP2 EQ PUSH2 0x778 JUMPI DUP2 DUP3 REVERT JUMPDEST PUSH1 0x0 DUP3 MLOAD PUSH2 0x84D DUP2 DUP5 PUSH1 0x20 DUP8 ADD PUSH2 0x9CB 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 DUP2 MLOAD DUP4 AND PUSH1 0x20 DUP1 DUP4 ADD SWAP2 SWAP1 SWAP2 MSTORE SWAP1 SWAP2 ADD MLOAD SWAP1 SWAP2 AND PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP5 AND DUP3 MSTORE PUSH1 0x40 PUSH1 0x20 DUP4 ADD MSTORE DUP3 MLOAD DUP1 PUSH1 0x40 DUP5 ADD MSTORE PUSH2 0x8EC DUP2 PUSH1 0x60 DUP6 ADD PUSH1 0x20 DUP8 ADD PUSH2 0x9CB JUMP JUMPDEST PUSH1 0x1F ADD PUSH32 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE0 AND SWAP2 SWAP1 SWAP2 ADD PUSH1 0x60 ADD SWAP4 SWAP3 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 0x20 DUP1 DUP3 MSTORE PUSH1 0x1F SWAP1 DUP3 ADD MSTORE PUSH32 0x496E697469616C4D6967726174696F6E2F494E56414C49445F53454E44455200 PUSH1 0x40 DUP3 ADD MSTORE PUSH1 0x60 ADD SWAP1 JUMP JUMPDEST PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x9E6 JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x9CE JUMP JUMPDEST DUP4 DUP2 GT ISZERO PUSH2 0x635 JUMPI POP POP PUSH1 0x0 SWAP2 ADD MSTORE JUMP JUMPDEST PUSH20 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF DUP2 AND DUP2 EQ PUSH2 0xA19 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP JUMP INVALID LOG2 PUSH5 0x6970667358 0x22 SLT KECCAK256 LOG1 PUSH16 0x740E3543E464FB7B9EC07EBB663ADE6C 0x4E DUP15 PUSH20 0xC8ADD2A24EA1B0D4D96F6664736F6C634300060C STOP CALLER ",
"sourceMap": "962:3875:13:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3392:1114;;;;;;:::i;:::-;;:::i;:::-;;;;;;;:::i;:::-;;;;;;;;1290:41;;;:::i;:::-;;;;;;;:::i;2342:734::-;;;;;;:::i;:::-;;:::i;4651:184::-;;;;;;:::i;:::-;;:::i;:::-;;3392:1114;3719:17;;3751:102;;;;;;;;;;;;;;;;;;;3791:48;3751:102;;;3509:14;;3655:208;;:42;:208::i;:::-;3976:16;;;;;4007:87;;;;;;;;;;;;;;;;;;;4047:33;4007:87;;;3912:192;;:42;:192::i;:::-;4183:151;;;;;4221:4;;4183:53;;:151;;4250:50;;4322:1;;4183:151;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;4394:54:13;;;;;4417:4;;-1:-1:-1;4394:47:13;;-1:-1:-1;4394:54:13;;4442:5;;4394:54;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;4469:30:13;;3392:1114;-1:-1:-1;;;;;;3392:1114:13:o;1290:41::-;;;:::o;2342:734::-;2519:14;2616:10;:30;2630:16;2616:30;;2608:74;;;;;;;;;;;;:::i;:::-;;;;;;;;;2765:6;2739:44;;;2805:4;2847:23;;;2872:5;2879:8;2824:64;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;2739:159;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;3030:15:13;;;;;:4;;-1:-1:-1;3030:8:13;;-1:-1:-1;3030:15:13;;3039:5;;3030:15;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;3063:6:13;;2342:734;-1:-1:-1;;;;;;2342:734:13:o;4651:184::-;4727:10;:29;4741:15;4727:29;;4719:73;;;;;;;;;;;;:::i;:::-;4815:12;4802:26;;;1205:438:14;1333:12;1347:23;1374:6;:19;;1394:4;1374:25;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1332:67;;;;1414:7;1413:8;:47;;;;1437:10;:17;1458:2;1437:23;;1413:47;:116;;;-1:-1:-1;1476:32:14;;1512:17;;1476:32;;;;;;;;;;;;:::i;:::-;:53;;;;1413:116;1409:228;;;1553:73;:63;1597:6;1605:10;1553:43;:63::i;:::-;:71;:73::i;:::-;1205:438;;;;:::o;1606:314:3:-;1728:12;1806:52;1873:6;1893:10;1763:150;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1606:314:3;;;;:::o;1531:170:22:-;1674:9;1668:16;1661:4;1650:9;1646:20;1639:46;1041:544:-1;;1165:4;1153:9;1148:3;1144:19;1140:30;1137:2;;;-1:-1;;1173:12;1137:2;1165:4;9002:9;1165:4;9038:6;9034:17;9145:6;9133:10;9130:22;9109:18;9097:10;9094:34;9091:62;9088:2;;;-1:-1;;9156:12;9088:2;1165:4;9175:22;1192:29;-1:-1;1192:29;720:20;;745:71;720:20;745:71;:::i;:::-;1282:113;;1459:2;1535:22;;523:20;548:55;523:20;548:55;:::i;:::-;1459:2;1474:16;;;;1467:97;1131:454;;-1:-1;;1131:454::o;1592:257::-;;1704:2;1692:9;1683:7;1679:23;1675:32;1672:2;;;-1:-1;;1710:12;1672:2;230:6;217:20;242:41;277:5;242:41;:::i;:::-;1762:71;1666:183;-1:-1;;;1666:183::o;1856:606::-;;;;2051:3;2039:9;2030:7;2026:23;2022:33;2019:2;;;-1:-1;;2058:12;2019:2;230:6;217:20;242:41;277:5;242:41;:::i;:::-;2110:71;-1:-1;2218:2;2271:22;;909:20;934:47;909:20;934:47;:::i;:::-;2226:77;-1:-1;2358:88;2438:7;2340:2;2414:22;;2358:88;:::i;:::-;2348:98;;2013:449;;;;;:::o;2469:436::-;;;2625:2;2613:9;2604:7;2600:23;2596:32;2593:2;;;-1:-1;;2631:12;2593:2;85:6;72:20;97:33;124:5;97:33;:::i;:::-;2683:63;-1:-1;2801:88;2881:7;2783:2;2857:22;;2801:88;:::i;:::-;2791:98;;2587:318;;;;;:::o;2912:261::-;;3026:2;3014:9;3005:7;3001:23;2997:32;2994:2;;;-1:-1;;3032:12;2994:2;378:6;372:13;10109:66;12761:5;10098:78;12737:5;12734:34;12724:2;;-1:-1;;12772:12;5969:271;;4220:5;9296:12;4331:52;4376:6;4371:3;4364:4;4357:5;4353:16;4331:52;:::i;:::-;4395:16;;;;;6103:137;-1:-1;;6103:137::o;6247:222::-;10637:42;10626:54;;;;3416:45;;6374:2;6359:18;;6345:124::o;6737:505::-;10637:42;10626:54;;;3416:45;;5632:23;;10626:54;;7228:2;7213:18;;;4506:72;;;;5833:16;;;5827:23;10626:54;;;5926:14;;;4506:72;6978:2;6963:18;;6949:293::o;7249:417::-;;10637:42;3454:5;10626:54;3423:3;3416:45;7422:2;7540;7529:9;7525:18;7518:48;3852:5;9296:12;9452:6;7422:2;7411:9;7407:18;9440:19;3945:52;3990:6;9480:14;7411:9;9480:14;7540:2;3971:5;3967:16;3945:52;:::i;:::-;12395:2;12375:14;12391:7;12371:28;4009:39;;;;9480:14;4009:39;;7393:273;-1:-1;;;7393:273::o;7673:218::-;10109:66;10098:78;;;;3662:36;;7798:2;7783:18;;7769:122::o;7898:345::-;10109:66;10098:78;;;;3662:36;;10637:42;10626:54;8229:2;8214:18;;3259:58;8059:2;8044:18;;8030:213::o;8523:416::-;8723:2;8737:47;;;5191:2;8708:18;;;9440:19;5227:33;9480:14;;;5207:54;5280:12;;;8694:245::o;12031:268::-;12096:1;12103:101;12117:6;12114:1;12111:13;12103:101;;;12184:11;;;12178:18;12165:11;;;12158:39;12139:2;12132:10;12103:101;;;12219:6;12216:1;12213:13;12210:2;;;-1:-1;;12096:1;12266:16;;12259:27;12080:219::o;12412:117::-;10637:42;12499:5;10626:54;12474:5;12471:35;12461:2;;12520:1;;12510:12;12461:2;12455:74;:::o"
},
"methodIdentifiers": {
"bootstrap(address,(address,address))": "08cf7934",
"die(address)": "c9353cb5",
"initializeCaller()": "5f136a4a",
"initializeZeroEx(address,address,(address,address))": "a23ce6ce"
}
}
},
"sourceTreeHashHex": "0x168c39849d8b9c0c6fe2db4b39a8f9d0dce6bca6809904f8c7d95cfb85120f58",
"sources": {
"./InitialMigration.sol": {
"id": 13,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"../ZeroEx.sol\";\nimport \"../features/interfaces/IBootstrapFeature.sol\";\nimport \"../features/SimpleFunctionRegistryFeature.sol\";\nimport \"../features/OwnableFeature.sol\";\nimport \"./LibBootstrap.sol\";\n\n\n/// @dev A contract for deploying and configuring a minimal ZeroEx contract.\ncontract InitialMigration {\n\n /// @dev Features to bootstrap into the the proxy contract.\n struct BootstrapFeatures {\n SimpleFunctionRegistryFeature registry;\n OwnableFeature ownable;\n }\n\n /// @dev The allowed caller of `initializeZeroEx()`. In production, this would be\n /// the governor.\n address public immutable initializeCaller;\n /// @dev The real address of this contract.\n address private immutable _implementation;\n\n /// @dev Instantiate this contract and set the allowed caller of `initializeZeroEx()`\n /// to `initializeCaller_`.\n /// @param initializeCaller_ The allowed caller of `initializeZeroEx()`.\n constructor(address initializeCaller_) public {\n initializeCaller = initializeCaller_;\n _implementation = address(this);\n }\n\n /// @dev Initialize the `ZeroEx` contract with the minimum feature set,\n /// transfers ownership to `owner`, then self-destructs.\n /// Only callable by `initializeCaller` set in the contstructor.\n /// @param owner The owner of the contract.\n /// @param zeroEx The instance of the ZeroEx contract. ZeroEx should\n /// been constructed with this contract as the bootstrapper.\n /// @param features Features to bootstrap into the proxy.\n /// @return _zeroEx The configured ZeroEx contract. Same as the `zeroEx` parameter.\n function initializeZeroEx(\n address payable owner,\n ZeroEx zeroEx,\n BootstrapFeatures memory features\n )\n public\n virtual\n returns (ZeroEx _zeroEx)\n {\n // Must be called by the allowed initializeCaller.\n require(msg.sender == initializeCaller, \"InitialMigration/INVALID_SENDER\");\n\n // Bootstrap the initial feature set.\n IBootstrapFeature(address(zeroEx)).bootstrap(\n address(this),\n abi.encodeWithSelector(this.bootstrap.selector, owner, features)\n );\n\n // Self-destruct. This contract should not hold any funds but we send\n // them to the owner just in case.\n this.die(owner);\n\n return zeroEx;\n }\n\n /// @dev Sets up the initial state of the `ZeroEx` contract.\n /// The `ZeroEx` contract will delegatecall into this function.\n /// @param owner The new owner of the ZeroEx contract.\n /// @param features Features to bootstrap into the proxy.\n /// @return success Magic bytes if successful.\n function bootstrap(address owner, BootstrapFeatures memory features)\n public\n virtual\n returns (bytes4 success)\n {\n // Deploy and migrate the initial features.\n // Order matters here.\n\n // Initialize Registry.\n LibBootstrap.delegatecallBootstrapFunction(\n address(features.registry),\n abi.encodeWithSelector(\n SimpleFunctionRegistryFeature.bootstrap.selector\n )\n );\n\n // Initialize OwnableFeature.\n LibBootstrap.delegatecallBootstrapFunction(\n address(features.ownable),\n abi.encodeWithSelector(\n OwnableFeature.bootstrap.selector\n )\n );\n\n // De-register `SimpleFunctionRegistryFeature._extendSelf`.\n SimpleFunctionRegistryFeature(address(this)).rollback(\n SimpleFunctionRegistryFeature._extendSelf.selector,\n address(0)\n );\n\n // Transfer ownership to the real owner.\n OwnableFeature(address(this)).transferOwnership(owner);\n\n success = LibBootstrap.BOOTSTRAP_SUCCESS;\n }\n\n /// @dev Self-destructs this contract. Only callable by this contract.\n /// @param ethRecipient Who to transfer outstanding ETH to.\n function die(address payable ethRecipient) public virtual {\n require(msg.sender == _implementation, \"InitialMigration/INVALID_SENDER\");\n selfdestruct(ethRecipient);\n }\n}\n"
},
"../ZeroEx.sol": {
"id": 0,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol\";\nimport \"./migrations/LibBootstrap.sol\";\nimport \"./features/BootstrapFeature.sol\";\nimport \"./storage/LibProxyStorage.sol\";\nimport \"./errors/LibProxyRichErrors.sol\";\n\n\n/// @dev An extensible proxy contract that serves as a universal entry point for\n/// interacting with the 0x protocol.\ncontract ZeroEx {\n // solhint-disable separate-by-one-line-in-contract,indent,var-name-mixedcase\n using LibBytesV06 for bytes;\n\n /// @dev Construct this contract and register the `BootstrapFeature` feature.\n /// After constructing this contract, `bootstrap()` should be called\n /// by `bootstrap()` to seed the initial feature set.\n /// @param bootstrapper Who can call `bootstrap()`.\n constructor(address bootstrapper) public {\n // Temporarily create and register the bootstrap feature.\n // It will deregister itself after `bootstrap()` has been called.\n BootstrapFeature bootstrap = new BootstrapFeature(bootstrapper);\n LibProxyStorage.getStorage().impls[bootstrap.bootstrap.selector] =\n address(bootstrap);\n }\n\n // solhint-disable state-visibility\n\n /// @dev Forwards calls to the appropriate implementation contract.\n fallback() external payable {\n bytes4 selector = msg.data.readBytes4(0);\n address impl = getFunctionImplementation(selector);\n if (impl == address(0)) {\n _revertWithData(LibProxyRichErrors.NotImplementedError(selector));\n }\n\n (bool success, bytes memory resultData) = impl.delegatecall(msg.data);\n if (!success) {\n _revertWithData(resultData);\n }\n _returnWithData(resultData);\n }\n\n /// @dev Fallback for just receiving ether.\n receive() external payable {}\n\n // solhint-enable state-visibility\n\n /// @dev Get the implementation contract of a registered function.\n /// @param selector The function selector.\n /// @return impl The implementation contract address.\n function getFunctionImplementation(bytes4 selector)\n public\n view\n returns (address impl)\n {\n return LibProxyStorage.getStorage().impls[selector];\n }\n\n /// @dev Revert with arbitrary bytes.\n /// @param data Revert data.\n function _revertWithData(bytes memory data) private pure {\n assembly { revert(add(data, 32), mload(data)) }\n }\n\n /// @dev Return with arbitrary bytes.\n /// @param data Return data.\n function _returnWithData(bytes memory data) private pure {\n assembly { return(add(data, 32), mload(data)) }\n }\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/LibBytesV06.sol": {
"id": 20,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\nimport \"./errors/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": 21,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary 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"
},
"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol": {
"id": 22,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\nlibrary 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"
},
"./LibBootstrap.sol": {
"id": 14,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"../errors/LibProxyRichErrors.sol\";\n\n\nlibrary LibBootstrap {\n\n /// @dev Magic bytes returned by the bootstrapper to indicate success.\n /// This is `keccack('BOOTSTRAP_SUCCESS')`.\n bytes4 internal constant BOOTSTRAP_SUCCESS = 0xd150751b;\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 delegatecallBootstrapFunction(\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)) != BOOTSTRAP_SUCCESS)\n {\n LibProxyRichErrors.BootstrapCallFailedError(target, resultData).rrevert();\n }\n }\n}\n"
},
"../errors/LibProxyRichErrors.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;\n\n\nlibrary LibProxyRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function NotImplementedError(bytes4 selector)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"NotImplementedError(bytes4)\")),\n selector\n );\n }\n\n function InvalidBootstrapCallerError(address actual, address expected)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"InvalidBootstrapCallerError(address,address)\")),\n actual,\n expected\n );\n }\n\n function InvalidDieCallerError(address actual, address expected)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"InvalidDieCallerError(address,address)\")),\n actual,\n expected\n );\n }\n\n function BootstrapCallFailedError(address target, bytes memory resultData)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"BootstrapCallFailedError(address,bytes)\")),\n target,\n resultData\n );\n }\n}\n"
},
"../features/BootstrapFeature.sol": {
"id": 5,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"../migrations/LibBootstrap.sol\";\nimport \"../storage/LibProxyStorage.sol\";\nimport \"./interfaces/IBootstrapFeature.sol\";\n\n\n/// @dev Detachable `bootstrap()` feature.\ncontract BootstrapFeature is\n IBootstrapFeature\n{\n // solhint-disable state-visibility,indent\n /// @dev The ZeroEx contract.\n /// This has to be immutable to persist across delegatecalls.\n address immutable private _deployer;\n /// @dev The implementation address of this contract.\n /// This has to be immutable to persist across delegatecalls.\n address immutable private _implementation;\n /// @dev The deployer.\n /// This has to be immutable to persist across delegatecalls.\n address immutable private _bootstrapCaller;\n // solhint-enable state-visibility,indent\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Construct this contract and set the bootstrap migration contract.\n /// After constructing this contract, `bootstrap()` should be called\n /// to seed the initial feature set.\n /// @param bootstrapCaller The allowed caller of `bootstrap()`.\n constructor(address bootstrapCaller) public {\n _deployer = msg.sender;\n _implementation = address(this);\n _bootstrapCaller = bootstrapCaller;\n }\n\n /// @dev Bootstrap the initial feature set of this contract by delegatecalling\n /// into `target`. Before exiting the `bootstrap()` function will\n /// deregister itself from the proxy to prevent being called again.\n /// @param target The bootstrapper contract address.\n /// @param callData The call data to execute on `target`.\n function bootstrap(address target, bytes calldata callData) external override {\n // Only the bootstrap caller can call this function.\n if (msg.sender != _bootstrapCaller) {\n LibProxyRichErrors.InvalidBootstrapCallerError(\n msg.sender,\n _bootstrapCaller\n ).rrevert();\n }\n // Deregister.\n LibProxyStorage.getStorage().impls[this.bootstrap.selector] = address(0);\n // Self-destruct.\n BootstrapFeature(_implementation).die();\n // Call the bootstrapper.\n LibBootstrap.delegatecallBootstrapFunction(target, callData);\n }\n\n /// @dev Self-destructs this contract.\n /// Can only be called by the deployer.\n function die() external {\n assert(address(this) == _implementation);\n if (msg.sender != _deployer) {\n LibProxyRichErrors.InvalidDieCallerError(msg.sender, _deployer).rrevert();\n }\n selfdestruct(msg.sender);\n }\n}\n"
},
"../storage/LibProxyStorage.sol": {
"id": 17,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"./LibStorage.sol\";\n\n\n/// @dev Storage helpers for the proxy contract.\nlibrary LibProxyStorage {\n\n /// @dev Storage bucket for proxy contract.\n struct Storage {\n // Mapping of function selector -> function implementation\n mapping(bytes4 => address) impls;\n // The owner of the proxy contract.\n address owner;\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.Proxy\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": 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;\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"
},
"../features/interfaces/IBootstrapFeature.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\n\n/// @dev Detachable `bootstrap()` feature.\ninterface IBootstrapFeature {\n\n /// @dev Bootstrap the initial feature set of this contract by delegatecalling\n /// into `target`. Before exiting the `bootstrap()` function will\n /// deregister itself from the proxy to prevent being called again.\n /// @param target The bootstrapper contract address.\n /// @param callData The call data to execute on `target`.\n function bootstrap(address target, bytes calldata callData) external;\n}\n"
},
"../features/SimpleFunctionRegistryFeature.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\nimport \"@0x/contracts-utils/contracts/src/v06/errors/LibRichErrorsV06.sol\";\nimport \"../fixins/FixinCommon.sol\";\nimport \"../storage/LibProxyStorage.sol\";\nimport \"../storage/LibSimpleFunctionRegistryStorage.sol\";\nimport \"../errors/LibSimpleFunctionRegistryRichErrors.sol\";\nimport \"../migrations/LibBootstrap.sol\";\nimport \"./interfaces/IFeature.sol\";\nimport \"./interfaces/ISimpleFunctionRegistryFeature.sol\";\n\n\n/// @dev Basic registry management features.\ncontract SimpleFunctionRegistryFeature is\n IFeature,\n ISimpleFunctionRegistryFeature,\n FixinCommon\n{\n /// @dev Name of this feature.\n string public constant override FEATURE_NAME = \"SimpleFunctionRegistry\";\n /// @dev Version of this feature.\n uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Initializes this feature, registering its own functions.\n /// @return success Magic bytes if successful.\n function bootstrap()\n external\n returns (bytes4 success)\n {\n // Register the registration functions (inception vibes).\n _extend(this.extend.selector, _implementation);\n _extend(this._extendSelf.selector, _implementation);\n // Register the rollback function.\n _extend(this.rollback.selector, _implementation);\n // Register getters.\n _extend(this.getRollbackLength.selector, _implementation);\n _extend(this.getRollbackEntryAtIndex.selector, _implementation);\n return LibBootstrap.BOOTSTRAP_SUCCESS;\n }\n\n /// @dev Roll back to a prior implementation of a function.\n /// Only directly callable by an authority.\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)\n external\n override\n onlyOwner\n {\n (\n LibSimpleFunctionRegistryStorage.Storage storage stor,\n LibProxyStorage.Storage storage proxyStor\n ) = _getStorages();\n\n address currentImpl = proxyStor.impls[selector];\n if (currentImpl == targetImpl) {\n // Do nothing if already at targetImpl.\n return;\n }\n // Walk history backwards until we find the target implementation.\n address[] storage history = stor.implHistory[selector];\n uint256 i = history.length;\n for (; i > 0; --i) {\n address impl = history[i - 1];\n history.pop();\n if (impl == targetImpl) {\n break;\n }\n }\n if (i == 0) {\n LibSimpleFunctionRegistryRichErrors.NotInRollbackHistoryError(\n selector,\n targetImpl\n ).rrevert();\n }\n proxyStor.impls[selector] = targetImpl;\n emit ProxyFunctionUpdated(selector, currentImpl, targetImpl);\n }\n\n /// @dev Register or replace a function.\n /// Only directly callable by an authority.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function extend(bytes4 selector, address impl)\n external\n override\n onlyOwner\n {\n _extend(selector, impl);\n }\n\n /// @dev Register or replace a function.\n /// Only callable from within.\n /// This function is only used during the bootstrap process and\n /// should be deregistered by the deployer after bootstrapping is\n /// complete.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function _extendSelf(bytes4 selector, address impl)\n external\n onlySelf\n {\n _extend(selector, impl);\n }\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 override\n view\n returns (uint256 rollbackLength)\n {\n return LibSimpleFunctionRegistryStorage.getStorage().implHistory[selector].length;\n }\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 override\n view\n returns (address impl)\n {\n return LibSimpleFunctionRegistryStorage.getStorage().implHistory[selector][idx];\n }\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)\n private\n {\n (\n LibSimpleFunctionRegistryStorage.Storage storage stor,\n LibProxyStorage.Storage storage proxyStor\n ) = _getStorages();\n\n address oldImpl = proxyStor.impls[selector];\n address[] storage history = stor.implHistory[selector];\n history.push(oldImpl);\n proxyStor.impls[selector] = impl;\n emit ProxyFunctionUpdated(selector, oldImpl, impl);\n }\n\n /// @dev Get the storage buckets for this feature and the proxy.\n /// @return stor Storage bucket for this feature.\n /// @return proxyStor age bucket for the proxy.\n function _getStorages()\n private\n pure\n returns (\n LibSimpleFunctionRegistryStorage.Storage storage stor,\n LibProxyStorage.Storage storage proxyStor\n )\n {\n return (\n LibSimpleFunctionRegistryStorage.getStorage(),\n LibProxyStorage.getStorage()\n );\n }\n}\n"
},
"../fixins/FixinCommon.sol": {
"id": 12,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-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": 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 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": 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 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"
},
"../features/interfaces/IOwnableFeature.sol": {
"id": 10,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol\";\n\n\n// solhint-disable no-empty-blocks\n/// @dev Owner management and migration features.\ninterface IOwnableFeature is\n IOwnableV06\n{\n /// @dev Emitted when `migrate()` is called.\n /// @param caller The caller of `migrate()`.\n /// @param migrator The migration contract.\n /// @param newOwner The address of the new owner.\n event Migrated(address caller, address migrator, address newOwner);\n\n /// @dev Execute a migration function in the context of the ZeroEx contract.\n /// The result of the function being called should be the magic bytes\n /// 0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner.\n /// The owner will be temporarily set to `address(this)` inside the call.\n /// Before returning, the owner will be set to `newOwner`.\n /// @param target The migrator contract address.\n /// @param newOwner The address of the new owner.\n /// @param data The call data.\n function migrate(address target, bytes calldata data, address newOwner) external;\n}\n"
},
"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol": {
"id": 23,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\ninterface IOwnableV06 {\n\n /// @dev Emitted by Ownable when ownership is transferred.\n /// @param previousOwner The previous owner of the contract.\n /// @param newOwner The new owner of the contract.\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /// @dev Transfers ownership of the contract to a new address.\n /// @param newOwner The address that will become the owner.\n function transferOwnership(address newOwner) external;\n\n /// @dev The owner of this contract.\n /// @return ownerAddress The owner address.\n function owner() external view returns (address ownerAddress);\n}\n"
},
"../features/interfaces/ISimpleFunctionRegistryFeature.sol": {
"id": 11,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\n\n/// @dev Basic registry management features.\ninterface ISimpleFunctionRegistryFeature {\n\n /// @dev A function implementation was updated via `extend()` or `rollback()`.\n /// @param selector The function selector.\n /// @param oldImpl The implementation contract address being replaced.\n /// @param newImpl The replacement implementation contract address.\n event ProxyFunctionUpdated(bytes4 indexed selector, address oldImpl, address newImpl);\n\n /// @dev Roll back to a prior implementation of a function.\n /// @param selector The function selector.\n /// @param targetImpl The address of an older implementation of the function.\n function rollback(bytes4 selector, address targetImpl) external;\n\n /// @dev Register or replace a function.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function extend(bytes4 selector, address impl) external;\n\n /// @dev Retrieve the length of the rollback history for a function.\n /// @param selector The function selector.\n /// @return rollbackLength The number of items in the rollback history for\n /// the function.\n function getRollbackLength(bytes4 selector)\n external\n view\n returns (uint256 rollbackLength);\n\n /// @dev Retrieve an entry in the rollback history for a function.\n /// @param selector The function selector.\n /// @param idx The index in the rollback history.\n /// @return impl An implementation address for the function at\n /// index `idx`.\n function getRollbackEntryAtIndex(bytes4 selector, uint256 idx)\n external\n view\n returns (address impl);\n}\n"
},
"../storage/LibSimpleFunctionRegistryStorage.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;\npragma experimental ABIEncoderV2;\n\nimport \"./LibStorage.sol\";\n\n\n/// @dev Storage helpers for the `SimpleFunctionRegistry` feature.\nlibrary LibSimpleFunctionRegistryStorage {\n\n /// @dev Storage bucket for this feature.\n struct Storage {\n // Mapping of function selector -> implementation history.\n mapping(bytes4 => address[]) implHistory;\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.SimpleFunctionRegistry\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"
},
"../errors/LibSimpleFunctionRegistryRichErrors.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;\n\n\nlibrary LibSimpleFunctionRegistryRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function NotInRollbackHistoryError(bytes4 selector, address targetImpl)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"NotInRollbackHistoryError(bytes4,address)\")),\n selector,\n targetImpl\n );\n }\n}\n"
},
"../features/interfaces/IFeature.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\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"
},
"../features/OwnableFeature.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/errors/LibRichErrorsV06.sol\";\nimport \"../fixins/FixinCommon.sol\";\nimport \"../errors/LibOwnableRichErrors.sol\";\nimport \"../storage/LibOwnableStorage.sol\";\nimport \"../migrations/LibBootstrap.sol\";\nimport \"../migrations/LibMigrate.sol\";\nimport \"./interfaces/IFeature.sol\";\nimport \"./interfaces/IOwnableFeature.sol\";\nimport \"./SimpleFunctionRegistryFeature.sol\";\n\n\n/// @dev Owner management features.\ncontract OwnableFeature is\n IFeature,\n IOwnableFeature,\n FixinCommon\n{\n\n /// @dev Name of this feature.\n string public constant override FEATURE_NAME = \"Ownable\";\n /// @dev Version of this feature.\n uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Initializes this feature. The intial owner will be set to this (ZeroEx)\n /// to allow the bootstrappers to call `extend()`. Ownership should be\n /// transferred to the real owner by the bootstrapper after\n /// bootstrapping is complete.\n /// @return success Magic bytes if successful.\n function bootstrap() external returns (bytes4 success) {\n // Set the owner to ourselves to allow bootstrappers to call `extend()`.\n LibOwnableStorage.getStorage().owner = address(this);\n\n // Register feature functions.\n SimpleFunctionRegistryFeature(address(this))._extendSelf(this.transferOwnership.selector, _implementation);\n SimpleFunctionRegistryFeature(address(this))._extendSelf(this.owner.selector, _implementation);\n SimpleFunctionRegistryFeature(address(this))._extendSelf(this.migrate.selector, _implementation);\n return LibBootstrap.BOOTSTRAP_SUCCESS;\n }\n\n /// @dev Change the owner of this contract.\n /// Only directly callable by the owner.\n /// @param newOwner New owner address.\n function transferOwnership(address newOwner)\n external\n override\n onlyOwner\n {\n LibOwnableStorage.Storage storage proxyStor = LibOwnableStorage.getStorage();\n\n if (newOwner == address(0)) {\n LibOwnableRichErrors.TransferOwnerToZeroError().rrevert();\n } else {\n proxyStor.owner = newOwner;\n emit OwnershipTransferred(msg.sender, newOwner);\n }\n }\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 /// Temporarily sets the owner to ourselves so we can perform admin functions.\n /// Before returning, the owner will be set to `newOwner`.\n /// @param target The migrator contract address.\n /// @param data The call data.\n /// @param newOwner The address of the new owner.\n function migrate(address target, bytes calldata data, address newOwner)\n external\n override\n onlyOwner\n {\n if (newOwner == address(0)) {\n LibOwnableRichErrors.TransferOwnerToZeroError().rrevert();\n }\n\n LibOwnableStorage.Storage storage stor = LibOwnableStorage.getStorage();\n // The owner will be temporarily set to `address(this)` inside the call.\n stor.owner = address(this);\n\n // Perform the migration.\n LibMigrate.delegatecallMigrateFunction(target, data);\n\n // Update the owner.\n stor.owner = newOwner;\n\n emit Migrated(msg.sender, target, newOwner);\n }\n\n /// @dev Get the owner of this contract.\n /// @return owner_ The owner of this contract.\n function owner() external override view returns (address owner_) {\n return LibOwnableStorage.getStorage().owner;\n }\n}\n"
},
"../storage/LibOwnableStorage.sol": {
"id": 16,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"./LibStorage.sol\";\n\n\n/// @dev Storage helpers for the `Ownable` feature.\nlibrary LibOwnableStorage {\n\n /// @dev Storage bucket for this feature.\n struct Storage {\n // The owner of this contract.\n address owner;\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.Ownable\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"
},
"./LibMigrate.sol": {
"id": 15,
"content": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-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"
}
},
"sourceCodes": {
"./InitialMigration.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 \"../ZeroEx.sol\";\nimport \"../features/interfaces/IBootstrapFeature.sol\";\nimport \"../features/SimpleFunctionRegistryFeature.sol\";\nimport \"../features/OwnableFeature.sol\";\nimport \"./LibBootstrap.sol\";\n\n\n/// @dev A contract for deploying and configuring a minimal ZeroEx contract.\ncontract InitialMigration {\n\n /// @dev Features to bootstrap into the the proxy contract.\n struct BootstrapFeatures {\n SimpleFunctionRegistryFeature registry;\n OwnableFeature ownable;\n }\n\n /// @dev The allowed caller of `initializeZeroEx()`. In production, this would be\n /// the governor.\n address public immutable initializeCaller;\n /// @dev The real address of this contract.\n address private immutable _implementation;\n\n /// @dev Instantiate this contract and set the allowed caller of `initializeZeroEx()`\n /// to `initializeCaller_`.\n /// @param initializeCaller_ The allowed caller of `initializeZeroEx()`.\n constructor(address initializeCaller_) public {\n initializeCaller = initializeCaller_;\n _implementation = address(this);\n }\n\n /// @dev Initialize the `ZeroEx` contract with the minimum feature set,\n /// transfers ownership to `owner`, then self-destructs.\n /// Only callable by `initializeCaller` set in the contstructor.\n /// @param owner The owner of the contract.\n /// @param zeroEx The instance of the ZeroEx contract. ZeroEx should\n /// been constructed with this contract as the bootstrapper.\n /// @param features Features to bootstrap into the proxy.\n /// @return _zeroEx The configured ZeroEx contract. Same as the `zeroEx` parameter.\n function initializeZeroEx(\n address payable owner,\n ZeroEx zeroEx,\n BootstrapFeatures memory features\n )\n public\n virtual\n returns (ZeroEx _zeroEx)\n {\n // Must be called by the allowed initializeCaller.\n require(msg.sender == initializeCaller, \"InitialMigration/INVALID_SENDER\");\n\n // Bootstrap the initial feature set.\n IBootstrapFeature(address(zeroEx)).bootstrap(\n address(this),\n abi.encodeWithSelector(this.bootstrap.selector, owner, features)\n );\n\n // Self-destruct. This contract should not hold any funds but we send\n // them to the owner just in case.\n this.die(owner);\n\n return zeroEx;\n }\n\n /// @dev Sets up the initial state of the `ZeroEx` contract.\n /// The `ZeroEx` contract will delegatecall into this function.\n /// @param owner The new owner of the ZeroEx contract.\n /// @param features Features to bootstrap into the proxy.\n /// @return success Magic bytes if successful.\n function bootstrap(address owner, BootstrapFeatures memory features)\n public\n virtual\n returns (bytes4 success)\n {\n // Deploy and migrate the initial features.\n // Order matters here.\n\n // Initialize Registry.\n LibBootstrap.delegatecallBootstrapFunction(\n address(features.registry),\n abi.encodeWithSelector(\n SimpleFunctionRegistryFeature.bootstrap.selector\n )\n );\n\n // Initialize OwnableFeature.\n LibBootstrap.delegatecallBootstrapFunction(\n address(features.ownable),\n abi.encodeWithSelector(\n OwnableFeature.bootstrap.selector\n )\n );\n\n // De-register `SimpleFunctionRegistryFeature._extendSelf`.\n SimpleFunctionRegistryFeature(address(this)).rollback(\n SimpleFunctionRegistryFeature._extendSelf.selector,\n address(0)\n );\n\n // Transfer ownership to the real owner.\n OwnableFeature(address(this)).transferOwnership(owner);\n\n success = LibBootstrap.BOOTSTRAP_SUCCESS;\n }\n\n /// @dev Self-destructs this contract. Only callable by this contract.\n /// @param ethRecipient Who to transfer outstanding ETH to.\n function die(address payable ethRecipient) public virtual {\n require(msg.sender == _implementation, \"InitialMigration/INVALID_SENDER\");\n selfdestruct(ethRecipient);\n }\n}\n",
"../ZeroEx.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/LibBytesV06.sol\";\nimport \"./migrations/LibBootstrap.sol\";\nimport \"./features/BootstrapFeature.sol\";\nimport \"./storage/LibProxyStorage.sol\";\nimport \"./errors/LibProxyRichErrors.sol\";\n\n\n/// @dev An extensible proxy contract that serves as a universal entry point for\n/// interacting with the 0x protocol.\ncontract ZeroEx {\n // solhint-disable separate-by-one-line-in-contract,indent,var-name-mixedcase\n using LibBytesV06 for bytes;\n\n /// @dev Construct this contract and register the `BootstrapFeature` feature.\n /// After constructing this contract, `bootstrap()` should be called\n /// by `bootstrap()` to seed the initial feature set.\n /// @param bootstrapper Who can call `bootstrap()`.\n constructor(address bootstrapper) public {\n // Temporarily create and register the bootstrap feature.\n // It will deregister itself after `bootstrap()` has been called.\n BootstrapFeature bootstrap = new BootstrapFeature(bootstrapper);\n LibProxyStorage.getStorage().impls[bootstrap.bootstrap.selector] =\n address(bootstrap);\n }\n\n // solhint-disable state-visibility\n\n /// @dev Forwards calls to the appropriate implementation contract.\n fallback() external payable {\n bytes4 selector = msg.data.readBytes4(0);\n address impl = getFunctionImplementation(selector);\n if (impl == address(0)) {\n _revertWithData(LibProxyRichErrors.NotImplementedError(selector));\n }\n\n (bool success, bytes memory resultData) = impl.delegatecall(msg.data);\n if (!success) {\n _revertWithData(resultData);\n }\n _returnWithData(resultData);\n }\n\n /// @dev Fallback for just receiving ether.\n receive() external payable {}\n\n // solhint-enable state-visibility\n\n /// @dev Get the implementation contract of a registered function.\n /// @param selector The function selector.\n /// @return impl The implementation contract address.\n function getFunctionImplementation(bytes4 selector)\n public\n view\n returns (address impl)\n {\n return LibProxyStorage.getStorage().impls[selector];\n }\n\n /// @dev Revert with arbitrary bytes.\n /// @param data Revert data.\n function _revertWithData(bytes memory data) private pure {\n assembly { revert(add(data, 32), mload(data)) }\n }\n\n /// @dev Return with arbitrary bytes.\n /// @param data Return data.\n function _returnWithData(bytes memory data) private pure {\n assembly { return(add(data, 32), mload(data)) }\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",
"@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",
"./LibBootstrap.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/LibProxyRichErrors.sol\";\n\n\nlibrary LibBootstrap {\n\n /// @dev Magic bytes returned by the bootstrapper to indicate success.\n /// This is `keccack('BOOTSTRAP_SUCCESS')`.\n bytes4 internal constant BOOTSTRAP_SUCCESS = 0xd150751b;\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 delegatecallBootstrapFunction(\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)) != BOOTSTRAP_SUCCESS)\n {\n LibProxyRichErrors.BootstrapCallFailedError(target, resultData).rrevert();\n }\n }\n}\n",
"../errors/LibProxyRichErrors.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 LibProxyRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function NotImplementedError(bytes4 selector)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"NotImplementedError(bytes4)\")),\n selector\n );\n }\n\n function InvalidBootstrapCallerError(address actual, address expected)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"InvalidBootstrapCallerError(address,address)\")),\n actual,\n expected\n );\n }\n\n function InvalidDieCallerError(address actual, address expected)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"InvalidDieCallerError(address,address)\")),\n actual,\n expected\n );\n }\n\n function BootstrapCallFailedError(address target, bytes memory resultData)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"BootstrapCallFailedError(address,bytes)\")),\n target,\n resultData\n );\n }\n}\n",
"../features/BootstrapFeature.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 \"../migrations/LibBootstrap.sol\";\nimport \"../storage/LibProxyStorage.sol\";\nimport \"./interfaces/IBootstrapFeature.sol\";\n\n\n/// @dev Detachable `bootstrap()` feature.\ncontract BootstrapFeature is\n IBootstrapFeature\n{\n // solhint-disable state-visibility,indent\n /// @dev The ZeroEx contract.\n /// This has to be immutable to persist across delegatecalls.\n address immutable private _deployer;\n /// @dev The implementation address of this contract.\n /// This has to be immutable to persist across delegatecalls.\n address immutable private _implementation;\n /// @dev The deployer.\n /// This has to be immutable to persist across delegatecalls.\n address immutable private _bootstrapCaller;\n // solhint-enable state-visibility,indent\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Construct this contract and set the bootstrap migration contract.\n /// After constructing this contract, `bootstrap()` should be called\n /// to seed the initial feature set.\n /// @param bootstrapCaller The allowed caller of `bootstrap()`.\n constructor(address bootstrapCaller) public {\n _deployer = msg.sender;\n _implementation = address(this);\n _bootstrapCaller = bootstrapCaller;\n }\n\n /// @dev Bootstrap the initial feature set of this contract by delegatecalling\n /// into `target`. Before exiting the `bootstrap()` function will\n /// deregister itself from the proxy to prevent being called again.\n /// @param target The bootstrapper contract address.\n /// @param callData The call data to execute on `target`.\n function bootstrap(address target, bytes calldata callData) external override {\n // Only the bootstrap caller can call this function.\n if (msg.sender != _bootstrapCaller) {\n LibProxyRichErrors.InvalidBootstrapCallerError(\n msg.sender,\n _bootstrapCaller\n ).rrevert();\n }\n // Deregister.\n LibProxyStorage.getStorage().impls[this.bootstrap.selector] = address(0);\n // Self-destruct.\n BootstrapFeature(_implementation).die();\n // Call the bootstrapper.\n LibBootstrap.delegatecallBootstrapFunction(target, callData);\n }\n\n /// @dev Self-destructs this contract.\n /// Can only be called by the deployer.\n function die() external {\n assert(address(this) == _implementation);\n if (msg.sender != _deployer) {\n LibProxyRichErrors.InvalidDieCallerError(msg.sender, _deployer).rrevert();\n }\n selfdestruct(msg.sender);\n }\n}\n",
"../storage/LibProxyStorage.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\";\n\n\n/// @dev Storage helpers for the proxy contract.\nlibrary LibProxyStorage {\n\n /// @dev Storage bucket for proxy contract.\n struct Storage {\n // Mapping of function selector -> function implementation\n mapping(bytes4 => address) impls;\n // The owner of the proxy contract.\n address owner;\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.Proxy\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",
"../features/interfaces/IBootstrapFeature.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 Detachable `bootstrap()` feature.\ninterface IBootstrapFeature {\n\n /// @dev Bootstrap the initial feature set of this contract by delegatecalling\n /// into `target`. Before exiting the `bootstrap()` function will\n /// deregister itself from the proxy to prevent being called again.\n /// @param target The bootstrapper contract address.\n /// @param callData The call data to execute on `target`.\n function bootstrap(address target, bytes calldata callData) external;\n}\n",
"../features/SimpleFunctionRegistryFeature.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 \"../fixins/FixinCommon.sol\";\nimport \"../storage/LibProxyStorage.sol\";\nimport \"../storage/LibSimpleFunctionRegistryStorage.sol\";\nimport \"../errors/LibSimpleFunctionRegistryRichErrors.sol\";\nimport \"../migrations/LibBootstrap.sol\";\nimport \"./interfaces/IFeature.sol\";\nimport \"./interfaces/ISimpleFunctionRegistryFeature.sol\";\n\n\n/// @dev Basic registry management features.\ncontract SimpleFunctionRegistryFeature is\n IFeature,\n ISimpleFunctionRegistryFeature,\n FixinCommon\n{\n /// @dev Name of this feature.\n string public constant override FEATURE_NAME = \"SimpleFunctionRegistry\";\n /// @dev Version of this feature.\n uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Initializes this feature, registering its own functions.\n /// @return success Magic bytes if successful.\n function bootstrap()\n external\n returns (bytes4 success)\n {\n // Register the registration functions (inception vibes).\n _extend(this.extend.selector, _implementation);\n _extend(this._extendSelf.selector, _implementation);\n // Register the rollback function.\n _extend(this.rollback.selector, _implementation);\n // Register getters.\n _extend(this.getRollbackLength.selector, _implementation);\n _extend(this.getRollbackEntryAtIndex.selector, _implementation);\n return LibBootstrap.BOOTSTRAP_SUCCESS;\n }\n\n /// @dev Roll back to a prior implementation of a function.\n /// Only directly callable by an authority.\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)\n external\n override\n onlyOwner\n {\n (\n LibSimpleFunctionRegistryStorage.Storage storage stor,\n LibProxyStorage.Storage storage proxyStor\n ) = _getStorages();\n\n address currentImpl = proxyStor.impls[selector];\n if (currentImpl == targetImpl) {\n // Do nothing if already at targetImpl.\n return;\n }\n // Walk history backwards until we find the target implementation.\n address[] storage history = stor.implHistory[selector];\n uint256 i = history.length;\n for (; i > 0; --i) {\n address impl = history[i - 1];\n history.pop();\n if (impl == targetImpl) {\n break;\n }\n }\n if (i == 0) {\n LibSimpleFunctionRegistryRichErrors.NotInRollbackHistoryError(\n selector,\n targetImpl\n ).rrevert();\n }\n proxyStor.impls[selector] = targetImpl;\n emit ProxyFunctionUpdated(selector, currentImpl, targetImpl);\n }\n\n /// @dev Register or replace a function.\n /// Only directly callable by an authority.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function extend(bytes4 selector, address impl)\n external\n override\n onlyOwner\n {\n _extend(selector, impl);\n }\n\n /// @dev Register or replace a function.\n /// Only callable from within.\n /// This function is only used during the bootstrap process and\n /// should be deregistered by the deployer after bootstrapping is\n /// complete.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function _extendSelf(bytes4 selector, address impl)\n external\n onlySelf\n {\n _extend(selector, impl);\n }\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 override\n view\n returns (uint256 rollbackLength)\n {\n return LibSimpleFunctionRegistryStorage.getStorage().implHistory[selector].length;\n }\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 override\n view\n returns (address impl)\n {\n return LibSimpleFunctionRegistryStorage.getStorage().implHistory[selector][idx];\n }\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)\n private\n {\n (\n LibSimpleFunctionRegistryStorage.Storage storage stor,\n LibProxyStorage.Storage storage proxyStor\n ) = _getStorages();\n\n address oldImpl = proxyStor.impls[selector];\n address[] storage history = stor.implHistory[selector];\n history.push(oldImpl);\n proxyStor.impls[selector] = impl;\n emit ProxyFunctionUpdated(selector, oldImpl, impl);\n }\n\n /// @dev Get the storage buckets for this feature and the proxy.\n /// @return stor Storage bucket for this feature.\n /// @return proxyStor age bucket for the proxy.\n function _getStorages()\n private\n pure\n returns (\n LibSimpleFunctionRegistryStorage.Storage storage stor,\n LibProxyStorage.Storage storage proxyStor\n )\n {\n return (\n LibSimpleFunctionRegistryStorage.getStorage(),\n LibProxyStorage.getStorage()\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",
"../features/interfaces/IOwnableFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\nimport \"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol\";\n\n\n// solhint-disable no-empty-blocks\n/// @dev Owner management and migration features.\ninterface IOwnableFeature is\n IOwnableV06\n{\n /// @dev Emitted when `migrate()` is called.\n /// @param caller The caller of `migrate()`.\n /// @param migrator The migration contract.\n /// @param newOwner The address of the new owner.\n event Migrated(address caller, address migrator, address newOwner);\n\n /// @dev Execute a migration function in the context of the ZeroEx contract.\n /// The result of the function being called should be the magic bytes\n /// 0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner.\n /// The owner will be temporarily set to `address(this)` inside the call.\n /// Before returning, the owner will be set to `newOwner`.\n /// @param target The migrator contract address.\n /// @param newOwner The address of the new owner.\n /// @param data The call data.\n function migrate(address target, bytes calldata data, address newOwner) external;\n}\n",
"@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\n\n\ninterface IOwnableV06 {\n\n /// @dev Emitted by Ownable when ownership is transferred.\n /// @param previousOwner The previous owner of the contract.\n /// @param newOwner The new owner of the contract.\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /// @dev Transfers ownership of the contract to a new address.\n /// @param newOwner The address that will become the owner.\n function transferOwnership(address newOwner) external;\n\n /// @dev The owner of this contract.\n /// @return ownerAddress The owner address.\n function owner() external view returns (address ownerAddress);\n}\n",
"../features/interfaces/ISimpleFunctionRegistryFeature.sol": "// SPDX-License-Identifier: Apache-2.0\n/*\n\n Copyright 2020 ZeroEx Intl.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n*/\n\npragma solidity ^0.6.5;\npragma experimental ABIEncoderV2;\n\n\n/// @dev Basic registry management features.\ninterface ISimpleFunctionRegistryFeature {\n\n /// @dev A function implementation was updated via `extend()` or `rollback()`.\n /// @param selector The function selector.\n /// @param oldImpl The implementation contract address being replaced.\n /// @param newImpl The replacement implementation contract address.\n event ProxyFunctionUpdated(bytes4 indexed selector, address oldImpl, address newImpl);\n\n /// @dev Roll back to a prior implementation of a function.\n /// @param selector The function selector.\n /// @param targetImpl The address of an older implementation of the function.\n function rollback(bytes4 selector, address targetImpl) external;\n\n /// @dev Register or replace a function.\n /// @param selector The function selector.\n /// @param impl The implementation contract for the function.\n function extend(bytes4 selector, address impl) external;\n\n /// @dev Retrieve the length of the rollback history for a function.\n /// @param selector The function selector.\n /// @return rollbackLength The number of items in the rollback history for\n /// the function.\n function getRollbackLength(bytes4 selector)\n external\n view\n returns (uint256 rollbackLength);\n\n /// @dev Retrieve an entry in the rollback history for a function.\n /// @param selector The function selector.\n /// @param idx The index in the rollback history.\n /// @return impl An implementation address for the function at\n /// index `idx`.\n function getRollbackEntryAtIndex(bytes4 selector, uint256 idx)\n external\n view\n returns (address impl);\n}\n",
"../storage/LibSimpleFunctionRegistryStorage.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\";\n\n\n/// @dev Storage helpers for the `SimpleFunctionRegistry` feature.\nlibrary LibSimpleFunctionRegistryStorage {\n\n /// @dev Storage bucket for this feature.\n struct Storage {\n // Mapping of function selector -> implementation history.\n mapping(bytes4 => address[]) implHistory;\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.SimpleFunctionRegistry\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",
"../errors/LibSimpleFunctionRegistryRichErrors.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 LibSimpleFunctionRegistryRichErrors {\n\n // solhint-disable func-name-mixedcase\n\n function NotInRollbackHistoryError(bytes4 selector, address targetImpl)\n internal\n pure\n returns (bytes memory)\n {\n return abi.encodeWithSelector(\n bytes4(keccak256(\"NotInRollbackHistoryError(bytes4,address)\")),\n selector,\n targetImpl\n );\n }\n}\n",
"../features/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",
"../features/OwnableFeature.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 \"../fixins/FixinCommon.sol\";\nimport \"../errors/LibOwnableRichErrors.sol\";\nimport \"../storage/LibOwnableStorage.sol\";\nimport \"../migrations/LibBootstrap.sol\";\nimport \"../migrations/LibMigrate.sol\";\nimport \"./interfaces/IFeature.sol\";\nimport \"./interfaces/IOwnableFeature.sol\";\nimport \"./SimpleFunctionRegistryFeature.sol\";\n\n\n/// @dev Owner management features.\ncontract OwnableFeature is\n IFeature,\n IOwnableFeature,\n FixinCommon\n{\n\n /// @dev Name of this feature.\n string public constant override FEATURE_NAME = \"Ownable\";\n /// @dev Version of this feature.\n uint256 public immutable override FEATURE_VERSION = _encodeVersion(1, 0, 0);\n\n using LibRichErrorsV06 for bytes;\n\n /// @dev Initializes this feature. The intial owner will be set to this (ZeroEx)\n /// to allow the bootstrappers to call `extend()`. Ownership should be\n /// transferred to the real owner by the bootstrapper after\n /// bootstrapping is complete.\n /// @return success Magic bytes if successful.\n function bootstrap() external returns (bytes4 success) {\n // Set the owner to ourselves to allow bootstrappers to call `extend()`.\n LibOwnableStorage.getStorage().owner = address(this);\n\n // Register feature functions.\n SimpleFunctionRegistryFeature(address(this))._extendSelf(this.transferOwnership.selector, _implementation);\n SimpleFunctionRegistryFeature(address(this))._extendSelf(this.owner.selector, _implementation);\n SimpleFunctionRegistryFeature(address(this))._extendSelf(this.migrate.selector, _implementation);\n return LibBootstrap.BOOTSTRAP_SUCCESS;\n }\n\n /// @dev Change the owner of this contract.\n /// Only directly callable by the owner.\n /// @param newOwner New owner address.\n function transferOwnership(address newOwner)\n external\n override\n onlyOwner\n {\n LibOwnableStorage.Storage storage proxyStor = LibOwnableStorage.getStorage();\n\n if (newOwner == address(0)) {\n LibOwnableRichErrors.TransferOwnerToZeroError().rrevert();\n } else {\n proxyStor.owner = newOwner;\n emit OwnershipTransferred(msg.sender, newOwner);\n }\n }\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 /// Temporarily sets the owner to ourselves so we can perform admin functions.\n /// Before returning, the owner will be set to `newOwner`.\n /// @param target The migrator contract address.\n /// @param data The call data.\n /// @param newOwner The address of the new owner.\n function migrate(address target, bytes calldata data, address newOwner)\n external\n override\n onlyOwner\n {\n if (newOwner == address(0)) {\n LibOwnableRichErrors.TransferOwnerToZeroError().rrevert();\n }\n\n LibOwnableStorage.Storage storage stor = LibOwnableStorage.getStorage();\n // The owner will be temporarily set to `address(this)` inside the call.\n stor.owner = address(this);\n\n // Perform the migration.\n LibMigrate.delegatecallMigrateFunction(target, data);\n\n // Update the owner.\n stor.owner = newOwner;\n\n emit Migrated(msg.sender, target, newOwner);\n }\n\n /// @dev Get the owner of this contract.\n /// @return owner_ The owner of this contract.\n function owner() external override view returns (address owner_) {\n return LibOwnableStorage.getStorage().owner;\n }\n}\n",
"../storage/LibOwnableStorage.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\";\n\n\n/// @dev Storage helpers for the `Ownable` feature.\nlibrary LibOwnableStorage {\n\n /// @dev Storage bucket for this feature.\n struct Storage {\n // The owner of this contract.\n address owner;\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.Ownable\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",
"./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"
},
"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": {}
}