Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 52 additions & 6 deletions pkg/bath/stonfi.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,15 @@ var StonfiSwapStraw = Straw[BubbleJettonSwap]{
}

var StonfiV1PTONStraw = Straw[BubbleJettonTransfer]{
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp)},
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp), func(bubble *Bubble) bool {
tx := bubble.Info.(BubbleTx)
body := tx.decodedBody.Value.(abi.JettonTransferMsgBody)
amount := big.Int(body.Amount)
if big.NewInt(tx.inputAmount).Cmp(&amount) < 1 {
return false
}
return true
}},
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
tx := bubble.Info.(BubbleTx)
newAction.master, _ = tx.additionalInfo.JettonMaster(tx.account.Address)
Expand All @@ -136,7 +144,15 @@ var StonfiV1PTONStraw = Straw[BubbleJettonTransfer]{
return nil
},
SingleChild: &Straw[BubbleJettonTransfer]{
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp)},
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp), func(bubble *Bubble) bool {
tx := bubble.Info.(BubbleTx)
body := tx.decodedBody.Value.(abi.JettonNotifyMsgBody)
amount := big.Int(body.Amount)
if big.NewInt(tx.inputAmount).Cmp(&amount) < 1 {
return false
}
return true
}},
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
tx := bubble.Info.(BubbleTx)
newAction.success = true
Expand All @@ -150,7 +166,14 @@ var StonfiV1PTONStraw = Straw[BubbleJettonTransfer]{
}

var StonfiV2PTONStraw = Straw[BubbleJettonTransfer]{
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.PtonTonTransferMsgOp)},
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.PtonTonTransferMsgOp), func(bubble *Bubble) bool {
tx := bubble.Info.(BubbleTx)
body := tx.decodedBody.Value.(abi.PtonTonTransferMsgBody)
if uint64(tx.inputAmount) <= uint64(body.TonAmount) {
return false
}
return true
}},
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
tx := bubble.Info.(BubbleTx)
newAction.master, _ = tx.additionalInfo.JettonMaster(tx.account.Address)
Expand All @@ -166,7 +189,15 @@ var StonfiV2PTONStraw = Straw[BubbleJettonTransfer]{
return nil
},
SingleChild: &Straw[BubbleJettonTransfer]{
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp)},
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.JettonNotifyMsgOp), func(bubble *Bubble) bool {
tx := bubble.Info.(BubbleTx)
body := tx.decodedBody.Value.(abi.JettonNotifyMsgBody)
amount := big.Int(body.Amount)
if big.NewInt(tx.inputAmount).Cmp(&amount) < 1 {
return false
}
return true
}},
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
tx := bubble.Info.(BubbleTx)
newAction.success = true
Expand All @@ -180,7 +211,15 @@ var StonfiV2PTONStraw = Straw[BubbleJettonTransfer]{
}

var StonfiV2PTONStrawReverse = Straw[BubbleJettonTransfer]{
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp)},
CheckFuncs: []bubbleCheck{IsTx, HasInterface(abi.JettonWallet), HasOperation(abi.JettonTransferMsgOp), func(bubble *Bubble) bool {
tx := bubble.Info.(BubbleTx)
body := tx.decodedBody.Value.(abi.JettonTransferMsgBody)
amount := big.Int(body.Amount)
if big.NewInt(tx.inputAmount).Cmp(&amount) < 1 {
return false
}
return true
}},
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
tx := bubble.Info.(BubbleTx)
newAction.master, _ = tx.additionalInfo.JettonMaster(tx.account.Address)
Expand All @@ -198,7 +237,14 @@ var StonfiV2PTONStrawReverse = Straw[BubbleJettonTransfer]{
},
Children: []Straw[BubbleJettonTransfer]{
{
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.PtonTonTransferMsgOp)},
CheckFuncs: []bubbleCheck{IsTx, HasOperation(abi.PtonTonTransferMsgOp), func(bubble *Bubble) bool {
tx := bubble.Info.(BubbleTx)
body := tx.decodedBody.Value.(abi.PtonTonTransferMsgBody)
if uint64(tx.inputAmount) <= uint64(body.TonAmount) {
return false
}
return true
}},
Builder: func(newAction *BubbleJettonTransfer, bubble *Bubble) error {
tx := bubble.Info.(BubbleTx)
newAction.success = true
Expand Down
Loading