timelock

package
v0.0.0-...-fb0831a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 9 Imported by: 2 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RoleAdmin     = "ADMIN"
	RoleProposer  = "PROPOSER"
	RoleCanceller = "CANCELLER"
	RoleBypasser  = "BYPASSER"
)

Timelock role symbols (contracts/timelock/src/types.rs).

View Source
const ContractType = "Timelock"

ContractType labels Timelock.

Variables

View Source
var Deploy = stellarops.NewDeployOperation("timelock:deploy", "Deploys the Timelock Soroban contract from WASM")

Deploy uploads timelock.wasm and creates the contract through its constructor.

View Source
var GetMinDelay = cldfops.NewOperation(
	"timelock:get-min-delay",
	stellarops.ContractDeploymentVersion,
	"Reads the current Timelock minimum delay via simulation",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in GetMinDelayInput) (GetMinDelayOutput, error) {
		c := tlbindings.NewTimelockClient(d.Invoker, in.ContractID)
		delay, err := c.GetMinDelay(b.GetContext())
		if err != nil {
			return GetMinDelayOutput{}, err
		}
		return GetMinDelayOutput{MinDelay: delay}, nil
	},
)

GetMinDelay calls Timelock `get_min_delay` (simulation, read-only).

View Source
var GrantRole = cldfops.NewOperation(
	"timelock:grant-role",
	stellarops.ContractDeploymentVersion,
	"Grants a Timelock role (e.g. ADMIN_ROLE) to an account",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in GrantRoleInput) (stellarops.Void, error) {
		c := tlbindings.NewTimelockClient(d.Invoker, in.ContractID)
		if err := c.GrantRole(b.GetContext(), in.Caller, in.Role, in.Account); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

GrantRole calls Timelock `grant_role`.

View Source
var RevokeRole = cldfops.NewOperation(
	"timelock:revoke-role",
	stellarops.ContractDeploymentVersion,
	"Revokes a Timelock role from an account",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in RevokeRoleInput) (stellarops.Void, error) {
		c := tlbindings.NewTimelockClient(d.Invoker, in.ContractID)
		if err := c.RevokeRole(b.GetContext(), in.Caller, in.Role, in.Account); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

RevokeRole calls Timelock `revoke_role`.

View Source
var UpdateDelay = cldfops.NewOperation(
	"timelock:update-delay",
	stellarops.ContractDeploymentVersion,
	"Updates Timelock minimum delay",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in UpdateDelayInput) (stellarops.Void, error) {
		c := tlbindings.NewTimelockClient(d.Invoker, in.ContractID)
		if err := c.UpdateDelay(b.GetContext(), in.Caller, in.NewDelay); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

UpdateDelay calls Timelock `update_delay`.

Functions

func ConstructorArgs

func ConstructorArgs(in ConstructorInput) ([]xdr.ScVal, error)

ConstructorArgs encodes the Timelock __constructor arguments.

func VerifyConstructed

func VerifyConstructed(ctx context.Context, inv bindings.Invoker, contractID string, want ConstructorInput) error

VerifyConstructed reads back the Timelock min delay and every role's members of contractID: ADMIN must be the contract alone and the other roles must hold exactly the requested accounts.

Types

type ConstructorInput

type ConstructorInput struct {
	MinDelay   uint64   `json:"min_delay"`
	Proposers  []string `json:"proposers"`
	Cancellers []string `json:"cancellers"`
	Bypassers  []string `json:"bypassers"`
}

ConstructorInput holds the Timelock __constructor arguments. There is no admin or executor field: the constructor grants ADMIN only to the contract itself, and execute_batch is permissionless once an operation is ready.

type GetMinDelayInput

type GetMinDelayInput struct {
	ContractID string `json:"contract_id"`
}

GetMinDelayInput identifies the Timelock instance to read the configured min delay from.

type GetMinDelayOutput

type GetMinDelayOutput struct {
	MinDelay uint64 `json:"min_delay"`
}

GetMinDelayOutput is the current Timelock min delay (in seconds).

type GrantRoleInput

type GrantRoleInput struct {
	ContractID string `json:"contract_id"`
	Caller     string `json:"caller"`
	Role       string `json:"role"`
	Account    string `json:"account"`
}

GrantRoleInput grants a role on Timelock to an account. Used by Deployer to grant ADMIN_ROLE to the Timelock itself so role administration goes through scheduled ops.

type RevokeRoleInput

type RevokeRoleInput struct {
	ContractID string `json:"contract_id"`
	Caller     string `json:"caller"`
	Role       string `json:"role"`
	Account    string `json:"account"`
}

RevokeRoleInput revokes a role on Timelock from an account.

type UpdateDelayInput

type UpdateDelayInput struct {
	ContractID string `json:"contract_id"`
	Caller     string `json:"caller"`
	NewDelay   uint64 `json:"new_delay"`
}

UpdateDelayInput changes the Timelock's minimum delay (must be scheduled through itself).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL