token_lock_box

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: 8 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 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, big.NewInt(in.Amount)); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Deposit calls token lock box `deposit`.

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 Upgrade = cldfops.NewOperation(
	"token-lock-box:upgrade",
	stellarops.ContractDeploymentVersion,
	"Upgrades the Token Lock Box Soroban contract in place to a new WASM hash",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in UpgradeInput) (stellarops.Void, error) {
		c := tlbbindings.NewTokenLockBoxClient(d.Invoker, in.ContractID)
		if err := c.Upgrade(b.GetContext(), in.NewWasmHash); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Upgrade calls `upgrade` on Token Lock Box (owner-gated in-place self-upgrade).

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, big.NewInt(in.Amount), in.Recipient); err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Withdraw calls token lock box `withdraw`.

Functions

func ConstructorArgs

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

ConstructorArgs encodes the token lock box __constructor arguments.

func VerifyConstructed

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

VerifyConstructed reads back every token lock box constructor field of contractID.

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 ConstructorInput

type ConstructorInput struct {
	Owner string `json:"owner"`
	Token string `json:"token"`
}

ConstructorInput holds the token lock box __constructor arguments.

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 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 UpgradeInput

type UpgradeInput struct {
	ContractID  string   `json:"contract_id"`
	NewWasmHash [32]byte `json:"new_wasm_hash"`
}

UpgradeInput upgrades the Token Lock Box contract in place to a new Wasm hash.

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