Smart Contract Rookie
Deploy a basic smart contract
ViewView on NFTx
The approval program in this challenge is relatively simple. The first time it's deployed it jumps to the "setup" branch, where it stores the first application argument you provided into a global state called "access_code". Now on subsequent calls, you must provide the same argument as it's compared to be the same. If the comparison is successful, the smart contract will increment a "counter" in global state. Note that in this task the code for the contract is already written.
A smart contract is required to be compiled down to bytecode before being submitted to the network. Depending on how much global and/or local state data the smart contract uses, the schema must be configured and provided with the rest of the transaction parameters (the approval program provided requires just 1 global byteslice and 1 global int). Once the transaction has been successfully committed to a block, the application ID can be found and can be used to further calculate the application account address. Further calls to the now deployed smart contract can be made using the application ID.
Prepare for the challenge
The documentation above explains the details of smart contracts and how the SDKs can be used to deploy and call them.
You will complete the challenge with our partner Replit in a new tab. Fork the Replit using the 'Fork Replit' button in the righthand corner to begin. If this is your first challenge, you will need to create a Replit account before forking the challenge code.
In this challenge, you need to:
- Compile the smart contract to bytecode
- Construct an application call transaction with the correct parameters
- Deploy the smart contract and identify the application ID
- Call the smart contract with the correct parameters, incrementing the counter
Introduce yourself, ChallengerSign In
Check out our Discord channel, where you can communicate with other Algorand developers.