Rust
Pinocchio Escrow

Pinocchio Escrow

18 Graduates

Refund

The refund instruction lets the maker cancel an open offer:

  • Close the escrow PDA and send its rent lamports back to the maker.
  • Move the full Token A balance out of the vault and back to the maker, then close the vault account.

Required Account

Knowing that this are the required accounts:

  • maker: the creator of the escrow. Must be a signer and mutable
  • escrow: the escrow account that we're initializing. Must be mutable
  • mint_a: the token we're depositing in the escrow
  • mint_b: the token we want to receive
  • maker_ata_a: the associated token account owned by the maker. Must be mutable
  • vault: the associated token account owned by the escrow. Must be mutable
  • associated_token_program: the associated token program. Must be executable
  • token_program: the token program. Must be executable
  • system_program: the system program. Must be executable

We're going to let you create your own account struct since now you should be familiar with the process.

Instruction Data

All the data that we need to perform the logic already lives in the Escrow account or on the accounts that we're deserializing. For this reason we don't need any instruction_data for this instruction.

Logic

Here again, we're going to let you spread your wings and create your own logic for this! Don't be scared to go back to the previous sections to see how we implemented the make and take instruction, or reach out on Discord if you get stuck.

Next PageConclusion
OR SKIP TO THE CHALLENGE
Ready to take the challenge?
Contents
View Source
Blueshift © 2025Commit: cc5f933