Skip to content

Commit

Permalink
add some light comments to instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
brewmaster012 committed Oct 2, 2024
1 parent 0e18af4 commit f352dc3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions programs/protocol-contracts-solana/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pub mod gateway {
Ok(())
}

// admin function to pause or unpause deposit
pub fn set_deposit_paused(ctx: Context<UpdatePaused>, deposit_paused: bool) -> Result<()> {
let pda = &mut ctx.accounts.pda;
require!(
Expand Down Expand Up @@ -84,6 +85,10 @@ pub mod gateway {
Ok(())
}

// deposit SOL into this program and the `receiver` on ZetaChain zEVM
// will get corresponding ZRC20 credit.
// amount: amount of lamports (10^-9 SOL) to deposit
// receiver: ethereum address (20Bytes) of the receiver on ZetaChain zEVM
pub fn deposit(
ctx: Context<Deposit>,
amount: u64,
Expand All @@ -110,6 +115,10 @@ pub mod gateway {
Ok(())
}

// deposit SOL into this program and the `receiver` on ZetaChain zEVM
// will get corresponding ZRC20 credit. The `receiver` should be a contract
// on zEVM and the `message` will be used as input data for the contract call.
// The `receiver` contract on zEVM will get the SOL ZRC20 credit and receive the `message`.
pub fn deposit_and_call(
ctx: Context<Deposit>,
amount: u64,
Expand All @@ -121,6 +130,10 @@ pub mod gateway {
Ok(())
}

// deposit SPL token into this program and the `receiver` on ZetaChain zEVM
// will get corresponding ZRC20 credit.
// amount: amount of SPL token to deposit
// receiver: ethereum address (20Bytes) of the receiver on ZetaChain zEVM
pub fn deposit_spl_token(
ctx: Context<DepositSplToken>,
amount: u64,
Expand Down Expand Up @@ -157,6 +170,11 @@ pub mod gateway {
Ok(())
}

// like `deposit_spl_token` instruction,
// deposit SPL token into this program and the `receiver` on ZetaChain zEVM
// will get corresponding ZRC20 credit. The `receiver` should be a contract
// on zEVM and the `message` will be used as input data for the contract call.
// The `receiver` contract on zEVM will get the SPL token ZRC20 credit and receive the `message`.
pub fn deposit_spl_token_and_call(
ctx: Context<DepositSplToken>,
amount: u64,
Expand Down

0 comments on commit f352dc3

Please sign in to comment.