bath

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TonTransfer           ActionType = "TonTransfer"
	SmartContractExec     ActionType = "SmartContractExec"
	NftItemTransfer       ActionType = "NftItemTransfer"
	NftPurchase           ActionType = "NftPurchase"
	JettonTransfer        ActionType = "JettonTransfer"
	JettonMint            ActionType = "JettonMint"
	JettonBurn            ActionType = "JettonBurn"
	ContractDeploy        ActionType = "ContractDeploy"
	Subscription          ActionType = "Subscribe"
	UnSubscription        ActionType = "UnSubscribe"
	ElectionsDepositStake ActionType = "ElectionsDepositStake"
	ElectionsRecoverStake ActionType = "ElectionsRecoverStake"
	DepositStake          ActionType = "DepositStake"
	WithdrawStake         ActionType = "WithdrawStake"
	WithdrawStakeRequest  ActionType = "WithdrawStakeRequest"
	JettonSwap            ActionType = "JettonSwap"
	AuctionBid            ActionType = "AuctionBid"
	DomainRenew           ActionType = "DomainRenew"
	InscriptionMint       ActionType = "InscriptionMint"
	InscriptionTransfer   ActionType = "InscriptionTransfer"

	RefundDnsTg   RefundType = "DNS.tg"
	RefundDnsTon  RefundType = "DNS.ton"
	RefundGetGems RefundType = "GetGems"
	RefundUnknown RefundType = "unknown"
)
View Source
const (
	GetGemsAuction  NftAuctionType = "getgems"
	DnsTonAuction                  = "DNS.ton"
	DnsTgAuction                   = "DNS.tg"
	NumberTgAuction                = "NUMBER.tg"
)

Variables

View Source
var DNSRenewStraw = Straw[BubbleDnsItemRenew]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.DeleteDnsRecordMsgOp), HasInterface(abi.NftItem), func(bubble *Bubble) bool {
		return bubble.Info.(BubbleTx).decodedBody.Value.(abi.DeleteDnsRecordMsgBody).Key.Equal(tlb.Bits256{})
	}},
	Builder: func(newAction *BubbleDnsItemRenew, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.Renewer = tx.inputFrom.Address
		newAction.Item = tx.account.Address
		newAction.Success = tx.success
		return nil
	},
	SingleChild: &Straw[BubbleDnsItemRenew]{
		Optional:   true,
		CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.BounceMsgOp)},
	},
}
View Source
var DedustLPJettonMintStraw = Straw[BubbleJettonMint]{
	CheckFuncs: []bubbleCheck{IsTx, Or(HasOpcode(0xb56b9598), HasOpcode(0x1674b0a0))},
	Builder: func(newAction *BubbleJettonMint, bubble *Bubble) (err error) {
		tx := bubble.Info.(BubbleTx)
		newAction.master = tx.account.Address
		return nil
	},
	Children: []Straw[BubbleJettonMint]{
		{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonInternalTransferMsgOp)},
			Builder: func(newAction *BubbleJettonMint, bubble *Bubble) error {
				tx := bubble.Info.(BubbleTx)
				msg := tx.decodedBody.Value.(abi.JettonInternalTransferMsgBody)
				newAction.amount = msg.Amount
				newAction.recipientWallet = tx.account.Address
				newAction.success = tx.success
				return nil
			},
			Children: []Straw[BubbleJettonMint]{
				{
					CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp)},
					Builder: func(newAction *BubbleJettonMint, bubble *Bubble) error {
						tx := bubble.Info.(BubbleTx)
						newAction.recipient = tx.account
						return nil
					},
				},
				{CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ExcessMsgOp)}, Optional: true},
			},
		},
	},
}

DedustLPJettonMintStraw example: https://tonviewer.com/transaction/6d33487c44249d7844db8fac38a5cecf1502ec7e0c09d266e98e95a2b1be17b5

View Source
var DedustSwapStraw = Straw[BubbleJettonSwap]{
	CheckFuncs: []bubbleCheck{IsJettonTransfer, JettonTransferOperation(abi.DedustSwapJettonOp)},
	Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
		transfer := bubble.Info.(BubbleJettonTransfer)
		newAction.Dex = Dedust
		newAction.In.JettonMaster = transfer.master
		newAction.In.JettonWallet = transfer.senderWallet
		newAction.In.Amount = big.Int(transfer.amount)
		newAction.In.IsTon = transfer.isWrappedTon
		if transfer.payload.Value.(abi.DedustSwapJettonPayload).Step.Params.KindOut {
			return errors.New("dedust swap: wrong kind of limits")
		}
		newAction.Out.Amount = big.Int(transfer.payload.Value.(abi.DedustSwapJettonPayload).Step.Params.Limit)
		return nil
	},
	SingleChild: &Straw[BubbleJettonSwap]{
		CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.DedustSwapExternalMsgOp)},
		Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
			newAction.Router = bubble.Info.(BubbleTx).account.Address
			return nil
		},
		SingleChild: &Straw[BubbleJettonSwap]{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.DedustPayoutFromPoolMsgOp)},
			SingleChild: &Straw[BubbleJettonSwap]{
				CheckFuncs: []bubbleCheck{IsJettonTransfer},
				Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
					newAction.Success = true
					transfer := bubble.Info.(BubbleJettonTransfer)
					newAction.Out.JettonMaster = transfer.master
					newAction.Out.IsTon = transfer.isWrappedTon
					newAction.Out.Amount = big.Int(transfer.amount)
					newAction.Out.JettonWallet = transfer.recipientWallet
					return nil
				},
			},
		},
	},
}
View Source
var DepositLiquidStakeStraw = Straw[BubbleDepositStake]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.TonstakePoolDepositMsgOp)},
	Builder: func(newAction *BubbleDepositStake, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.Pool = tx.account.Address
		newAction.Staker = tx.inputFrom.Address
		newAction.Amount = tx.inputAmount - int64(ton.OneTON)
		if newAction.Amount < 0 {
			newAction.Amount = 0
		}
		newAction.Success = tx.success
		newAction.Implementation = core.StakingImplementationLiquidTF
		return nil
	},
	SingleChild: &Straw[BubbleDepositStake]{
		CheckFuncs: []bubbleCheck{IsBounced},
		Optional:   true,
	},
}
View Source
var DepositTFStakeStraw = Straw[BubbleDepositStake]{
	CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.TvPool), HasTextComment("d")},
	Builder: func(newAction *BubbleDepositStake, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.Pool = tx.account.Address
		newAction.Staker = tx.inputFrom.Address
		newAction.Amount = tx.inputAmount
		newAction.Success = tx.success
		newAction.Implementation = core.StakingImplementationTF
		return nil
	},
	SingleChild: &Straw[BubbleDepositStake]{
		CheckFuncs: []bubbleCheck{IsBounced},
		Optional:   true,
	},
}
View Source
var ElectionsDepositStakeStraw = Straw[BubbleElectionsDepositStake]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ElectorNewStakeMsgOp), IsAccount(config.ElectorAddress())},
	Builder: func(newAction *BubbleElectionsDepositStake, bubble *Bubble) error {
		bubbleTx := bubble.Info.(BubbleTx)
		newAction.Amount = bubbleTx.inputAmount
		newAction.Staker = bubbleTx.inputFrom.Address
		return nil
	},
	Children: []Straw[BubbleElectionsDepositStake]{
		{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ElectorNewStakeConfirmationMsgOp)},
			Builder: func(newAction *BubbleElectionsDepositStake, bubble *Bubble) error {
				newAction.Success = true
				return nil
			},
		},
	},
}
View Source
var ElectionsRecoverStakeStraw = Straw[BubbleElectionsRecoverStake]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ElectorRecoverStakeRequestMsgOp), IsAccount(config.ElectorAddress())},
	Builder: func(newAction *BubbleElectionsRecoverStake, bubble *Bubble) error {
		bubbleTx := bubble.Info.(BubbleTx)
		newAction.Staker = bubbleTx.inputFrom.Address
		return nil
	},
	Children: []Straw[BubbleElectionsRecoverStake]{
		{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ElectorRecoverStakeResponseMsgOp)},
			Builder: func(newAction *BubbleElectionsRecoverStake, bubble *Bubble) error {
				newAction.Amount = bubble.Info.(BubbleTx).inputAmount
				newAction.Success = true
				return nil
			},
		},
	},
}
View Source
var JettonBurnStraw = Straw[BubbleJettonBurn]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonBurnMsgOp)},
	Builder: func(newAction *BubbleJettonBurn, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		msg := tx.decodedBody.Value.(abi.JettonBurnMsgBody)
		newAction.amount = msg.Amount
		if tx.inputFrom != nil {
			newAction.sender = *tx.inputFrom
		}
		if tx.additionalInfo != nil {
			if master, ok := tx.additionalInfo.JettonMaster(tx.account.Address); ok {

				newAction.master = master
			}
		}
		newAction.senderWallet = tx.account.Address
		newAction.success = tx.success
		return nil
	},
	SingleChild: &Straw[BubbleJettonBurn]{
		CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonBurnNotificationMsgOp)},
		Builder: func(newAction *BubbleJettonBurn, bubble *Bubble) error {
			newAction.master = bubble.Info.(BubbleTx).account.Address
			return nil
		},
		Optional: true,
	},
}
View Source
var JettonTransferClassicStraw = Straw[BubbleJettonTransfer]{
	CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp)},
	Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.master, _ = tx.additionalInfo.JettonMaster(tx.account.Address)
		newAction.senderWallet = tx.account.Address
		newAction.sender = tx.inputFrom
		body := tx.decodedBody.Value.(abi.JettonTransferMsgBody)
		newAction.amount = body.Amount
		newAction.payload = body.ForwardPayload.Value
		recipient, err := ton.AccountIDFromTlb(body.Destination)
		if err == nil && recipient != nil {
			newAction.recipient = &Account{Address: *recipient}
		}
		return nil
	},
	SingleChild: &Straw[BubbleJettonTransfer]{
		CheckFuncs: []bubbleCheck{IsTx, Or(HasInterface(abi.JettonWallet), HasOperation(abi.JettonInternalTransferMsgOp))},
		Optional:   true,
		Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
			tx := bubble.Info.(BubbleTx)
			newAction.recipientWallet = tx.account.Address
			if newAction.master.IsZero() {
				newAction.master, _ = tx.additionalInfo.JettonMaster(tx.account.Address)
			}
			newAction.success = tx.success
			return nil
		},
		ValueFlowUpdater: func(newAction *BubbleJettonTransfer, flow *ValueFlow) {
			if newAction.success {
				if newAction.recipient != nil {
					flow.AddJettons(newAction.recipient.Address, newAction.master, big.Int(newAction.amount))
				}
				if newAction.sender != nil {
					flow.SubJettons(newAction.sender.Address, newAction.master, big.Int(newAction.amount))
				}
			}
		},
		Children: []Straw[BubbleJettonTransfer]{
			{
				CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp)},
				Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
					tx := bubble.Info.(BubbleTx)
					newAction.success = true
					body := tx.decodedBody.Value.(abi.JettonNotifyMsgBody)
					newAction.amount = body.Amount
					newAction.payload = body.ForwardPayload.Value
					newAction.recipient = &tx.account
					if newAction.sender == nil {
						sender, err := ton.AccountIDFromTlb(body.Sender)
						if err == nil {
							newAction.sender = &Account{Address: *sender}
						}
					}
					return nil
				},
				ValueFlowUpdater: func(newAction *BubbleJettonTransfer, flow *ValueFlow) {
					if newAction.recipient != nil {
						flow.AddJettons(newAction.recipient.Address, newAction.master, big.Int(newAction.amount))
					}
					if newAction.sender != nil {
						flow.SubJettons(newAction.sender.Address, newAction.master, big.Int(newAction.amount))
					}
				},
				Optional: true,
			},
			{
				CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ExcessMsgOp)},
				Optional:   true,
			},
		},
	},
}
View Source
var JettonTransferPTONStraw = Straw[BubbleJettonTransfer]{
	CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp)},
	Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.master, _ = tx.additionalInfo.JettonMaster(tx.account.Address)
		newAction.senderWallet = tx.account.Address
		newAction.sender = tx.inputFrom
		body := tx.decodedBody.Value.(abi.JettonTransferMsgBody)
		newAction.amount = body.Amount
		newAction.isWrappedTon = true
		recipient, err := ton.AccountIDFromTlb(body.Destination)
		if err == nil {
			newAction.recipient = &Account{Address: *recipient}
		}
		return nil
	},
	SingleChild: &Straw[BubbleJettonTransfer]{
		CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp)},
		Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
			tx := bubble.Info.(BubbleTx)
			newAction.success = true
			body := tx.decodedBody.Value.(abi.JettonNotifyMsgBody)
			newAction.amount = body.Amount
			newAction.payload = body.ForwardPayload.Value
			newAction.recipient = &tx.account
			return nil
		},
	},
}
View Source
var JettonTransfersBurnsMints = []StrawFunc{
	JettonTransferPTONStraw.Merge,
	JettonTransferClassicStraw.Merge,
	JettonBurnStraw.Merge,
	DedustLPJettonMintStraw.Merge,
	WtonMintStraw.Merge,
}
View Source
var MegatonFiJettonSwap = Straw[BubbleJettonSwap]{
	CheckFuncs: []bubbleCheck{IsJettonTransfer, IsJettonReceiver(abi.MegatonfiRouter)},
	Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
		tx := bubble.Info.(BubbleJettonTransfer)
		newAction.UserWallet = tx.sender.Address
		newAction.In.Amount = big.Int(tx.amount)
		newAction.In.IsTon = tx.isWrappedTon
		newAction.Router = tx.recipient.Address
		newAction.In.JettonWallet = tx.senderWallet
		newAction.In.JettonMaster = tx.master
		newAction.Dex = Megatonfi
		return nil
	},
	Children: []Straw[BubbleJettonSwap]{
		{
			CheckFuncs: []bubbleCheck{IsJettonTransfer, IsJettonReceiver(abi.MegatonfiExchange)},
			Children: []Straw[BubbleJettonSwap]{
				{
					CheckFuncs: []bubbleCheck{IsJettonTransfer, IsJettonReceiver(abi.MegatonfiRouter)},
					Children: []Straw[BubbleJettonSwap]{
						{
							CheckFuncs: []bubbleCheck{IsJettonTransfer},
							Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
								tx := bubble.Info.(BubbleJettonTransfer)
								newAction.Success = tx.success
								newAction.Out.Amount = big.Int(tx.amount)
								newAction.Out.IsTon = tx.isWrappedTon
								newAction.Out.JettonWallet = tx.recipientWallet
								newAction.Out.JettonMaster = tx.master
								return nil
							},
						},
					},
				},
			},
		},
	},
}

MegatonFiJettonSwap creates a BubbleJettonSwap if there is a jetton swap in a trace.

View Source
var NFTStraws = []StrawFunc{
	NftTransferStraw.Merge,
	NftTransferNotifyStraw.Merge,
}
View Source
var NftPurchaseStraw = Straw[BubbleNftPurchase]{
	CheckFuncs: []bubbleCheck{
		IsTx,
		Or(HasInterface(abi.NftSaleV2), HasInterface(abi.NftSaleV1)),
		HasEmptyBody,
		AmountInterval(1, 1<<62),
		func(bubble *Bubble) bool {
			tx := bubble.Info.(BubbleTx)
			return tx.additionalInfo != nil && tx.additionalInfo.NftSaleContract != nil && tx.additionalInfo.NftSaleContract.Owner != nil
		}},
	Builder: func(newAction *BubbleNftPurchase, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		sale := tx.additionalInfo.NftSaleContract
		newAction.Seller = *sale.Owner
		newAction.AuctionType = GetGemsAuction
		newAction.Buyer = tx.inputFrom.Address
		newAction.Price = sale.NftPrice
		return nil
	},
	SingleChild: &Straw[BubbleNftPurchase]{
		CheckFuncs: []bubbleCheck{IsNftTransfer},
		Builder: func(newAction *BubbleNftPurchase, bubble *Bubble) error {
			newAction.Success = bubble.Info.(BubbleNftTransfer).success
			newAction.Nft = bubble.Info.(BubbleNftTransfer).account.Address
			return nil
		},
		Optional: true,
	},
}
View Source
var NftTransferNotifyStraw = Straw[BubbleNftTransfer]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.NftOwnershipAssignedMsgOp)},
	Builder: func(newAction *BubbleNftTransfer, bubble *Bubble) error {
		receiverTx := bubble.Info.(BubbleTx)
		transfer := receiverTx.decodedBody.Value.(abi.NftOwnershipAssignedMsgBody)
		newAction.success = true
		if receiverTx.inputFrom == nil {
			return fmt.Errorf("nft transfer notify without sender")
		}
		newAction.account = *receiverTx.inputFrom
		if newAction.sender == nil {
			newAction.sender = parseAccount(transfer.PrevOwner)
		}
		newAction.recipient = &receiverTx.account
		newAction.payload = transfer.ForwardPayload.Value
		return nil
	},
}
View Source
var NftTransferStraw = Straw[BubbleNftTransfer]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.NftTransferMsgOp), HasInterface(abi.NftItem)},
	Builder: func(newAction *BubbleNftTransfer, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		transfer := tx.decodedBody.Value.(abi.NftTransferMsgBody)
		newAction.account = tx.account
		newAction.success = tx.success
		newAction.sender = tx.inputFrom
		newAction.payload = transfer.ForwardPayload.Value
		if newAction.recipient == nil {
			newAction.recipient = parseAccount(transfer.NewOwner)
		}
		return nil
	},
	Children: []Straw[BubbleNftTransfer]{
		Optional(NftTransferNotifyStraw),
		{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ExcessMsgOp)},
			Optional:   true,
		},
	},
}
View Source
var PendingWithdrawRequestLiquidStraw = Straw[BubbleWithdrawStakeRequest]{
	CheckFuncs: []bubbleCheck{Is(BubbleJettonBurn{})},
	Builder: func(newAction *BubbleWithdrawStakeRequest, bubble *Bubble) error {
		newAction.Staker = bubble.Info.(BubbleJettonBurn).sender.Address
		newAction.Implementation = core.StakingImplementationLiquidTF
		amount := big.Int(bubble.Info.(BubbleJettonBurn).amount)
		i := amount.Int64()
		newAction.Amount = &i
		return nil
	},
	SingleChild: &Straw[BubbleWithdrawStakeRequest]{
		CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.TonstakePoolWithdrawMsgOp)},
		Builder: func(newAction *BubbleWithdrawStakeRequest, bubble *Bubble) error {
			newAction.Pool = bubble.Info.(BubbleTx).account.Address
			return nil
		},
		SingleChild: &Straw[BubbleWithdrawStakeRequest]{
			CheckFuncs: []bubbleCheck{IsTx, HasOpcode(0x1674b0a0)},
			SingleChild: &Straw[BubbleWithdrawStakeRequest]{
				CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.TonstakeNftInitMsgOp)},
				SingleChild: &Straw[BubbleWithdrawStakeRequest]{
					CheckFuncs: []bubbleCheck{Is(BubbleNftTransfer{})},
					Builder: func(newAction *BubbleWithdrawStakeRequest, bubble *Bubble) error {
						newAction.Success = true
						return nil
					},
				},
			},
		},
	},
}
View Source
var StonfiMintStraw = Straw[BubbleJettonMint]{}

https://dev.tonviewer.com/transaction/e19381edd8f05922eeba3c31f4b8b4b737478b4ca7b37130bdbbfd7bfa773227 todo: add liquidity (mint lp tokens)

View Source
var StonfiSwapStraw = Straw[BubbleJettonSwap]{
	CheckFuncs: []bubbleCheck{Is(BubbleJettonTransfer{})},
	Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
		newAction.Dex = Stonfi
		jettonTx := bubble.Info.(BubbleJettonTransfer)
		newAction.UserWallet = jettonTx.sender.Address
		newAction.In.Amount = big.Int(jettonTx.amount)
		newAction.In.IsTon = jettonTx.isWrappedTon
		newAction.In.JettonMaster = jettonTx.master
		return nil
	},
	SingleChild: &Straw[BubbleJettonSwap]{
		CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.StonfiSwapMsgOp), HasInterface(abi.StonfiPool)},
		Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
			tx := bubble.Info.(BubbleTx)
			a, b := tx.additionalInfo.STONfiPool.Token0, tx.additionalInfo.STONfiPool.Token1
			body := tx.decodedBody.Value.(abi.StonfiSwapMsgBody)
			newAction.Out.Amount = big.Int(body.MinOut)
			s, err := tongo.AccountIDFromTlb(body.SenderAddress)
			if err != nil {
				return err
			}
			if s != nil && *s == b {
				a, b = b, a
			}
			newAction.In.JettonWallet = a
			newAction.Out.JettonWallet = b
			if tx.additionalInfo != nil {
				newAction.In.JettonMaster, _ = tx.additionalInfo.JettonMaster(a)
				newAction.Out.JettonMaster, _ = tx.additionalInfo.JettonMaster(b)
			}
			return nil
		},
		SingleChild: &Straw[BubbleJettonSwap]{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.StonfiPaymentRequestMsgOp)},
			Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
				tx := bubble.Info.(BubbleTx)
				newAction.Router = tx.account.Address
				return nil
			},
			SingleChild: &Straw[BubbleJettonSwap]{
				CheckFuncs: []bubbleCheck{Is(BubbleJettonTransfer{}), Or(JettonTransferOpCode(0xc64370e5), JettonTransferOpCode(0x5ffe1295))},
				Builder: func(newAction *BubbleJettonSwap, bubble *Bubble) error {
					jettonTx := bubble.Info.(BubbleJettonTransfer)
					if jettonTx.senderWallet != newAction.Out.JettonWallet {

						return nil
					}
					newAction.Out.Amount = big.Int(jettonTx.amount)
					newAction.Out.IsTon = jettonTx.isWrappedTon
					newAction.Success = true
					return nil
				},
			},
		},
	},
}
View Source
var StrawAuctionBigGetgems = Straw[AuctionBidBubble]{
	CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.NftAuctionV1), HasEmptyBody, AmountInterval(1, 1<<62)},
	Builder: func(newAction *AuctionBidBubble, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.Auction = tx.account.Address
		newAction.Bidder = tx.inputFrom.Address
		newAction.Amount = tx.inputAmount
		newAction.Success = tx.success
		newAction.Type = GetGemsAuction
		if tx.additionalInfo != nil && tx.additionalInfo.NftSaleContract != nil {
			newAction.NftAddress = &tx.additionalInfo.NftSaleContract.Item
		}
		return nil
	},
}
View Source
var StrawAuctionBuyGetgems = Straw[BubbleNftPurchase]{
	CheckFuncs: []bubbleCheck{Is(AuctionBidBubble{})},
	Builder: func(newAction *BubbleNftPurchase, bubble *Bubble) error {
		bid := bubble.Info.(AuctionBidBubble)
		newAction.Buyer = bid.Bidder
		newAction.Nft = *bid.NftAddress
		newAction.Price = bid.Amount
		newAction.AuctionType = bid.Type
		newAction.Success = bid.Success
		return nil
	},
	SingleChild: &Straw[BubbleNftPurchase]{
		CheckFuncs: []bubbleCheck{IsNftTransfer},
	},
}
View Source
var StrawFindAuctionBidFragmentSimple = Straw[AuctionBidBubble]{
	CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.Teleitem), HasEmptyBody, AmountInterval(1, 1<<62)},
	Builder: func(newAction *AuctionBidBubble, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.Type = DnsTgAuction
		newAction.Amount = tx.inputAmount
		newAction.Bidder = tx.inputFrom.Address
		newAction.Success = tx.success
		newAction.Auction = tx.account.Address
		newAction.NftAddress = &tx.account.Address
		return nil
	},
}
View Source
var TgAuctionV1InitialBidStraw = Straw[AuctionBidBubble]{
	CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.TelemintDeployMsgOp)},
	Builder: func(newAction *AuctionBidBubble, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		body := tx.decodedBody.Value.(abi.TelemintDeployMsgBody)
		newAction.Type = DnsTgAuction
		newAction.Amount = tx.inputAmount
		newAction.Bidder = tx.inputFrom.Address
		newAction.Username = string(body.Msg.Username)
		return nil
	},
	SingleChild: &Straw[AuctionBidBubble]{
		CheckFuncs: []bubbleCheck{IsTx, HasOpcode(0x299a3e15)},
		Builder: func(newAction *AuctionBidBubble, bubble *Bubble) error {
			tx := bubble.Info.(BubbleTx)
			newAction.Success = tx.success

			newAction.Auction = tx.account.Address
			newAction.NftAddress = &tx.account.Address
			if tx.additionalInfo.EmulatedTeleitemNFT != nil {
				newAction.Nft = &core.NftItem{
					Address:           tx.account.Address,
					Index:             tx.additionalInfo.EmulatedTeleitemNFT.Index,
					CollectionAddress: tx.additionalInfo.EmulatedTeleitemNFT.CollectionAddress,
					Verified:          tx.additionalInfo.EmulatedTeleitemNFT.Verified,
					Transferable:      false,
					Metadata: map[string]interface{}{
						"name":  newAction.Username,
						"image": fmt.Sprintf("https://nft.fragment.com/username/%v.webp", newAction.Username),
					},
				}
			}
			return nil
		},
	},
}
View Source
var WithdrawLiquidStake = Straw[BubbleWithdrawStake]{
	CheckFuncs: []bubbleCheck{Is(BubbleJettonBurn{})},
	Builder: func(newAction *BubbleWithdrawStake, bubble *Bubble) error {
		newAction.Staker = bubble.Info.(BubbleJettonBurn).sender.Address
		newAction.Implementation = core.StakingImplementationLiquidTF
		amount := big.Int(bubble.Info.(BubbleJettonBurn).amount)
		newAction.Amount = amount.Int64()
		return nil
	},
	SingleChild: &Straw[BubbleWithdrawStake]{
		CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.TonstakePoolWithdrawMsgOp)},
		Builder: func(newAction *BubbleWithdrawStake, bubble *Bubble) error {
			newAction.Pool = bubble.Info.(BubbleTx).account.Address
			return nil
		},
		SingleChild: &Straw[BubbleWithdrawStake]{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.TonstakePoolWithdrawalMsgOp)},
		},
	},
}
View Source
var WithdrawStakeImmediatelyStraw = Straw[BubbleWithdrawStake]{
	CheckFuncs: []bubbleCheck{Is(BubbleWithdrawStakeRequest{})},
	Builder: func(newAction *BubbleWithdrawStake, bubble *Bubble) error {
		req := bubble.Info.(BubbleWithdrawStakeRequest)
		newAction.Pool = req.Pool
		newAction.Staker = req.Staker
		newAction.Amount = -req.attachedAmount
		newAction.Implementation = req.Implementation
		return nil
	},
	SingleChild: &Straw[BubbleWithdrawStake]{
		CheckFuncs: []bubbleCheck{IsTx, AmountInterval(int64(ton.OneTON), 1<<63-1)},
		Builder: func(newAction *BubbleWithdrawStake, bubble *Bubble) error {
			newAction.Amount += bubble.Info.(BubbleTx).inputAmount
			return nil
		},
	},
}
View Source
var WithdrawTFStakeRequestStraw = Straw[BubbleWithdrawStakeRequest]{
	CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.TvPool), HasTextComment("w")},
	Builder: func(newAction *BubbleWithdrawStakeRequest, bubble *Bubble) error {
		tx := bubble.Info.(BubbleTx)
		newAction.Pool = tx.account.Address
		newAction.Staker = tx.inputFrom.Address
		newAction.Success = tx.success
		newAction.attachedAmount = tx.inputAmount
		newAction.Implementation = core.StakingImplementationTF
		return nil
	},
	Children: []Straw[BubbleWithdrawStakeRequest]{
		{
			Optional:   true,
			CheckFuncs: []bubbleCheck{IsTx, AmountInterval(0, int64(ton.OneTON))},
		},
	},
}
View Source
var WtonMintStraw = Straw[BubbleJettonMint]{
	CheckFuncs: []bubbleCheck{IsTx, HasOpcode(0x77a33521)},
	Builder: func(newAction *BubbleJettonMint, bubble *Bubble) error {
		newAction.recipient = bubble.Info.(BubbleTx).account
		return nil
	},
	Children: []Straw[BubbleJettonMint]{
		{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonInternalTransferMsgOp)},
			Builder: func(newAction *BubbleJettonMint, bubble *Bubble) error {
				tx := bubble.Info.(BubbleTx)
				body := tx.decodedBody.Value.(abi.JettonInternalTransferMsgBody)
				newAction.amount = body.Amount
				if tx.additionalInfo != nil {
					if master, ok := tx.additionalInfo.JettonMaster(tx.account.Address); ok {
						newAction.master = master
					}
				}
				newAction.recipientWallet = tx.account.Address
				newAction.success = tx.success
				return nil
			},
			Children: []Straw[BubbleJettonMint]{
				{
					CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp)},
					Optional:   true,
				},
				{
					CheckFuncs: []bubbleCheck{Is(BubbleContractDeploy{})},
					Optional:   true,
				},
			},
		},
		{
			CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.ExcessMsgOp)},
			Optional:   true,
		},
	},
}

Functions

func AmountInterval added in v1.1.0

func AmountInterval(min, max int64) bubbleCheck

func CollectActionsAndValueFlow

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

func ConvertToInscriptionActions added in v1.2.0

func ConvertToInscriptionActions(msgs []core.InscriptionMessage) map[ton.Bits256][]Action

func FindExtendedSubscription

func FindExtendedSubscription(bubble *Bubble) bool

func FindInitialSubscription

func FindInitialSubscription(bubble *Bubble) bool

func FindTFNominatorAction added in v1.0.0

func FindTFNominatorAction(bubble *Bubble) bool

func FindUnSubscription added in v1.0.0

func FindUnSubscription(bubble *Bubble) bool

func HasEmptyBody added in v1.2.0

func HasEmptyBody(b *Bubble) bool

func HasInterface added in v1.1.0

func HasInterface(iface abi.ContractInterface) bubbleCheck

func HasOpcode added in v1.1.0

func HasOpcode(op uint32) bubbleCheck

func HasOperation added in v1.1.0

func HasOperation(name abi.MsgOpName) bubbleCheck

func HasTextComment added in v1.1.0

func HasTextComment(comment string) bubbleCheck

func Is added in v1.1.0

func Is(t actioner) bubbleCheck

func IsAccount added in v1.1.0

func IsAccount(id tongo.AccountID) bubbleCheck

func IsBounced added in v1.1.0

func IsBounced(bubble *Bubble) bool

func IsJettonReceiver added in v1.1.0

func IsJettonReceiver(iface abi.ContractInterface) bubbleCheck

func IsJettonTransfer added in v1.1.0

func IsJettonTransfer(b *Bubble) bool

func IsNftTransfer added in v1.2.0

func IsNftTransfer(b *Bubble) bool

func IsTx added in v1.1.0

func IsTx(b *Bubble) bool

func JettonTransferOpCode added in v1.1.0

func JettonTransferOpCode(opCode uint32) bubbleCheck

func JettonTransferOperation added in v1.1.0

func JettonTransferOperation(op abi.JettonOpName) bubbleCheck

func MergeAllBubbles

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

func Or added in v1.1.0

func Or(check1, check2 bubbleCheck) bubbleCheck

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
	NFTs    [2]int // 0 - added, 1 - removed
}

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"`
	JettonMint            *JettonMintAction            `json:",omitempty"`
	JettonBurn            *JettonBurnAction            `json:",omitempty"`
	ContractDeploy        *ContractDeployAction        `json:",omitempty"`
	Subscription          *SubscriptionAction          `json:",omitempty"`
	UnSubscription        *UnSubscriptionAction        `json:",omitempty"`
	AuctionBid            *AuctionBidAction            `json:",omitempty"`
	ElectionsDepositStake *ElectionsDepositStakeAction `json:",omitempty"`
	ElectionsRecoverStake *ElectionsRecoverStakeAction `json:",omitempty"`
	DepositStake          *DepositStakeAction          `json:",omitempty"`
	WithdrawStake         *WithdrawStakeAction         `json:",omitempty"`
	WithdrawStakeRequest  *WithdrawStakeRequestAction  `json:",omitempty"`
	JettonSwap            *JettonSwapAction            `json:",omitempty"`
	DnsRenew              *DnsRenewAction              `json:",omitempty"`
	InscriptionMint       *InscriptionMintAction       `json:",omitempty"`
	InscriptionTransfer   *InscriptionTransferAction   `json:",omitempty"`
	Success               bool
	Type                  ActionType
}

func (Action) ContributeToExtra

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

func (Action) IsSubject added in v1.0.0

func (a Action) IsSubject(account tongo.AccountID) bool

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(ctx context.Context, 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) int64

type AuctionBidAction

type AuctionBidAction struct {
	Type       NftAuctionType
	Amount     int64
	Nft        *core.NftItem
	NftAddress *tongo.AccountID
	Bidder     tongo.AccountID
	Auction    tongo.AccountID
}

func (*AuctionBidAction) SubjectAccounts added in v1.0.0

func (a *AuctionBidAction) SubjectAccounts() []tongo.AccountID

type AuctionBidBubble added in v1.1.0

type AuctionBidBubble struct {
	Type           NftAuctionType
	Amount         int64
	Nft            *core.NftItem
	NftAddress     *tongo.AccountID
	Bidder         tongo.AccountID
	Auction        tongo.AccountID
	PreviousBidder *tongo.AccountID //maybe don't requered
	Username       string
	Success        bool
}

func (AuctionBidBubble) ToAction added in v1.1.0

func (a AuctionBidBubble) ToAction() *Action

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

type BubbleDepositStake struct {
	Staker         tongo.AccountID
	Amount         int64
	Success        bool
	Pool           tongo.AccountID
	Implementation core.StakingImplementation
}

func (BubbleDepositStake) ToAction added in v0.1.1

func (ds BubbleDepositStake) ToAction() *Action

type BubbleDnsItemRenew added in v1.2.0

type BubbleDnsItemRenew struct {
	DnsRenewAction
	Success bool
}

func (BubbleDnsItemRenew) ToAction added in v1.2.0

func (b BubbleDnsItemRenew) ToAction() *Action

type BubbleElectionsDepositStake added in v1.1.0

type BubbleElectionsDepositStake struct {
	Staker  tongo.AccountID
	Amount  int64
	Success bool
}

func (BubbleElectionsDepositStake) ToAction added in v1.1.0

func (ds BubbleElectionsDepositStake) ToAction() *Action

type BubbleElectionsRecoverStake added in v1.1.0

type BubbleElectionsRecoverStake struct {
	Staker  tongo.AccountID
	Amount  int64
	Success bool
}

func (BubbleElectionsRecoverStake) ToAction added in v1.1.0

func (b BubbleElectionsRecoverStake) ToAction() *Action

type BubbleJettonBurn added in v1.1.0

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

func (BubbleJettonBurn) ToAction added in v1.1.0

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

type BubbleJettonMint added in v1.1.0

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

func (BubbleJettonMint) ToAction added in v1.1.0

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

type BubbleJettonSwap added in v1.1.0

type BubbleJettonSwap struct {
	Dex        Dex
	UserWallet tongo.AccountID
	Router     tongo.AccountID
	Out        assetTransfer
	In         assetTransfer
	Success    bool
}

BubbleJettonSwap contains information about a jetton swap operation at a dex.

func (BubbleJettonSwap) ToAction added in v1.1.0

func (b BubbleJettonSwap) 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 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 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 BubbleUnSubscription added in v1.0.0

type BubbleUnSubscription struct {
	Subscription, Subscriber, Beneficiary Account
	Success                               bool
}

func (BubbleUnSubscription) ToAction added in v1.0.0

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

type BubbleWithdrawStake added in v1.1.0

type BubbleWithdrawStake struct {
	Staker         tongo.AccountID
	Amount         int64
	Pool           tongo.AccountID
	Implementation core.StakingImplementation
}

func (BubbleWithdrawStake) ToAction added in v1.1.0

func (ds BubbleWithdrawStake) ToAction() *Action

type BubbleWithdrawStakeRequest added in v1.1.0

type BubbleWithdrawStakeRequest struct {
	Staker         tongo.AccountID
	Amount         *int64
	Success        bool
	Pool           tongo.AccountID
	Implementation core.StakingImplementation
	// contains filtered or unexported fields
}

func (BubbleWithdrawStakeRequest) ToAction added in v1.1.0

func (ds BubbleWithdrawStakeRequest) ToAction() *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.

type DepositStakeAction added in v0.1.1

type DepositStakeAction struct {
	Staker         tongo.AccountID
	Amount         int64
	Pool           tongo.AccountID
	Implementation core.StakingImplementation
}

func (*DepositStakeAction) SubjectAccounts added in v1.0.0

func (a *DepositStakeAction) SubjectAccounts() []tongo.AccountID

type Dex added in v1.1.0

type Dex string
const (
	Stonfi    Dex = "stonfi"
	Megatonfi Dex = "megatonfi"
	Dedust    Dex = "dedust"
)

type DnsRenewAction added in v1.2.0

type DnsRenewAction struct {
	Item    ton.AccountID
	Renewer ton.AccountID
}

func (DnsRenewAction) SubjectAccounts added in v1.2.0

func (a DnsRenewAction) SubjectAccounts() []ton.AccountID

type ElectionsDepositStakeAction added in v1.1.0

type ElectionsDepositStakeAction struct {
	Amount  int64
	Elector tongo.AccountID
	Staker  tongo.AccountID
}

func (*ElectionsDepositStakeAction) SubjectAccounts added in v1.1.0

func (a *ElectionsDepositStakeAction) SubjectAccounts() []tongo.AccountID

type ElectionsRecoverStakeAction added in v1.1.0

type ElectionsRecoverStakeAction struct {
	Amount  int64
	Elector tongo.AccountID
	Staker  tongo.AccountID
}

func (*ElectionsRecoverStakeAction) SubjectAccounts added in v1.1.0

func (a *ElectionsRecoverStakeAction) SubjectAccounts() []tongo.AccountID

type EncryptedComment added in v1.0.0

type EncryptedComment struct {
	EncryptionType string
	CipherText     []byte
}

type InscriptionMintAction added in v1.2.0

type InscriptionMintAction struct {
	Minter ton.AccountID
	Amount uint64
	Ticker string
	Type   string
}

type InscriptionTransferAction added in v1.2.0

type InscriptionTransferAction struct {
	Src, Dst ton.AccountID
	Amount   uint64
	Ticker   string
	Type     string
}

type JettonBurnAction added in v1.1.0

type JettonBurnAction struct {
	Jetton        tongo.AccountID
	Sender        tongo.AccountID
	SendersWallet tongo.AccountID
	Amount        tlb.VarUInteger16
}

func (*JettonBurnAction) SubjectAccounts added in v1.1.0

func (a *JettonBurnAction) SubjectAccounts() []tongo.AccountID

type JettonMintAction added in v1.1.0

type JettonMintAction struct {
	Jetton           tongo.AccountID
	Recipient        tongo.AccountID
	RecipientsWallet tongo.AccountID
	Amount           tlb.VarUInteger16
}

func (*JettonMintAction) SubjectAccounts added in v1.1.0

func (a *JettonMintAction) SubjectAccounts() []tongo.AccountID

type JettonSwapAction added in v1.1.0

type JettonSwapAction struct {
	Dex        Dex
	UserWallet tongo.AccountID
	Router     tongo.AccountID
	In         assetTransfer
	Out        assetTransfer
}

func (*JettonSwapAction) SubjectAccounts added in v1.1.0

func (a *JettonSwapAction) SubjectAccounts() []tongo.AccountID

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
	// contains filtered or unexported fields
}

func (*JettonTransferAction) SubjectAccounts added in v1.0.0

func (a *JettonTransferAction) SubjectAccounts() []tongo.AccountID

type Merge

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

type NftAuctionType added in v0.1.0

type NftAuctionType string

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 ForAccount(a tongo.AccountID) Option

func WithInformationSource added in v0.1.0

func WithInformationSource(source core.InformationSource) Option

func WithStraws

func WithStraws(straws []StrawFunc) 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) SubjectAccounts added in v1.0.0

func (a *SmartContractAction) SubjectAccounts() []tongo.AccountID

type Straw

type Straw[newBubbleT actioner] struct {
	CheckFuncs       []bubbleCheck
	Builder          func(newAction *newBubbleT, bubble *Bubble) error //uses to convert old bubble to new Bubble.Info
	ValueFlowUpdater func(newAction *newBubbleT, flow *ValueFlow)
	SingleChild      *Straw[newBubbleT]
	Children         []Straw[newBubbleT]
	Optional         bool
}

func Optional added in v1.1.0

func Optional[T actioner](s Straw[T]) Straw[T]

Optional returns copy of declarative straw but optional

func (Straw[newBubbleT]) Merge added in v1.1.0

func (s Straw[newBubbleT]) Merge(bubble *Bubble) bool

type StrawFunc added in v1.1.0

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

StrawFunc 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"
	TfProcessPendingWithdrawRequests TFCommand = "TfProcessPendingWithdrawRequests"
	TfUpdateValidatorSet             TFCommand = "TfUpdateValidatorSet"
)

type TonTransferAction

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

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.

func (*ValueFlow) AddFee

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

func (*ValueFlow) AddJettons

func (flow *ValueFlow) AddJettons(accountID tongo.AccountID, jettonMaster 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)

func (*ValueFlow) SubJettons added in v1.2.0

func (flow *ValueFlow) SubJettons(accountID tongo.AccountID, jettonMaster tongo.AccountID, value big.Int)

type WithdrawStakeAction added in v1.1.0

type WithdrawStakeAction struct {
	Staker         tongo.AccountID
	Amount         int64
	Pool           tongo.AccountID
	Implementation core.StakingImplementation
}

func (*WithdrawStakeAction) SubjectAccounts added in v1.1.0

func (a *WithdrawStakeAction) SubjectAccounts() []tongo.AccountID

type WithdrawStakeRequestAction added in v1.1.0

type WithdrawStakeRequestAction struct {
	Staker         tongo.AccountID
	Amount         *int64
	Pool           tongo.AccountID
	Implementation core.StakingImplementation
}

func (*WithdrawStakeRequestAction) SubjectAccounts added in v1.1.0

func (a *WithdrawStakeRequestAction) SubjectAccounts() []tongo.AccountID

Jump to

Keyboard shortcuts

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