https://github.com/Abhinavpatra/week-13-lst

  1. tracks the blockchain for incoming transactions to an address we own
  2. Anytime SOL comes to this address, we mint our custom token to that address(HSOL). The amount depends on the mathematical formula
  3. whenever the user returns some token, we will return them SOL in a similar amount

{96933929-3D20-47CC-B4B8-28E30C867696}.png

{2F18A20E-6EA4-4A25-BD68-8AFD0995B548}.png

Indexer

  1. We use an indexer to scan every block and transaction, and lets you subscribe to specific events you are interested in
  2. An indexer constantly monitors and processes blockchain activity, looking for transactions or blocks pertaining to a specific address.

1. create a helium account, and configure a webhook

select transaction types, and or whatever events happens on that address

{4E7826AD-250F-47A7-A48A-08E2D95308B9}.png

  1. first we wait to get a request like this, from the webhook informing us that a transaction has happened on our account
  2. then we parse that block, to find out if the details are right. and if it has been sent to our account. if so then we move to the next step
  3. we parse the amount of sol sent to our account
    1. accordingly we mint tokens using solana/spl-token library and send those tokens from the ATA to the address which sent us the SOL.
  4. create your own token, (probably in your cli) and hardcode that as TOKEN_MINT_ADDRESS as the mint PublicKey, accordingly also set public and private key that you will use to generate mint of the token using mintTo function, use obviously the same public and private key, that you used to generate the token

{3EF1B690-FC3F-462C-87C2-895315621650}.png