autonity
Methods
ActivatedValidator()
ActivatedValidator(
startBlock?,
endBlock?,
addr?): Promise<IActivatedValidator[]>
Emitted when a validator is activated.
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional start block to filter events |
endBlock ? | number | optional end block to filter events |
addr ? | AddressLike | optional address to filter events by validator address |
Returns
Promise
<IActivatedValidator
[]>
activateValidator()
activateValidator(_address): Promise<ContractTransactionResponse>
Re-activates a paused validator.
Parameters
Parameter | Type | Description |
---|---|---|
_address | AddressLike | address of the validator to activate |
Returns
Promise
<ContractTransactionResponse
>
allowance()
allowance(owner, spender): Promise<bigint>
Returns the allowance for ERC-20 transfers
Parameters
Parameter | Type |
---|---|
owner | AddressLike |
spender | AddressLike |
Returns
Promise
<bigint
>
Approval()
Approval(
startBlock?,
endBlock?,
owner?,
spender?): Promise<IApproval[]>
ERC-20 approval event binding.
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional start block to filter events |
endBlock ? | number | optional end block to filter events |
owner ? | AddressLike | optional owner address to filter events |
spender ? | AddressLike | optional 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
Parameter | Type |
---|---|
spender | AddressLike |
amount | BigNumberish |
Returns
Promise
<ContractTransactionResponse
>
approveBonding()
approveBonding(_caller, _amount): Promise<ContractTransactionResponse>
Approves another account to bond NTN on behalf of the caller.
Parameters
Parameter | Type | Description |
---|---|---|
_caller | AddressLike | address allowed to bond on behalf of owner |
_amount | BigNumberish | amount 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
Parameter | Type | Description |
---|---|---|
_validator | AddressLike | address of the validator to delegate stake to |
_selfBond | BigNumberish | total amount of NTN to self-bond |
_delegated | BigNumberish | total amount of NTN to delegate |
Returns
Promise
<ContractTransactionResponse
>
balanceOf()
balanceOf(_address): Promise<bigint>
Returns the NTN balance of an address
Parameters
Parameter | Type |
---|---|
_address | AddressLike |
Returns
Promise
<bigint
>
bond()
bond(_validator, _amount): Promise<ContractTransactionResponse>
Creates a bonding request to delegate stake to a validator.
Parameters
Parameter | Type | Description |
---|---|---|
_validator | AddressLike | address of the validator to delegate to |
_amount | BigNumberish | amount of NTN to bond |
Returns
Promise
<ContractTransactionResponse
>
bondFrom()
bondFrom(
_account,
_validator,
_amount): Promise<ContractTransactionResponse>
Creates a bonding request on behalf of another account.
Parameters
Parameter | Type | Description |
---|---|---|
_account | AddressLike | address of the delegator |
_validator | AddressLike | address of the validator to delegate to |
_amount | BigNumberish | amount of NTN to bond |
Returns
Promise
<ContractTransactionResponse
>
bondingAllowance()
bondingAllowance(_owner, _caller): Promise<bigint>
Returns the bonding allowance for an account
Parameters
Parameter | Type |
---|---|
_owner | AddressLike |
_caller | AddressLike |
Returns
Promise
<bigint
>
changeCommissionRate()
changeCommissionRate(_validator, _rate): Promise<ContractTransactionResponse>
Changes the commission rate for a validator.
Parameters
Parameter | Type | Description |
---|---|---|
_validator | AddressLike | address of the validator |
_rate | BigNumberish | new 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
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional start block to filter events |
endBlock ? | number | optional end block to filter events |
validator ? | AddressLike | optional 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
Parameter | Type | Description |
---|---|---|
_id | BigNumberish | the 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
Parameter | Type | Description |
---|---|---|
_height | BigNumberish | the block height |
Returns
Promise
<EpochInfo
>
getEpochFromBlock()
getEpochFromBlock(_block): Promise<bigint>
Returns the epoch associated with a block number.
Parameters
Parameter | Type | Description |
---|---|---|
_block | BigNumberish | the 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
Parameter | Type | Description |
---|---|---|
vault | AddressLike | address of the vault |
id | BigNumberish | index 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
Parameter | Type | Description |
---|---|---|
vault | AddressLike | address 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
Parameter | Type | Description |
---|---|---|
_id | BigNumberish | the ID of the unbonding request |
Returns
Promise
<UnbondingRequest
>
getUnbondingShare()
getUnbondingShare(unbondingID): Promise<bigint>
Returns the unbonding share amount for a request.
Parameters
Parameter | Type | Description |
---|---|---|
unbondingID | BigNumberish | ID of the unbonding request |
Returns
Promise
<bigint
>
getValidator()
getValidator(addr): Promise<Validator>
Returns validator information for a given address.
Parameters
Parameter | Type | Description |
---|---|---|
addr | AddressLike | address 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
Parameter | Type | Description |
---|---|---|
addr | AddressLike | address 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
Parameter | Type | Description |
---|---|---|
unbondingID | BigNumberish | ID of the unbonding request |
Returns
Promise
<boolean
>
MintedStake()
MintedStake(
startBlock?,
endBlock?,
addr?): Promise<IMintedStake[]>
Emitted when stake is minted.
Parameters
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional start block to filter events |
endBlock ? | number | optional end block to filter events |
addr ? | AddressLike | optional 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
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional start block to filter events |
endBlock ? | number | optional end block to filter events |
validator ? | AddressLike | optional 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
Parameter | Type | Description |
---|---|---|
startBlock ? | number | optional start block to filter events |
endBlock ? | number | optional end block to filter events |
validator ? | AddressLike | optional 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
Parameter | Type | Description |
---|---|---|
_address | AddressLike | address 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
Parameter | Type | Description |
---|---|---|
_enode | string | Enode of the validator node |
_oracleAddress | AddressLike | Oracle server address managed by the validator |
_consensusKey | BytesLike | Validator’s BLS public key (bytes) |
_signatures | BytesLike | Proof 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
Parameter | Type |
---|---|
_recipient | AddressLike |
_amount | BigNumberish |
Returns
Promise
<ContractTransactionResponse
>
transferFrom()
transferFrom(
_sender,
_recipient,
_amount): Promise<ContractTransactionResponse>
Transfers NTN tokens from one address to another
Parameters
Parameter | Type |
---|---|
_sender | AddressLike |
_recipient | AddressLike |
_amount | BigNumberish |
Returns
Promise
<ContractTransactionResponse
>
unbond()
unbond(_validator, _amount): Promise<ContractTransactionResponse>
Creates an unbonding request to withdraw delegated stake.
Parameters
Parameter | Type | Description |
---|---|---|
_validator | AddressLike | address of the validator to unbond from |
_amount | BigNumberish | amount of LNTN to unbond |
Returns
Promise
<ContractTransactionResponse
>
unbondFrom()
unbondFrom(
_account,
_validator,
_amount): Promise<ContractTransactionResponse>
Creates an unbonding request on behalf of another account.
Parameters
Parameter | Type | Description |
---|---|---|
_account | AddressLike | address of the delegator |
_validator | AddressLike | address of the validator to unbond from |
_amount | BigNumberish | amount of LNTN to unbond |
Returns
Promise
<ContractTransactionResponse
>
updateEnode()
updateEnode(_nodeAddress, _enode): Promise<ContractTransactionResponse>
Updates the enode of a registered validator.
Parameters
Parameter | Type | Description |
---|---|---|
_nodeAddress | AddressLike | validator address to update |
_enode | string | new enode string |
Returns
Promise
<ContractTransactionResponse
>