Platform equity tokens are non-circulating currencies and cannot be transferred by default. These tokens are recorded in the user's veNFT account as points.
- Convert 1 CETUS to 1 xCETUS Mint
- LP NFT lock-up mining rewards released.
- xCETUS can be transferred under certain conditions.
- To prevent special circumstances, only the platform has the permission to transfer xCETUS.
veNFT stores xCETUS in a non-transferable form under the user account.
- Holding xCETUS allows participation in Cetus reward dividends.
- Dividends are distributed based on the proportion of xCETUS in the wallet's veNFT account relative to the total xCETUS in the market.
To start using the xcetus SDK
, you first need to install it in your TypeScript project. You can add it using npm, yarn, or bun:
Github Link: https://github.com/CetusProtocol/xcetus-sdk
NPM Link: dd_xcetus-sdk
npm install dd_xcetus-sdk
or
yarn add dd_xcetus-sdk
or
bun install dd_xcetus-sdk
Import the SDK into the TypeScript file where you intend to use it:
import { CetusXcetusSDK } from 'dd_xcetus-sdk'
or
import { initMainnetSDK, initTestnetSDK } from 'dd_xcetus-sdk'
Initialize the SDK with the required configuration parameters. This typically includes setting up the network and API keys, if needed.
- Mainnet:
const sdk = CetusXcetusSDK.createSDK({ env: 'mainnet' })
or
const sdk = initMainnetSDK()
- Testnet:
const sdk = CetusXcetusSDK.createSDK({ env: 'testnet' })
or
const sdk = initTestnetSDK()
if you want to use test account, your can do this:
import { buildTestAccount } from 'dd_common_sdk'
sendKeypair = buildTestAccount()
sdk.setSenderAddress(sendKeypair.toSuiAddress())
or you can use your own wallet address.
Gets the VeNFT object for the specified account address.
const ownerVeNFT = await sdk.XCetusModule.getOwnerVeNFT(sendKeypair.getPublicKey().toSuiAddress())
// ownerVeNFT
{
creator: 'Cetus',
description: "A non-transferrable NFT storing Cetus Escrowed Token xCETUS that represents a user's governance power on Cetus Protocol.",
image_url: 'https://x77unmxbojk6nincdlzd57hhk5qgp5223rrrxrsplqqcs23vu5ja.arweave.net/v_9GsuFyVeahohryPvznV2Bn91rcYxvGT1wgKWt1p1I',
link: 'https://app.cetus.zone',
name: 'Cetus veNFT #14562',
project_url: 'https://www.cetus.zone',
id: '0x12adbc7e726cf2a5a9d4c4f0bdd08b6a49c876be99b2e650778a68d3891584bc',
index: '14562',
type: '0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606::xcetus::VeNFT',
xcetus_balance: '1000000000'
}
Gets the list of LockCetus objects owned by the specified account address.
const redeemLockList = await sdk.XCetusModule.getOwnerRedeemLockList(sendKeypair.getPublicKey().toSuiAddress())
redeemLockList: [
{
id: '0x005ba9202a5d9e41c73155a1b4e47...',
type: '0x9e69acc50ca03bc943c4f7c5304c2a6002d507b51c11913b247159c60422c606::lock_coin::LockedCoin<0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b::cetus::CETUS>',
locked_start_time: 1730442744,
locked_until_time: 1745994744,
cetus_amount: '500000000',
xcetus_amount: '500000000',
lock_day: 180,
},
]
const payload = await sdk.XCetusModule.convertPayload({
amount: '10000000000',
venft_id,
})
const lock_day = 15
const amountInput = 20000
const amount = await sdk.XCetusModule.redeemNum(amountInput, n)
sdk.XCetusModule.redeemLockPayload({
venft_id: venft_id,
amount,
lock_day,
})
const lock_id = '0x005ba9202a5d9e41c73155a1b4e47...'
const lockCetus = await sdk.XCetusModule.getLockCetus(lock_id)
if (lockCetus && !XCetusUtil.isLocked(lockCetus)) {
const payload = sdk.XCetusModule.redeemPayload({
venft_id: venft_id,
lock_id: lock_id,
})
}
const veNFTDividendInfo = await sdk.XCetusModule.getVeNFTDividendInfo(venft_id)
if (veNFTDividendInfo) {
const payload = await sdk.XCetusModule.redeemDividendV3Payload(venft_id, veNFTDividendInfo.rewards)
}
const lock_id = '0x005ba9202a5d9e41c73155a1...'
const lockCetus = await sdk.XCetusModule.getLockCetus(lock_id)
if (lockCetus && XCetusUtil.isLocked(lockCetus)) {
const payload = sdk.XCetusModule.cancelRedeemPayload({
venft_id: venft_id,
lock_id: lock_id,
})
}
const dividendManager = await sdk.XCetusModule.getDividendManager()
const veNFTDividendInfo = await sdk.XCetusModule.getVeNFTDividendInfo(dividendManager.venft_dividends.id)
const lock_day = 15
const amountInput = 20000
const amount = await sdk.XCetusModule.redeemNum(amountInput, n)
const lock_day = 15
const amountInput = 20000
const amount = await sdk.XCetusModule.reverseRedeemNum(amountInput, n)
const lock_id = '0x005ba9202a5d9e41c73155a1b...'
const amount = await sdk.XCetusModule.getXCetusAmount(lock_id)
const phaseDividendInfo = await sdk.XCetusModule.getPhaseDividendInfo('10')
const ownerVeNFT = await sdk.XCetusModule.getOwnerVeNFT(sendKeypair.getPublicKey().toSuiAddress())
if (ownerVeNFT) {
const xcetusManager = await sdk.XCetusModule.getXcetusManager()
const veNftAmount = await sdk.XCetusModule.getVeNftAmount(xcetusManager.nfts.handle, ownerVeNFT.id)
const rate = d(ownerVeNFT.xcetus_balance).div(xcetusManager.treasury)
}
the Cetus smart contract may return the following error codes:
Module | Error Code | Description | Contract Methods |
---|---|---|---|
lock_coin | 0 | The lock time must be greater than the current time | lock_coin |
lock_coin | 1 | The lock period has not ended | unlock_coin |
locking | 1 | Insufficient XCetus balance | redeem_lock |
locking | 2 | Locking period for XCetus is out of allowed range | redeem_lock |
locking | 3 | Invalid redeemable XCetus amount | redeem_lock |
locking | 4 | veNFT does not match the associated LockedCoin | cancel_redeem_lock, redeem |
locking | 5 | LockCoin has expired; locking has ended | cancel_redeem_lock |
locking | 7 | Unauthorized treasury manager | redeem_treasury |
locking | 8 | The version of the contract has been deprecated | The vast majority of methods |
xcetus | 1 | XCetus balance is not zero | burn_venft |
xcetus | 5 | The address already has a VeNFT | burn_lp |
xcetus | 6 | XCetus in unlocking process is not zero | request_transfer_venft_by_admin, approve_transfer_venft, mint_venft |
xcetus | 7 | VeNFT does not exist | approve_transfer_venft |
xcetus | 8 | Transfer request already exists | request_transfer_venft_by_admin |
xcetus | 9 | Transfer request does not exist | approve_transfer_venft, cancel_transfer_venft_request_by_admin |
xcetus | 10 | TransferVeNFTRequest does not match the VeNFT | approve_transfer_venft |
xcetus | 11 | The destination address is inconsistent with the one in TransferVeNFTRequest | approve_transfer_venft |
Use the following links to learn more about Cetus:
Learn more about working with Cetus in the Cetus Documentation.
Join the Cetus community on Cetus Discord.
MIT