ISwap
Functions
initialize
Initializes the MarketPlace, setting the WCSB contract address.
function initialize(address mira_, uint256 minCsb_, uint256 minMira_, address admin) external;
Parameters
Name | Type | Description |
---|---|---|
mira_ | address | The address of MIRA contract. |
minCsb_ | uint256 | The minimum amount of CSB to sell. |
minMira_ | uint256 | The minimum amount of MIRA to sell. |
admin | address | The address of the contract admin. |
pause
Pauses interaction with the contract. Requirements:
- The caller must have the ADMIN_ROLE.
function pause() external;
unpause
Resumes interaction with the contract. Requirements:
- The caller must have the ADMIN_ROLE.
function unpause() external;
setMinMira
Sets the minimum amount of MIRA to sell.
function setMinMira(uint256 minMira_) external;
Parameters
Name | Type | Description |
---|---|---|
minMira_ | uint256 | The minimum amount of MIRA to sell. |
setMinCsb
Sets the minimum amount of CSB to sell.
function setMinCsb(uint256 minCsb_) external;
Parameters
Name | Type | Description |
---|---|---|
minCsb_ | uint256 | The minimum amount of CSB to sell. |
sellMIRA
Sells MIRA for CSB.
Creates a SellOrder and emits the SellMIRA
event.
function sellMIRA(uint256 miraAmount, uint256 expectedCsbAmount) external returns (uint256 orderId);
Parameters
Name | Type | Description |
---|---|---|
miraAmount | uint256 | The amount of MIRA to sell. |
expectedCsbAmount | uint256 | The expected amount of CSB to receive. |
Returns
Name | Type | Description |
---|---|---|
orderId | uint256 | The new created order id. |
sellCSB
Sells CSB for MIRA.
Creates a SellOrder and emits the SellCSB
event.
The amount of CSB to sell must be specified in the msg.value
.
function sellCSB(uint256 expectedMiraAmount) external payable returns (uint256 orderId);
Parameters
Name | Type | Description |
---|---|---|
expectedMiraAmount | uint256 | The expected amount of MIRA to receive. |
Returns
Name | Type | Description |
---|---|---|
orderId | uint256 | The new created order id. |
cancelOrder
Cancels a sell order and refunds to the seller.
Deletes a given SellOrder and emits the SellOrderCanceled
event.
function cancelOrder(uint256 orderId) external;
Parameters
Name | Type | Description |
---|---|---|
orderId | uint256 | The order id to cancel. |
acceptOrder
Accepts a sell order and transfers the tokens to the traders.
Deletes a given SellOrder and emits the SellOrderMatched
event.
function acceptOrder(uint256 orderId) external payable;
Parameters
Name | Type | Description |
---|---|---|
orderId | uint256 | The order id to accept. |
getOrder
Returns the SellOrder struct of a given order id.
function getOrder(uint256 orderId) external view returns (DataTypes.SellOrder memory);
Parameters
Name | Type | Description |
---|---|---|
orderId | uint256 | The order id to get. |
Returns
Name | Type | Description |
---|---|---|
<none> | DataTypes.SellOrder | order The SellOrder struct. |
mira
Returns the address of MIRA contract.
function mira() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | The address of MIRA contract. |
getMinMira
Returns the minimum amount of MIRA to sell.
function getMinMira() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The minimum amount of MIRA to sell. |
getMinCsb
Returns the minimum amount of CSB to sell.
function getMinCsb() external view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The minimum amount of CSB to sell. |