Flow
Flow OverView
This is a complete flow of what it looks like interacting with Mr krabz with different users on multiple chains as if they were on. We'll also be going into the nitty gritty' s, so stick along.
We have 4 different users John, Jake, Terry, Dan and Finn.
John, Jake, Terry - FVM
Dan and Finn - Polygon
The Journey Begins
These 5 guys decide to all participate in a live round ongoing on mrKrabz protocol and buy 1 ticket each.(User can buy up to 3 tickets across chains and after that no more, what wins arent users )
They all come purchasing tickets on the chain of their choice.
We assume that each ticket cost 2 FIL or 3 MATIC and that no one makes a purchase with Krabz tokens. (Ticket Prices Officially are set in usd price values so tickets aren't cheaper on one over the other.)
So therefore we have a total of 6 FIL and 6 MATIC and 0 KRABZ in our cross chain reward pool.
Lets assume a user on FVM chain being Terry wins the lotto with the only ticket that has the the 3 matching numbers. (Note: There can be more than on winner it'll spilt amongst all of them).
How much will Terry earn ?
We'll assume asset prices for the sake of this tutorial but our good friends at Tellor provide these prices for us.
Lets take 1 FIL = 3 USD and 1 MATIC = 1.5 USD and KrabzToken = 0.9 USD
The total cross chain reward pool in USD would be
FIL = 6 * 3 = 12 USD
MATIC = 6 * 1.5 = 9 USD
KRABZ = 0* 0.9 = 0 USD
Total reward pool balance = 21USD
We then convert this 21 USD to krabz token = 23.3 KRABZ
Terry's cross chain balance gets increased by 23.3 KRABZ tokens which he can withdraw at any time.(This assumes that krabz token has enough liquidity in exchanges to be traded for.)
Note
The random value isnt really random. This was made so beacuse of being able to test for actual winner and no support for chainlink VRF on FVM testnet.
Cross chain transactions from one chain to the other in this case FVM and Polygon take about 8 to 9 minutes. In essence, if i top up my wallet balance on fvm it'll take 8-9 mins to reflect on Polygon.
Last updated