Skip to main content

autonity

Methods​

ActivatedValidator()​

ActivatedValidator(
startBlock?,
endBlock?,
addr?): Promise<IActivatedValidator[]>

Emitted when a validator is activated.

Parameters​

ParameterTypeDescription
startBlock?numberoptional start block to filter events
endBlock?numberoptional end block to filter events
addr?AddressLikeoptional address to filter events by validator address

Returns​

Promise<IActivatedValidator[]>


activateValidator()​

activateValidator(_address): Promise<ContractTransactionResponse>

Re-activates a paused validator.

Parameters​

ParameterTypeDescription
_addressAddressLikeaddress of the validator to activate

Returns​

Promise<ContractTransactionResponse>


allowance()​

allowance(owner, spender): Promise<bigint>

Returns the allowance for ERC-20 transfers

Parameters​

ParameterType
ownerAddressLike
spenderAddressLike

Returns​

Promise<bigint>


Approval()​

Approval(
startBlock?,
endBlock?,
owner?,
spender?): Promise<IApproval[]>

ERC-20 approval event binding.

Parameters​

ParameterTypeDescription
startBlock?numberoptional start block to filter events
endBlock?numberoptional end block to filter events
owner?AddressLikeoptional owner address to filter events
spender?AddressLikeoptional spender address to filter events

Returns​

Promise<IApproval[]>


approve()​

approve(spender, amount): Promise<ContractTransactionResponse>

Approves spender to transfer NTN tokens on behalf of the caller

Parameters​

ParameterType
spenderAddressLike
amountBigNumberish

Returns​

Promise<ContractTransactionResponse>


approveBonding()​

approveBonding(_caller, _amount): Promise<ContractTransactionResponse>

Approves another account to bond NTN on behalf of the caller.

Parameters​

ParameterTypeDescription
_callerAddressLikeaddress allowed to bond on behalf of owner
_amountBigNumberishamount of NTN that can be bonded

Returns​

Promise<ContractTransactionResponse>


autobond()​

autobond(
_validator,
_selfBond,
_delegated): Promise<ContractTransactionResponse>

Creates a bonding request with automatic self-bond and delegation.

Parameters​

ParameterTypeDescription
_validatorAddressLikeaddress of the validator to delegate stake to
_selfBondBigNumberishtotal amount of NTN to self-bond
_delegatedBigNumberishtotal amount of NTN to delegate

Returns​

Promise<ContractTransactionResponse>


balanceOf()​

balanceOf(_address): Promise<bigint>

Returns the NTN balance of an address

Parameters​

ParameterType
_addressAddressLike

Returns​

Promise<bigint>


bond()​

bond(_validator, _amount): Promise<ContractTransactionResponse>

Creates a bonding request to delegate stake to a validator.

Parameters​

ParameterTypeDescription
_validatorAddressLikeaddress of the validator to delegate to
_amountBigNumberishamount of NTN to bond

Returns​

Promise<ContractTransactionResponse>


bondFrom()​

bondFrom(
_account,
_validator,
_amount): Promise<ContractTransactionResponse>

Creates a bonding request on behalf of another account.

Parameters​

ParameterTypeDescription
_accountAddressLikeaddress of the delegator
_validatorAddressLikeaddress of the validator to delegate to
_amountBigNumberishamount of NTN to bond

Returns​

Promise<ContractTransactionResponse>


bondingAllowance()​

bondingAllowance(_owner, _caller): Promise<bigint>

Returns the bonding allowance for an account

Parameters​

ParameterType
_ownerAddressLike
_callerAddressLike

Returns​

Promise<bigint>


changeCommissionRate()​

changeCommissionRate(_validator, _rate): Promise<ContractTransactionResponse>

Changes the commission rate for a validator.

Parameters​

ParameterTypeDescription
_validatorAddressLikeaddress of the validator
_rateBigNumberishnew commission rate (0-10000, where 10000 = 100%)

Returns​

Promise<ContractTransactionResponse>


circulatingSupply()​

circulatingSupply(): Promise<bigint>

Returns the circulating supply of NTN tokens

Returns​

Promise<bigint>


decimals()​

decimals(): Promise<bigint>

Returns the number of decimal places for NTN token

Returns​

Promise<bigint>


EnodeUpdate()​

EnodeUpdate(
startBlock?,
endBlock?,
validator?): Promise<IEnodeUpdate[]>

Emitted when a validator's enode is updated.

Parameters​

ParameterTypeDescription
startBlock?numberoptional start block to filter events
endBlock?numberoptional end block to filter events
validator?AddressLikeoptional address to filter events by validator address

Returns​

Promise<IEnodeUpdate[]>


getBlockPeriod()​

getBlockPeriod(): Promise<bigint>

Returns the block period duration

Returns​

Promise<bigint>


getBondingRequestByID()​

getBondingRequestByID(_id): Promise<BondingRequest>

Returns the bonding request for a given ID.

Parameters​

ParameterTypeDescription
_idBigNumberishthe ID of the bonding request

Returns​

Promise<BondingRequest>


getClientConfig()​

getClientConfig(): Promise<ClientConfig>

Returns the client-aware configuration

Returns​

Promise<ClientConfig>


getCommittee()​

getCommittee(): Promise<Committee[]>

Returns the current consensus committee members

Returns​

Promise<Committee[]>


getCommitteeEnodes()​

getCommitteeEnodes(): Promise<string[]>

Returns the enodes of current committee members

Returns​

Promise<string[]>


getConfig()​

getConfig(): Promise<AutonityConfig>

Returns the current contract configuration

Returns​

Promise<AutonityConfig>


getCurrentCommitteeSize()​

getCurrentCommitteeSize(): Promise<bigint>

Returns the current size of the consensus committee

Returns​

Promise<bigint>


getCurrentEpochPeriod()​

getCurrentEpochPeriod(): Promise<bigint>

Returns the epoch period of the current epoch

Returns​

Promise<bigint>


getEpochByHeight()​

getEpochByHeight(_height): Promise<EpochInfo>

Returns epoch information for a specific block height.

Parameters​

ParameterTypeDescription
_heightBigNumberishthe block height

Returns​

Promise<EpochInfo>


getEpochFromBlock()​

getEpochFromBlock(_block): Promise<bigint>

Returns the epoch associated with a block number.

Parameters​

ParameterTypeDescription
_blockBigNumberishthe block number

Returns​

Promise<bigint>


getEpochID()​

getEpochID(): Promise<bigint>

Returns the current epoch ID

Returns​

Promise<bigint>


getEpochInfo()​

getEpochInfo(): Promise<EpochInfo>

Returns the current epoch information

Returns​

Promise<EpochInfo>


getEpochPeriod()​

getEpochPeriod(): Promise<bigint>

Returns the epoch period (next period if update is scheduled)

Returns​

Promise<bigint>


getEpochTotalBondedStake()​

getEpochTotalBondedStake(): Promise<bigint>

Returns the total bonded stake for the current epoch

Returns​

Promise<bigint>


getInflationReserve()​

getInflationReserve(): Promise<bigint>

Returns the current inflation reserve amount

Returns​

Promise<bigint>


getLastEpochBlock()​

getLastEpochBlock(): Promise<bigint>

Returns the last epoch's end block height

Returns​

Promise<bigint>


getLastEpochTime()​

getLastEpochTime(): Promise<bigint>

Returns the last epoch's end block timestamp

Returns​

Promise<bigint>


getLiquidLogicContract()​

getLiquidLogicContract(): Promise<string>

Returns the liquid logic contract address

Returns​

Promise<string>


getMaxCommitteeSize()​

getMaxCommitteeSize(): Promise<bigint>

Returns the maximum allowed committee size

Returns​

Promise<bigint>


getMaxScheduleDuration()​

getMaxScheduleDuration(): Promise<bigint>

Returns the maximum allowed schedule duration

Returns​

Promise<bigint>


getMinimumBaseFee()​

getMinimumBaseFee(): Promise<bigint>

Returns the minimum gas price for transactions

Returns​

Promise<bigint>


getNewContract()​

getNewContract(): Promise<[string, string]>

Returns new contract bytecode and ABI for upgrades.

Returns​

Promise<[string, string]>


getNextEpochBlock()​

getNextEpochBlock(): Promise<bigint>

Returns the next epoch block number

Returns​

Promise<bigint>


getOperator()​

getOperator(): Promise<string>

Returns the current operator account address

Returns​

Promise<string>


getOracle()​

getOracle(): Promise<string>

Returns the oracle contract address

Returns​

Promise<string>


getSchedule()​

getSchedule(vault, id): Promise<Schedule>

Returns a specific schedule for a vault.

Parameters​

ParameterTypeDescription
vaultAddressLikeaddress of the vault
idBigNumberishindex of the schedule

Returns​

Promise<Schedule>


getSlasher()​

getSlasher(): Promise<string>

Returns the slasher contract address

Returns​

Promise<string>


getTotalSchedules()​

getTotalSchedules(vault): Promise<bigint>

Returns the total number of schedules for a vault.

Parameters​

ParameterTypeDescription
vaultAddressLikeaddress of the vault

Returns​

Promise<bigint>


getTreasuryAccount()​

getTreasuryAccount(): Promise<string>

Returns the current treasury account address

Returns​

Promise<string>


getTreasuryFee()​

getTreasuryFee(): Promise<bigint>

Returns the current treasury fee amount

Returns​

Promise<bigint>


getUnbondingPeriod()​

getUnbondingPeriod(): Promise<bigint>

Returns the unbonding period duration

Returns​

Promise<bigint>


getUnbondingRequestByID()​

getUnbondingRequestByID(_id): Promise<UnbondingRequest>

Returns the unbonding request for a given ID.

Parameters​

ParameterTypeDescription
_idBigNumberishthe ID of the unbonding request

Returns​

Promise<UnbondingRequest>


getUnbondingShare()​

getUnbondingShare(unbondingID): Promise<bigint>

Returns the unbonding share amount for a request.

Parameters​

ParameterTypeDescription
unbondingIDBigNumberishID of the unbonding request

Returns​

Promise<bigint>


getValidator()​

getValidator(addr): Promise<Validator>

Returns validator information for a given address.

Parameters​

ParameterTypeDescription
addrAddressLikeaddress of the validator

Returns​

Promise<Validator>


getValidators()​

getValidators(): Promise<string[]>

Returns the list of all validator addresses

Returns​

Promise<string[]>


getValidatorState()​

getValidatorState(addr): Promise<bigint>

Returns the state of a validator.

Parameters​

ParameterTypeDescription
addrAddressLikeaddress of the validator

Returns​

Promise<bigint>


getVersion()​

getVersion(): Promise<bigint>

Returns the current contract version

Returns​

Promise<bigint>


isUnbondingReleased()​

isUnbondingReleased(unbondingID): Promise<boolean>

Checks if an unbonding request has been released.

Parameters​

ParameterTypeDescription
unbondingIDBigNumberishID of the unbonding request

Returns​

Promise<boolean>


MintedStake()​

MintedStake(
startBlock?,
endBlock?,
addr?): Promise<IMintedStake[]>

Emitted when stake is minted.

Parameters​

ParameterTypeDescription
startBlock?numberoptional start block to filter events
endBlock?numberoptional end block to filter events
addr?AddressLikeoptional address to filter events by address

Returns​

Promise<IMintedStake[]>


name()​

name(): Promise<string>

Returns the name of the NTN token

Returns​

Promise<string>


NewBondingRequest()​

NewBondingRequest(
startBlock?,
endBlock?,
validator?): Promise<INewBondingRequest[]>

Emitted when a bonding request is registered.

Parameters​

ParameterTypeDescription
startBlock?numberoptional start block to filter events
endBlock?numberoptional end block to filter events
validator?AddressLikeoptional address to filter events by validator address

Returns​

Promise<INewBondingRequest[]>


NewUnbondingRequest()​

NewUnbondingRequest(
startBlock?,
endBlock?,
validator?): Promise<INewUnbondingRequest[]>

Emitted when an unbonding request is registered.

Parameters​

ParameterTypeDescription
startBlock?numberoptional start block to filter events
endBlock?numberoptional end block to filter events
validator?AddressLikeoptional address to filter events by validator address

Returns​

Promise<INewUnbondingRequest[]>


pauseValidator()​

pauseValidator(_address): Promise<ContractTransactionResponse>

Pauses a validator and stops it from accepting delegations.

Parameters​

ParameterTypeDescription
_addressAddressLikeaddress of the validator to pause

Returns​

Promise<ContractTransactionResponse>


registerValidator()​

registerValidator(
_enode,
_oracleAddress,
_consensusKey,
_signatures): Promise<ContractTransactionResponse>

Registers a validator on the Autonity contract.

Effects:

  • Assigns caller as the validator's treasury account
  • Deploys a "Liquid Stake" token
  • Emits the RegisteredValidator event

Parameters​

ParameterTypeDescription
_enodestringEnode of the validator node
_oracleAddressAddressLikeOracle server address managed by the validator
_consensusKeyBytesLikeValidator’s BLS public key (bytes)
_signaturesBytesLikeProof of ownership, including: 1. Treasury message signed by validator account key 2. Treasury message signed by oracle account key 3. BLS signature

Returns​

Promise<ContractTransactionResponse>

The transaction response from the blockchain


STANDARD_DECIMALS()​

STANDARD_DECIMALS(): Promise<bigint>

Returns the standard decimals constant

Returns​

Promise<bigint>


STANDARD_SCALE_FACTOR()​

STANDARD_SCALE_FACTOR(): Promise<bigint>

Returns the standard scale factor constant

Returns​

Promise<bigint>


symbol()​

symbol(): Promise<string>

Returns the symbol of the NTN token

Returns​

Promise<string>


totalSupply()​

totalSupply(): Promise<bigint>

Returns the total supply of NTN tokens

Returns​

Promise<bigint>


transfer()​

transfer(_recipient, _amount): Promise<ContractTransactionResponse>

Transfers NTN tokens to another address

Parameters​

ParameterType
_recipientAddressLike
_amountBigNumberish

Returns​

Promise<ContractTransactionResponse>


transferFrom()​

transferFrom(
_sender,
_recipient,
_amount): Promise<ContractTransactionResponse>

Transfers NTN tokens from one address to another

Parameters​

ParameterType
_senderAddressLike
_recipientAddressLike
_amountBigNumberish

Returns​

Promise<ContractTransactionResponse>


unbond()​

unbond(_validator, _amount): Promise<ContractTransactionResponse>

Creates an unbonding request to withdraw delegated stake.

Parameters​

ParameterTypeDescription
_validatorAddressLikeaddress of the validator to unbond from
_amountBigNumberishamount of LNTN to unbond

Returns​

Promise<ContractTransactionResponse>


unbondFrom()​

unbondFrom(
_account,
_validator,
_amount): Promise<ContractTransactionResponse>

Creates an unbonding request on behalf of another account.

Parameters​

ParameterTypeDescription
_accountAddressLikeaddress of the delegator
_validatorAddressLikeaddress of the validator to unbond from
_amountBigNumberishamount of LNTN to unbond

Returns​

Promise<ContractTransactionResponse>


updateEnode()​

updateEnode(_nodeAddress, _enode): Promise<ContractTransactionResponse>

Updates the enode of a registered validator.

Parameters​

ParameterTypeDescription
_nodeAddressAddressLikevalidator address to update
_enodestringnew enode string

Returns​

Promise<ContractTransactionResponse>