-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(ethers): change to ethers and upgrade dependencies #55
Conversation
cde87f0
to
b013360
Compare
This pull request fixes 1 alert when merging b013360 into aa2c585 - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging 1f8a91a into aa2c585 - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging b3ca582 into aa2c585 - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging d65de2a into aa2c585 - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging dc471e9 into aa2c585 - view on LGTM.com fixed alerts:
|
This pull request fixes 1 alert when merging 0b966f5 into aa2c585 - view on LGTM.com fixed alerts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a comment, please review
scripts/deploy.ts
Outdated
} | ||
}; | ||
|
||
export const writeConfiig = (config: NetworkAddresses) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export const writeConfiig = (config: NetworkAddresses) => { | |
export const writeConfig = (config: NetworkAddresses) => { |
scripts/deploy.ts
Outdated
const contractAddresses = await deployContracts(); | ||
console.table(contractAddresses); | ||
const newConfig = generateJsonConfig(contractAddresses); | ||
writeConfiig(newConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
writeConfiig(newConfig); | |
writeConfig(newConfig); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
d3ac8a4
to
2c76164
Compare
I invite you to rebase this on master now to resolve conflicts. |
27f6402
to
4e596d3
Compare
daed972
to
9661766
Compare
validShares(_partners) | ||
{ | ||
RevenuePartner[] memory partners, | ||
address remainderAddress |
Check notice
Code scanning / Slither
Missing zero address validation
hex"a9059cbb", | ||
tokenRecipient, | ||
tokenAmount)); | ||
(bool success, bytes memory ret) = tokenAddr.call{gas: tokenGas}( |
Check notice
Code scanning / Slither
Pre-declaration usage of local variables
); | ||
} | ||
|
||
|
||
//Why this require is not needed: in the case that the EVM implementation | ||
//sends gasleft() as req.gas if gasleft() < req.gas (see EIP-1930), which would end in the call reverting | ||
//If the relayer made this on purpose in order to collect the payment, since all gasLeft() | ||
//was sent to this call, then the next line would give an out of gas, and, as a consequence, will | ||
//revert the whole transaction, and the payment will not happen | ||
//But it could happen that the destination call makes a gasleft() check and decides to revert if it is | ||
//not enough, in that case there might be enough gas to complete the relay and the token payment would be collected | ||
//For that reason, the next require line must be left uncommented, to avoid malicious relayer attacks to destination contract | ||
//methods that revert if the gasleft() is not enough to execute whatever logic they have. | ||
|
||
require(gasleft() > req.gas,"Not enough gas left"); | ||
(success, ret) = req.to.call{gas: req.gas, value: req.value}(req.data); | ||
|
||
//If any balance has been added then trasfer it to the owner EOA | ||
uint256 balanceToTransfer = address(this).balance; | ||
if ( balanceToTransfer > 0) { | ||
//can't fail: req.from signed (off-chain) the request, so it must be an EOA... | ||
payable(req.from).transfer(balanceToTransfer); | ||
} | ||
|
||
} | ||
|
||
function getChainID() private pure returns (uint256 id) { | ||
//Why this require is not needed: in the case that the EVM implementation | ||
//sends gasleft() as req.gas if gasleft() < req.gas (see EIP-1930), which would end in the call reverting | ||
//If the relayer made this on purpose in order to collect the payment, since all gasLeft() | ||
//was sent to this call, then the next line would give an out of gas, and, as a consequence, will | ||
//revert the whole transaction, and the payment will not happen | ||
//But it could happen that the destination call makes a gasleft() check and decides to revert if it is | ||
//not enough, in that case there might be enough gas to complete the relay and the token payment would be collected | ||
//For that reason, the next require line must be left uncommented, to avoid malicious relayer attacks to destination contract | ||
//methods that revert if the gasleft() is not enough to execute whatever logic they have. | ||
|
||
require(gasleft() > req.gas, "Not enough gas left"); | ||
(success, ret) = req.to.call{gas: req.gas, value: req.value}(req.data); | ||
|
||
//If any balance has been added then trasfer it to the owner EOA | ||
uint256 balanceToTransfer = address(this).balance; | ||
if (balanceToTransfer > 0) { | ||
//can't fail: req.from signed (off-chain) the request, so it must be an EOA... | ||
payable(req.from).transfer(balanceToTransfer); | ||
} | ||
} |
Check warning
Code scanning / Slither
Low-level calls
override | ||
onlyOwner | ||
{ | ||
function transferOwnership(address _owner) external override onlyOwner { |
Check warning
Code scanning / Slither
Conformance to Solidity naming conventions
@@ -4,17 +4,17 @@ | |||
contract Migrations { | |||
address public owner; | |||
// solhint-disable-next-line var-name-mixedcase | |||
uint public last_completed_migration; | |||
uint256 public last_completed_migration; |
Check warning
Code scanning / Slither
Conformance to Solidity naming conventions
bytes memory dataToCheck1 = abi.encodePacked( | ||
decodedTx1.data, | ||
decodedTx1.gasLimit, | ||
decodedTx1.to, | ||
decodedTx1.value | ||
); |
Check warning
Code scanning / Slither
Variable names too similar
string public override versionPenalizer = | ||
"2.0.1+enveloping.penalizer.ipenalizer"; |
Check warning
Code scanning / Slither
State variables that could be declared constant
function removeToken(address token, uint256 index) external onlyOwner { | ||
require(token != address(0), "Token cannot be zero address"); | ||
require(tokens[token] == true, "Token is not accepted"); | ||
require(token == acceptedTokens[index], "Wrong token index"); | ||
delete tokens[token]; | ||
acceptedTokens[index] = acceptedTokens[acceptedTokens.length - 1]; | ||
acceptedTokens.pop(); | ||
} |
Check warning
Code scanning / Slither
Boolean equality
function acceptToken(address token) external onlyOwner { | ||
require(token != address(0), "Token cannot be zero address"); | ||
require(tokens[token] == false, "Token is already accepted"); | ||
tokens[token] = true; | ||
acceptedTokens.push(token); | ||
} |
Check warning
Code scanning / Slither
Boolean equality
8a5f55c
to
9c2696d
Compare
{ | ||
function penalize( | ||
address relayWorker, | ||
address payable beneficiary |
Check notice
Code scanning / Slither
Missing zero address validation
{ | ||
|
||
function directExecute( | ||
address to, |
Check notice
Code scanning / Slither
Missing zero address validation
{ | ||
|
||
function directExecute( | ||
address to, |
Check notice
Code scanning / Slither
Missing zero address validation
noBalanceToShare | ||
{ | ||
function updateRemainderAddress( | ||
address remainderAddress |
Check notice
Code scanning / Slither
Missing zero address validation
608bb6f
to
867c2d4
Compare
); | ||
} | ||
|
||
|
||
//Why this require is not needed: in the case that the EVM implementation | ||
//sends gasleft() as req.gas if gasleft() < req.gas (see EIP-1930), which would end in the call reverting | ||
//If the relayer made this on purpose in order to collect the payment, since all gasLeft() | ||
//was sent to this call, then the next line would give an out of gas, and, as a consequence, will | ||
//revert the whole transaction, and the payment will not happen | ||
//But it could happen that the destination call makes a gasleft() check and decides to revert if it is | ||
//not enough, in that case there might be enough gas to complete the relay and the token payment would be collected | ||
//For that reason, the next require line must be left uncommented, to avoid malicious relayer attacks to destination contract | ||
//methods that revert if the gasleft() is not enough to execute whatever logic they have. | ||
|
||
require(gasleft() > req.gas,"Not enough gas left"); | ||
(success, ret) = req.to.call{gas: req.gas, value: req.value}(req.data); | ||
|
||
//If any balance has been added then trasfer it to the owner EOA | ||
uint256 balanceToTransfer = address(this).balance; | ||
if ( balanceToTransfer > 0) { | ||
//can't fail: req.from signed (off-chain) the request, so it must be an EOA... | ||
payable(req.from).transfer(balanceToTransfer); | ||
} | ||
|
||
} | ||
|
||
function getChainID() private pure returns (uint256 id) { | ||
//Why this require is not needed: in the case that the EVM implementation | ||
//sends gasleft() as req.gas if gasleft() < req.gas (see EIP-1930), which would end in the call reverting | ||
//If the relayer made this on purpose in order to collect the payment, since all gasLeft() | ||
//was sent to this call, then the next line would give an out of gas, and, as a consequence, will | ||
//revert the whole transaction, and the payment will not happen | ||
//But it could happen that the destination call makes a gasleft() check and decides to revert if it is | ||
//not enough, in that case there might be enough gas to complete the relay and the token payment would be collected | ||
//For that reason, the next require line must be left uncommented, to avoid malicious relayer attacks to destination contract | ||
//methods that revert if the gasleft() is not enough to execute whatever logic they have. | ||
|
||
require(gasleft() > req.gas, "Not enough gas left"); | ||
(success, ret) = req.to.call{gas: req.gas, value: req.value}(req.data); | ||
|
||
//If any balance has been added then trasfer it to the owner EOA | ||
uint256 balanceToTransfer = address(this).balance; | ||
if (balanceToTransfer > 0) { | ||
//can't fail: req.from signed (off-chain) the request, so it must be an EOA... | ||
payable(req.from).transfer(balanceToTransfer); | ||
} | ||
} |
Check notice
Code scanning / Slither
Block timestamp
8fac133
to
4e2a5bd
Compare
feat(upgrade): re-create project with hardhat & ethers removing truffle and web3 chore: re-adds contracts chore: adds dev rules chore(contracts): fixes solidity lint errors chore(test): re-adds tests chore(upgrade): adds deployment tools chore(upgrade): add smock for contract mocking chore(upgrade): removes sol tests chore(upgrade): fixe pre-commit and update readme chore(upgrade): add more eslint rules chore(deps): move typechain to deps chore(upgrade): unignore dist from npm i chore(ethers): return util token for manual testing 👿 PP-565: migrate the removeTokens script to use Hardhat and Ethers.js (#92) * refactor: migrate the removeTokens script to use Hardhat and Ethers.js * fix: fix the task in hardhat.config, update Readme and apply format Co-authored-by: Antonio Morrone <antonio@iovlabs.org> PP-566: migrate script deploy collector (#95) * feat: dummy commit, create empty deployCollector.ts file * refactor: add script and task to deploy a Collector using Hardhat and Ethers.js * style: apply format rules * test: add the tests, remove the positional arguments and simplify the output file * fix: apply PR suggestions Remove some scripts from the package.json Use console.table to print the collector output Rename the input config file parameter Co-authored-by: Antonio Morrone <antonio@iovlabs.org> PP-569: migrate change partners (#97) * chore: change package.json version * feat: migrate the change-partners script to use ether.js * fix: change the parseJsonFile function to return undefined * fix: apply PR suggestions * Revert "style: include automatically formatted solidity files" This reverts commit 76ee863. * fix: remove the script from package.json and update Readme.md * style: apply formatting rules PP-567 Migrate Withdraw Task (#93) * feat: new hardhat task * feat: create withdraw task * chore: update readme * feat: complete withdrawal task and tests * chore: linted * fix: no from parameter on withdraw * chore: change readme, description of task * feat: reorganize tasks and tests * fix: restore .prepare script * fix: typo on script * fix: restore file permissions * fix: prettier issues, no waffle json file * fix: no prepare task * chore: remove unneeded rules * fix: change Readme.md to fix the command instruction * fix: restore the collector:deploy sample config file Co-authored-by: Christos Otarola <christos@Christoss-MacBook-Pro.local> Co-authored-by: Antonio Morrone <antonio@iovlabs.org> PP-355/update-rif-relay-server (#96) * refactor(index): expose typing for relay-server * refactor: prettier fix: fix the collector and add the missing tests Fix the collector updateRemainderAddress Include the missing test for the stakeForAddress method fix: add config to use custom signers to run scripts (#106) feat: expiration mechanism (#105) * feat: expiration mechanism * fix: FWD to SW * feat: validate time on deploy Co-authored-by: Christos Otarola <christos@Christoss-MacBook-Pro.local> PP-602/RelayClient: _validateSmartWallet (#109) * refactor(SmartWallet): expose getOwner * refactor(index): expose PromiseOrValue * chore: github workflow PP-358: include the contracts in dist (#112) * fix: remove contracts from npmignore * chore: rename .prettierrc to prettier.json5 to be consistent among all the repos PP-357: Add a task to mint utility tokens (#113) * feat: add a task to mint utility tokens * fix: apply linting and format to tasks * refactor: expose RelayHubInterface * docs: readme Co-authored-by: Francisco Tobar <francisco.tobar@iovlabs.org>
4e2a5bd
to
7ed4b21
Compare
* chore(ethers): change to ethers and updgrade dependencies feat(upgrade): re-create project with hardhat & ethers removing truffle and web3 chore: re-adds contracts chore: adds dev rules chore(contracts): fixes solidity lint errors chore(test): re-adds tests chore(upgrade): adds deployment tools chore(upgrade): add smock for contract mocking chore(upgrade): removes sol tests chore(upgrade): fixe pre-commit and update readme chore(upgrade): add more eslint rules chore(deps): move typechain to deps chore(upgrade): unignore dist from npm i chore(ethers): return util token for manual testing 👿 PP-565: migrate the removeTokens script to use Hardhat and Ethers.js (#92) * refactor: migrate the removeTokens script to use Hardhat and Ethers.js * fix: fix the task in hardhat.config, update Readme and apply format Co-authored-by: Antonio Morrone <antonio@iovlabs.org> PP-566: migrate script deploy collector (#95) * feat: dummy commit, create empty deployCollector.ts file * refactor: add script and task to deploy a Collector using Hardhat and Ethers.js * style: apply format rules * test: add the tests, remove the positional arguments and simplify the output file * fix: apply PR suggestions Remove some scripts from the package.json Use console.table to print the collector output Rename the input config file parameter Co-authored-by: Antonio Morrone <antonio@iovlabs.org> PP-569: migrate change partners (#97) * chore: change package.json version * feat: migrate the change-partners script to use ether.js * fix: change the parseJsonFile function to return undefined * fix: apply PR suggestions * Revert "style: include automatically formatted solidity files" This reverts commit 76ee863. * fix: remove the script from package.json and update Readme.md * style: apply formatting rules PP-567 Migrate Withdraw Task (#93) * feat: new hardhat task * feat: create withdraw task * chore: update readme * feat: complete withdrawal task and tests * chore: linted * fix: no from parameter on withdraw * chore: change readme, description of task * feat: reorganize tasks and tests * fix: restore .prepare script * fix: typo on script * fix: restore file permissions * fix: prettier issues, no waffle json file * fix: no prepare task * chore: remove unneeded rules * fix: change Readme.md to fix the command instruction * fix: restore the collector:deploy sample config file Co-authored-by: Christos Otarola <christos@Christoss-MacBook-Pro.local> Co-authored-by: Antonio Morrone <antonio@iovlabs.org> PP-355/update-rif-relay-server (#96) * refactor(index): expose typing for relay-server * refactor: prettier fix: fix the collector and add the missing tests Fix the collector updateRemainderAddress Include the missing test for the stakeForAddress method fix: add config to use custom signers to run scripts (#106) feat: expiration mechanism (#105) * feat: expiration mechanism * fix: FWD to SW * feat: validate time on deploy Co-authored-by: Christos Otarola <christos@Christoss-MacBook-Pro.local> PP-602/RelayClient: _validateSmartWallet (#109) * refactor(SmartWallet): expose getOwner * refactor(index): expose PromiseOrValue * chore: github workflow PP-358: include the contracts in dist (#112) * fix: remove contracts from npmignore * chore: rename .prettierrc to prettier.json5 to be consistent among all the repos PP-357: Add a task to mint utility tokens (#113) * feat: add a task to mint utility tokens * fix: apply linting and format to tasks * refactor: expose RelayHubInterface * docs: readme Co-authored-by: Francisco Tobar <francisco.tobar@iovlabs.org> * fix: apply format and lint rules --------- Co-authored-by: Francisco Tobar <francisco.tobar@iovlabs.org> Co-authored-by: Antonio Morrone <antonio@iovlabs.org>
What
adapt contracts to 0.8.9 solidity versionWhy