-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge the develop branch to the master branch, preparation to v5.4.1
- Loading branch information
Showing
10 changed files
with
134 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: release | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
flats: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: get_release | ||
uses: bruceadams/get-release@v1.2.1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 10 | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
id: npm-cache | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} | ||
- run: npm install | ||
if: ${{ !steps.npm-cache.outputs.cache-hit }} | ||
- run: npm run flatten | ||
- run: zip flats $(find flats -name '*.sol') | ||
- uses: actions/upload-release-asset@v1.0.2 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.get_release.outputs.upload_url }} | ||
asset_path: flats.zip | ||
asset_name: tokenbridge-contracts-flattened-${{ steps.get_release.outputs.tag_name }}.zip | ||
asset_content_type: application/zip |
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,49 @@ | ||
pragma solidity 0.4.24; | ||
|
||
import "openzeppelin-solidity/contracts/math/SafeMath.sol"; | ||
import "../interfaces/ERC677.sol"; | ||
|
||
/** | ||
* @title SafeERC20 | ||
* @dev Helper methods for safe token transfers. | ||
* Functions perform additional checks to be sure that token transfer really happened. | ||
*/ | ||
library SafeERC20 { | ||
using SafeMath for uint256; | ||
|
||
/** | ||
* @dev Same as ERC20.transfer(address,uint256) but with extra consistency checks. | ||
* @param _token address of the token contract | ||
* @param _to address of the receiver | ||
* @param _value amount of tokens to send | ||
*/ | ||
function safeTransfer(address _token, address _to, uint256 _value) internal { | ||
LegacyERC20(_token).transfer(_to, _value); | ||
assembly { | ||
if returndatasize { | ||
returndatacopy(0, 0, 32) | ||
if iszero(mload(0)) { | ||
revert(0, 0) | ||
} | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* @dev Same as ERC20.transferFrom(address,address,uint256) but with extra consistency checks. | ||
* @param _token address of the token contract | ||
* @param _from address of the sender | ||
* @param _value amount of tokens to send | ||
*/ | ||
function safeTransferFrom(address _token, address _from, uint256 _value) internal { | ||
LegacyERC20(_token).transferFrom(_from, address(this), _value); | ||
assembly { | ||
if returndatasize { | ||
returndatacopy(0, 0, 32) | ||
if iszero(mload(0)) { | ||
revert(0, 0) | ||
} | ||
} | ||
} | ||
} | ||
} |
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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