Skip to content

Commit

Permalink
Merge branch 'develop' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
elenadimitrova committed Dec 1, 2020
2 parents b9a15b4 + a9efbe0 commit c4d04d9
Show file tree
Hide file tree
Showing 100 changed files with 17,458 additions and 15,861 deletions.
81 changes: 71 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ version: 2
job_common: &job_common
docker:
- image: circleci/node:10.21-stretch
auth:
username: argentcircleci
password: $DOCKERHUB_PASSWORD
working_directory: ~/argent-contracts
job_python: &job_python
docker:
- image: circleci/python:3.8.0b1-stretch-node
auth:
username: argentcircleci
password: $DOCKERHUB_PASSWORD
working_directory: ~/argent-contracts
step_save_cache: &step_save_cache
save_cache:
Expand All @@ -22,27 +28,40 @@ step_setup_global_packages: &step_setup_global_packages
name: "Set up global packages"
command: |
npm install
step_pull_solc_docker: &step_pull_solc_docker
run:
name: "Pull solc docker images"
command: |
docker pull ethereum/solc:0.5.4
docker pull ethereum/solc:0.6.12
step_setup_slither: &step_setup_slither
run:
name: "Setup slither analyser https://github.com/crytic/slither"
command: |
wget https://github.com/ethereum/solidity/releases/download/v0.5.4/solc-static-linux
chmod +x solc-static-linux
sudo mv solc-static-linux /usr/local/bin/solc
sudo pip3 install slither-analyzer
sudo apt-get install jq
step_setup_solc_select: &step_setup_solc_select
run:
name: "Setup solc-select"
command: |
git clone https://github.com/crytic/solc-select.git
bash ./solc-select/scripts/install.sh
jobs:
unit-test:
<<: *job_common
steps:
- checkout
- <<: *step_restore_cache
- setup_remote_docker:
version: 19.03.13
- <<: *step_pull_solc_docker
- <<: *step_setup_global_packages
- run:
name: "Lint JavaScript"
command: npm run lint:js
- run:
name: "Lint Solidity contracts"
command: npm run lint:contracts
- run:
name: "Testing deployment scripts and benchmark gas costs"
command: npm run ganache >/dev/null 2>&1 & npm run test:deployment && npm run test:benchmark
- run:
name: "Compiling external library contracts"
command: npm run compile:lib
Expand All @@ -56,11 +75,20 @@ jobs:
name: "Compiling test contracts"
command: npm run compile:test
- run:
name: "Lint JavaScript"
command: npm run lint:js
name: "Provision lib artefacts"
command: npm run provision:lib:artefacts
- run:
name: "Test deployment scripts"
command: npm run ganache >/dev/null 2>&1 & npm run test:deployment
no_output_timeout: 60m
- run:
name: "Running unit tests"
command: npm run ganache >/dev/null 2>&1 & npm run test
# Save coverage artifacts
- store_artifacts:
path: gas-usage-report.log
destination: reports/gas-usage-report.log
- run: npx codechecks
- run:
name: "Running coverage"
command: |
Expand All @@ -71,16 +99,49 @@ jobs:
# Save coverage artifacts
- store_artifacts:
path: coverage
destination: coverage-artifacts
security-test:
<<: *job_python
steps:
- checkout
- <<: *step_restore_cache
- setup_remote_docker:
version: 19.03.13
- <<: *step_pull_solc_docker
- <<: *step_setup_global_packages
- <<: *step_setup_slither
- <<: *step_setup_solc_select
- run:
name: "Check TokenPriceRegistry tokens for ERC20 compliance"
command: |
export PATH=/home/circleci/.solc-select:$PATH
echo "export PATH=/home/circleci/.solc-select:$PATH" >> ~/.bashrc
solc --version
npm run validate:erc20
- run:
name: "Run slither on infrastructure contracts based on solc 0.5"
command: |
export PATH=/home/circleci/.solc-select:$PATH
npm run security:slither:infrastructure_0.5
when: always
- run:
name: "Run slither on infrastructure contracts based on solc 0.6"
command: |
export PATH=/home/circleci/.solc-select:$PATH
npm run security:slither:infrastructure_0.6
when: always
- run:
name: "Run slither on wallet modules contracts"
command: |
export PATH=/home/circleci/.solc-select:$PATH
npm run security:slither:modules
when: always
- run:
name: "Run slither"
command: npm run security:slither
name: "Run slither on wallet contracts"
command: |
export PATH=/home/circleci/.solc-select:$PATH
npm run security:slither:wallet
when: always
workflows:
version: 2
commit:
Expand Down
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ build/*
contracts/*
contracts-test/*
coverage/*
lib/*
lib/*
scripts/coverage.js
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@
"no-underscore-dangle": "off",
"no-await-in-loop": "off",
"no-restricted-syntax": "off",
"guard-for-in": "off"
"guard-for-in": "off",
"function-paren-newline": "off",
"comma-dangle": "off",
"object-curly-newline": "off",
"no-unused-expressions": "off",
"import/no-extraneous-dependencies": "off",
"import/no-unresolved": "off"

},
"parserOptions": {
"ecmaVersion": 2018
Expand Down
13 changes: 8 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build-legacy
tmp
bin
.outputParameter
flatten

## Core latex/pdflatex auxiliary files:
*.aux
Expand All @@ -28,15 +29,17 @@ bin

.env
utils/config/*.json
!utils/config/ganache.json
!utils/config/development.json
!utils/config/kovan.json
!utils/config/kovan-fork.json
ganache-accounts.json

## Etherlime
**/.etherlime-store
flat
## solidity-coverage
.coverage_artifacts
.coverage_contracts
.coverage_tests
coverage
coverage.json
coverage.json

crytic-export
gas-usage-report.log
15 changes: 15 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
client: require('ganache-cli'),
skipFiles: [
"../contracts-test",
"../contracts-legacy",
"../lib"
],
providerOptions: {
port: 8555,
_chainId: 1895,
network_id: 1597649375983,
account_keys_path: "./ganache-accounts.json",
default_balance_ether: 10000
}
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions codechecks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
checks:
- name: eth-gas-reporter/codechecks
19 changes: 19 additions & 0 deletions contracts-test/TestOwnedContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.6.12;
import "../contracts/infrastructure/base/Owned.sol";

/**
* @title TestOwnedContract
* @notice Represents an arbitrary contract implementing Owned.
*/
contract TestOwnedContract is Owned {

uint256 public state;

event StateSet(uint256 indexed _state, uint256 indexed _value);

function setStateRestricted(uint256 _state) public onlyOwner payable {
state = _state;
emit StateSet(_state, msg.value);
}
}
2 changes: 1 addition & 1 deletion contracts/infrastructure/DexRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../infrastructure/base/Owned.sol";
import "./base/Owned.sol";
import "./IDexRegistry.sol";

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/Utils.sol";
import "../common/LimitUtils.sol";
import "../common/BaseTransfer.sol";
import "../../infrastructure/storage/ILimitStorage.sol";
import "../../infrastructure/storage/IGuardianStorage.sol";
import "./common/Utils.sol";
import "./common/LimitUtils.sol";
import "./common/BaseTransfer.sol";
import "../infrastructure/storage/ILimitStorage.sol";
import "../infrastructure/storage/IGuardianStorage.sol";

/**
* @title ApprovedTransfer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/Utils.sol";
import "../common/BaseFeature.sol";
import "../common/GuardianUtils.sol";
import "../common/LimitUtils.sol";
import "../../infrastructure/storage/ILimitStorage.sol";
import "../../infrastructure/ITokenPriceRegistry.sol";
import "../../infrastructure/storage/IGuardianStorage.sol";
import "./common/Utils.sol";
import "./common/BaseFeature.sol";
import "./common/GuardianUtils.sol";
import "./common/LimitUtils.sol";
import "../infrastructure/storage/ILimitStorage.sol";
import "../infrastructure/ITokenPriceRegistry.sol";
import "../infrastructure/storage/IGuardianStorage.sol";

/**
* @title RelayerManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/BaseFeature.sol";
import "../../../lib/other/ERC20.sol";
import "../../../lib/paraswap/IAugustusSwapper.sol";
import "../../infrastructure/ITokenPriceRegistry.sol";
import "../../infrastructure/IDexRegistry.sol";
import "./common/BaseFeature.sol";
import "../../lib/other/ERC20.sol";
import "../../lib/paraswap/IAugustusSwapper.sol";
import "../infrastructure/ITokenPriceRegistry.sol";
import "../infrastructure/IDexRegistry.sol";

/**
* @title TokenExchanger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
pragma solidity ^0.6.12;
pragma experimental ABIEncoderV2;

import "../common/Utils.sol";
import "../common/BaseTransfer.sol";
import "../common/LimitUtils.sol";
import "../../infrastructure/storage/ILimitStorage.sol";
import "../../infrastructure/storage/ITransferStorage.sol";
import "../../infrastructure/ITokenPriceRegistry.sol";
import "../../../lib/other/ERC20.sol";
import "./common/Utils.sol";
import "./common/BaseTransfer.sol";
import "./common/LimitUtils.sol";
import "../infrastructure/storage/ILimitStorage.sol";
import "../infrastructure/storage/ITransferStorage.sol";
import "../infrastructure/ITokenPriceRegistry.sol";
import "../../lib/other/ERC20.sol";

/**
* @title TransferManager
Expand Down
39 changes: 39 additions & 0 deletions deployment/0_limited_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* global artifacts */
global.web3 = web3;
const chai = require("chai");
const BN = require("bn.js");
const bnChai = require("bn-chai");

const { expect } = chai;
chai.use(bnChai(BN));

const TestOwnedContract = artifacts.require("TestOwnedContract");
const MultiSig = artifacts.require("MultiSigWallet");

const deployManager = require("../utils/deploy-manager.js");
const MultisigExecutor = require("../utils/multisigexecutor.js");

async function main() {
const { deploymentAccount, configurator } = await deployManager.getProps();
console.log("deploymentAccount", deploymentAccount);
const { config } = configurator;

const testContractWrapper = await TestOwnedContract.new();
console.log("TestOwnedContract created at", testContractWrapper.address);

await testContractWrapper.changeOwner(config.contracts.MultiSigWallet);
console.log("Set the MultiSig as the owner of TestOwnedContract");

const MultiSigWrapper = await MultiSig.at(config.contracts.MultiSigWallet);
const multisigExecutor = new MultisigExecutor(MultiSigWrapper, deploymentAccount, config.multisig.autosign);
await multisigExecutor.executeCall(testContractWrapper, "setStateRestricted", [99]);
const stateValue = await testContractWrapper.state();
expect(stateValue).to.eq.BN(99);

console.log("## completed deployment script 7 ##");
}

// For truffle exec
module.exports = function (callback) {
main().then(() => callback()).catch((err) => callback(err));
};
Loading

0 comments on commit c4d04d9

Please sign in to comment.