πŸ”Swap

Awesome, we're now rocking a "pool"! The next step is to put it to work and make some transactions happen.

Inscribe OP Swap

Swapping BRC20 tokens from a liquidity pool is an absolutely incredible way to exchange tokens!

With this method, you can trade tokens in a flash, without having to rely on pesky exchanges or intermediaries.

Plus, liquidity pools offer unparalleled exchange rates and minimal fees, making it the most cost-effective option out there. Not only that, but swapping tokens can enhance the overall liquidity of the pool, bolstering its performance and stability.

It's a revolutionary way to trade tokens that is both convenient and efficient, while also supporting the growth and liquidity of the pool. Get ready to swap your way to greatness!

Just a heads up - the accounting process for this will need to be calculated off-chain. The pool ratio is pretty complex and might not be easy to understand for the average user. But don't worry, as technology continues to advance, this should become a more feasible option. We will keep on pushing forward!

Now, lets swap 10 "oshi" for 10 "ordi" and see what happens.

{ 
  "p": "brc-20",
  "op": "swap",
  "tick": "ordi",
  "pid": "2141090",
  "amt-1": "10",
  "amt-2": "10",
  "slip": "0.003"
}
KeyRequiredDescription

p

Yes

Protocol: Helps other systems identify and process brc-20 events

op

Yes

Operation: Type of event (Deploy, Mint, Transfer)

tick

Yes

Ticker: 4 letter identifier of the brc-20

pid

Yes

hash of the liquidity pool. (see section Create a pool using $LPV1 BRC-20)

amt1

Yes

Quantity that you allow to be transferrable as referenced earlier (here for $ordi)

amt2

Yes

Quantity that you allow to be transferrable as referenced earlier (here for $oshi)

slip

Yes

Slippage you allow

Explanation

  • First, 10 "oshi" tokens have been extracted from your balance via the "input" system.

  • The pid system has been used to confirm this transaction.

  • These tokens have then been added to the "ordi-oshi" pool via hash incription.

  • The "amt-2" has been set to 10, indicating the output amount.

  • Finally, you'll receive a return of 10 "ordi" tokens. Enjoy!

Stay tuned for our future πŸͺ„ magic tricks or Buidl with us on:

Last updated