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 | Required | Parameter | Type | Description |

|:----------:|-----------------------|-------------------------|------------------------------------------| | | amount | number | Max amount for that percentage | | | percentage | number | Fee % (precision 2) |


KDAPool | Required | Parameter | Type | Description |

|:----------:|------------------|------------|--------------------------------------| | ✅ | active | boolean | True if the pooling should be active | | ✅ | adminAddress | string | Admin Address | | ✅ | fRatioKLV | number | Fixed ratio for KLV | | ✅ | fRatioKDA | number | Fixed ratio for KDA |

Fixed Ratio calculation:


Role Structure List with all role values | Required | Parameter | Type |

Description | |:----------:|---------------------------|------------|------------------------------------------| | ✅ | address | string | Target Address | | ✅ | hasRoleMint | boolean | Should be able to mint? | | ✅ | hasRoleSetITOPrices | boolean | Should be able to set ITO prices? |


Staking Structure | Required | Parameter | Type | Description |

|:----------:|--------------------------|------------|------------------------------------------| | ✅ | interestType | number | 0: APR, 1: FPR | | | apr | number | Percentage | | | minEpochsToClaim | number | Minimum epochs to claim rewards | | | minEpochsToUnstake | number | Minimum epochs to unstake | | | minEpochsToWithdraw | number | Minimum 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 ID | Type Name | Description |

|:-------:|-------------|-------------------------------------------------| | 0 | FPR Deposit | Deposits an amount of currency to be distributed to all holders of target asset. | | 1 | KDA Pool | Deposits 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 Value | Status Name | Description |

|--------------|-------------|--------------------------| | 0 | DefaultITO | Keeps previous status value | | 1 | ActiveITO | Enables ITO/Whitelist | | 2 | PausedITO | Pauses 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 Value | Status Name | Description |

|--------------|-------------|------------------------------------| | 0 | DefaultITO | Keeps previous status value | | 1 | ActivelTO | Enables ITO/Whitelist | | 2 | PausedITO | Pauses 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 | ID | Type | Description | | -- | ------------------------- |

----------------------------------------- | | 0 | FeePerDataByte | Bandwidth fee value | | 1 | KAppFeeCreateValidator | Create validator fee value | | 2 | KAppFeeCreateAsset | Asset fee value | | 3 | MaxEpochsUnclaimed | Max unclaimed time (in epochs) for buckets| | 4 | MinSelfDelegatedAmount | Min self-delegated amount needed to be a validator | | 5 | MinTotalDelegatedAmount | Min total delegated amount needed to be a validator | | 6 | BlockRewards | Block rewards for validators | | 7 | StakingRewards | Staking rewards value | | 8 | KApp Fee for Transfer | KApp Fee for Transfer | | 9 | KApp Fee for Asset Trigger| KApp Fee for Asset Trigger | | 10 | KApp Fee for Validator Config | KApp Fee for Validator Config | | 11 | KApp Fee for Freeze | KApp Fee for Freeze| | 12 | KApp Fee for Unfreeze | KApp Fee for Unfreeze | | 13 | KApp Fee for Delegation | KApp Fee for Delegation | | 14 | KApp Fee for Delegation | KApp Fee for Delegation | | 15 | KApp Fee for Withdraw | KApp Fee for Withdraw | | 16 | KApp Fee for Claim | KApp Fee for Claim | | 17 | KApp Fee for Unjail | KApp Fee for Unjail | | 18 | KApp Fee for Account Name | KApp Fee for Account Name | | 19 | KApp Fee for Proposal | KApp Fee for Proposal | | 20 | KApp Fee for Vote | KApp Fee for Vote | | 21 | KApp Fee for Config ITO | KApp Fee for Config ITO | | 22 | KApp Fee for Set ITO Prices | KApp Fee for Set ITO Prices | | 23 | KApp Fee for Buy | KApp Fee for Buy | | 24 | KApp Fee for Sell | KApp Fee for Sell | | 25 | KApp Fee for Cancel Market Order | KApp Fee for Cancel Market Order | | 26 | KApp Fee for Marketplace Creation | KApp Fee for Marketplace Creation | | 27 | KApp Fee for Config Marketplace | KApp Fee for Config Marketplace | | 28 | KApp Fee for Update Account Permission | KApp Fee for Update Account Permission | | 29 | Max NFT Mint per batch | Max NFT Minted in one contract | | 30 | Min KFI staked to enable Proposals Kapps | Min overall KFI staked to enable Proposals | | 31 | Min KLV Bucket Amount | Minimum KLV Amount per bucket | | 32 | Max bucket size | Max buckets per account | | 33 | Leader Validator rewards percentage | Leader Validator rewards percentage | | 34 | Max Epochs for active proposal duration | Max Epochs an proposal will remain active | | 35 | KApp Fee for ITO Trigger | KApp Fee for ITO Trigger | | 36 | KApp Fee for Deposit | KApp 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 | Required | Parameter | Type | Description |

|----------|-----------|--------|---------------------------------| | ✅ |type | number | 0: Owner, 1: User | | ✅ |permissionName | string | Permission identifier | | ✅ |threshold | number | Minimum sign amount to permit transaction | | ✅ |operations | string | See Operations | | ✅ |signers | AccKey object array | Defines the weight of the accounts' votes |


AccKey structure | Required | Parameter | Type | Description |

|----------|-----------|--------|---------------------------------| | ✅ |address | string | Target address | | ✅ |weight | number | Target 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?