sac_token

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Approve = cldfops.NewOperation(
	"sac-token:approve",
	stellarops.ContractDeploymentVersion,
	"Approves a SAC token spender up to expiration_ledger",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in ApproveInput) (stellarops.Void, error) {
		args := []xdr.ScVal{
			scval.AddressToScVal(in.From),
			scval.AddressToScVal(in.Spender),
			scval.I128ToScVal(in.Amount),
			scval.Uint32ToScVal(in.ExpirationLedger),
		}
		_, err := d.Invoker.InvokeContract(b.GetContext(), in.ContractID, "approve", args)
		if err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Approve calls `approve` on a SAC token contract.

View Source
var Transfer = cldfops.NewOperation(
	"sac-token:transfer",
	stellarops.ContractDeploymentVersion,
	"Transfers SAC tokens between Stellar accounts/contracts",
	func(b cldfops.Bundle, d stellardeps.StellarDeps, in TransferInput) (stellarops.Void, error) {
		args := []xdr.ScVal{
			scval.AddressToScVal(in.From),
			scval.AddressToScVal(in.To),
			scval.I128ToScVal(in.Amount),
		}
		_, err := d.Invoker.InvokeContract(b.GetContext(), in.ContractID, "transfer", args)
		if err != nil {
			return stellarops.Void{}, err
		}
		return stellarops.Void{}, nil
	},
)

Transfer calls `transfer` on a SAC token contract (e.g. for funding lock-release pools).

Functions

This section is empty.

Types

type ApproveInput

type ApproveInput struct {
	ContractID       string `json:"contract_id"`
	From             string `json:"from"`
	Spender          string `json:"spender"`
	Amount           int64  `json:"amount"`
	ExpirationLedger uint32 `json:"expiration_ledger"`
}

ApproveInput is the input for a Soroban Asset Contract (SAC) `approve` call.

type TransferInput

type TransferInput struct {
	ContractID string `json:"contract_id"`
	From       string `json:"from"`
	To         string `json:"to"`
	Amount     int64  `json:"amount"`
}

TransferInput is the input for a Soroban Asset Contract (SAC) `transfer` call.

Jump to

Keyboard shortcuts

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