SIP 134: Minimal Proxies for Binary Options Source

AuthorDanijel, Justin Moses, Brett Sun, Anton Jurisevic
Discussions-Tohttps://research.synthetix.io/t/sip-134-minimal-proxies-for-bos/386
StatusFeasibility
Created2021-04-30

Simple Summary

Reduce Binary Option Market creation gas costs by:

  • Deploy a ERC-1167 Minimal Proxy when a new BinaryOptionMarket is created.
  • Deploy a ERC-1167 Minimal Proxy when a new BinaryOption is created.

Abstract

This SIP proposes to optimize the creation of BinaryOptionMarkets and the options themselves by deploying ERC-1167 Minimal Proxies. The approach was already implemented for Virtual Synths in SIP-127

Motivation

The general motivation behind the Minimal Proxy pattern is explained in SIP-127.
The use case for BinaryOptions is significant as the gas cost for creating a market are quite large at L1 at >$1000 at the time of writing the SIP.

Gas costs at creating a new BinaryOptionMarket will be greatly reduced with this change from 5,200,000 gas to less than 1,000,000 gas.

Specification

Overview

The BinaryOptionsMarket and BinaryOption contracts will be modified to reuse the pattern of Minimal proxies as implemented in SIP-127.

Rationale

Minimal Proxies have proved to provide a great relief in terms of gas costs to deploy new contracts with same implementation but different variables/states.

Technical Specification

Minimal proxy has been implemented as in SIP-127. Additional changes specific to Binary Options contracts are:

  • A new base contract is added for Owned pattern to support initialization via a method call for MininalProxies inherriting this contract.
  • BinaryOptionMarket no longer has MixinResolver as supercontract. This reduced the release and maintanance overhead.

Test Cases

Unit tests included with implementation.
Additional production test added to compare gas costs.

Configurable Values (Via SCCP)

None.

Copyright and related rights waived via CC0.