This article is primary aimed at folks who have some idea of working with smart contracts in Solidity and want to switch over to building smart contracts in Rust. It would be a hands on tutorial on how we can build a basic gambling smart contract.
Here is the schema of how it would work.
- Install dependencies
- Clone boilerplate code and understand the code.
- Program Flow
- Someone calls the entrypoint, The entrypoint forwards the arguments to the processor
- The processor asks instruction.rs to decode the instruction_data argument from the entrypoint function. Using the decoded data, the processor will now decide which processing function to use to process the request.
- The processor may use state.rs to encode state into or decode the state of an account which has been passed into the entrypoint.