Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

ZeroEx: Merge Migrate and Ownable Features #2564

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"config": {
"publicInterfaceContracts": "Authorizable,IAuthorizable,IOwnable,LibAddress,LibAddressArray,LibAddressArrayRichErrors,LibAuthorizableRichErrors,LibBytes,LibBytesRichErrors,LibEIP1271,LibEIP712,LibFractions,LibOwnableRichErrors,LibReentrancyGuardRichErrors,LibRichErrors,LibSafeMath,LibSafeMathRichErrors,Ownable,ReentrancyGuard,Refundable",
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
"abis": "./test/generated-artifacts/@(Authorizable|D18|DeploymentConstants|IAuthorizable|IOwnable|LibAddress|LibAddressArray|LibAddressArrayRichErrors|LibAuthorizableRichErrors|LibBytes|LibBytesRichErrors|LibEIP1271|LibEIP712|LibFractions|LibOwnableRichErrors|LibReentrancyGuardRichErrors|LibRichErrors|LibSafeMath|LibSafeMathRichErrors|Ownable|ReentrancyGuard|Refundable|TestAuthorizable|TestLibAddress|TestLibAddressArray|TestLibBytes|TestLibEIP712|TestLibRichErrors|TestLibSafeMath|TestLogDecoding|TestLogDecodingDownstream|TestOwnable|TestReentrancyGuard|TestRefundable|TestRefundableReceiver).json"
"abis": "./test/generated-artifacts/@(Authorizable|D18|DeploymentConstants|IAuthorizable|IOwnable|IOwnableV06|LibAddress|LibAddressArray|LibAddressArrayRichErrors|LibAuthorizableRichErrors|LibBytes|LibBytesRichErrors|LibBytesRichErrorsV06|LibBytesV06|LibEIP1271|LibEIP712|LibFractions|LibOwnableRichErrors|LibReentrancyGuardRichErrors|LibRichErrors|LibRichErrorsV06|LibSafeMath|LibSafeMathRichErrors|Ownable|ReentrancyGuard|Refundable|TestAuthorizable|TestLibAddress|TestLibAddressArray|TestLibBytes|TestLibEIP712|TestLibRichErrors|TestLibSafeMath|TestLogDecoding|TestLogDecodingDownstream|TestOwnable|TestReentrancyGuard|TestRefundable|TestRefundableReceiver).json"
},
"repository": {
"type": "git",
Expand Down
8 changes: 8 additions & 0 deletions contracts/utils/test/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,22 @@ import * as D18 from '../test/generated-artifacts/D18.json';
import * as DeploymentConstants from '../test/generated-artifacts/DeploymentConstants.json';
import * as IAuthorizable from '../test/generated-artifacts/IAuthorizable.json';
import * as IOwnable from '../test/generated-artifacts/IOwnable.json';
import * as IOwnableV06 from '../test/generated-artifacts/IOwnableV06.json';
import * as LibAddress from '../test/generated-artifacts/LibAddress.json';
import * as LibAddressArray from '../test/generated-artifacts/LibAddressArray.json';
import * as LibAddressArrayRichErrors from '../test/generated-artifacts/LibAddressArrayRichErrors.json';
import * as LibAuthorizableRichErrors from '../test/generated-artifacts/LibAuthorizableRichErrors.json';
import * as LibBytes from '../test/generated-artifacts/LibBytes.json';
import * as LibBytesRichErrors from '../test/generated-artifacts/LibBytesRichErrors.json';
import * as LibBytesRichErrorsV06 from '../test/generated-artifacts/LibBytesRichErrorsV06.json';
import * as LibBytesV06 from '../test/generated-artifacts/LibBytesV06.json';
import * as LibEIP1271 from '../test/generated-artifacts/LibEIP1271.json';
import * as LibEIP712 from '../test/generated-artifacts/LibEIP712.json';
import * as LibFractions from '../test/generated-artifacts/LibFractions.json';
import * as LibOwnableRichErrors from '../test/generated-artifacts/LibOwnableRichErrors.json';
import * as LibReentrancyGuardRichErrors from '../test/generated-artifacts/LibReentrancyGuardRichErrors.json';
import * as LibRichErrors from '../test/generated-artifacts/LibRichErrors.json';
import * as LibRichErrorsV06 from '../test/generated-artifacts/LibRichErrorsV06.json';
import * as LibSafeMath from '../test/generated-artifacts/LibSafeMath.json';
import * as LibSafeMathRichErrors from '../test/generated-artifacts/LibSafeMathRichErrors.json';
import * as Ownable from '../test/generated-artifacts/Ownable.json';
Expand Down Expand Up @@ -63,6 +67,10 @@ export const artifacts = {
Refundable: Refundable as ContractArtifact,
IAuthorizable: IAuthorizable as ContractArtifact,
IOwnable: IOwnable as ContractArtifact,
LibBytesV06: LibBytesV06 as ContractArtifact,
LibBytesRichErrorsV06: LibBytesRichErrorsV06 as ContractArtifact,
LibRichErrorsV06: LibRichErrorsV06 as ContractArtifact,
IOwnableV06: IOwnableV06 as ContractArtifact,
TestAuthorizable: TestAuthorizable as ContractArtifact,
TestLibAddress: TestLibAddress as ContractArtifact,
TestLibAddressArray: TestLibAddressArray as ContractArtifact,
Expand Down
4 changes: 4 additions & 0 deletions contracts/utils/test/wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ export * from '../test/generated-wrappers/d18';
export * from '../test/generated-wrappers/deployment_constants';
export * from '../test/generated-wrappers/i_authorizable';
export * from '../test/generated-wrappers/i_ownable';
export * from '../test/generated-wrappers/i_ownable_v06';
export * from '../test/generated-wrappers/lib_address';
export * from '../test/generated-wrappers/lib_address_array';
export * from '../test/generated-wrappers/lib_address_array_rich_errors';
export * from '../test/generated-wrappers/lib_authorizable_rich_errors';
export * from '../test/generated-wrappers/lib_bytes';
export * from '../test/generated-wrappers/lib_bytes_rich_errors';
export * from '../test/generated-wrappers/lib_bytes_rich_errors_v06';
export * from '../test/generated-wrappers/lib_bytes_v06';
export * from '../test/generated-wrappers/lib_e_i_p1271';
export * from '../test/generated-wrappers/lib_e_i_p712';
export * from '../test/generated-wrappers/lib_fractions';
export * from '../test/generated-wrappers/lib_ownable_rich_errors';
export * from '../test/generated-wrappers/lib_reentrancy_guard_rich_errors';
export * from '../test/generated-wrappers/lib_rich_errors';
export * from '../test/generated-wrappers/lib_rich_errors_v06';
export * from '../test/generated-wrappers/lib_safe_math';
export * from '../test/generated-wrappers/lib_safe_math_rich_errors';
export * from '../test/generated-wrappers/ownable';
Expand Down
4 changes: 4 additions & 0 deletions contracts/utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,22 @@
"test/generated-artifacts/DeploymentConstants.json",
"test/generated-artifacts/IAuthorizable.json",
"test/generated-artifacts/IOwnable.json",
"test/generated-artifacts/IOwnableV06.json",
"test/generated-artifacts/LibAddress.json",
"test/generated-artifacts/LibAddressArray.json",
"test/generated-artifacts/LibAddressArrayRichErrors.json",
"test/generated-artifacts/LibAuthorizableRichErrors.json",
"test/generated-artifacts/LibBytes.json",
"test/generated-artifacts/LibBytesRichErrors.json",
"test/generated-artifacts/LibBytesRichErrorsV06.json",
"test/generated-artifacts/LibBytesV06.json",
"test/generated-artifacts/LibEIP1271.json",
"test/generated-artifacts/LibEIP712.json",
"test/generated-artifacts/LibFractions.json",
"test/generated-artifacts/LibOwnableRichErrors.json",
"test/generated-artifacts/LibReentrancyGuardRichErrors.json",
"test/generated-artifacts/LibRichErrors.json",
"test/generated-artifacts/LibRichErrorsV06.json",
"test/generated-artifacts/LibSafeMath.json",
"test/generated-artifacts/LibSafeMathRichErrors.json",
"test/generated-artifacts/Ownable.json",
Expand Down
47 changes: 0 additions & 47 deletions contracts/zero-ex/contracts/src/errors/LibMigrateRichErrors.sol

This file was deleted.

22 changes: 22 additions & 0 deletions contracts/zero-ex/contracts/src/errors/LibOwnableRichErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,26 @@ library LibOwnableRichErrors {
bytes4(keccak256("TransferOwnerToZeroError()"))
);
}

function AlreadyMigratingError()
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("AlreadyMigratingError()"))
);
}

function MigrateCallFailedError(address target, bytes memory resultData)
internal
pure
returns (bytes memory)
{
return abi.encodeWithSelector(
bytes4(keccak256("MigrateCallFailedError(address,bytes)")),
target,
resultData
);
}
}
43 changes: 0 additions & 43 deletions contracts/zero-ex/contracts/src/features/IMigrate.sol

This file was deleted.

20 changes: 18 additions & 2 deletions contracts/zero-ex/contracts/src/features/IOwnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ import "@0x/contracts-utils/contracts/src/v06/interfaces/IOwnableV06.sol";


// solhint-disable no-empty-blocks
/// @dev Owner management features.
/// @dev Owner management and migration features.
interface IOwnable is
IOwnableV06
{}
{
/// @dev Emitted when `migrate()` is called.
/// @param caller The caller of `migrate()`.
/// @param migrator The migration contract.
/// @param newOwner The address of the new owner.
event Migrated(address caller, address migrator, address newOwner);

/// @dev Execute a migration function in the context of the ZeroEx contract.
/// The result of the function being called should be the magic bytes
/// 0x2c64c5ef (`keccack('MIGRATE_SUCCESS')`). Only callable by the owner.
/// The owner will be temporarily set to `address(this)` inside the call.
/// Before returning, the owner will be set to `newOwner`.
/// @param target The migrator contract address.
/// @param newOwner The address of the new owner.
/// @param data The call data.
function migrate(address target, bytes calldata data, address newOwner) external;
}
94 changes: 0 additions & 94 deletions contracts/zero-ex/contracts/src/features/Migrate.sol

This file was deleted.

Loading