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 ETHbutton; - 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
synthesizeon the BSCPortalcontract with params:- WBNB contract address;
- BNB amount;
- Ethereum wallet address where to transfer synthetic BNB.
- BSC Portal accept BNB amount and call
BridgetoMint synthetic BNBon Ethereum chain; 14.Bridgecalls methodmintSyntheticTokenonSynthesiscontract on Ethereum chain to mint synthetic BNB on Ethereum chain; Synthesissend minted synthetic BNB to user on Ethereum chain;- The system calls the function
Add Liquiditywith pairETH + synthetic BNBon 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 ETHbutton; - 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
burnSyntheticTokenonSynthesizeEthereum contract with params:- Synthetic BNB contract address;
- Synthetic BNB amount;
- BSC wallet address where to transfer original BNB.
SynthesiscallBridgetoBurn synthetic BNBon Ethereum chain;Bridgecalls methodunsynthesizeonPortalcontract on BSC;Portalsend original BNB to user on BSC;- Success.
Link to sequence diagram http://is.gd/63CbQ6