token_lock_box

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const ContractType = "TokenLockBox"

ContractType labels token lock box contracts.

Variables

View Source
var AcceptOwnership = cldfops.NewOperation(
	"token-lock-box:accept-ownership",
	stellarops.ContractDeploymentVersion,
	"Accepts token lock box ownership after transfer_ownership",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in AcceptOwnershipInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.AcceptOwnership(b.GetContext()); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

AcceptOwnership calls `accept_ownership` on token lock box.

View Source
var AddAllowedCallers = cldfops.NewOperation(
	"token-lock-box:add-allowed-callers",
	stellarops.ContractDeploymentVersion,
	"Adds allowed caller addresses that may deposit or withdraw from the lock box",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in AddAllowedCallersInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.AddAllowedCallers(b.GetContext(), in.Callers); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

AddAllowedCallers calls token lock box `add_allowed_callers`.

View Source
var Deploy = stellarops.NewDeployOperation("token-lock-box:deploy", "Deploys the token lock box Soroban contract from WASM")

Deploy uploads pools_token_lock_box.wasm.

View Source
var Deposit = cldfops.NewOperation(
	"token-lock-box:deposit",
	stellarops.ContractDeploymentVersion,
	"Deposits tokens from an allowed caller into the lock box",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in DepositInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.Deposit(b.GetContext(), in.Caller, in.Amount); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Deposit calls token lock box `deposit`.

View Source
var Initialize = cldfops.NewOperation(
	"token-lock-box:initialize",
	stellarops.ContractDeploymentVersion,
	"Initializes token lock box with owner and token",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in InitializeInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.Initialize(b.GetContext(), in.Owner, in.Token); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Initialize calls token lock box `initialize`.

View Source
var RemoveAllowedCallers = cldfops.NewOperation(
	"token-lock-box:remove-allowed-callers",
	stellarops.ContractDeploymentVersion,
	"Removes allowed caller addresses from the lock box allowlist",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in RemoveAllowedCallersInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.RemoveAllowedCallers(b.GetContext(), in.Callers); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

RemoveAllowedCallers calls token lock box `remove_allowed_callers`.

View Source
var TransferOwnership = cldfops.NewOperation(
	"token-lock-box:transfer-ownership",
	stellarops.ContractDeploymentVersion,
	"Transfers token lock box ownership to a pending new owner",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in TransferOwnershipInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.TransferOwnership(b.GetContext(), in.NewOwner); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

TransferOwnership calls `transfer_ownership` on token lock box.

View Source
var Withdraw = cldfops.NewOperation(
	"token-lock-box:withdraw",
	stellarops.ContractDeploymentVersion,
	"Withdraws tokens from the lock box to a recipient on behalf of an allowed caller",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in WithdrawInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.Withdraw(b.GetContext(), in.Caller, in.Amount, in.Recipient); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Withdraw calls token lock box `withdraw`.

Functions

This section is empty.

Types

type AcceptOwnershipInput

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

AcceptOwnershipInput completes two-step ownership transfer for the caller.

type AddAllowedCallersInput

type AddAllowedCallersInput struct {
	ContractID string   `json:"contract_id"`
	Callers    []string `json:"callers"`
}

AddAllowedCallersInput adds pool addresses to the lock box allowlist (owner-only).

type DepositInput

type DepositInput struct {
	ContractID string `json:"contract_id"`
	Caller     string `json:"caller"`
	Amount     int64  `json:"amount"`
}

DepositInput pulls tokens from caller into the lock box (allowed caller only).

type InitializeInput

type InitializeInput struct {
	ContractID string `json:"contract_id"`
	Owner      string `json:"owner"`
	Token      string `json:"token"`
}

InitializeInput configures lock box owner and token.

type RemoveAllowedCallersInput

type RemoveAllowedCallersInput struct {
	ContractID string   `json:"contract_id"`
	Callers    []string `json:"callers"`
}

RemoveAllowedCallersInput removes pool addresses from the lock box allowlist (owner-only).

type TransferOwnershipInput

type TransferOwnershipInput struct {
	ContractID string `json:"contract_id"`
	NewOwner   string `json:"new_owner"`
}

TransferOwnershipInput starts two-step ownership transfer.

type WithdrawInput

type WithdrawInput struct {
	ContractID string `json:"contract_id"`
	Caller     string `json:"caller"`
	Amount     int64  `json:"amount"`
	Recipient  string `json:"recipient"`
}

WithdrawInput sends tokens from the lock box to a recipient (allowed caller only).

Jump to

Keyboard shortcuts

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