Smart contracts consists of 3 main contracts
-
https://github.com/digiu-ai/simplifi-dex/blob/dex_refactor/contracts/Synthesis.sol Synthesis responsible for minting and burning a pegged tokens
-
https://github.com/digiu-ai/simplifi-dex/blob/dex_refactor/contracts/Portal.sol Portal contract responsible for pegged token vault
-
https://github.com/digiu-ai/simplifi-dex/blob/dex_refactor/contracts/Bridge.sol Bridge contract responsible for offchain communications
Precondition: the user has connected two wallets: BSC (Binance Chain Wallet) and Ethereum (Metamask) and he has both assets (ETH and BNB)
Result: user created a cross-chain pool
- User clicks
Add Liquidity
; - The user selects the active one who wants to add. By default selected ETH to Ethereum and BNB to BSC;
- The system displays a list of assets for each chain;
- User selects ETH;
- The system displays the balance of the ETH wallet;
- The system displays the
Confirm ETH
button; - User clicks
Confirm ETH
; - The system calls confirmation on the smart contract of the selected token;
- The user selects the 2nd asset;
- Makes it approve on the BSC chain;
- The system displays the estimated user share in the pool;
- User clicks
Add Liquidity
; - The system calls
synthesize
on the BSCPortal
contract with params:- WBNB contract address;
- BNB amount;
- Ethereum wallet address where to transfer synthetic BNB.
- BSC Portal accept BNB amount and call
Bridge
toMint synthetic BNB
on Ethereum chain; 14.Bridge
calls methodmintSyntheticToken
onSynthesis
contract on Ethereum chain to mint synthetic BNB on Ethereum chain; Synthesis
send minted synthetic BNB to user on Ethereum chain;- The system calls the function
Add Liquidity
with pairETH + synthetic BNB
on the Ethereum chain; - Success.
Link to sequence diagram http://is.gd/JYtC2v
Precondition: the user has connected two wallets: BSC (Binance Chain Wallet) and Ethereum (Metamask) and he has ETH asset
Result: user received asset BNB on BSC
- User clicks
Swap
; - The user selects the active one who wants to swap. By default selected ETH to Ethereum and BNB to BSC;
- The system displays a list of assets for each chain;
- User selects ETH;
- The system displays the balance of the ETH wallet;
- The system displays the
Confirm ETH
button; - User clicks
Confirm ETH
; - The system calls confirmation on the smart contract of the selected token;
- The user selects the 2nd asset (BNB);
- Makes it approve on the BSC chain;
- The system displays the estimated amount of BNB;
- User clicks
Swap
; - The system swap ETH to synthetic BNB
- The system calls method
burnSyntheticToken
onSynthesize
Ethereum contract with params:- Synthetic BNB contract address;
- Synthetic BNB amount;
- BSC wallet address where to transfer original BNB.
Synthesis
callBridge
toBurn synthetic BNB
on Ethereum chain;Bridge
calls methodunsynthesize
onPortal
contract on BSC;Portal
send original BNB to user on BSC;- Success.
Link to sequence diagram http://is.gd/63CbQ6