Documentation
¶
Index ¶
- Constants
- Variables
- func ConstructorArgs(in ConstructorInput) ([]xdr.ScVal, error)
- func VerifyConstructed(ctx context.Context, inv bindings.Invoker, contractID string, ...) error
- type ConstructorInput
- type GetMinDelayInput
- type GetMinDelayOutput
- type GrantRoleInput
- type RevokeRoleInput
- type UpdateDelayInput
Constants ¶
const ( RoleAdmin = "ADMIN" RoleProposer = "PROPOSER" RoleCanceller = "CANCELLER" RoleBypasser = "BYPASSER" )
Timelock role symbols (contracts/timelock/src/types.rs).
const ContractType = "Timelock"
ContractType labels Timelock.
Variables ¶
var Deploy = stellarops.NewDeployOperation("timelock:deploy", "Deploys the Timelock Soroban contract from WASM")
Deploy uploads timelock.wasm and creates the contract through its constructor.
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).
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`.
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`.
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).