Documentation
¶
Index ¶
- Constants
- Variables
- func CollectActionsAndValueFlow(bubble *Bubble, forAccount *tongo.AccountID) ([]Action, *ValueFlow)
- func FindContractDeploy(bubble *Bubble) bool
- func FindDepositStake(bubble *Bubble) bool
- func FindExtendedSubscription(bubble *Bubble) bool
- func FindInitialSubscription(bubble *Bubble) bool
- func FindJettonTransfer(bubble *Bubble) bool
- func FindNFTTransfer(bubble *Bubble) bool
- func FindNftPurchase(bubble *Bubble) bool
- func FindRecoverStake(bubble *Bubble) bool
- func FindSTONfiSwap(bubble *Bubble) bool
- func FindTFNominatorAction(bubble *Bubble) bool
- func FindUnSubscription(bubble *Bubble) bool
- func MergeAllBubbles(bubble *Bubble, straws []Straw)
- type Account
- type AccountValueFlow
- type Action
- type ActionType
- type ActionsList
- type AuctionBidAction
- type Bubble
- type BubbleContractDeploy
- type BubbleDepositStake
- type BubbleJettonTransfer
- type BubbleNftPurchase
- type BubbleNftTransfer
- type BubbleRecoverStake
- type BubbleSTONfiSwap
- type BubbleSubscription
- type BubbleTFNominator
- type BubbleTx
- type BubbleUnSubscription
- type ContractDeployAction
- type ContractDeployment
- type DepositStakeAction
- type EncryptedComment
- type JettonTransferAction
- type Matcher
- type Merge
- type NftAuctionType
- type NftPurchaseAction
- type NftTransferAction
- type Option
- type Options
- type RecoverStakeAction
- type Refund
- type RefundType
- type STONfiSwapAction
- type SmartContractAction
- type Straw
- type SubscriptionAction
- type TFCommand
- type TonTransferAction
- type UnSubscriptionAction
- type ValueFlow
Constants ¶
const ( Empty ActionType = "Empty" TonTransfer ActionType = "TonTransfer" SmartContractExec ActionType = "SmartContractExec" NftItemTransfer ActionType = "NftItemTransfer" NftPurchase ActionType = "NftPurchase" JettonTransfer ActionType = "JettonTransfer" ContractDeploy ActionType = "ContractDeploy" Subscription ActionType = "Subscribe" UnSubscription ActionType = "UnSubscribe" DepositStake ActionType = "DepositStake" RecoverStake ActionType = "RecoverStake" STONfiSwap ActionType = "STONfiSwap" AuctionBid ActionType = "AuctionBid" AuctionTgInitBid ActionType = "AuctionTgInitBid" RefundDnsTg RefundType = "DNS.tg" RefundDnsTon RefundType = "DNS.ton" RefundGetGems RefundType = "GetGems" RefundUnknown RefundType = "unknown" )
Variables ¶
var DefaultStraws = []Straw{ FindNFTTransfer, FindJettonTransfer, FindInitialSubscription, FindExtendedSubscription, FindUnSubscription, FindNftPurchase, FindDepositStake, FindRecoverStake, FindTFNominatorAction, FindSTONfiSwap, FindContractDeploy, }
var GetGemsSale = Matcher{ CheckFunc: func(bubble Bubble) bool { txBubble, ok := bubble.Info.(BubbleTx) if !ok { return false } if !txBubble.account.Is(abi.NftSaleGetgems) && !txBubble.account.Is(abi.NftSale) { return false } return true }, Children: []Matcher{ { CheckFunc: func(bubble Bubble) bool { _, ok := bubble.Info.(BubbleNftTransfer) return ok }, }, }, }
Functions ¶
func FindContractDeploy ¶ added in v1.0.0
FindContractDeploy looks for contract deployments in the given bubble and creates a new ContractDeploy action for each. So at the end the bubble will look like: bubble -> ContractDeploy -> ContractDeploy -> bubble.children.
func FindDepositStake ¶ added in v0.1.1
func FindInitialSubscription ¶
func FindJettonTransfer ¶
func FindNFTTransfer ¶
func FindNftPurchase ¶ added in v0.1.0
func FindRecoverStake ¶ added in v0.1.1
func FindSTONfiSwap ¶ added in v1.0.0
func FindTFNominatorAction ¶ added in v1.0.0
func FindUnSubscription ¶ added in v1.0.0
func MergeAllBubbles ¶
Types ¶
type AccountValueFlow ¶
AccountValueFlow contains a change of assets for a particular account.
type Action ¶
type Action struct {
TonTransfer *TonTransferAction `json:",omitempty"`
SmartContractExec *SmartContractAction `json:",omitempty"`
NftItemTransfer *NftTransferAction `json:",omitempty"`
NftPurchase *NftPurchaseAction `json:",omitempty"`
JettonTransfer *JettonTransferAction `json:",omitempty"`
ContractDeploy *ContractDeployAction `json:",omitempty"`
Subscription *SubscriptionAction `json:",omitempty"`
UnSubscription *UnSubscriptionAction `json:",omitempty"`
AuctionBid *AuctionBidAction `json:",omitempty"`
DepositStake *DepositStakeAction `json:",omitempty"`
RecoverStake *RecoverStakeAction `json:",omitempty"`
STONfiSwap *STONfiSwapAction `json:",omitempty"`
Success bool
Type ActionType
}
func (Action) ContributeToExtra ¶
type ActionType ¶
type ActionType string
type ActionsList ¶
func FindActions ¶
FindActions finds known action patterns in the given trace and returns a list of actions.
type AuctionBidAction ¶
type AuctionBidAction struct {
Bidder tongo.AccountID
PreviousBidder *tongo.AccountID
Bid int64
Item *core.NftItem
AuctionType string
}
func (*AuctionBidAction) SubjectAccounts ¶ added in v1.0.0
func (a *AuctionBidAction) SubjectAccounts() []tongo.AccountID
type Bubble ¶
type Bubble struct {
Info actioner
Accounts []tongo.AccountID
Children []*Bubble
ValueFlow *ValueFlow
// ContractDeployments specifies a list of contracts initialized by this bubble.
ContractDeployments map[tongo.AccountID]ContractDeployment
}
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 ProcessChildren ¶
func (*Bubble) MergeContractDeployments ¶ added in v1.0.0
MergeContractDeployments copies contract deployments from other bubble.
type BubbleContractDeploy ¶ added in v1.0.0
type BubbleContractDeploy struct {
Contract tongo.AccountID
// AccountInitInterfaces is a list of interfaces implemented by the stateInit.Code.
// This list can differ from the current list of interfaces.
// TODO: AccountInitInterfaces is an empty list in opentonapi, fix.
AccountInitInterfaces []abi.ContractInterface
Success bool
}
func (BubbleContractDeploy) ToAction ¶ added in v1.0.0
func (b BubbleContractDeploy) ToAction() *Action
type BubbleDepositStake ¶ added in v0.1.1
func (BubbleDepositStake) ToAction ¶ added in v0.1.1
func (ds BubbleDepositStake) ToAction() *Action
type BubbleJettonTransfer ¶
type BubbleJettonTransfer struct {
// contains filtered or unexported fields
}
func (BubbleJettonTransfer) ToAction ¶
func (b BubbleJettonTransfer) ToAction() (action *Action)
type BubbleNftPurchase ¶ added in v0.1.0
type BubbleNftPurchase struct {
Success bool
Buyer tongo.AccountID
Seller tongo.AccountID
Nft tongo.AccountID
AuctionType NftAuctionType
Price int64
}
func (BubbleNftPurchase) ToAction ¶ added in v0.1.0
func (b BubbleNftPurchase) ToAction() *Action
type BubbleNftTransfer ¶
type BubbleNftTransfer struct {
// contains filtered or unexported fields
}
func (BubbleNftTransfer) ToAction ¶
func (b BubbleNftTransfer) ToAction() (action *Action)
type BubbleRecoverStake ¶ added in v0.1.1
func (BubbleRecoverStake) ToAction ¶ added in v0.1.1
func (b BubbleRecoverStake) ToAction() *Action
type BubbleSTONfiSwap ¶ added in v1.0.0
type BubbleSTONfiSwap struct {
AmountIn uint64
AmountOut uint64
UserWallet tongo.AccountID
STONfiRouter tongo.AccountID
JettonWalletIn tongo.AccountID
JettonMasterIn tongo.AccountID
JettonWalletOut tongo.AccountID
JettonMasterOut tongo.AccountID
Success bool
}
BubbleSTONfiSwap contains information about a swap operation at the STONfi dex.
func (BubbleSTONfiSwap) ToAction ¶ added in v1.0.0
func (b BubbleSTONfiSwap) ToAction() *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 BubbleTFNominator ¶ added in v1.0.0
type BubbleTFNominator struct {
Command TFCommand
Amount int64
Actor tongo.AccountID
Contract tongo.AccountID
Success bool
}
func (BubbleTFNominator) ToAction ¶ added in v1.0.0
func (b BubbleTFNominator) ToAction() *Action
type BubbleUnSubscription ¶ added in v1.0.0
func (BubbleUnSubscription) ToAction ¶ added in v1.0.0
func (b BubbleUnSubscription) ToAction() (action *Action)
type ContractDeployAction ¶
type ContractDeployAction struct {
Address tongo.AccountID
Interfaces []abi.ContractInterface
}
func (*ContractDeployAction) SubjectAccounts ¶ added in v1.0.0
func (a *ContractDeployAction) SubjectAccounts() []tongo.AccountID
type ContractDeployment ¶ added in v1.0.0
type ContractDeployment struct {
// contains filtered or unexported fields
}
ContractDeployment holds information about initialization of a contract. TODO: should ContractDeployment contains LT/time of a deployment so we can sort several ContractDeploy actions?
type DepositStakeAction ¶ added in v0.1.1
func (*DepositStakeAction) SubjectAccounts ¶ added in v1.0.0
func (a *DepositStakeAction) SubjectAccounts() []tongo.AccountID
type EncryptedComment ¶ added in v1.0.0
type JettonTransferAction ¶
type JettonTransferAction struct {
Comment *string
EncryptedComment *EncryptedComment
Jetton tongo.AccountID
Recipient *tongo.AccountID
Sender *tongo.AccountID
RecipientsWallet tongo.AccountID
SendersWallet tongo.AccountID
Amount tlb.VarUInteger16
Refund *Refund
}
func (*JettonTransferAction) SubjectAccounts ¶ added in v1.0.0
func (a *JettonTransferAction) SubjectAccounts() []tongo.AccountID
type NftAuctionType ¶ added in v0.1.0
type NftAuctionType string
const ( GetGemsAuction NftAuctionType = "getgems" BasicAuction NftAuctionType = "basic" )
type NftPurchaseAction ¶ added in v0.1.0
type NftPurchaseAction struct {
Nft tongo.AccountID
Buyer tongo.AccountID
Seller tongo.AccountID
AuctionType NftAuctionType
Price int64
}
func (*NftPurchaseAction) SubjectAccounts ¶ added in v1.0.0
func (a *NftPurchaseAction) SubjectAccounts() []tongo.AccountID
type NftTransferAction ¶
type NftTransferAction struct {
Comment *string
EncryptedComment *EncryptedComment
Recipient *tongo.AccountID
Sender *tongo.AccountID
Nft tongo.AccountID
Refund *Refund
}
func (*NftTransferAction) SubjectAccounts ¶ added in v1.0.0
func (a *NftTransferAction) SubjectAccounts() []tongo.AccountID
type Option ¶
type Option func(*Options)
func ForAccount ¶
func WithInformationSource ¶ added in v0.1.0
func WithInformationSource(source core.InformationSource) Option
func WithStraws ¶
WithStraws provides functions to find actions in a trace.
type RecoverStakeAction ¶ added in v0.1.1
func (*RecoverStakeAction) SubjectAccounts ¶ added in v1.0.0
func (a *RecoverStakeAction) SubjectAccounts() []tongo.AccountID
type Refund ¶
type Refund struct {
Type RefundType
Origin string
}
type RefundType ¶
type RefundType string
type STONfiSwapAction ¶ added in v1.0.0
type STONfiSwapAction struct {
UserWallet tongo.AccountID
STONfiRouter tongo.AccountID
JettonWalletIn tongo.AccountID
JettonMasterIn tongo.AccountID
JettonWalletOut tongo.AccountID
JettonMasterOut tongo.AccountID
AmountIn uint64
AmountOut uint64
}
func (*STONfiSwapAction) SubjectAccounts ¶ added in v1.0.0
func (a *STONfiSwapAction) SubjectAccounts() []tongo.AccountID
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
func (*SmartContractAction) SubjectAccounts ¶ added in v1.0.0
func (a *SmartContractAction) SubjectAccounts() []tongo.AccountID
type Straw ¶
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
}
func (*SubscriptionAction) SubjectAccounts ¶ added in v1.0.0
func (a *SubscriptionAction) SubjectAccounts() []tongo.AccountID
type TFCommand ¶ added in v1.0.0
type TFCommand string
const ( TfDepositStakeRequest TFCommand = "TfDepositStakeRequest" TfRecoverStakeRequest TFCommand = "TfRecoverStakeRequest" TfRequestWithdraw TFCommand = "TfRequestWithdraw" TfProcessPendingWithdrawRequests TFCommand = "TfProcessPendingWithdrawRequests" TfDeposit TFCommand = "TfDeposit" TfUpdateValidatorSet TFCommand = "TfUpdateValidatorSet" )
type TonTransferAction ¶
type TonTransferAction struct {
Amount int64
Comment *string
EncryptedComment *EncryptedComment
Recipient tongo.AccountID
Sender tongo.AccountID
Refund *Refund
}
func (*TonTransferAction) ContributeToExtra ¶
func (a *TonTransferAction) ContributeToExtra(account tongo.AccountID, extra int64) int64
func (*TonTransferAction) SubjectAccounts ¶ added in v1.0.0
func (a *TonTransferAction) SubjectAccounts() []tongo.AccountID
type UnSubscriptionAction ¶
type UnSubscriptionAction struct {
Subscription tongo.AccountID
Subscriber tongo.AccountID
Beneficiary tongo.AccountID
}
func (*UnSubscriptionAction) SubjectAccounts ¶ added in v1.0.0
func (a *UnSubscriptionAction) SubjectAccounts() []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.