ShareLedger Swap/Bridge Overview Part 2

April 13, 2023

Let's talk about the ShareLedger (SLP3) to ERC20 (Ethereum) and BEP20 (Binance Chain) bridge.

Whilst it follows the same PEG mechanism, there are some fundamental differences that make this process more efficient from a fee perspective and also from the number of transactions that are incurred.

When a user initiates an outgoing (SLP3 to ERC20/BEP20) bridge request with the ShareRing app, it invokes a ShareLedger module called 'SWAP'. The command structure looks something like this (in fact, you can download the ShareLedger CLI from our github and run a swap out request without using the app if you want):

./shareledger tx swap out [dest_address] [network] [amount] [flags]

 The benefit of using this method to bridge the tokens out to ERC20/BEP20 is that we only need 1 PEG wallet (instead of individual PEG wallets), so the SHR (including the bridge fee) are automatically sent and locked into the main SWAP MODULE instead of an individual PEG wallet.

 Below is an example of a transaction that bridged SHR OUT to ERC20 from SLP3:

https://explorer.shareri.ng/transactions/47F12EAFC9A684E7357B6B5109F07EFFCF866C28C6BCB1E91AA4C3A05DE2E5BE

 For the time being, we have also added an 'Approval' function to the SLP3 to ERC20/BEP20. The purpose of this Approval function is to act as a gatekeeper for malicious actors that try to circumvent the process (as we've seen on a number of bridges).  Certain staff in our company have a process where they quickly batch review the bridge requests and then 'sign' the transaction with the ShareRing app to authorise the swap.  For this reason, we also maintain a balance on the swap module to a low value to avoid any possibility of someone draining the PEG. To date, we've had no swaps that were rejected.  The plan is to slowly remove this approval function from the swapping tool over the coming year by adding in some other automated monitoring systems.

 Below is a sample of what the SWAP Approval and our Admin dashboard looks like for our Admin staff:

Swapping

Below is a logical diagram of the process that's used for the Bridge:

BRIDGE/SWAP OUT:

BRIDGE/SWAP IN: