Quantcast
Channel: Recent Questions - Solana Stack Exchange
Viewing all articles
Browse latest Browse all 7994

How to handle both SPLs and native SOL token in my contract?

$
0
0

Hi I was working on making a contract that should support both SOL and SPL tokens.

Is there a recommended way to manage SOL and SPL token altogether? It looks like we need to wrap SOL to make it work. A way I an thinking to do is ask the user to wrap it first, but it doesn't feel really user friendly.

Is there a recommended way to do that? I was thinking a function that could look like that:

pub fn function_one(ctx: Context<Game>, amount: u64) -> Result<()> {    is_spl = detect_if_spl()    if not spl {       wrap_sol()     }   ...   ...}

Thank you!


Viewing all articles
Browse latest Browse all 7994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>