diff --git a/contracts/erc1155/compiler.json b/contracts/erc1155/compiler.json index 7afcb02b45..8b4584994a 100644 --- a/contracts/erc1155/compiler.json +++ b/contracts/erc1155/compiler.json @@ -26,7 +26,6 @@ "src/interfaces/IERC1155Mintable.sol", "src/interfaces/IERC1155Receiver.sol", "src/interfaces/IERC1155.sol", - "src/utils/SafeMath.sol", "src/utils/Address.sol" ] } diff --git a/contracts/erc1155/contracts/src/ERC1155.sol b/contracts/erc1155/contracts/src/ERC1155.sol index c4d6e38bf5..ee586e612b 100644 --- a/contracts/erc1155/contracts/src/ERC1155.sol +++ b/contracts/erc1155/contracts/src/ERC1155.sol @@ -18,7 +18,7 @@ pragma solidity ^0.5.3; -import "./utils/SafeMath.sol"; +import "@0x/contracts-utils/contracts/src/SafeMath.sol"; import "./utils/Address.sol"; import "./interfaces/IERC1155.sol"; import "./interfaces/IERC1155Receiver.sol"; diff --git a/contracts/erc1155/contracts/src/ERC1155Mintable.sol b/contracts/erc1155/contracts/src/ERC1155Mintable.sol index 9332f9ea4d..9269e4b597 100644 --- a/contracts/erc1155/contracts/src/ERC1155Mintable.sol +++ b/contracts/erc1155/contracts/src/ERC1155Mintable.sol @@ -1,6 +1,6 @@ pragma solidity ^0.5.3; -import "./utils/SafeMath.sol"; +import "@0x/contracts-utils/contracts/src/SafeMath.sol"; import "./ERC1155.sol"; import "./interfaces/IERC1155Mintable.sol"; diff --git a/contracts/erc1155/contracts/src/utils/SafeMath.sol b/contracts/erc1155/contracts/src/utils/SafeMath.sol deleted file mode 100644 index 4ae314fdcb..0000000000 --- a/contracts/erc1155/contracts/src/utils/SafeMath.sol +++ /dev/null @@ -1,105 +0,0 @@ -/* - - Copyright 2018 ZeroEx Intl. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -pragma solidity ^0.5.3; - - -contract SafeMath { - - function safeMul(uint256 a, uint256 b) - internal - pure - returns (uint256) - { - if (a == 0) { - return 0; - } - uint256 c = a * b; - require( - c / a == b, - "UINT256_OVERFLOW" - ); - return c; - } - - function safeDiv(uint256 a, uint256 b) - internal - pure - returns (uint256) - { - uint256 c = a / b; - return c; - } - - function safeSub(uint256 a, uint256 b) - internal - pure - returns (uint256) - { - require( - b <= a, - "UINT256_UNDERFLOW" - ); - return a - b; - } - - function safeAdd(uint256 a, uint256 b) - internal - pure - returns (uint256) - { - uint256 c = a + b; - require( - c >= a, - "UINT256_OVERFLOW" - ); - return c; - } - - function max64(uint64 a, uint64 b) - internal - pure - returns (uint256) - { - return a >= b ? a : b; - } - - function min64(uint64 a, uint64 b) - internal - pure - returns (uint256) - { - return a < b ? a : b; - } - - function max256(uint256 a, uint256 b) - internal - pure - returns (uint256) - { - return a >= b ? a : b; - } - - function min256(uint256 a, uint256 b) - internal - pure - returns (uint256) - { - return a < b ? a : b; - } -} diff --git a/contracts/erc1155/package.json b/contracts/erc1155/package.json index 3fe5620a01..e988deed8f 100644 --- a/contracts/erc1155/package.json +++ b/contracts/erc1155/package.json @@ -68,7 +68,7 @@ }, "dependencies": { "@0x/base-contract": "^5.0.0", - "@0x/contracts-utils": "2.0.1", + "@0x/contracts-utils": "2.0.8", "@0x/types": "^2.1.0", "@0x/typescript-typings": "^4.1.0", "@0x/utils": "^4.2.0",