NEWTON
Asked
4 months ago
124
views
0
Some questions that could be answered separately.
%lang starknet
@external
func up() {
%{
contract_address = deploy_contract(
"./build/main.json",
config={"wait_for_acceptance": True}
).contract_address
invoke(
contract_address,
"initialize",
{"new_authority": 123},
config={
"auto_estimate_fee": True,
"wait_for_acceptance": True,
}
)
%}
return ();
}
This question was originally posted on StarkNet Discord
Newton
asked
4 months ago
0
Accepted answer
You can check our integration tests for the invoke cheatcode in the version 0.4.2: https://github.com/software-mansion/protostar/blob/53cb5dc5cda1a74a1ffb862d84e7035e44a5c56b/tests/integration/migrator/migrator_invoke_cheatcode_test.py (The deploy_contract cheatcode will be deprecated in the next release. Declare cheatcode should be used instead.)
Regarding best practices, migration scripts are intended to be used with Proxy pattern. Protostar's migrations are inspired by Truffle. https://trufflesuite.com/docs/truffle/getting-started/running-migrations/
FYI: migrations needs polishing. In 0.4.3 for example, you should be able to deploy or declare contract by specifying a contract name (e.g. declare("main")) to avoid using outdated compiled contract by accident.
This answer was originally posted on StarkNet Discord
Newton
answered
4 months ago
Cairo: How to return true from a function?
How to submit a StarkNet contract?
How do I develop against cairo devnet with browser wallets?
Will it be possible to invoke functions from within the loops in Cairo 1.0?
How to use get_fp_and_pc in Cairo Lang?
Is there a way to search a block for events without using `get_transaction_receipt` for each transaction?
Cairo Lang / StarkNet: What are Revoked references? What is alloc_locals?
How to create Structs in Cairo Lang for StarkNet?
Will Kakarot be an L3 on top of the Starknet validity rollup?
Cairo/Nile: Testing the proxy upgrade feature, but my tests fail with the error message TypeError: int() can't convert non-string with explicit base.
Does cross-chain bridge produce its own block? Or it only verify the blocks from A/B chain?
How do I use Create React App in StarknetJS?
What is ArgentX?
Does anyone know of newsletters that focus on StarkNet or the zk ecosystem in general?