Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .circleci/config.template.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DO NOT EDIT MANUALLY!
# autogenerated by `.circleci/pack.js` from contents of `jobs` .yml files
version: 2.1
commands:
{{> commands}}
Expand Down
7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DO NOT EDIT MANUALLY!
# autogenerated by `.circleci/pack.js` from contents of `jobs` .yml files
version: 2.1
commands:
cmd-wait-for-port:
Expand Down Expand Up @@ -206,8 +208,11 @@ jobs:
name: Show Slither output
command: |
set +e
slither .
slither . --disable-color 2>&1 | tee slitherReport.txt
exit 0
- store_artifacts:
path: slitherReport.txt
destination: slitherReport.txt
job-test-deploy-script:
working_directory: ~/repo
docker:
Expand Down
6 changes: 5 additions & 1 deletion .circleci/src/jobs/job-static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,9 @@ steps:
# ignore slither error codes
command: |
set +e
slither .
slither . --disable-color 2>&1 | tee slitherReport.txt
exit 0
- store_artifacts:
path: slitherReport.txt
destination: slitherReport.txt

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ process.yml
.db

optimism

# python venv
.venv/
11 changes: 11 additions & 0 deletions contracts/RewardsDistributionRecipient.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,15 @@ contract RewardsDistributionRecipient is Owned {
function setRewardsDistribution(address _rewardsDistribution) external onlyOwner {
rewardsDistribution = _rewardsDistribution;
}

/* ========== Math helpers ========== */

/*
* @dev copied from openzeppelin-solidity-2.3.0/contracts/math/Math.sol
* to avoid using OZ Math import because of contract name collision (Math)
* with the internal Math.sol contract which e.g. is confusing for slither-analyzer
*/
function _min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
}
3 changes: 1 addition & 2 deletions contracts/ShortingRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pragma solidity ^0.5.16;

pragma experimental ABIEncoderV2;

import "openzeppelin-solidity-2.3.0/contracts/math/Math.sol";
import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol";
import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/SafeERC20.sol";
Expand Down Expand Up @@ -72,7 +71,7 @@ contract ShortingRewards is IShortingRewards, RewardsDistributionRecipient, Reen
}

function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
return _min(block.timestamp, periodFinish);
}

function rewardPerToken() public view returns (uint256) {
Expand Down
3 changes: 1 addition & 2 deletions contracts/StakingRewards.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pragma solidity ^0.5.16;

import "openzeppelin-solidity-2.3.0/contracts/math/Math.sol";
import "openzeppelin-solidity-2.3.0/contracts/math/SafeMath.sol";
import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/ERC20Detailed.sol";
import "openzeppelin-solidity-2.3.0/contracts/token/ERC20/SafeERC20.sol";
Expand Down Expand Up @@ -56,7 +55,7 @@ contract StakingRewards is IStakingRewards, RewardsDistributionRecipient, Reentr
}

function lastTimeRewardApplicable() public view returns (uint256) {
return Math.min(block.timestamp, periodFinish);
return _min(block.timestamp, periodFinish);
}

function rewardPerToken() public view returns (uint256) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lint": "solhint \"contracts/*.sol\" && solhint \"contracts/test-helpers/*.sol\" && solhint --config contracts/interfaces/.solhint.json \"contracts/interfaces/*.sol\" && eslint \"**/*.js\"",
"lint:fix": "eslint --fix \"**/*.js\"",
"build:ci": "node .circleci/pack.js",
"slither": "pip3 install --user slither-analyzer && slither .",
"slither": "python3 -m venv .venv && .venv/bin/python -m pip install slither-analyzer && .venv/bin/python -m slither .",
"pack": "webpack --mode production",
"prepublishOnly": "npm run describe && npm run pack",
"fork": "node --max-old-space-size=4096 ./node_modules/.bin/hardhat node",
Expand Down
3 changes: 2 additions & 1 deletion slither.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"buidler_cache_directory": "build/cache"
"buidler_cache_directory": "build/cache",
"hardhat_artifacts_directory": "build/artifacts"
}