-
Notifications
You must be signed in to change notification settings - Fork 2
Added Hardhat tasks for FastBridge solidity #92
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
base: master
Are you sure you want to change the base?
Changes from 6 commits
2689f45
33394e2
cc9fd20
052d965
ce50553
bc927d5
f0b73d5
cad08e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -104,30 +104,56 @@ Follow below steps to execute script and start interacting | |
| Note: bridge address will be picked from `deploymentAddress[network].new.bridge` (from `spectre-bridge-protocol/eth/scripts/deployment/deploymentAddresses.json`) | ||
|
|
||
| ### To interact with FastBridge using hardhat task | ||
| To call any method of EthErc20FastBridge use hardhat task `method` | ||
| Run command `npx hardhat method --jsonstring <json_string_input>` | ||
| ``` | ||
| to create `json_string_input` | ||
| 1. create json with `signature` and `arguments` properties in below example format | ||
|
|
||
| { | ||
| "signature": "setWhitelistedTokens(address[],bool[])", | ||
| "argcount": "2", | ||
| "arguments": { | ||
| "arg1": [ | ||
| "0xdAC17F958D2ee523a2206206994597C13D831ec7", | ||
| "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", | ||
| "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" | ||
| ], | ||
| "arg2": [ | ||
| true, | ||
| true, | ||
| true | ||
| ] | ||
| 1. To call any method of EthErc20FastBridge use hardhat task `method` | ||
| Run command `npx hardhat method --jsonstring <json_string_input>` | ||
|
|
||
| to create `json_string_input` | ||
| 1. create json with `signature` and `arguments` properties in below example format | ||
| ``` | ||
| { | ||
| "signature": "setWhitelistedTokens(address[],bool[])", | ||
| "argcount": "2", | ||
| "arguments": { | ||
| "arg1": [ | ||
| "0xdAC17F958D2ee523a2206206994597C13D831ec7", | ||
| "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", | ||
| "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" | ||
| ], | ||
| "arg2": [ | ||
| true, | ||
| true, | ||
| true | ||
| ] | ||
| } | ||
| } | ||
| } | ||
|
|
||
| 2. pass below json to JSON.stringify() and use output as `json_string_input` | ||
|
|
||
| ``` | ||
| example: to call `setWhitelistedTokens` method run command `npx hardhat method --jsonstring '{"signature":"setWhitelistedTokens","arguments":{"arg1":["0xdAC17F958D2ee523a2206206994597C13D831ec7"],"arg2":[true]}}'` | ||
| ``` | ||
| 2. pass below json to JSON.stringify() and use output as `json_string_input` | ||
|
|
||
|
|
||
| For example: to call `setWhitelistedTokens` method run command | ||
| ``` | ||
| npx hardhat method --jsonstring '{"signature":"setWhitelistedTokens","arguments":{"arg1":["0xdAC17F958D2ee523a2206206994597C13D831ec7"],"arg2":[true]}}' | ||
| ``` | ||
|
|
||
| 2. To deploy fast-bridge run `npx hardhat deploy_fastbridge --verification <bool> --network <network_name>` , here `--verification` is an optional parameter with default value `false` if passed `true` than contract is verified just after the deployment. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you write commands in the separate code block, not as inline code? It will be much easier to read.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| 3. To verify already deployed contract on same network run `npx hardhat verify_bridge --proxyaddress <fastbridge_proxy_address> --network <network_name>` | ||
| 4. To whitelists single erc20 token in fast-bridge run `npx hardhat whitelists_token --tokenaddress <token_address> --network <network_name>`, here the pvt key of signer need to have the authorised role to make successful txn and key is picked from .env file so you need to setup it before running the cmd. | ||
| <br>For example: | ||
| ``` | ||
| npx hardhat whitelists_token --tokenaddress 0xb2d75C5a142A68BDA438e6a318C7FBB2242f9693 --network mumbai | ||
| ``` | ||
| 5. To whitelists token in bulk run `npx hardhat whitelists_token_in_bulk --tokenaddresses <comma_separated_token_addresses> --whiteliststatus <comma_separated_bool_value> --network <network_name>` | ||
| <br>For example:- | ||
| ``` | ||
| npx hardhat whitelists_token_in_bulk --tokenaddresses 0xF0b0c5E2c3A35213992bD9b45Af352D6D4035203,0xaa2D6608241B6B930BCcaFE245eFDf052e46C9aA --whiteliststatus true,true,true --network mumbai | ||
| ``` | ||
| Here also signer need to have the access role to make txn successful. | ||
| 6. To check whether the token is whitelisted or not run `npx hardhat is_token_whitelisted --tokenaddress <token_address> --network <network_name>` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice to have an opportunity to set up the address of the fast bridge contract
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added in cad08e9 |
||
| 7. To remove token from whitelists run `npx hardhat remove_token_from_whitelists --tokenaddress <token_address> --network <network_name>` | ||
| <br>For example: | ||
| ``` | ||
| npx hardhat remove_token_from_whitelists --tokenaddress 0xb2d75C5a142A68BDA438e6a318C7FBB2242f9693 --network mumbai | ||
| ``` | ||
| 8. To pause fast_bridge run `npx hardhat pause_fastbridge --network <network_name>`, here the signer needs to have desired role to do so. | ||
| 9. To unpause fast_bridge run `npx hardhat unpause_fastbridge --network <network_name>`, here also the signer needs to have proper access role to do so. | ||
| 10. To upgrade the fastbridge run `npx hardhat upgrade_fastbridge --network <network_name>`, here the signer needs to have the proper admin role to upgrade the fast-bridge contract. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
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.
I suggest removing this generic task and creating separate hardhat tasks for each contract method.
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.
I have implemented separate tasks for each contract method in this PR, just not removed this generic function which could work as add-on functionality. Please let me know if you differ from this thought. I can remove the generic task.
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.
The implementation for methods
transferTokensandwithdrawStuckTokensis missed. This tasks also can be useful for debugging.I prefer to remove the generic method, but it is up to you.
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.
f0b73d5