bath

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Empty              ActionType = "Empty"
	TonTransfer        ActionType = "TonTransfer"
	SmartContractExec  ActionType = "SmartContractExec"
	NftItemTransfer    ActionType = "NftItemTransfer"
	GetGemsNftPurchase ActionType = "GetGemsNftPurchase"
	JettonTransfer     ActionType = "JettonTransfer"
	ContractDeploy     ActionType = "ContractDeploy"
	Subscription       ActionType = "Subscription"
	UnSubscription     ActionType = "UnSubscribe"
	AuctionBid         ActionType = "AuctionBid"
	AuctionTgInitBid   ActionType = "AuctionTgInitBid"

	RefundDnsTg   RefundType = "DNS.tg"
	RefundDnsTon  RefundType = "DNS.ton"
	RefundGetGems RefundType = "GetGems"
	RefundUnknown RefundType = "unknown"
)

Variables

Functions

func CollectActionsAndValueFlow

func CollectActionsAndValueFlow(bubble *Bubble, forAccount *tongo.AccountID) ([]Action, *ValueFlow)

func FindExtendedSubscription

func FindExtendedSubscription(bubble *Bubble) bool

func FindGetGemsNftPurchase

func FindGetGemsNftPurchase(bubble *Bubble) bool

func FindInitialSubscription

func FindInitialSubscription(bubble *Bubble) bool

func FindJettonTransfer

func FindJettonTransfer(bubble *Bubble) bool

func FindNFTTransfer

func FindNFTTransfer(bubble *Bubble) bool

func MergeAllBubbles

func MergeAllBubbles(bubble *Bubble, straws []Straw)

Types

type Account

type Account struct {
	Address    tongo.AccountID
	Interfaces []abi.ContractInterface
}

func (*Account) Addr

func (a *Account) Addr() *tongo.AccountID

func (Account) Is

type AccountValueFlow

type AccountValueFlow struct {
	Ton     int64
	Fees    int64
	Jettons map[tongo.AccountID]big.Int
}

AccountValueFlow contains a change of assets for a particular account.

type Action

type Action struct {
	TonTransfer        *TonTransferAction
	SmartContractExec  *SmartContractAction
	NftItemTransfer    *NftTransferAction
	GetGemsNftPurchase *GetGemsNftPurchaseAction
	JettonTransfer     *JettonTransferAction
	ContractDeploy     *ContractDeployAction
	Subscription       *SubscriptionAction
	UnSubscription     *UnSubscriptionAction
	AuctionBid         *AuctionBidAction
	Success            bool
	Type               ActionType
}

func (Action) ContributeToExtra

func (a Action) ContributeToExtra(account tongo.AccountID, extra int64) int64

func (Action) String

func (a Action) String() string

type ActionType

type ActionType string

type ActionsList

type ActionsList struct {
	Actions   []Action
	ValueFlow *ValueFlow
}

func FindActions

func FindActions(trace *core.Trace, opts ...Option) (*ActionsList, error)

FindActions finds known action patterns in the given trace and returns a list of actions.

func (*ActionsList) Extra

func (l *ActionsList) Extra(account tongo.AccountID, fullTrace *core.Trace) int64

type AuctionBidAction

type AuctionBidAction struct {
	Bidder         tongo.AccountID
	PreviousBidder *tongo.AccountID
	Bid            int64
	Item           *core.NftItem
	AuctionType    string
}

type Bubble

type Bubble struct {
	Info      actioner
	Accounts  []tongo.AccountID
	Children  []*Bubble
	ValueFlow *ValueFlow
}

Bubble represents a transaction in the beginning. But we can merge neighbour bubbles together if we find a known action pattern like an NFT Transfer or a SmartContractExecution in a trace.

func FromTrace

func FromTrace(trace *core.Trace) *Bubble

func ProcessChildren

func ProcessChildren(children []*Bubble, fns ...func(child *Bubble) *Merge) []*Bubble

func (Bubble) String

func (b Bubble) String() string

type BubbleGetGemsNftPurchase

type BubbleGetGemsNftPurchase struct {
	Success  bool
	NewOwner tongo.AccountID
	Nft      tongo.AccountID
}

func (BubbleGetGemsNftPurchase) ToAction

func (b BubbleGetGemsNftPurchase) ToAction() *Action

type BubbleJettonTransfer

type BubbleJettonTransfer struct {
	// contains filtered or unexported fields
}

func (BubbleJettonTransfer) ToAction

func (b BubbleJettonTransfer) ToAction() (action *Action)

type BubbleNftTransfer

type BubbleNftTransfer struct {
	// contains filtered or unexported fields
}

func (BubbleNftTransfer) ToAction

func (b BubbleNftTransfer) ToAction() (action *Action)

type BubbleSubscription

type BubbleSubscription struct {
	Subscription, Subscriber, Beneficiary Account
	Amount                                int64
	Success                               bool
	First                                 bool
}

func (BubbleSubscription) ToAction

func (b BubbleSubscription) ToAction() (action *Action)

type BubbleTx

type BubbleTx struct {
	// contains filtered or unexported fields
}

func (BubbleTx) String

func (b BubbleTx) String() string

func (BubbleTx) ToAction

func (b BubbleTx) ToAction() *Action

type ContractDeployAction

type ContractDeployAction struct {
	Address    tongo.AccountID
	Interfaces []string
}

type GetGemsNftPurchaseAction

type GetGemsNftPurchaseAction struct {
	Nft      tongo.AccountID
	NewOwner tongo.AccountID
}

type JettonTransferAction

type JettonTransferAction struct {
	Comment          *string
	Jetton           tongo.AccountID
	Recipient        *tongo.AccountID
	Sender           *tongo.AccountID
	RecipientsWallet tongo.AccountID
	SendersWallet    tongo.AccountID
	Amount           tlb.VarUInteger16
	Refund           *Refund
}

type Merge

type Merge struct {
	// contains filtered or unexported fields
}

type NftTransferAction

type NftTransferAction struct {
	Comment   *string
	Recipient *tongo.AccountID
	Sender    *tongo.AccountID
	Nft       tongo.AccountID
	Refund    *Refund
}

type Option

type Option func(*Options)

func ForAccount

func ForAccount(a tongo.AccountID) Option

func WithStraws

func WithStraws(straws []Straw) Option

WithStraws provides functions to find actions in a trace.

type Options

type Options struct {
	// contains filtered or unexported fields
}

type Refund

type Refund struct {
	Type   RefundType
	Origin string
}

type RefundType

type RefundType string

type SmartContractAction

type SmartContractAction struct {
	TonAttached int64
	Executor    tongo.AccountID
	Contract    tongo.AccountID
	Operation   string
	Payload     string
}

func (*SmartContractAction) ContributeToExtra

func (a *SmartContractAction) ContributeToExtra(account tongo.AccountID, extra int64) int64

type Straw

type Straw func(bubble *Bubble) (success bool)

Straw extracts information from the given bubble and its children and modifies the bubble if needed. If the bubble is modified this function return true.

type SubscriptionAction

type SubscriptionAction struct {
	Subscription tongo.AccountID
	Subscriber   tongo.AccountID
	Beneficiary  tongo.AccountID
	Amount       int64
	First        bool
}

type TonTransferAction

type TonTransferAction struct {
	Amount    int64
	Comment   *string
	Recipient tongo.AccountID
	Sender    tongo.AccountID
	Refund    *Refund
}

func (*TonTransferAction) ContributeToExtra

func (a *TonTransferAction) ContributeToExtra(account tongo.AccountID, extra int64) int64

type UnSubscriptionAction

type UnSubscriptionAction struct {
	Subscription tongo.AccountID
	Subscriber   tongo.AccountID
	Beneficiary  tongo.AccountID
}

type ValueFlow

type ValueFlow struct {
	Accounts map[tongo.AccountID]*AccountValueFlow
}

ValueFlow contains a change of assets for each account involved in a trace.

func (*ValueFlow) AddFee

func (flow *ValueFlow) AddFee(accountID tongo.AccountID, amount int64)

func (*ValueFlow) AddJettons

func (flow *ValueFlow) AddJettons(accountID tongo.AccountID, jetton tongo.AccountID, value big.Int)

func (*ValueFlow) AddTons

func (flow *ValueFlow) AddTons(accountID tongo.AccountID, amount int64)

func (*ValueFlow) Merge

func (flow *ValueFlow) Merge(other *ValueFlow)

Jump to

Keyboard shortcuts

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