Skip to content

Chainlink hackathon Loopring AMM

Brecht Devos edited this page Sep 14, 2020 · 2 revisions

zkRollup AMM

Introduction

Reading material:

Loopring 3.6 introduces AMMs on the protocol level using the balancer curve. AMM can be enabled for a token on an account by setting a non-zero AMM weight. When multiple weights are non-zero, AMM is automatically enabled for all those tokens. Any number of tokens on the account can have a non-zero weight to create a pool of multiple tokens.

Enabling AMM is easy, but if the funds are pooled together we need to keep track of which user owns how large a part of the total balance in the pool account. This is where the AMM pool contract comes in. This is just a normal smart contract which interacts with layer 2 in a specific way, though you don't have to worry about this too much. The demo contract implements this already so you can focus on the actual pool implementation in solidity.

Task

Modify the demo AMM pool contract to implement a real working AMM pool. A $1500 bounty is provided for an AMM pool that doesn't have external dependencies (Uniswap, Balancer,...). There is also a $1500 bounty for an AMM pool contract does uses ChainLink to enhance the AMM in certain ways (StableCredit, bancorV2, dodo,...) by e.g. playing with the weights or minting a stable coin.

Getting started

Clone https://github.com/Loopring/protocols.git. Checkout the protocol36-ammpool branch. Follow the build instructions provided here: https://github.com/Loopring/protocols/tree/master/packages/loopring_v3

A demo implementation of an AMM pool contract is provided in contracts/test/AmmPool.sol. Modify this contract to add the requested features. Focus on modifying beforeBlockSubmitted (more specifically the functions called there) and implement your required changes. We don't expect a fully working and tested implementation, we are mainly interested in interesting AMM use cases that we can use to build upon.

nothing here

Clone this wiki locally