Token API
Public Variables
AllocatedAmount | The number of 1xMM Tokens which have been allocated |
ApprovedTokens | The list tokens which have been approved for change |
AvailableTokens | The number of 1xMM Tokens which are available for sale. Available Tokens = TotalSupply - AllocatedAmount |
Decimals | The 1xMM contract number of decimals |
ETHDepositIsAllowed | True if deposits in ETH are allowed. ETH deposits enable users to change their ETH against 1xMM automatically and at EthExchangeRate |
ETHExchangeIsAllowed | True if users are allowed to change their 1xMM Tokens against ETH, at EthExchangeRate |
EthExchangeRate | The exchange rate ETH/1XMM |
TotalSupply | The total amount of 1xMM Tokens. When tokens are burnt, the TotalSupply amount decreases by the amount of token burnt. |
Events
Allocated | uint256 indexed timestamp address indexed beneficiary uint256 amount | The event is triggered when Owner allocates tokens to a beneficiary. |
Approval | address indexed owner address indexed spender uint256 amount | The event is triggered when a wallet owner grants an allowance to a spender. |
BridgeOutCancelled | uint256 indexed timestamp address indexed from uint64 toChainId | The event is triggered when a bridge to ‘toChainId’ is cancelled for a user. Users have to use our UI/UX interface to request a bridge cancellation. |
BridgeOutRequested | uint256 indexed timestamp address indexed from uint64 toChainId uint128 amount | The event is triggered when a user requests a bridge from 1xMM Token contract where the bridge request is called to 1xMM Token contract on ‘toChainId’. |
BridgeOutValidated | uint256 indexed timestamp address indexed forUser uint64 toChainId uint128 amount | The event is triggered when a bridge has been validated; i.e. tokens on the initial chain have been made available for sale again, and tokens on the ‘toChainId’ have been allocated to the user. |
Burnt | uint256 indexed timestamp uint256 amount | The event is triggered when an amount of 1xMM Token has been burnt. |
ChangedBack | uint256 indexed timestamp address indexed beneficiary uint256 amountOfTokens | The event is triggered when a beneficiary has changed by some 1xMM Tokens against the native token of the blockchain where change has been requested (e.g. ETH on Ethereum). amountOfTokens represents the number of native tokens received. |
ChangedBackFor | uint256 indexed timestamp address indexed beneficiary address tokenReceived uint256 amount | The event is triggered when a beneficiary has changed by some 1xMM Tokens against some other tokens available for sale (e.g. USDT on Ethereum). amount represents the number of other tokens received. |
Deposited | uint256 indexed timestamp address indexed from uint256 amountETH uint256 amountToken | The event is triggered when a user deposits some native tokens (i.e. ETH on Ethereum) and receives some 1xMM Tokens in exchange. |
Transfer | address indexed from address indexed to uint256 amount | The event is triggered when user ‘from’ has transferred some 1xMM Tokens to user ‘to’. |
Withdrawn | uint256 indexed timestamp address indexed from uint256 amount | The event is triggered when a user requests to change 1xMM tokens against either native tokens or another ERC20 token. amount represents the number of 1xMM Tokens which were changed. |
Methods
allowance | address owner address spender uint256 | Returns the allowance allocated to the ‘spender’ by an ‘owner’ of Tokens. |
approve | address spender uint256 amount bool | Provides allowance amount to ‘spender’ over msg.sender’s Tokens. |
balanceOf | address account uint256 | Gets the Token balance of the account. |
depositEther | bool | User can deposit Ether onto the 1xMM contract if ETH deposits are authorized (ETHDepositIsAllowed=true). The user receives 1xMM Tokens at the rate EthExchangeRate. The ETH amount is attached to the transaction value. |
getApprovedTokens | address[] | Returns the list of ERC20 token addresses which have been approved for change. |
getAvailableQuantityOfETH | uint256 | Returns the quantity of ETH available for change against 1xMM Token. |
getAvailableQuantityOfToken | address tokenToBeReceived uint256 | Returns the quantity of tokenToBeReceived available for change. |
getExchangeInfoForToken | address tokenToBeReceived bool uint64 | Returns information regarding the change of 1xMM Token against tokenToBeReceived. |
getValidChainIds | uint64[] | Returns the chain IDs allowed for bridging. |
hasPendingBridgeIn | bool | Returns the pending bridges to the contract for the user sending the request. |
hasPendingBridgeOut | bool | Returns the pending bridges out of the contract for the user sending the request. |
requestBridgeOut | uint64 toChainId uint128 amount bool | User requests a bridge from the 1xMM contract where the request is sent to another chain ID. |
sellBack | uint128 amountToken bool | User can sell back amountToken against ETH if authorized (ETHExchangeIsAllowed=true). The user receives ETH at the rate EthExchangeRate. |
sellBackAgainst | uint128 amountToken address tokenToBeReceived bool | User can sell 1xMM Token against tokenToBeReceived if authorized. |
totalSupply | uint256 | Gets the total supply of Tokens. |
transfer | address to uint256 amount bool | Transfers amount of Token to ‘to’ address. |
transferFrom | address from address to uint256 amount bool | Executes a transfer from ‘from’ address to ‘to’ address, allowed if msg.sender has received approval. |
Pool API
Pool API
ApplyPenaltyFee | boolean | True if penalty applies when users offset positions before their expected term |
CompensationIsActive | boolean | True if the compensation feature is active |
CompensatedSide | string | The side being compensated in case of loss. The side can be Long, Short, or both |
CompensationRatio | number | The ratio of compensation when a user has a loss, and if the user is entitled to receive compensation. E.g., if the loss is 0.2% and the compensationRatio is 50%, 0.1% of the loss will be covered by CompensationToken. |
CompensationToken | string | The token provided to users when they are on the losing side of an accrual, if the compensation feature is activated |
ConversionRate | number | The conversion rate, expressed as real_rate_pips * 2^32 / 10000. The rate is a uint64 rate where 1^32 is equivalent to 1.0. |
Fee | number | The daily position fee charged by the pool (in percent of basis point) |
FeeRebateThreshold | number | If a user holds CompensationToken, they are entitled to a pool fee rebate. The rebate is equal to 2.5% discount per FeeRebateThreshold level held, up to 35%. For example, if a user holds 250 CompensationToken and the FeeRebateThreshold is 50, they can get 250 / 50 * 2.5% rebate, or 12.5% |
IsActivated | boolean | True if deposits are allowed |
LeverageIsActive | boolean | True if users can use leverage. When using leverage, users with the same leverage will be facing each other |
MinDeposit | number | The minimum deposit amount, in units of tokens. This prevents users from depositing too small amounts. Example: 100 means a 100-token minimum deposit per transaction. |
MinFeeRebateThreshold | number | The minimum amount of CompensationToken required to receive a pool fee rebate. The rebate is 15% if the user holds this amount of CompensationToken, 30% if they hold 2x this amount, and 50% if they hold 4x this amount. |
MinWithdrawal | number | The minimum amount when reducing a position |
Owner | address | The pool owner |
Penalty | number | The penalty fee if a user doesn’t hold the position over the expected term (in percent of basis point) |
Token | address | The address of the token handled by the pool. ETH pools do not have this public property. |
Pool Events
Deposit | address indexed from uint indexed timestamp Position position | The event is triggered when a deposit is executed. |
PositionReduced | address indexed from uint indexed timestamp uint128 amount | The event is triggered when a user reduces a position. |
FeeChanged | uint indexed timestamp uint8 oldFee uint8 newFee | The event is triggered when the pool fee is changed. The fee is expressed in percent of basis point. |
PenaltyChanged | uint indexed timestamp uint8 oldPenalty uint8 newPenalty | The event is triggered when the pool penalty fee is changed. The fee is expressed in percent of basis point. |
CompensationTokenChanged | uint indexed timestamp address indexed from address indexed to | The event is triggered when the compensation token for a pool is changed. The initial compensation token is 1XMM Token. |
CompensationStatusChanged | uint indexed timestamp bool status | The event is triggered when the compensation feature is activated or deactivated. |
CompensationSideChanged | uint indexed timestamp CompensatedSides compensationSide | The event is triggered when the compensation side is changed. |
OwnerChanged | uint indexed timestamp address indexed prevOwner address indexed newOwner | The event is triggered when the pool ownership is changed. |
Pool Methods
closeAllPositions | When called, all the existing positions of a user will be closed. | |
closePosition | uint32 positionIndex | Closes the position at positionIndex in user's positions. |
deposit | LongShort longShort uint128 amount Leverage leverage | Users can deposit Token (or ETH) into the pool. Deposits will be added on the Long or Short side, with the specified leverage (default leverage is x1). User is charged a minimumFee which corresponds to the daily fee accrued over 50% of the pool Term. User's position is equal to: amount - minimumFee Note: if the deposit is executed after mid update interval time (e.g. if fixings are updated every 5 minutes, the mid update interval time is 2.5 minutes), the deposit will be added to the next fixing ⇔ amounts will be pending until the next fixing is updated. This has been implemented to avoid users passing orders at period ends. |
getCompensationTokenBalance | Gets the balance of CompensationToken owned by the pool. | |
getLastRateIndices | Leverage leverage | Gets the last rate indices for a given leverage. The rate index corresponds to the sum of past accruals. |
getMissedFixings | Gets the list of fixing indices for the missed fixings. | |
getPoolPendingPositions | Leverage leverage | Returns (uint128 long, uint128 short), the long and short pending positions; i.e. the positions for which fixingIndex0 corresponds to the next fixing. |
getPoolPositions | Leverage leverage | Returns (uint128 long, uint128 short), the long and short live positions. |
getPosition | uint32 positionIndex | Returns the user's position at positionIndex. |
getPositions | Returns all user's positions. | |
reducePosition | uint32 positionIndex uint128 amount | Users can reduce an existing position. The position at positionIndex will be reduced by amount. If Amount is bigger than the current position size, the whole position is closed. An additional fee is charged to the user, at pro rata temporis (minus the minimum fee charged at inception).If the position has -100% perf, nothing is returns to the user. |