Ticket
Ticket
readGreyList
Read grey list
import { readGreyList } from "derivstudio/cds";
let queryTransaction = readGreyList(_tokenId);
let ret = sdk.query(queryTransaction);
** Request **
Params
Type
Description
_tokenId
uint256
ticket token id
** Response **
Params
Type
Description
isGreyToken
bool
is grey token
readrentExpires
Read the rent expiration date for a ticket
import { readrentExpires } from "derivstudio/cds";
let queryTransaction = readrentExpires(_tokenId,_user);
let ret = sdk.query(queryTransaction);
** Request **
** Params**
Type
Description
_tokenId
uint256
ticket token id
_user
address
rent user
** Response **
Params
Type
Description
timestamp
uint256
rent expired at
readMiner
Read the token address issued under a ticket
import { readMiner } from "derivstudio/cds";
let queryTransaction = readMiner();
let ret = sdk.query(queryTransaction);
** Response **
Params
Type
Description
miner
address
miner
readTotalSupply
Read the total token amount issued under a ticket
import { readTotalSupply } from "derivstudio/cds";
let queryTransaction = readTotalSupply();
let ret = sdk.query(queryTransaction);
** Response **
Params
Type
Description
totalSupply
uint256
ticket total supply
readTokenTotalSupply
The amount of specified tickets
import { readTokenTotalSupply } from "derivstudio/cds";
let queryTransaction = readTokenTotalSupply(token_id);
let ret = sdk.query(queryTransaction);
** Request **
Params
Type
Description
token_id
uint256
ticket id
** Response **
Params
Type
Description
totalSupply
uint256
a ticket amount
readTokenOwner
Read the ticket address of the owner
import { readTokenTotalSupply } from "derivstudio/cds";
let queryTransaction = readTokenOwner(token_id);
let ret = sdk.query(queryTransaction);
** Request **
Params
Type
Description
token_id
uint256
ticket id
** Response **
Params
Type
Description
owner
address
a ticket owner
readTokenFroze
Read whether the ticket is collateralized or not
import { readTokenFroze } from "derivstudio/cds";
let queryTransaction = readTokenFroze(token_id);
let ret = sdk.query(queryTransaction);
** Request **
Params
Type
Description
token_id
uint256
ticket id
** Response **
Params
Type
Description
isFroze
bool
ticket is frozen
Issue
Issue a CDS
import { issue } from "derivstudio/cds";
let transaction = issue(_tokenId,_leverage,_baseToken,_underlyingHash,_isStakeNFT,_maturityDate,_initialMargin,_minInvest);
Params
Type
Description
_tokenId
address
ticket id
_leverage
uint256
Leverage,*10,e.g., leverage 1.1 is 11
_baseToken
address
Tokens
_underlyingHash
bytes32
cds content
_isStakeNFT
uint256
Is the collateral nft
_maturityDate
uint256
cds maturity date(seconds)
_initialMargin
uint256
Initial lp amount
_minInvest
uint256
Minimum liquidity investment
SafeTransferFrom
Transfer a ticket
import { safeTransferFrom } from "derivstudio/ticket";
let transaction = safeTransferFrom(from,to, tokenId, amount, Buffer.from(''));
Params
Type
Description
from
address
ticket transfer from
to
address
ticket transfer to
ticket_id
uint256
ticket transfer id
amount
uint256
amount=from address balance,just ticket owner have right to transfer
TackBack
Take back the NFT ticket after the rental period expires
import { tackBack } from "derivstudio/ticket";
let transaction = tackBack(user,ticketId);
Params
Type
Description
user
address
rent address of user
ticket_id
uint256
ticket transfer id
Last updated