Writing an instruction: create
In the previous sections, we have defined our program's main data structure
The next step is to write our program's one of two main primitives:
We'll start by renaming the
src/processor/example_instr.rs file to
Similarly we'll rename the
ExampleInstr variant of the
instruction::ProgramInstruction enum to
Create, and the
instruction::example binding to
We should also alter the log message in
"Instruction: Example Instruction" to
"Instruction: Create", and update the instruction comment at the top of
//! Create a new token vesting contract.
This primitive will perform several operations:
- Initialize a new
- Configure the
VestingContractwith user-provided parameters.
- Transfer funds into the program vault.
An instruction's specification is defined by its
Params objects. Let's start by thinking about what kinds of accounts we'll need, and then we'll take a look at the associated parameters.