-
Notifications
You must be signed in to change notification settings - Fork 22
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
[BCI-2714]: adds sncast scripts #396
Conversation
|
||
devnet: | ||
@printf "\nStarting a local starknet devnet docker container:\n\n" \ | ||
&& bash ../../../ops/scripts/devnet-hardhat-down.sh \ |
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.
We already call cleanup on startup:
bash "$(dirname -- "$0")/devnet-hardhat-down.sh" |
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.
Good catch! I'll modify the script
tc-deploy: | ||
@cd ./scripts && sncast --account "$(ACCOUNT_NAME)" script run deploy_test_consumer | ||
|
||
tc-set-latest-round: | ||
@cd ./scripts && sncast --account "$(ACCOUNT_NAME)" script run set_latest_round |
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.
You can define account = "$ACCOUNT_NAME"
in the toml config under the default profile, then we don't need to specify --account
everywhere
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!
- In
snfoundry.toml
the account name is now configurable through an environment variable which is set automatically in theMakefile
- The
Makefile
is now the only place where the account names for devnet and testnet are defined - it is not hardcoded in any other place
make create-account | ||
``` | ||
|
||
- Once the account has been created, its info should be stored in an accounts file on your local machine (usually at `~/.starknet_accounts/starknet_open_zeppelin_accounts.json`). If you'd like to view the account information later on, you can use the following command: |
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.
Let's define accounts-file
to be in the current directory and gitignore it. That way we're not leaving global artifacts on user's system
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.
(only for devnet though)
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!
- In
snfoundry.toml
, I madeaccounts-file
configurable through an environment variable which is set automatically in theMakefile
- The
Makefile
is now the only place where theaccounts-file
paths for devnet and testnet are defined - it is not hardcoded in any other place - For devnet, the accounts file is called
accounts.json
and it lives at the same level assnfoundry.toml
. It is currently gitignored using a pre-existing rule in the.gitignore
file in the repo's root directory - For testnet, the accounts file is unchanged (
~/.starknet_accounts/starknet_open_zeppelin_accounts.json
)
add-account: | ||
@printf "\nAdding an account named \"$(ACCOUNT_NAME)\"...\n\n" \ | ||
&& sncast \ | ||
--url "http://127.0.0.1:5050/rpc" \ |
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.
How about a devnet and a testnet profile in sncast, then removing --url
flags and hardcoding the account name on devnet?
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!
- In
snfoundry.toml
, there is now a devnet profile and testnet profile each with their own RPC URLs - In the
Makefile
the commands now use the--profile
flag - The
Makefile
sncast commands now require an argumentNETWORK
which is used to determine which profile a.k.a which network to run the script on
…new docs, refactors test cases for test_consumer, renames MAKEFILE commands, reorganizes folders, updates README
Quality Gate passedIssues Measures |
…ripts [BCI-2714]: adds sncast scripts
Adds
sncast
ScriptsOverview
Please see the ticket here for more details! tl;dr this PR adds support for using
sncast
to interact with the data feed example contracts on Starknet testnet OR a local container running starknet-devnet-rs.Primary Changes
./ops/scripts/devnet-hardhat.sh
such that the container version can be configured (snfoundry v0.21.0 needs an rpc v0.7 endpoint, and the script defaults to using rpc v0.6)./examples/contracts/aggregator_consumer/scripts/src/test-consumer
:MockAggregator
andAggregatorConsumer
)README.md
file in./examples/contracts/aggregator_consumer
consumer.cairo
contractread_decimals
(not needed for new docs)read_latest_round
(not needed for new docs)read_answer
(needed for new docs)set_answer
(needed for new docs)test_consumer.cairo
accordingly