zeta-chain / protocol-contracts-solana

solana interface contract for zetachain
MIT License
5 stars 2 forks source link

`withdraw_spl_token`: add mint in params and validate in the instruction processor #5

Closed brewmaster012 closed 4 months ago

brewmaster012 commented 4 months ago

Currently, in to withdraw SPL token from the gateway program, the user must provide correct from and to addresses otherwise the transfer will fail.

https://github.com/zeta-chain/protocol-contracts-solana/blob/21cfcadc11340a7b3b6072fb4e8c02e7812dacd3/programs/protocol-contracts-solana/src/lib.rs#L165-L175

Correct include the following conditions:

  1. the from and to are both token accounts;
  2. the from and to token accounts have the same mint account (they store the same SPL token)

Unlike Ethereum ERC20, SPL token cannot be transferred to arbitrary accounts/addresses.

lumtis commented 4 months ago

@brewmaster012 would it be possible to provide some more details and assess if it is in scope for https://github.com/zeta-chain/node/issues/2401?

brewmaster012 commented 4 months ago

Yeah I'm going to close this one. After evaluation this issue does not add additional check while introducing significant complexity.