diff --git a/contracts/erc1155/contracts/src/ERC1155.sol b/contracts/erc1155/contracts/src/ERC1155.sol index 97cc5761b7..335d4e27b6 100644 --- a/contracts/erc1155/contracts/src/ERC1155.sol +++ b/contracts/erc1155/contracts/src/ERC1155.sol @@ -19,7 +19,7 @@ pragma solidity ^0.5.5; import "@0x/contracts-utils/contracts/src/SafeMath.sol"; -import "@0x/contracts-utils/contracts/src/Address.sol"; +import "@0x/contracts-utils/contracts/src/LibAddress.sol"; import "./interfaces/IERC1155.sol"; import "./interfaces/IERC1155Receiver.sol"; import "./MixinNonFungibleToken.sol"; @@ -30,7 +30,7 @@ contract ERC1155 is IERC1155, MixinNonFungibleToken { - using Address for address; + using LibAddress for address; // selectors for receiver callbacks bytes4 constant public ERC1155_RECEIVED = 0xf23a6e61; @@ -97,7 +97,7 @@ contract ERC1155 is emit TransferSingle(msg.sender, from, to, id, value); // if `to` is a contract then trigger its callback - if (to._isContract()) { + if (to.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(to).onERC1155Received( msg.sender, from, @@ -177,7 +177,7 @@ contract ERC1155 is emit TransferBatch(msg.sender, from, to, ids, values); // if `to` is a contract then trigger its callback - if (to._isContract()) { + if (to.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(to).onERC1155BatchReceived( msg.sender, from, diff --git a/contracts/erc1155/contracts/src/ERC1155Mintable.sol b/contracts/erc1155/contracts/src/ERC1155Mintable.sol index e09fc0bd6c..7ef0a560b5 100644 --- a/contracts/erc1155/contracts/src/ERC1155Mintable.sol +++ b/contracts/erc1155/contracts/src/ERC1155Mintable.sol @@ -128,7 +128,7 @@ contract ERC1155Mintable is ); // if `to` is a contract then trigger its callback - if (dst._isContract()) { + if (dst.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received( msg.sender, msg.sender, @@ -177,7 +177,7 @@ contract ERC1155Mintable is emit TransferSingle(msg.sender, address(0x0), dst, id, 1); // if `to` is a contract then trigger its callback - if (dst._isContract()) { + if (dst.isContract()) { bytes4 callbackReturnValue = IERC1155Receiver(dst).onERC1155Received( msg.sender, msg.sender, diff --git a/contracts/multisig/contracts/src/AssetProxyOwner.sol b/contracts/multisig/contracts/src/AssetProxyOwner.sol index 0447dac4d9..3426f874de 100644 --- a/contracts/multisig/contracts/src/AssetProxyOwner.sol +++ b/contracts/multisig/contracts/src/AssetProxyOwner.sol @@ -98,7 +98,7 @@ contract AssetProxyOwner is { Transaction storage txn = transactions[transactionId]; txn.executed = true; - if (_external_call(txn.destination, txn.value, txn.data.length, txn.data)) { + if (_externalCall(txn.destination, txn.value, txn.data.length, txn.data)) { emit Execution(transactionId); } else { emit ExecutionFailure(transactionId); diff --git a/contracts/multisig/contracts/src/MultiSigWallet.sol b/contracts/multisig/contracts/src/MultiSigWallet.sol index e6d5e68f36..ac9022afd4 100644 --- a/contracts/multisig/contracts/src/MultiSigWallet.sol +++ b/contracts/multisig/contracts/src/MultiSigWallet.sol @@ -231,7 +231,7 @@ contract MultiSigWallet { if (isConfirmed(transactionId)) { Transaction storage txn = transactions[transactionId]; txn.executed = true; - if (_external_call(txn.destination, txn.value, txn.data.length, txn.data)) + if (_externalCall(txn.destination, txn.value, txn.data.length, txn.data)) Execution(transactionId); else { ExecutionFailure(transactionId); @@ -242,7 +242,7 @@ contract MultiSigWallet { // call has been separated into its own function in order to take advantage // of the Solidity's code generator to produce a loop that copies tx.data into memory. - function _external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) { + function _externalCall(address destination, uint value, uint dataLength, bytes data) internal returns (bool) { bool result; assembly { let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention) diff --git a/contracts/multisig/contracts/src/MultiSigWalletWithTimeLock.sol b/contracts/multisig/contracts/src/MultiSigWalletWithTimeLock.sol index f32a22ad04..96e388de41 100644 --- a/contracts/multisig/contracts/src/MultiSigWalletWithTimeLock.sol +++ b/contracts/multisig/contracts/src/MultiSigWalletWithTimeLock.sol @@ -109,7 +109,7 @@ contract MultiSigWalletWithTimeLock is { Transaction storage txn = transactions[transactionId]; txn.executed = true; - if (_external_call(txn.destination, txn.value, txn.data.length, txn.data)) { + if (_externalCall(txn.destination, txn.value, txn.data.length, txn.data)) { emit Execution(transactionId); } else { emit ExecutionFailure(transactionId); diff --git a/contracts/utils/compiler.json b/contracts/utils/compiler.json index cb6b7be456..942d46253d 100644 --- a/contracts/utils/compiler.json +++ b/contracts/utils/compiler.json @@ -24,7 +24,7 @@ } }, "contracts": [ - "src/Address.sol", + "src/LibAddress.sol", "src/LibBytes.sol", "src/LibEIP712.sol", "src/Ownable.sol", diff --git a/contracts/utils/contracts/src/Address.sol b/contracts/utils/contracts/src/LibAddress.sol similarity index 94% rename from contracts/utils/contracts/src/Address.sol rename to contracts/utils/contracts/src/LibAddress.sol index f3c7d946ff..93552335b7 100644 --- a/contracts/utils/contracts/src/Address.sol +++ b/contracts/utils/contracts/src/LibAddress.sol @@ -22,7 +22,7 @@ pragma solidity ^0.5.5; /** * Utility library of inline functions on addresses */ -library Address { +library LibAddress { /** * Returns whether the target address is a contract @@ -31,7 +31,7 @@ library Address { * @param account address of the account to check * @return whether the target address is a contract */ - function _isContract(address account) internal view returns (bool) { + function isContract(address account) internal view returns (bool) { uint256 size; // XXX Currently there is no better way to check if there is a contract in an address // than to check the size of the code at that address. diff --git a/contracts/utils/package.json b/contracts/utils/package.json index f3314c9ab1..acf2be9c0a 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -34,7 +34,7 @@ "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" }, "config": { - "abis": "./generated-artifacts/@(Address|IOwnable|LibBytes|LibEIP712|Ownable|ReentrancyGuard|RichErrors|SafeMath|TestConstants|TestLibAddressArray|TestLibBytes).json", + "abis": "./generated-artifacts/@(LibAddress|IOwnable|LibBytes|LibEIP712|Ownable|ReentrancyGuard|RichErrors|SafeMath|TestConstants|TestLibAddressArray|TestLibBytes).json", "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually." }, "repository": { diff --git a/contracts/utils/src/artifacts.ts b/contracts/utils/src/artifacts.ts index 9f1008b75a..bbe9c8b605 100644 --- a/contracts/utils/src/artifacts.ts +++ b/contracts/utils/src/artifacts.ts @@ -5,7 +5,7 @@ */ import { ContractArtifact } from 'ethereum-types'; -import * as Address from '../generated-artifacts/Address.json'; +import * as LibAddress from '../generated-artifacts/LibAddress.json'; import * as IOwnable from '../generated-artifacts/IOwnable.json'; import * as LibBytes from '../generated-artifacts/LibBytes.json'; import * as LibEIP712 from '../generated-artifacts/LibEIP712.json'; @@ -17,7 +17,7 @@ import * as TestConstants from '../generated-artifacts/TestConstants.json'; import * as TestLibAddressArray from '../generated-artifacts/TestLibAddressArray.json'; import * as TestLibBytes from '../generated-artifacts/TestLibBytes.json'; export const artifacts = { - Address: Address as ContractArtifact, + LibAddress: LibAddress as ContractArtifact, LibBytes: LibBytes as ContractArtifact, Ownable: Ownable as ContractArtifact, ReentrancyGuard: ReentrancyGuard as ContractArtifact, diff --git a/contracts/utils/src/wrappers.ts b/contracts/utils/src/wrappers.ts index b97fc95c2c..c2b2d10ad5 100644 --- a/contracts/utils/src/wrappers.ts +++ b/contracts/utils/src/wrappers.ts @@ -3,7 +3,7 @@ * Warning: This file is auto-generated by contracts-gen. Don't edit manually. * ----------------------------------------------------------------------------- */ -export * from '../generated-wrappers/address'; +export * from '../generated-wrappers/lib_address'; export * from '../generated-wrappers/i_ownable'; export * from '../generated-wrappers/lib_bytes'; export * from '../generated-wrappers/lib_e_i_p712'; diff --git a/contracts/utils/tsconfig.json b/contracts/utils/tsconfig.json index c37381d5fa..41af80b7d6 100644 --- a/contracts/utils/tsconfig.json +++ b/contracts/utils/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true }, "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], "files": [ - "generated-artifacts/Address.json", + "generated-artifacts/LibAddress.json", "generated-artifacts/IOwnable.json", "generated-artifacts/LibBytes.json", "generated-artifacts/LibEIP712.json",