Contracts

Core Contract Descriptions


This page describes the contracts that make up Arrow Markets and how they interact.

Router

The router is used to keep track of the latest up-to-date addresses of the ArrowRegistry contract. It can be used to call all functions to settle positions. Our server account calls the openLongPosition and closeLongPosition function on the router and the router forwards the request to the PositionManager contract.

Events

The events contract is used by all other contracts to emit events that can be useful for anyone monitoring the activity of ArrowMarkets RFQ Product. This way, events only come through a single contract and thus removes the complexity of listening many contracts at once.

Registry

The primary role of the registry contract is to keep a record of all option chain and option AERC1155 contracts. It holds relevant option information, including contract addresses.

Utilities

This is a Library with utility methods for recovering an address from a signature and for verifying that the correct order parameters were hashed.

Options

These contracts delegate with all implementation logic relative to options that can be upgraded in the future. The ArrowOptions contract is a modified version of ERC1155 called AERC1155 that tracks owners and also emits events through the events contract. It is separated from ArrowPositionManager due to contract size concerns.

AERC1155 Standard (Custom ERC1155)

The AERC1155 token alters the ERC1155 specification to mint, burn and safeTransfer after deployment. These modifications make it easier to have the positionManager contract adhere to the ERC1155 standard in the sense that the core ERC1155 functions are accessible by the ERC1155 interface IERC1155.

Circuit

When a user would like to open an option, they specify the parameters of the option, such as the expiration date and strike price (the body of the API request is shown below).

If a user uses their Externally Owned Account (EOA) - an Ethereum address that is NOT a smart contract - they sign a hash of these order parameters, and submit an API request to the server containing the order parameters, their hash, and the signature.

Upon receiving this request, the backend server checks the parameters, prices the option, and submits the order to the ArrowRouter on behalf of the user. It also submits the market maker address and relevant information from their provided quote. Upon receiving the order from the server, the ArrowPositionManager verifies the order parameters, marketMaker, position Parameters and the originating EOA address from the signature.

For every unique combination of expiration date and underlying asset a new option chain is created. Subsequently each unique strike price results in the creation of a new option contract. Currently, users can select four types of options types for purchase: CALL, PUT, CALLSPREAD, and PUTSPREAD options.

Settlement Process

Options are settled at the level of the ArrowPositionManager.

After the expiration date of an option chain has passed, the Chainlink Automation nodes call the initSettlement function in the position manager smart contract to calculate the total assets and liabilities of the expired option contracts.

The value of the total assets is the current balance of stablecoin plus the value of the positions, which are unwound and converted to units of the stablecoin when initSettlement is called.

The total liabilities are the total price difference between settlement price and strike price for options that are in the money (the payoff for the users), multiplied by the number of outstanding contracts at each strike. If there are additional funds in the smart contract after the liabilities have been paid, these funds are transferred to the marketMaker. If there are insufficient funds for the payoff, the marketMaker has to transfer it to User.

User Settlement of In-the-Money Contract:

After initSettlement has been called, if a user owns an option that expires in-the-money (ITM), the user can settle their position and withdraw their payoffs from the market makers that have sold them their positions. The market maker pays the user in units of the stablecoin and the user’s option balance is set to 0. If the market maker's stablecoin balance is not enough, then his total balance will be paid to the user, and the corresponding amount of options will be deducted from the user.

Last updated