Contract Details

Additional info on contract parameters and use cases

The parameters are used in the IPayload in the contract

E.g.:

const payload: ITransfer = {
  amount: 100 * 10 ** 6,
  receiver: 'receiverAddress',
  kda: 'KLV',
}

const Contract: IContract = {
  type: TransactionType.Transfer,
  payload,
}

Transfer

Transfer assets to another address.

Payload Parameters

RequiredParameterTypeDescription
receiverstringReceiver address
amountnumberAmount to be sent (precision)
kdastringAssetID. If empty, defaults to KLV
kdaRoyaltiesnumberTransfer royalties to pay if a fungible token has enabled the Transfer Percentage Royalties. See Royalties

Freeze

Freezes a certain amount of a token for staking. This frozen amount will be referred as a "bucket".

Payload Parameters

RequiredParameterTypeDescription
amountnumberAmount to be frozen (with precision)
kdastringDefaults to KLV

Unfreeze

Unfreezes a bucket.

Payload Parameters

RequiredParameterTypeDescription
bucketIdstringBucket to be unfrozen
kdastringUnfrozen asset ID, defaults to KLV if empty

Delegate

Delegates a bucket to a validator. Buckets can only be delegated to a validator address.

Payload Parameters

RequiredParameterTypeDescription
receiverstringAddress to be delegated to
bucketIdstringBucket to be delegated

Undelegate

Removes the delegation of a bucket.

Payload Parameters

RequiredParameterTypeDescription
bucketIdstringBucket ID to be undelegated

Claim

Claim either staking rewards, delegation rewards or expired marketplace orders.

Payload Parameters

RequiredParameterTypeDescription
claimTypenumberCheck list below
idstringCheck list below

Claim types All claim types and your function and referral param

Type IDTypeID Field Description
0StakingClaimAsset ID to be claimed
1AllowanceClaimAsset ID to be claimed
2MarketClaimOrder ID to be claimed

Withdraw

Retrieves the assets from an unfrozen bucket or assets from KDAPool.

Payload Parameters

RequiredParameterTypeDescription
kdastringAsset ID to be withdrawn
withdrawTypenumber0: Staking, 1: KDAPool
amountnumberAmount to be withdrawn from pool
currencyIDstringAsset to be withdrawn from pool

Withdraw Type

Type IDType NameDescription
0StakingWithdraw all unstaked buckets from target asset
1KDAPoolWithdraws an amount from target asset KDAPool deposits

Create Asset

Creates a new fungible token or a NFT/SFT collection.

Payload Parameters

RequiredParameterTypeDescription
namestringAsset name
tickerstringAsset shorthand (ticker)
ownerAddressstringOwner address
precisionnumberAsset precision (0 to 8)
uris{[label: string]: string}Relevant URI's
logostringLogo URI
initialSupplynumberInitial minted supply (fungible only) (with precision)
maxSupplynumberMaximum supply of the asset (with precision)
typenumber0: Fungible Token, 1: NFT, 2: SFT
stakingStaking objectStaking info
royaltiesRoyalties objectRoyalties info
roles{[label: string]: Role}Other addresses roles info
propertiesProperties objectAsset properties details
attributesAttributes objectIs paused/mint stopped?

Staking Structure

RequiredParameterTypeDescription
interestTypenumber0: APR, 1: FPR
aprnumberPercentage
minEpochsToClaimnumberMinimum epochs to claim rewards
minEpochsToUnstakenumberMinimum epochs to unstake
minEpochsToWithdrawnumberMinimum epochs to withdraw after unstake

Royalties Structure

RequiredParameterTypeDescription
addressstringRoyalty receiver address
transferPercentageRoyaltyInfo object arrayTransfer fee for fungible tokens (precision 2)
transferFixednumberTransfer fee for non-fungible tokens
marketPercentagenumberMarket percentage fee details for non-fungible tokens (precision 2)
marketFixednumberMarket fixed fee for non-fungible tokens
itoPercentagenumberITO percentage fee precision 2
itoFixednumberITO fixed fee (in the currency asset precision)
splitRoyalties{[address: string]: RoyaltySplitInfo}Defines the percentage of the fees when multiple addresses receive royalties

RoyaltySplitInfo Structure

RequiredParameterTypeDescription
percentTransferPercentagenumberPercentage that the given address will receive from transfer percentage precision 2
percentTransferFixednumberPercentage that the given address will receive from transfer fixed precision 2
percentMarketPercentagenumberPercentage that the given address will receive from market percentage precision 2
percentMarketFixednumberPercentage that the given address will receive from market fixed precision 2
percentITOPercentagenumberPercentage that the given address will receive from ito percentage precision 2
percentITOFixednumberPercentage that the given address will receive from ito fixed precision 2

RoyaltyInfo structure

RequiredParameterTypeDescription
amountnumberMax amount for that percentage
percentagenumberFee % (precision 2)

Role structure

RequiredParameterTypeDescription
addressstringOther wallet's address
hasRoleMintbooleanShould be able to mint?
hasRoleSetITOPricesbooleanShould be able to set ITO prices?

Properties Structure

RequiredParameterTypeDescription
canFreezebooleanShould be freezable?
canWipebooleanShould be wipeable?
canPausebooleanShould be pausable?
canMintbooleanShould be mintable?
canBurnbooleanShould be burnable?
canChangeOwnerbooleanShould the owner be changeable?
canAddRolesbooleanShould roles be add-able?

Attributes structure

RequiredParameterTypeDescription
isPausedbooleanShould be currently paused?
isNFTMintStoppedbooleanShould be currently NFT mint stopped?

Asset Trigger

Updates the properties or trigger functionalities of a fungible token, NFT collection or a single NFT.

The required parameters will depend on the trigger type. Trigger Type and AssetID are required in all of them.


Trigger Types: List with all trigger types values and its required payload

fields. You can see more info about each field here. Any parameter you send beyond the required ones will be ignored.

IDTypeDescriptionParameters
0MintDirectly mint assets in the receiver, amounttarget account, if the type is a SFT you can use the field value to set the max supply
1BurnDirectly burn owned assetsamount, you can change the asset to EXAMPLESFT-1234/1 to mint directly to a SFT using the nonce.
2WipeDirectly burn assets of the target account (asset owner only). Useful mostly for stable coinsreceiver, amount
3PausePauses all transactions of the target asset-
4ResumeResumes all transactions of the target asset-
5ChangeOwnerChanges the asset ownerreceiver
6AddRoleAdd a permission role to the assetrole
7RemoveRoleRemove a permission role of the assetreceiver
8UpdateMetadataUpdate the metadata of a given NFTmime, receiver (you may want to send transaction as well)
9StopNFTMintStop all NFT mints for that asset (forever)-
10UpdateLogoUpdates the asset's logologo URI
11UpdateURIsUpdate the stored relevant URIsuris URIs
12ChangeRoyaltiesReceiverChanges the address that receives royaltiesreceiver
13UpdateStakingUpdate staking paramsstaking
14UpdateRoyaltiesUpdate royalties paramsroyalties
15UpdateKDAFeePoolUpdate KDA pool paramskdaPool
16StopRoyaltiesChangeStop royalties changes from the asset
17StopNFTMetadataChangeStop Metadata changes for a given NFT

Payload Parameters

RequiredParameterTypeDescription
triggerTypenumberSets the trigger type (check here)
assetIdstringTarget Asset
receiverstringTarget address for transaction
amountnumberAmount (with precision)
uris{[key:string]: string}Ex: Ex: {"foo" : "http://bar.com"}
logostringLogo image URL
mimestringThe nature and format of the metadata
roleRole object arrayRole for Add/Remove Role types
stakingStaking objectUsed for updating staking params
royaltiesRoyalties objectUsed for updating royalties params
kdaPoolKDAPool objectUsed for updating kdaPool params

Royalties structure

RequiredParameterTypeDescription
addressstringRoyalty receiver address
transferPercentageRoyaltyInfo object arrayTransfer fee for fungible tokens (precision 2)
transferFixednumberTransfer fee for non-fungible tokens
marketPercentagenumberMarket percentage fee details for non-fungible tokens (precision 2)
marketFixednumberMarket fixed fee for non-fungible tokens
itoPercentagenumberITO percentage fee precision 2
itoFixednumberITO fixed fee (in the currency asset precision)
splitRoyalties{[address:string]: RoyaltySplitInfo}Defines the percentage of the fees when multiple addresses receive royalties

RoyaltySplitInfo structure

RequiredParameterTypeDescription
percentTransferPercentagenumberPercentage that the given address will receive from transfer percentage precision 2
percentTransferFixednumberPercentage that the given address will receive from transfer fixed precision 2
percentMarketPercentagenumberPercentage that the given address will receive from market percentage precision 2
percentMarketFixednumberPercentage that the given address will receive from market fixed precision 2
percentITOPercentagenumberPercentage that the given address will receive from ito percentage precision 2
percentITOFixednumberPercentage that the given address will receive from ito fixed precision 2

RoyaltyInfo structure

RequiredParameterTypeDescription
amountnumberMax amount for that percentage
percentagenumberFee % (precision 2)

KDAPool

RequiredParameterTypeDescription
activebooleanTrue if the pooling should be active
adminAddressstringAdmin Address
fRatioKLVnumberFixed ratio for KLV
fRatioKDAnumberFixed ratio for KDA

Fixed Ratio calculation:

quotient = (Fixed ratio for KDA) / (Fixed ratio for KLV)

Ex: When Fixed ratio for KLV is 1,and the Fixed ratio for KDA is 2, the cost will be 2 KDA per 1 KLV

Warning: Always use testnet to test the KDAPool ratio before spending real assets.


Role Structure List with all role values

RequiredParameterTypeDescription
addressstringTarget Address
hasRoleMintbooleanShould be able to mint?
hasRoleSetITOPricesbooleanShould be able to set ITO prices?

Staking Structure

RequiredParameterTypeDescription
interestTypenumber0: APR, 1: FPR
aprnumberPercentage
minEpochsToClaimnumberMinimum epochs to claim rewards
minEpochsToUnstakenumberMinimum epochs to unstake
minEpochsToWithdrawnumberMinimum epochs to withdraw after unstake

Deposit

Deposits an asset into a FPR pool or into an auto-swapping fee system.

Payload Parameters

RequiredParameterTypeDescription
depositTypenumber0: FPR Deposit, 1: KDA Pool, For more info, check Deposit Type
kdastringTarget Asset
currencyIdstringCurrency to be deposited
amountnumberAmount of currency to be deposited

Deposit Type

Type IDType NameDescription
0FPR DepositDeposits an amount of currency to be distributed to all holders of target asset.
1KDA PoolDeposits an amount of KLV to pay the fees of the target asset's transactions.

Config ITO

Sets up an Initial Token Offering for either a token or a NFT collection.

Payload Parameters

RequiredParameterTypeDescription
receiverAddressstringWallet address that will receive the currency
kdastringTarget Asset
maxAmountnumberMax amount of assets sold in the ITO (precision)
statusnumberSee Status
packInfo{[assetID: string]: Pack[]}Defines the currency in which the packs will be sold.
defaultLimitPerAddressnumberMax amount of NFTs an address can buy, if specific amount is not provided.
whitelistStatusnumberSee Status
whitelistInfo{[address: string]: WhiteListInfo}Defines specific NFT mint limit to given addresses
whitelistStartTimenumberWhitelist start time (in UnixTime (seconds))
whitelistEndTimenumberWhitelist end time (in UnixTime (seconds))
startTimenumberITO start time (in UnixTime (seconds))
endTimenumberITO end time (in UnixTime (seconds))

Pack structure

RequiredParameterTypeDescription
amountnumberFor NFTs: Amount sold; For tokens: Minimum amount for the price to be applied (with precision).
pricenumberFor NFTs: Price for each NFT; For tokens: Price for that amount.

WhiteListInfo structure

RequiredParameterTypeDescription
limitnumberMax amount of NFTs an address can buy.

Status

Status ValueStatus NameDescription
0DefaultITOKeeps previous status value
1ActiveITOEnables ITO/Whitelist
2PausedITOPauses ITO/Whitelist

ITO Trigger

Updates the properties or trigger functionalities of a fungible token, NFT collection or a single NFT.

The required parameters will depend on the trigger type. Trigger Type and AssetID are required in all of them.


Trigger Types List with all trigger types values and its required payload

fields. You can see more info about each field here. Any parameter you send beyond the required ones will be ignored.

IDTypeDescriptionParameters
0SetITOPricesUpdate ITOs packs pricespackInfo
1UpdateStatusUpdate statusstatus
2UpdateReceiverAddressUpdate receiver addressreceiverAddress
3UpdateMaxAmountUpdate max amount of minted NFTsmaxAmount
4UpdateDefaultLimitPerAddressUpdate default limit per addressdefaultLimitPerAddress
5UpdateTimesUpdate start and end time of ITOstartTime, endTime
6UpdateWhitelistStatusUpdate whitelist statuswhitelistStatus
7AddToWhitelistAdds address to whitelistwhitelistInfo
8RemoveFromWhitelistRemove address from whitelistwhitelistInfo
9UpdateWhitelistTimesUpdate start and end time of whitelistwhitelistStartTime, whilelistEndTime

Payload Parameters

RequiredParameterTypeDescription
triggerTypenumberSets the trigger type (check list above)
kdastringTarget Asset
receiverAddressstringAddress that will receive the currency
statusnumberSee Status
maxAmountnumberMaximum minted amount (with precision)
packInfo{[assetID: string]: { Packs: Pack []}}Defines the currency in which the packs will be sold.
defaultLimitPerAddressnumberMax amount of NFTs an address can buy, if not provided.
whitelistStatusnumberSee Status
whitelistInfo{[address: string]: WhiteListInfo }Defines specific NFT mint limit to given addresses
whitelistStartTimenumberWhitelist start time (in UnixTime (seconds))
whitelistEndTimenumberWhitelist end time (in UnixTime (seconds))
startTimenumberITO start time (in UnixTime (seconds))
endTimenumberITO end time (in UnixTime (seconds))

Obs: Javascript's Date.prototype.getTime() should be divided by 1000 for it to be converted to Unix Time (seconds)


Status

Status ValueStatus NameDescription
0DefaultITOKeeps previous status value
1ActivelTOEnables ITO/Whitelist
2PausedITOPauses ITO/Whitelist

Pack structure

RequiredParameterTypeDescription
amountnumberFor NFTs: Amount sold; For token: Min amount for that price to be applied (with precision).
pricenumberFor NFTs: Price for each NFT; For Tokens: Price for that amount.

WhiteListInfo structure

RequiredParameterTypeDescription
limitnumberMax amount of NFTs an address can buy.

Set ITO Prices

DEPRECATED: Updates the ITO prices, useful for ITO's that use an oracle-like pricing system.

This contract is deprecated, please use an ITO Trigger of type SetITOPrices.

Payload Parameters

RequiredParameterTypeDescription
kdastringTarget Asset
packinfo{[assetID: string]: Pack []}Defines the currency in which the packs will be sold.

Pack structure

RequiredParameterTypeDescription
amountnumberFor NFTs: Amount sold; For token: Min amount for that price to be applied (with precision).
pricenumberFor NFTs: Price for each NFT; For Tokens: Price for that amount.

Create Marketplace

Creates a marketplace

Payload Parameters

RequiredParameterTypeDescription
namestringMarketplace name
referralAddressstringRoyalties receiving address
referralPercentagenumberRoyalties percentage (precision 2)

Config Marketplace

Changes the parameters of a marketplace

Payload Parameters

RequiredParameterTypeDescription
namestringNew marketplace name
marketplaceIdstringTarget Marketplace ID
referralPercentagenumberNew referral percentage (precision 2)
referralAddressstringNew referral address

Sell

Payload Parameters

RequiredParameterTypeDescription
marketTypenumber0: Instant Sell, 1: Auction
marketplaceIdstringMaketplace ID in which the sell order will be created
assetIdstringAsset to be sold
currencyIdstringTransaction currency token
pricenumberPrice for instant sell (with precision)
reservePricenumberMinimum auction price (with precision)
endTimenumberExpiration sell time (in Unix Time). Max end time = 1 Year from creation date

price is required on Instant Sell Orders, but optional in Auction Orders. As explained below:

RequiredMarketTypePriceMeaning
0 (Instant Sell)Price for instant sellBids above this price instantly sell, ending the auction.
1 (Auction)PriceAuction start price.

Obs: Javascript's Date.prototype.getTime() should be divided by 1000 for it to be converted to Unix Time (seconds)

Buy

Creates a buy (or bid) order for a given market sell order.

Payload Parameters

RequiredParameterTypeDescription
buyTypenumber0: ITOBuy, 1: MarketBuy
idstringITOBuy: ITO Asset ID, MarketBuy: order ID
currencyIdstringID of the trade currency
amountnumberITOBuy: Amount to be bought, MarkeyBuy: item price / amount bidden(check precision)

Send the 'amount' parameter with the correct precision based on the currency asset

Cancel Market Order

Cancels a sell order

Payload Parameters

RequiredParameterTypeDescription
orderIdstringID generated on 'Sell Order'

Proposal

Creates a proposal to change the chain network parameters.

Payload Parameters

RequiredParameterTypeDescription
parameters{[paramKeyID:number]: string}A object that includes all chain parameters you would like to propose a change. (The value will most likely be a numeric string for current parameters) See parameter list below for correct key input
epochsDurationnumberProposal epochs duration
descriptionstringProposal description

Parameter key

IDTypeDescription
0FeePerDataByteBandwidth fee value
1KAppFeeCreateValidatorCreate validator fee value
2KAppFeeCreateAssetAsset fee value
3MaxEpochsUnclaimedMax unclaimed time (in epochs) for buckets
4MinSelfDelegatedAmountMin self-delegated amount needed to be a validator
5MinTotalDelegatedAmountMin total delegated amount needed to be a validator
6BlockRewardsBlock rewards for validators
7StakingRewardsStaking rewards value
8KApp Fee for TransferKApp Fee for Transfer
9KApp Fee for Asset TriggerKApp Fee for Asset Trigger
10KApp Fee for Validator ConfigKApp Fee for Validator Config
11KApp Fee for FreezeKApp Fee for Freeze
12KApp Fee for UnfreezeKApp Fee for Unfreeze
13KApp Fee for DelegationKApp Fee for Delegation
14KApp Fee for DelegationKApp Fee for Delegation
15KApp Fee for WithdrawKApp Fee for Withdraw
16KApp Fee for ClaimKApp Fee for Claim
17KApp Fee for UnjailKApp Fee for Unjail
18KApp Fee for Account NameKApp Fee for Account Name
19KApp Fee for ProposalKApp Fee for Proposal
20KApp Fee for VoteKApp Fee for Vote
21KApp Fee for Config ITOKApp Fee for Config ITO
22KApp Fee for Set ITO PricesKApp Fee for Set ITO Prices
23KApp Fee for BuyKApp Fee for Buy
24KApp Fee for SellKApp Fee for Sell
25KApp Fee for Cancel Market OrderKApp Fee for Cancel Market Order
26KApp Fee for Marketplace CreationKApp Fee for Marketplace Creation
27KApp Fee for Config MarketplaceKApp Fee for Config Marketplace
28KApp Fee for Update Account PermissionKApp Fee for Update Account Permission
29Max NFT Mint per batchMax NFT Minted in one contract
30Min KFI staked to enable Proposals KappsMin overall KFI staked to enable Proposals
31Min KLV Bucket AmountMinimum KLV Amount per bucket
32Max bucket sizeMax buckets per account
33Leader Validator rewards percentageLeader Validator rewards percentage
34Max Epochs for active proposal durationMax Epochs an proposal will remain active
35KApp Fee for ITO TriggerKApp Fee for ITO Trigger
36KApp Fee for DepositKApp Fee for Deposit

Vote

Votes on an active proposal, the weight of the vote depends on the staked KFI of the sender address (The KFI is not consumed).

Payload Parameters

RequiredParameterTypeDescription
amountnumberWeight of the vote, maximum amount depends on address' KFI
proposalIdnumberProposal id to be voted in
typenumber0: Vote Yes, 1: Vote No

Create Validator

Creates a validator for an address, controlled by a BLS key.

Payload Parameters

RequiredParameterTypeDescription
namestringValidator name
ownerAddressstringOwner address
rewardAddressstringRewards address
blsPublicKeystringBLS public key
canDelegatebooleanPermission to delegate
maxDelegationAmountnumberMax delegation amount
commissionnumberValidation commission (precision 2)
logostringLogo URI
uris{[key: string]: string} *Relevant URI's

*Object in which the keys are the URI labels and the values are the URIs

Config Validator

Changes the params of a given validator.

Payload Parameters

RequiredParameterTypeDescription
namestringChange validator name
rewardAddressstringChange rewards address
blsPublicKeystringChange BLS public key
canDelegatebooleanChange permission to delegate
commissionnumberChange commission (precision 2)
maxDelegationAmountnumberChange max delegation amount
logostringChange logo
uris{[key: string]: string} *Change uris

*Object in which the keys are the URI labels and the values are the URIs

Unjail

Sends an unjail request for the sender validator address.

Payload Parameters

Send Unjail request of sender address, no params required.

Set Account Name

Defines a name for the account.

Payload Parameters

RequiredParameterTypeDescription
namestringSet sender account's name

Update Account Permission

Updates the permissions of an account, setting multi-signature permissions with a set signature threshold. Useful for creating a safely shared account.

Payload Parameters

RequiredParameterTypeDescription
permissionsArray of AccPermission ObjectSet sender account's name

AccPermission structure

RequiredParameterTypeDescription
typenumber0: Owner, 1: User
permissionNamestringPermission identifier
thresholdnumberMinimum sign amount to permit transaction
operationsstringSee Operations
signersAccKey object arrayDefines the
weight of the accounts' votes

AccKey structure

RequiredParameterTypeDescription
addressstringTarget address
weightnumberTarget address vote weight

Operations

The operations property defines which operations the account should be able to do.

The value that this property receives is a hexadecimal string, where each bit represents a contract.

Ex:

"01af" is the hexadecimal to 000110101111.

The 1's represent the contracts it should be able to do (following this table)

This account will be able to do contracts of type 0, 1, 2, 3, 5, 7, 8 (Transfer, Create Asset, Create Validator, Config Validator, Unfreeze, Undelegate, Withdraw).

Relevant Link: binary to hex calculator

After getting the hexadecimal string, you need to invert the byte order, for proper processing in the blockchain.

you can use either of the following JS code to do so:

utils.parseAccountPermissionBinaryOperations('000110101111')

utils.reverseHexBytes('01af')

Both return the same "af01" which is the correct value for said operations.

Was this page helpful?