I worked a new feature in Loopring protocol, which has been approved and merged in Github repo.
Previous, the protocol has a setCutoff method to cancel all orders whose timestamp is less than the specified timestamp. However, that's not enought. What if we want to cancel orders for a trading pair. A trading pair is defined as orders that are from one sender to one receiver. So we implemented a new feature in Loopring protocol, which is to cancel all orders for specific trading pairs.
We generated a trading pair id with the sender address and the receiver address by using SHA-256 algorithm and xor operation. Then the trading pair id is added into a map and associated to a cutoff timestamp. We develop a new function to update the cutoff time. When a new ring is submited, we will validate if the order trading pair is cut off.
We also added tests for this feature.
Finally, 5 commits are complated and 72 lines of codes are added!
The most challenging part of the project is to understand Loopring protocol and to familiar with the codebase.
Merged PR: https://github.com/Loopring/protocol/pull/237 Step 2: check tradingPairCutoffs in validateOrder #237
In Review PR: https://github.com/Loopring/protocol/pull/238 Add tests for tradingPairCutoffs #238