-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287 from HQ20/new/transfer-dividends
New/transfer dividends
- Loading branch information
Showing
6 changed files
with
150 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
pragma solidity ^0.6.0; | ||
|
||
|
||
/// @dev Implements safe casting between int256 and uint256 | ||
/// @author Alberto Cuesta Cañada | ||
library SafeCast { | ||
|
||
/// @dev Maximum value that can be represented in an int256 | ||
function maxInt256() internal pure returns(int256) { | ||
// solium-disable-next-line max-len | ||
return 57896044618658097711785492504343953926634992332820282019728792003956564819967; | ||
} | ||
|
||
/// @dev Safe casting from int256 to uint256 | ||
function toUint(int256 x) internal pure returns(uint256) { | ||
require( | ||
x >= 0, | ||
"Cannot cast negative signed integer to unsigned integer." | ||
); | ||
return uint256(x); | ||
} | ||
|
||
/// @dev Safe casting from uint256 to int256 | ||
function toInt(uint256 x) internal pure returns(int256) { | ||
require( | ||
x <= toUint(maxInt256()), | ||
"Cannot cast overflowing unsigned integer to signed integer." | ||
); | ||
return int256(x); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters