OTC Contract
OTC can provide exchange services between ORC-20 tokens! This feature enables building an ORC-20 marketplace, Launchpad market or more use cases.
OTC Create
p
Yes
“orc-20”
Protocol: help other systems identify and process ORC-20 operations.
op
Yes
“otc-create”
Operation: type of operation
params
tick1
Yes
Ticker: symbol of the token to supply
params
tid1
Yes
Token ID: identifier of the token to supply
params
supply
Yes
Amount to supply: state the total amount of the token to supply in this OTC.
params
tick2
Yes
Ticker: symbol of the token to receive
params
tid2
Yes
Token ID: identifier of the token to receive
params
er
Yes
Exchange Rate: to get 1 token1, you need to pay the amount of token2, This value can be a decimal. The decimal places cannot exceed the decimal places of token2.
params
dl
Yes
Deadline: The end time of the OTC
params
mba
No
Minimum buy amount: default = 1, the decimal places cannot exceed the decimal places of token2.
params
oid
No
inscription ID
OTC ID: identifier of the OTC, the inscription ID where the OTC is deployed. This field is unnecessary during deployment and, if provided, will be considered invalid. It should determined by the actual inscription number.
Example:
After the inscription is minted, it does not take effect immediately. The inscription needs to be transferred once for it to become effective, and simultaneously, the inscription itself becomes inactive.
Upon transferring the inscription, the supply quantity of tick1 will be deducted from the user's available balance, and the balance will be transferred to the order. If the user's available balance is insufficient during the transfer, the operation fails, and the inscription becomes inactive.
OTC-Execute
p
Yes
“orc-20”
Protocol: help other systems identify and process ORC-20 operations
op
Yes
“otc-execute”
Operation: type of operation
params
oid
Yes
inscription ID
OTC ID: identifier of the OTC, the inscription ID where the OTC is deployed.
Example:
Notes:
When an OTC event meets either of the following two conditions, the otc-execute operation can be triggered:
According to the exchange rate, all supply is sold out, meaning the received quantity of token2 equals (supply * er). In this case, execute will proportionally transfer tick1 to the participants and tick2 to the project party.
If the deadline is exceeded and token1 is not fully sold, the OTC fails. In this scenario, execute will return tick1 to the project party and tick2 to the participant.
Since the execute operation does not require ownership validation, when either of the above conditions is met, anyone can mint the inscription. Minting the inscription triggers the operation without the need for a transfer. If none of the conditions is met, the inscription is considered invalid.
OTC-Buy
p
Yes
“orc-20”
Protocol: help other systems identify and process ORC-20 operations
op
Yes
“otc-buy”
Operation: type of operation
params
oid
Yes
inscription ID
OTC ID: identifier of the OTC, the inscription ID where the OTC is deployed.
params
tick
Yes
Ticker: symbol of the token to pay(tick2 in the OTC specified by oid)
params
tid
Yes
Token ID: identifier of the token(tid2 in the OTC specified by oid)
params
amt
Yes
Amount to pay: it states the amount of the token to pay for the OTC specified by oid
Example:
After the inscription is minted, it does not take effect immediately. The inscription needs to be transferred once for it to become effective, and simultaneously, the inscription itself becomes inactive.
If the user's available balance is insufficient during the transfer, the operation fails, and the inscription becomes inactive.
Once the operation takes effect, the quantity of tick2 will be deducted from the user's balance, awaiting the completion of the OTC process.
After the OTC is completed, if it is successful, the user will receive the corresponding quantity of tick1. In case of OTC failure, the ticks paid by the user will be returned in full.
If the user's balance in the OTC order is insufficient at the time of purchase, the transaction will fail.
Last updated