Files
openzeppelin-contracts/contracts/mocks/SafeCastMock.sol
Benjamin Smith 2c11ed59fa Safe Casting Library from uint256 to uintXX (#1926)
* Include Safe Casting Library with complete and exhaustive test-suite.

* linting test file.

* Typo in SafeCast import statement

* Update test/utils/SafeCast.test.js

* Rename `castUXX` to `toUintXX` from suggestion

* Tackling the quick and easy suggestions regarding error string improvements etc.

* typo and changelog update.

* Improve SafeCast tests

* Update test/utils/SafeCast.test.js

* Update test/utils/SafeCast.test.js

* incorrect import

* add SafeCast to docs site

* Update CHANGELOG.md

* Update SafeCast.sol
2019-10-22 13:59:11 -03:00

28 lines
598 B
Solidity

pragma solidity ^0.5.0;
import "../utils/SafeCast.sol";
contract SafeCastMock {
using SafeCast for uint;
function toUint128(uint a) public pure returns (uint128) {
return a.toUint128();
}
function toUint64(uint a) public pure returns (uint64) {
return a.toUint64();
}
function toUint32(uint a) public pure returns (uint32) {
return a.toUint32();
}
function toUint16(uint a) public pure returns (uint16) {
return a.toUint16();
}
function toUint8(uint a) public pure returns (uint8) {
return a.toUint8();
}
}