Skip to content

Commit

Permalink
Merge the develop branch to the master branch, preparation to v5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
akolotov committed Aug 24, 2020
2 parents e09bd71 + 49bcae3 commit e442eb2
Show file tree
Hide file tree
Showing 42 changed files with 721 additions and 1,482 deletions.
10 changes: 5 additions & 5 deletions .dockerignore
@@ -1,16 +1,16 @@
node_modules
deploy/node_modules
**/node_modules
.git
.gitignore
.dockerignore
deploy/.env
deploy/*.config
deploy/*.env
deploy/*.env*
!deploy/.env.example
docker-compose.yml
Dockerfile
*.log
flats
contracts.sublime-project
contracts.sublime-workspace
upgrade/.env*
upgrade/*.env*
!upgrade/.env.example
build/
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -10,6 +10,6 @@ insert_final_newline = true
[*.ts]
indent_style = tab

[{package.json,.travis.yml}]
[{package.json}]
indent_style = space
indent_size = 4
92 changes: 92 additions & 0 deletions .github/workflows/main.yml
@@ -0,0 +1,92 @@
name: tokenbridge-contracts

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- 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 lint
test:
runs-on: ubuntu-latest
steps:
- 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 test
gasreport:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')
steps:
- 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 test:gasreport:ci
env:
CC_SECRET: ${{ secrets.CC_SECRET }}
coverage:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')
steps:
- 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 coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
publish:
runs-on: ubuntu-latest
needs:
- lint
- test
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v2
- if: startsWith(github.ref, 'refs/tags')
run: echo "::set-env name=DOCKER_TAGS::${GITHUB_REF#refs/tags/},latest"
- if: startsWith(github.ref, 'refs/heads')
run: echo "::set-env name=DOCKER_TAGS::${GITHUB_REF#refs/heads/}-${GITHUB_SHA::8}"
- uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: poanetwork/tokenbridge-contracts
always_pull: true
tags: ${{ env.DOCKER_TAGS }}
7 changes: 4 additions & 3 deletions .gitignore
Expand Up @@ -6,7 +6,8 @@ flats
coverage
*.sublime-*
.0x-artifacts
upgrade/.env*
deploy/.env
deploy/*.config
deploy/*.env
deploy/*.env*
!deploy/.env.example
upgrade/*.env*
!upgrade/.env.example
14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Expand Up @@ -2,7 +2,7 @@

Thank your for contributing to this project! We welcome collaborators and expect users to follow our [code of conduct](CODE_OF_CONDUCT.md) when submitting code or comments.

1. Fork the repo ( https://github.com/poanetwork/poa-bridge-contracts/fork ).
1. Fork the repo ( https://github.com/poanetwork/tokenbridge-contracts/fork ).
2. Create your feature branch (`git checkout -b my-new-feature`).
3. Write tests that cover your work.
4. Commit your changes (`git commit -am 'Add some feature'`).
Expand All @@ -19,7 +19,7 @@ Thank your for contributing to this project! We welcome collaborators and expect
In either case, try to write a regression test that fails because of the bug but passes with your fix.

### Issues
Creating and discussing [Issues](https://github.com/poanetwork/poa-bridge-contracts/issues) provides significant value to the project. If you find a bug you can report it in an Issue.
Creating and discussing [Issues](https://github.com/poanetwork/tokenbridge-contracts/issues) provides significant value to the project. If you find a bug you can report it in an Issue.

### Pull Requests
All pull requests should include:
Expand Down
37 changes: 15 additions & 22 deletions Dockerfile
@@ -1,24 +1,10 @@
FROM node:10

RUN apt-get update
RUN apt-get install -y netcat
RUN apt-get clean
FROM node:10 as contracts

WORKDIR /contracts

COPY package.json .
COPY package-lock.json .
RUN npm install

COPY ./deploy/package.json ./deploy/
COPY ./deploy/package-lock.json ./deploy/
RUN cd ./deploy; npm install; cd ..

COPY ./upgrade/package.json ./upgrade/
COPY ./upgrade/package-lock.json ./upgrade/
RUN cd ./upgrade; npm install; cd ..

COPY ./scripts ./scripts
RUN npm install --only=prod

COPY truffle-config.js truffle-config.js
COPY ./contracts ./contracts
Expand All @@ -27,16 +13,23 @@ RUN npm run compile
COPY flatten.sh flatten.sh
RUN bash flatten.sh

COPY .eslintignore .eslintignore
COPY .eslintrc .eslintrc
COPY .prettierrc .prettierrc
FROM node:10

WORKDIR /contracts
COPY --from=contracts /contracts/build ./build
COPY --from=contracts /contracts/flats ./flats

COPY ./deploy/package.json ./deploy/
COPY ./deploy/package-lock.json ./deploy/
RUN cd ./deploy; npm install --only=prod; cd ..

COPY ./upgrade/package.json ./upgrade/
COPY ./upgrade/package-lock.json ./upgrade/
RUN cd ./upgrade; npm install --only=prod; cd ..

COPY ./upgrade ./upgrade
COPY deploy.sh deploy.sh
COPY ./deploy ./deploy
COPY .solhint.json .solhint.json
COPY codechecks.yml codechecks.yml
COPY ./test ./test

ENV PATH="/contracts/:${PATH}"
ENV NOFLAT=true
42 changes: 42 additions & 0 deletions Dockerfile.dev
@@ -0,0 +1,42 @@
FROM node:10

RUN apt-get update
RUN apt-get install -y netcat
RUN apt-get clean

WORKDIR /contracts

COPY package.json .
COPY package-lock.json .
RUN npm install

COPY ./deploy/package.json ./deploy/
COPY ./deploy/package-lock.json ./deploy/
RUN cd ./deploy; npm install; cd ..

COPY ./upgrade/package.json ./upgrade/
COPY ./upgrade/package-lock.json ./upgrade/
RUN cd ./upgrade; npm install; cd ..

COPY ./scripts ./scripts

COPY truffle-config.js truffle-config.js
COPY ./contracts ./contracts
RUN npm run compile

COPY flatten.sh flatten.sh
RUN bash flatten.sh

COPY .eslintignore .eslintignore
COPY .eslintrc .eslintrc
COPY .prettierrc .prettierrc

COPY ./upgrade ./upgrade
COPY deploy.sh deploy.sh
COPY ./deploy ./deploy
COPY .solhint.json .solhint.json
COPY codechecks.yml codechecks.yml
COPY ./test ./test

ENV PATH="/contracts/:${PATH}"
ENV NOFLAT=true
2 changes: 1 addition & 1 deletion README.md
@@ -1,5 +1,5 @@
[![Join the chat at https://gitter.im/poanetwork/poa-bridge](https://badges.gitter.im/poanetwork/poa-bridge.svg)](https://gitter.im/poanetwork/poa-bridge?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://api.travis-ci.org/poanetwork/tokenbridge-contracts.svg?branch=master)](https://travis-ci.org/poanetwork/tokenbridge-contracts)
[![Build Status](https://github.com/poanetwork/tokenbridge-contracts/workflows/tokenbridge-contracts/badge.svg?branch=master)](https://github.com/poanetwork/tokenbridge-contracts/workflows/tokenbridge-contracts/badge.svg?branch=master)
[![Coverage Status](https://coveralls.io/repos/github/poanetwork/tokenbridge-contracts/badge.svg?branch=master)](https://coveralls.io/github/poanetwork/tokenbridge-contracts?branch=master)

# POA Bridge Smart Contracts
Expand Down
5 changes: 5 additions & 0 deletions contracts/interfaces/ERC677.sol
Expand Up @@ -9,3 +9,8 @@ contract ERC677 is ERC20 {
function increaseAllowance(address spender, uint256 addedValue) public returns (bool);
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool);
}

contract LegacyERC20 {
function transfer(address _spender, uint256 _value) public; // returns (bool);
function transferFrom(address _owner, address _spender, uint256 _value) public; // returns (bool);
}
2 changes: 1 addition & 1 deletion contracts/upgradeable_contracts/BasicAMBMediator.sol
Expand Up @@ -15,7 +15,7 @@ contract BasicAMBMediator is Ownable {
bytes32 internal constant REQUEST_GAS_LIMIT = 0x2dfd6c9f781bb6bbb5369c114e949b69ebb440ef3d4dd6b2836225eb1dc3a2be; // keccak256(abi.encodePacked("requestGasLimit"))

/**
* @dev Throws if caller on the other side if not an associated mediator.
* @dev Throws if caller on the other side is not an associated mediator.
*/
modifier onlyMediator {
require(msg.sender == address(bridgeContract()));
Expand Down
13 changes: 2 additions & 11 deletions contracts/upgradeable_contracts/ERC20Bridge.sol
Expand Up @@ -16,23 +16,14 @@ contract ERC20Bridge is BasicForeignBridge {
addressStorage[ERC20_TOKEN] = _token;
}

function _relayTokens(address _sender, address _receiver, uint256 _amount) internal {
function relayTokens(address _receiver, uint256 _amount) external {
require(_receiver != address(0));
require(_receiver != address(this));
require(_amount > 0);
require(withinLimit(_amount));
addTotalSpentPerDay(getCurrentDay(), _amount);

erc20token().transferFrom(_sender, address(this), _amount);
erc20token().transferFrom(msg.sender, address(this), _amount);
emit UserRequestForAffirmation(_receiver, _amount);
}

function relayTokens(address _from, address _receiver, uint256 _amount) external {
require(_from == msg.sender || _from == _receiver);
_relayTokens(_from, _receiver, _amount);
}

function relayTokens(address _receiver, uint256 _amount) external {
_relayTokens(msg.sender, _receiver, _amount);
}
}
68 changes: 0 additions & 68 deletions contracts/upgradeable_contracts/MediatorMessagesGuard.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/upgradeable_contracts/VersionableBridge.sol
Expand Up @@ -2,7 +2,7 @@ pragma solidity 0.4.24;

contract VersionableBridge {
function getBridgeInterfacesVersion() external pure returns (uint64 major, uint64 minor, uint64 patch) {
return (5, 0, 0);
return (5, 1, 0);
}

/* solcov ignore next */
Expand Down

0 comments on commit e442eb2

Please sign in to comment.