
The Laminar Flow synthetic asset, margin trading, and money market protocols are now deployed on Ethereum testnet and ready for you to experiment with. Launch of the Laminar Flow protocols on Ethereum will mark our first step of bridging on-and-off chain liquidity and users.
The road ahead will include building a Flowchain based on Substrate to enable high-performance trading for the masses and connecting with the Polkadot network to enable cross-chain communications. Our Ethereum implementation will primarily serve as a value gateway, allowing us to leverage the functionality and contribute liquidity to the DeFi ecosystem there. The two will be integrated to leverage the best of both worlds, providing a better trading experience, bringing more liquidity on-chain, and empowering more open finance applications.
We will be showcasing our protocols and trading platform at the 2019 Singapore Fintech Festival next week. Come visit us at booth 1K14 Nov 11–15 at Singapore Expo.
You are welcome to review our code, ask questions and provide feedback.
Key Features
The Laminar Flow Protocols on testnet is focused on delivering the following features:
- You can trade long and short EURUSD, USDJPY, XAUUSD, and APPLUSD pairs
- You can mint synthetic assets including Euro (fEUR), JPY (fJPY), Gold (fXAU), and Apple Stock (fAAPL) with DAI
- You can deposit these assets to earn interests
- You can become a liquidity provider and set up your spread and rules trustlessly
Each asset has its live price feed from selected sources, and each liquidity pool (set up by a liquidity provider) would have its own spread, supported margin pairs and leverages.
On Kovan initial deployment, the following margin pairs are available to trade:
- Long and short 10x EURUSD
- Long and short 20x USDJPY
- Long and short 20x XAUUSD
- Long and short 5x APPLUSD
The Flow Exchange Web App
We have built a web application so that you can test the functionalities of the protocols. This is a work in progress that will improve significantly as we progress. Please kindly excuse bugs, and provide feedback to help us improve.
Check out the Flow Exchange DApp
Synthetic Asset exchange sneak peek

Margin Trading sneak peek

GraphQL
Developers can build applications on top of the Laminar Flow Protocols. Participants like Liquidity Providers and Liquidators can also build queries and bots to optimize their performances. We have built the Laminar Flow Protocol Subgraph for you to query the synthetic assets, margin positions, liquidity pools, and other useful information.
The Source Code
Here is a collection of Solidity source code that includes:
- The Synthetic Asset contracts
- The Flow Token contract
- The Margin Trading contracts
- The Money Market contract
- The Liquidity Pool contracts
- The Price Oracle contracts
Find the source code report and documentation below to learn the specifics and start building on top of it
- https://github.com/laminar-protocol/flow-protocol-ethereum
- https://github.com/laminar-protocol/flow-protocol-ethereum/wiki
The Contracts on Kovan
Here is a list of addresses of deployed contracts outlined above. We will continue to develop and improve the protocols, and new contracts would be deployed as we progress. You can find the latest deployment here.
Synthetic Asset Protocol contract
- Synthetic Asset Protocol contract: in charge of minting and redeeming fToken, as well as depositing/withdrawing fToken to and from the money market 0x117A85ebadBd933b576c6c2cfc6B160E380BC13d
Flow Token contracts
- fEUR contract: the Euro synthetic asset token contract 0x99D46D56b4f17BeFbE95673161aBDa45a0c29bf8
- fJPY contract: the JPY synthetic asset token contract 0xEAc94CCD74EFa1ED1578fF8276A96066b788c3A7
- fXAU contract: the Gold synthetic asset token contract 0xeD476b30f8296626051A3b5d5fA2A83CdC2B36eD
- fAPPL contract: the Apple Stock synthetic asset token contract 0x9A442a19b2168CdBED51BD3dbDECe1e9FA5E6d7E
Margin Trading contract
- Margin Trading Protocol contract: in charge of opening and closing margin positions 0x813fE903Ff23481F078fe9784d41a54E2F689f9B
Margin Trading Pair/Position contracts
- l10USDEUR contract: as 10x leveraged long EUR 0xf2E9Cdf8E75870bf8D804d0DF03f1D524aa9978E
- s10USDEUR contract: as 10x leveraged short EUR pair 0x3934dc02b0AB5F1fcEe6d0a4C64D3a50EC8e6B3F
- l20JPYUSD contract: as 20x leveraged long JPY 0x125b050ba02790181B6424CF7B65c80E1ec8D1f1
- s20JPYUSD contract: as 20x leveraged short JPY 0xbC6195AdA20Db07CeB55d7E853AbB876B4D0AFe2
- l20XAUUSD contract: as 20x leveraged short Gold 0x9e7223dC81D532FbA103b9D62c4f0946592B408B
- s20XAUUSD contract: as 20x leveraged short Gold 0x2C3F4d7bdB4b14b4840F65fFAc5aaDb9cff51628
- l5APPLUSD contract: as 20x leveraged short Apple Stock 0x67891828e4406b84e81e9B0af35Ea2A1a411D7bF
- s5APPLUSD contract: as 20x leveraged short Apple Stock 0xb390CD29EA45066E06623480D1b235f50E6618c8
Money Market contracts
- Money Market contract: in charge of liquidity, lending and withdrawing funds to and from Compound to earn interest while trading 0xd14C27C500f10038821bDf5cEE32314bFc41F60B
- iUSD contract: a subcontract of the money market contract to track internal USD 0xC33826CB3E21a4916B5Aa8cD3bB1e7cEc3588e1C
Price Oracle contract
- Simple Price Oracle contract: taking price feeds from multiple sources and implementing basic safety mechanisms 0x0629674131B06d9e6ea39E7B548E471081702EdF
Liquidity Pool contracts
- Liquidity pool_1 contract: has bid/ask spread of 0.3% 0x8b205c597602ebf442857D4714d996B343fFa20c
- Liquidity pool_2 contract: has bid/ask spread of 0.31% 0x6582204488d330ffAf464592179936EA1E8A3c1f
External contracts
- DAI contract: provided by Compound 0xbF7A7169562078c96f0eC1A8aFD6aE50f12e5A99
- cDAI contact: as Compound DAI 0x0a1e4d0b5c71b955c0a5993023fc48ba6e380496
Get Started with Laminar Flow
To start using and interacting with the above app and contracts, you will need to get Kovan test ETH and DAI tokens. Follow this guide to use Ethereum testnet for Laminar Flow Protocols before proceeding.
Contract Walkthrough Guide
The following examples will guide you through using the Laminar Flow contracts to mint and redeem Euro synthetic asset — fEUR, deposit fEUR to earn interest and conduct margin trades for EUR with 10x leverage. We will use Etherscan and Remix together with your Metamask extension to interact with the contracts.
Set up to use the Synthetic Asset contract
The synthetic asset contract is the management contract for minting fTokens, redeeming DAI, depositing fTokens to earn interest, etc.
1. Approve Synthetic Asset Protocol contract to move DAI
- Set up Remix to approve, refer to the Set up Remix section in the testnet setup guide.
- Expand the approve function
- spender as Synthetic Asset contract address 0x117A85ebadBd933b576c6c2cfc6B160E380BC13d
- amount = 2000000000000000000000000 as 2,000,000 DAI. You can approve a large amount that you don’t have to approve for every interaction.
- Click the Transact button, and confirm the transaction on your Metamask. See example transaction here
2. Go to the Contract — Write Contract section of the Synthetic Asset contract on Etherscan.
3. Click the Connect to web3 button, essentially connecting to your Metamask. Ensure your Metamask is connected to Kovan testnet.
Mint Synthetic EUR — fEUR with DAI
The process of minting $100 worth of fEUR requires 10% additional collateral by default to counter price fluctuation and ensure stability. Each liquidity pool can set a higher ratio for additional security.
When a user deposits $100, the additional $10 will be put up by the liquidity pool, which is managed by the contracts automatically. If the price of EUR goes up, the liquidity pool may lose a portion of the $10 collateral, see more details here. The pools are willing to take the risks for the spread they will earn at each trade, and for their hedging strategies to make the business case.
- Assume that you have followed the above instruction and is on the write contract tab of the Synthetic asset contract.
- Use the mint function
- token as fEUR address = 0x99D46D56b4f17BeFbE95673161aBDa45a0c29bf8
- pool as chosen liquidity pool 1 = 0x8b205c597602ebf442857D4714d996B343fFa20c
- baseTokenAmount as how much DAI would like to deposit to generate fEUR = 200000000000000000000 as 200 DAI
3. Click the Write button, and confirm the transaction on your Metamask. See example transaction here
4. Result: In the Event Logs, you can see the price at the time of minting from the first event PriceUpdated, with the exchange rate at 1.1049 and the last event Minted showing 180.47 fEUR minted.
Note: the actual price for buying/selling fTokens needs to add/substrate the spread from the chosen liquidity pool.
Return fEUR to redeem DAI
Regardless of how you obtain the fEUR (either you’ve minted it, or bought it from an exchange), you can redeem its DAI collateral via the synthetic asset protocol contract. This essentially reduces the supply of fEUR.
- Assume that you have followed the above instruction and is on the write contract tab of the Synthetic asset contract
- Use the redeem function
- token as fEUR address = 0x99D46D56b4f17BeFbE95673161aBDa45a0c29bf8
- pool as chosen liquidity pool 1 = 0x8b205c597602ebf442857D4714d996B343fFa20c
- flowTokenAmount as how much fEUR you would like to return to redeem DAI = 20000000000000000000 as 20 fEUR
3. Click the Write button, and confirm the transaction on your Metamask. See example transaction here
4. Result: In the Event Logs, you can see the first event PriceUpdated with the exchange rate at 1.105, and the last event Redeemed with 22.0337 DAI returned to your account
Deposit fEUR to earn interest
The Synthetic Asset contract is connected to a Money Market contract behind the scenes, to manage the funds in the liquidity pool and in collateral. The money market would deposit a portion of the funds into the selected money market (with Compound being the default one for this version) to earn interest, which further improves liquidity. This facility is also open to individual fToken holders to make a deposit and earn interests.
- Assume that you have followed the above instruction and is on the write contract tab of the Synthetic asset contract.
- Use the deposit function
- token as fEUR address = 0x99D46D56b4f17BeFbE95673161aBDa45a0c29bf8
- flowTokenAmount as how much fEUR you would like to deposit = 50000000000000000000 as 50 fEUR
3. Click the Write button, and confirm the transaction on your Metamask. See example transaction here
4. Result: the DAI collateral for your 50 fEUR is now earning interest in money market
Withdraw fEUR and pocket earnings
If you withdraw immediately after deposit, you may not earn any interest.
- Assume that you have followed the above instruction and is on the write contract tab of the Synthetic asset contract.
- Use the withdraw function
- token as fEUR address = 0x99D46D56b4f17BeFbE95673161aBDa45a0c29bf8
- flowTokenAmount as how much fEUR you would like to withdraw = 50000000000000000000 as 50 fEUR
4. Click the Write button, and confirm the transaction on your Metamask. See example transaction here
5. Result: 50 fEUR is returned to your address, plus tiny bit of interest in 0.0003089 DAI.
Set up to use the Margin Trading Protocol contract
The margin trading contract is the management contact for open and closing margin positions, etc.
1. Approve Margin Trading Protocol contract to move DAI
- Set up Remix to approve, refer to the Set up Remix section in the testnet setup guide.
- Expand the approve function
- spender as Margin Trading contract address 0x813fE903Ff23481F078fe9784d41a54E2F689f9B
- amount = 20000000000000000000000000 as 20,000,000 DAI. You can approve a large amount so that you don’t have to approve for every interaction.
- Click the Transact button, and Confirm the transaction on your Metamask. See example transaction here
2. Go to the Contract — Write Contract section of the Margin Trading contract on Etherscan.
3. Click the Connect to web3 button, essentially connecting to your Metamask. Ensure your Metamask is connected to Kovan testnet.
Trade 10x Long EURUSD
To open a $100 10x long EURUSD position, the user put in $100, and the liquidity pool put in the equivalent amount of $100. This essentially gives the cover for price fluctuation of 10% (1/leverage). Either side could win or lose that margin amount, see more details here.
- Assume that you have followed the above instruction and is on the write contract tab of the Margin Trading contract.
- Use the openPosition function
- pair as l10USDEUR address = 0xf2E9Cdf8E75870bf8D804d0DF03f1D524aa9978E
- pool as chosen liquidity pool 1 = 0x8b205c597602ebf442857D4714d996B343fFa20c
- baseTokenAmount as the amount to put into the trade = 100000000000000000000 as 100 DAI (1 DAI as reserved liquidation fee + 99 DAI for the trade).
3. Click the Write button, and confirm the transaction on your Metamask. See example transaction here
4. Result: see the Event Logs on Etherscan, in the last event OpenPosition, see data in Num forms
- positionId = 0, baseTokenAmount, openPrice = 1.1085156, and closeSpread = 0.3%. The opening price, close spread coupled with the current price can be used for calculating potential profit/loss.
Close a Margin Position
- Assume that you have followed the above instruction and is on the write contract tab of the Margin Trading contract.
- Use the closePosition function
- pair as l10USDEUR address = 0xf2E9Cdf8E75870bf8D804d0DF03f1D524aa9978E
- positionId = 0
3. Click the Write button, and confirm the transaction on your Metamask.
See example transaction here
4. Result: see the last event ClosePosition in the Event Logs on Etherscan, the data fields in Num are
- positionId, price = 1.1014856 (lower than the open price, hence I lost a few bucks), ownerAmount = 93.7164 as the amount returned to the user, liquidityPoolAmount = 106.27 as the amount returned to the pool. The loss of the user is the gain of the liquidity pool and vice versa.
This concludes the walkthrough of synthetic asset and margin trading interactions with the protocols. We will introduce how to deploy your own liquidity pool and other features of the protocols in the following posts. Stay tuned.
What’s Next
We will be undergoing both financial and security audits, that more details and reports will be released as we progress. Ethereum mainnet Alpha is planned for Q1 2020.
Meanwhile, we have already started designing and developing the Flowchain as a specialized high-performance trading chain using Substrate within the Polkadot ecosystem. More updates will be available in a couple of weeks.
Get Updates from Laminar
Official Website: https://laminar.one
Twitter: https://twitter.com/LaminarProtocol
LinkedIn:https://www.linkedin.com/company/laminar-protocols
About Laminar
Laminar is a financial institute backed decentralized finance protocol company. It aims to create an open finance platform that will provide better access to trading instruments, and enable developers to build more open financial services. Laminar’s Flow Protocols bring both synthetic assets and margin trading on the blockchain. It helps to solve the challenges of opaque pricing and price manipulation in the current financial markets, bridges on- and off-chain parties, and ultimately boosts on-chain trading liquidity, exposure, and variety.
Testing Laminar Flow Synthetic Assets & Margin Trading Protocols was originally published in Laminar on Medium, where people are continuing the conversation by highlighting and responding to this story.