Market Maker Contract

Market Maker Contract

Interface

pragma solidity ^0.6.7;
contract OptionV2Maker {
	address[] public maker;
	mapping(address => bool) public allowMaker;
    mapping(address => uint256) public makerIndex;
    uint256 public rate;
    //makerBalance[_payToken][_indexNo][makeraddress][_poolId]
    mapping(address => mapping(uint256 => mapping(address => uint256[16])))
        public makerBalance;
	function getOrderMaker(uint256 _orderNo, uint256 _start) external  view  returns (uint256[50] memory makerArr, uint256[50] memory makerMargin);
	event Maker(address maker, bool allow);
    event MakerDeposit(address payToken, uint256 indexNo, uint8 poolId, address maker, uint256 amount, uint256 fee);
    event MakerWithdraw( address payToken,uint256 indexNo, uint8 poolId,  address maker,   uint256 amount);
}

##Events

  • Maker(address maker, bool allow) Add new or modify market maker permissions

  • MakerDeposit(address payToken,uint256 indexNo,uint8 poolId,address maker, uint256 amount, uint256 fee ) Market makers deposit margin MakerWithdraw(address payToken,uint256 indexNo,uint8 poolId,address maker, uint256 amount) Market makers withdrow margin

Methods(read thmods)

Based on the market maker address to lookup: maker_index

1. Allow Maker

mapping(address => bool) public allowMaker

Whether to run deposite margin

2. Maker

address[] public maker;

Based on maker_index to ger address

node

let address = await contract.maker(maker_index);

3.Rate

uint256 public rate

**The rate of market maker deposits margin **

4. Maker Balance

mapping(uint256 => mapping(uint256 => uint256[16])) public makerBalance

View the balance of single market maker in option pool

node

	let balance = await contract.makerBalance(pay_token,index_no,maker_index,pool_id);

5. Order Maker Length

function orderMakerLength( uint256 _orderNo ) external view returns (uint256)

Order maker length

6. Get Order Maker

function getOrderMaker( uint256 _orderNo, uint256 _start) external view returns (uint256[50] memory makerArr, uint256[50] memory makerMargin)

Get order maker

7. Pools

function pools(address _payToken, uint256 _indexNo, uint8 _poolId) external view returns (uint256)

Pools balance

Methods(write methods)

1. Make rDeposit

function makerDeposit(uint256 _payToken, uint256 _indexNo,uint8 _poolId, uint256 _amount ) external

Deposit margin

2. Maker Withdraw

function makerWithdraw(uint256 _payToken, uint256 _indexNo,uint8 _poolId, uint256 _amount ) external

Withdraw margin

Last updated