Functions
EVM
Functions that can be called are marked as external
or public
Solana
The
program
macro specifies the module containing the program's instruction logic, it is equivalent to an EVMcontract
.An
instruction
is the equivalent of an EVM function.Each instruction comes with a context. A context contains all the accounts an instruction needs to access. In Solana, data is stored in accounts, it is similar to an EVM mapping, but they are not the same because in EVM, data is stored within a contract while Solana programs are stateless. Data is stored separately and their storage addresses are derived.
In this example, we have to specify the buyer's token account because a successful swap increments the buyer's token account's balance (more on token accounts in another section). The
buyer_token_account
is the equivalent of the EVM Token'sbalances
mapping.
Last updated