SettleManager.sol

Last Updated At 30th Oct, 2024

State-Changing Functions

settlePosition

function settlePosition(
    address[] memory _path,
    uint16 _underlyingAssetIndex,
    uint256 _optionTokenId,
    uint256 _minOutWhenSwap,
    bool _withdrawETH
) external returns (uint256)
  • Settles a single option position

  • Handles token swaps and settlement calculations

  • Returns the amount received from settlement

settlePositions

function settlePositions(
    address[][] memory _paths,
    uint16 _underlyingAssetIndex,
    uint256[] memory _optionTokenIds,
    uint256[] memory _minOutWhenSwaps,
    bool _withdrawETH
) external
  • Settles multiple option positions in a single transaction

  • Batch processes settlements for efficiency

  • Handles multiple token swaps and settlements

Events

SettlePosition

event SettlePosition(
    address indexed account,
    uint16 indexed underlyingAssetIndex,
    uint40 indexed expiry,
    uint256 optionTokenId,
    uint256 size,
    address[] path,
    uint256 amountOut,
    uint256 settlePrice
)
  • Emitted when a position is settled

  • Records all settlement details including prices and amounts

  • Includes the token swap path used for settlement

ABI

[
  {
    "type": "receive",
    "stateMutability": "payable"
  },
  {
    "type": "function",
    "name": "__AuthorityUtil_init__",
    "inputs": [
      {
        "name": "_authority",
        "type": "address",
        "internalType": "contract IOptionsAuthority"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "__BasePositionManager_init__",
    "inputs": [
      {
        "name": "_optionsMarket",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_controller",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_weth",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_authority",
        "type": "address",
        "internalType": "contract IOptionsAuthority"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "approve",
    "inputs": [
      {
        "name": "_token",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_spender",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_amount",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "authority",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "contract IOptionsAuthority"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "controller",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "ethTransferGasLimit",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "initialize",
    "inputs": [
      {
        "name": "_optionsMarket",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_controller",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_weth",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "_authority",
        "type": "address",
        "internalType": "contract IOptionsAuthority"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "onERC1155BatchReceived",
    "inputs": [
      {
        "name": "operator",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "from",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "ids",
        "type": "uint256[]",
        "internalType": "uint256[]"
      },
      {
        "name": "values",
        "type": "uint256[]",
        "internalType": "uint256[]"
      },
      {
        "name": "data",
        "type": "bytes",
        "internalType": "bytes"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "bytes4",
        "internalType": "bytes4"
      }
    ],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "onERC1155Received",
    "inputs": [
      {
        "name": "operator",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "from",
        "type": "address",
        "internalType": "address"
      },
      {
        "name": "id",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "value",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "data",
        "type": "bytes",
        "internalType": "bytes"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "bytes4",
        "internalType": "bytes4"
      }
    ],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "optionsMarket",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "owner",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "renounceOwnership",
    "inputs": [],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "sendValue",
    "inputs": [
      {
        "name": "_receiver",
        "type": "address",
        "internalType": "address payable"
      },
      {
        "name": "_amount",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "setAuthority",
    "inputs": [
      {
        "name": "_newAuthority",
        "type": "address",
        "internalType": "contract IOptionsAuthority"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "setEthTransferGasLimit",
    "inputs": [
      {
        "name": "_ethTransferGasLimit",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "settlePosition",
    "inputs": [
      {
        "name": "_path",
        "type": "address[]",
        "internalType": "address[]"
      },
      {
        "name": "_underlyingAssetIndex",
        "type": "uint16",
        "internalType": "uint16"
      },
      {
        "name": "_optionTokenId",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "_minOutWhenSwap",
        "type": "uint256",
        "internalType": "uint256"
      },
      {
        "name": "_withdrawETH",
        "type": "bool",
        "internalType": "bool"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "uint256",
        "internalType": "uint256"
      }
    ],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "settlePositions",
    "inputs": [
      {
        "name": "_paths",
        "type": "address[][]",
        "internalType": "address[][]"
      },
      {
        "name": "_underlyingAssetIndex",
        "type": "uint16",
        "internalType": "uint16"
      },
      {
        "name": "_optionTokenIds",
        "type": "uint256[]",
        "internalType": "uint256[]"
      },
      {
        "name": "_minOutWhenSwaps",
        "type": "uint256[]",
        "internalType": "uint256[]"
      },
      {
        "name": "_withdrawETH",
        "type": "bool",
        "internalType": "bool"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "supportsInterface",
    "inputs": [
      {
        "name": "interfaceId",
        "type": "bytes4",
        "internalType": "bytes4"
      }
    ],
    "outputs": [
      {
        "name": "",
        "type": "bool",
        "internalType": "bool"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "function",
    "name": "transferOwnership",
    "inputs": [
      {
        "name": "newOwner",
        "type": "address",
        "internalType": "address"
      }
    ],
    "outputs": [],
    "stateMutability": "nonpayable"
  },
  {
    "type": "function",
    "name": "weth",
    "inputs": [],
    "outputs": [
      {
        "name": "",
        "type": "address",
        "internalType": "address"
      }
    ],
    "stateMutability": "view"
  },
  {
    "type": "event",
    "name": "AuthorityUpdated",
    "inputs": [
      {
        "name": "authority",
        "type": "address",
        "indexed": true,
        "internalType": "contract IOptionsAuthority"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "OwnershipTransferred",
    "inputs": [
      {
        "name": "previousOwner",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "newOwner",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "SetEthTransferGasLimit",
    "inputs": [
      {
        "name": "ethTransferGasLimit",
        "type": "uint256",
        "indexed": true,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  },
  {
    "type": "event",
    "name": "SettlePosition",
    "inputs": [
      {
        "name": "account",
        "type": "address",
        "indexed": true,
        "internalType": "address"
      },
      {
        "name": "underlyingAssetIndex",
        "type": "uint16",
        "indexed": true,
        "internalType": "uint16"
      },
      {
        "name": "expiry",
        "type": "uint40",
        "indexed": true,
        "internalType": "uint40"
      },
      {
        "name": "optionTokenId",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "size",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "path",
        "type": "address[]",
        "indexed": false,
        "internalType": "address[]"
      },
      {
        "name": "amountOut",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      },
      {
        "name": "settlePrice",
        "type": "uint256",
        "indexed": false,
        "internalType": "uint256"
      }
    ],
    "anonymous": false
  }
]

Last updated