NEWTON
Asked
6 months ago
130
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
6 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
6 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?
Is it possible to transpile contracts that use openzeppelin libraries?
Questions about useStarknetExecute. Do we update the transaction manager on our end? [StarkNet/Cairo]
What are gas fees in StarkNet?
Did you change the factory/create2 part (to compute pool addresses)?
Nethermind's warp error: JavaScript heap out of memory
A TypeError while unpacking nested tuples into felts
Trying to deploy contract with Argent guide but got error Unitialized Contract