Skip to main content

Operator Module

This is a library which contains all the helper functions you need for working with operators on SSV network.

After instantiating the SDK, you can call any of the functions in the utils library like so:

sdk.operators.registerOperator()

Function List

registerOperator()

Accepts a list of addresses, fetches their nonces using subgraph, returns as a list.

Input parameterInput typeDescriptionExample input
isPrivatebooltrue/false flag of whether the operator is privatetrue
yearlyFeebigintOperator yearly fee specified in ETH0.1234
publicKeystringThe operator public key (generated as part of the node setup)"LS0tLS1CRUdJTiBSU0EgUFVCTElDIE..."

Example:

import { parseEther } from 'viem'

const receipt = await sdk.operators
.registerOperator({
args: {
publicKey: "LS0tLS1CRUdJTiBSU0EgUFVCTElDIE..."
yearlyFee: parseEther('0.1234')
isPrivate: true,
},
})
.then((tx) => tx.wait())

removeOperator()

Permanently removes the operator from the network (irreversible). Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdbigintOperator id4

Example:

const receipt = await sdk.operators
.removeOperator({
args: {
operatorId: 4,
},
})
.then((tx) => tx.wait())

withdraw()

Withdraws an amount of ETH from a specified operator. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdstringOperator id4
amountbigintWithdraws a specified amount of ETH earnings from provided operator balance to msg.sender0.1234

Example:

import { parseEther } from 'viem'

const receipt = await sdk.operators.withdraw({
args: {
operatorId: "4",
amount: parseEther('0.1234'),
},
})
.then((tx) => tx.wait())

withdrawOperatorEarningsSSV()

Withdraws an amount of SSV from a specified operator. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdstringOperator id4
amountbigintWithdraws a specified amount of SSV tokens earnings from provided operator balance to msg.sender30

Example:

import { parseEther } from 'viem'

const receipt = await sdk.operators.withdrawOperatorEarningsSSV({
args: {
operatorId: "4",
amount: parseEther('30'),
},
})
.then((tx) => tx.wait())

withdrawAllOperatorEarningsSSV()

Withdraws all of the available SSV from a specified operator's balance. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdstringOperator id4

Example:

const receipt = await sdk.operators.withdrawAllOperatorEarningsSSV({
args: {
operatorId: "4",
},
})
.then((tx) => tx.wait())

withdrawAllVersionOperatorEarnings()

Withdraws all available SSV tokens and ETH from specified operators' balances. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdstringOperator id4

Example:

const receipt = await sdk.operators.withdrawAllVersionOperatorEarnings({
args: {
operatorId: "4",
},
})
.then((tx) => tx.wait())

setOperatorWhitelists()

For a list of operators provided, set a list of whitelisted addresses which can register validators to these operators.

Input parameterInput typeDescriptionExample input
operatorIdbigint[]Array of operator ID(s)[1,2,3,4]
whitelistedHex[]Array of ETH1 addresses to be whitelisted["0xA4831B989972605A62141a667578d742927Cbef9", "0xA4831B989972605A62141a667578d742927Cbef8"]

Example:

const receipt = await sdk.operators.setOperatorWhitelists({
args: {
operatorId: [1,2,3,4],
whitelisted: ["0xA4831B989972605A62141a667578d742927Cbef9", "0xA4831B989972605A62141a667578d742927Cbef8"],
},
})
.then((tx) => tx.wait())

removeOperatorWhitelists()

For a list of operators provided, remove a list of whitelisted addresses. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdbigint[]Array of operator ID(s)[1,2,3,4]
whitelistedHex[]Array of ETH1 addresses to be removed from the whitelist["0xA4831B989972605A62141a667578d742927Cbef9", "0xA4831B989972605A62141a667578d742927Cbef8"]

Example:

const receipt = await sdk.operators.removeOperatorWhitelists({
args: {
operatorId: [1,2,3,4],
whitelisted: ["0xA4831B989972605A62141a667578d742927Cbef9", "0xA4831B989972605A62141a667578d742927Cbef8"],
},
})
.then((tx) => tx.wait())

setOperatorsPrivate()

For a list of operators provided, set their status to private. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdbigint[]Array of operator ID(s)[1,2,3,4]

Example:

const receipt = await sdk.operators.setOperatorsPrivate({
args: {
operatorId: [1,2,3,4],
},
})
.then((tx) => tx.wait())

setOperatorsPublic()

For a list of operators provided, set their status to public. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdbigint[]Array of operator ID(s)[1,2,3,4]

Example:

const receipt = await sdk.operators.setOperatorsPublic({
args: {
operatorId: [1,2,3,4],
},
})
.then((tx) => tx.wait())

setOperatorWhitelistingContract()

For a list of operators provided, set an external whitelisting contract to manage the whitelist for these operators. Must be a valid whitelisting contract.. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdbigint[]Array of operator ID(s)[1,2,3,4]
whitelistingContractstringA valid whitelisting contract address"0xA4831B989972605A62141a667578d742927Cbef9"

Example:

const receipt = await sdk.operators.setOperatorWhitelistingContract({
args: {
operatorId: [1,2,3,4],
whitelistingContract: "0xA4831B989972605A62141a667578d742927Cbef9",
},
})
.then((tx) => tx.wait())

removeOperatorWhitelistingContract()

For a list of operators provided, remove the whitelisting contract stored. Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdbigint[]Array of operator ID(s)[1,2,3,4]

Example:

const receipt = await sdk.operators
.removeOperatorWhitelistingContract({
args: {
operatorId: [1,2,3,4],
},
})
.then((tx) => tx.wait())

declareOperatorFee()

Initiates the first step of the operator fee update cycle - declaration of a new fee. After specified time window operator will be able to change to the new fee with executeOperatorFee(). Will fail if msg.sender is not the operator owner.

Input parameterInput typeDescriptionExample input
operatorIdbigintOperator id4
feebigintNew fee (denominated as ETH per block). Amount must be shrinkable (divisible by 10000000), for simplicity we use parseEther0.1234

Example:

import { parseEther } from 'viem'

const receipt = await sdk.operators
.declareOperatorFee({
args: {
operatorId: 4,
fee: parseEther('0.1234'),
},
})
.then((tx) => tx.wait())

executeOperatorFee()

Activates operator's fee change specified in previously called declareOperatorFee(). This function needs to be called within a certain time window following declareOperatorFee().

Input parameterInput typeDescriptionExample input
operatorIdbigintOperator id4

Example:

const receipt = await sdk.operators
.executeOperatorFee({
args: {
operatorId: 4,
},
})
.then((tx) => tx.wait())

cancelDeclaredOperatorFee()

Cancels operator's fee change requested in previously called declareOperatorFee().

Input parameterInput typeDescriptionExample input
operatorIdbigintOperator id4

Example:

const receipt = await sdk.operators
.cancelDeclaredOperatorFee({
args: {
operatorId: 4,
},
})
.then((tx) => tx.wait())

reduceOperatorFee()

Reduce the operator fee, does not abide by the restrictions of fee increase.

Input parameterInput typeDescriptionExample input
operatorIdbigintOperator id4
feebigintNew fee (denominated as ETH per block). Amount must be shrinkable (divisible by 10000000), for simplicity we use parseEther0.1234

Example:

import { parseEther } from 'viem'

const receipt = await sdk.operators
.reduceOperatorFee({
args: {
operatorId: 4,
fee: parseEther('0.1234'),
},
})
.then((tx) => tx.wait())