Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stonfi-v2 #304

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
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
318 changes: 316 additions & 2 deletions abi/generated_test.go

Large diffs are not rendered by default.

197 changes: 191 additions & 6 deletions abi/get_methods.go

Large diffs are not rendered by default.

79 changes: 79 additions & 0 deletions abi/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ const (
NftSaleV2
PaymentChannel
Sbt
StonfiLpAccountV2
StonfiPool
StonfiPoolV2
StonfiRouter
StonfiRouterV2
StonfiVaultV2
StorageContract
StorageProvider
StormExecutor
Expand Down Expand Up @@ -144,10 +148,18 @@ func (c ContractInterface) String() string {
return "payment_channel"
case Sbt:
return "sbt"
case StonfiLpAccountV2:
return "stonfi_lp_account_v2"
case StonfiPool:
return "stonfi_pool"
case StonfiPoolV2:
return "stonfi_pool_v2"
case StonfiRouter:
return "stonfi_router"
case StonfiRouterV2:
return "stonfi_router_v2"
case StonfiVaultV2:
return "stonfi_vault_v2"
case StorageContract:
return "storage_contract"
case StorageProvider:
Expand Down Expand Up @@ -287,10 +299,18 @@ func ContractInterfaceFromString(s string) ContractInterface {
return PaymentChannel
case "sbt":
return Sbt
case "stonfi_lp_account_v2":
return StonfiLpAccountV2
case "stonfi_pool":
return StonfiPool
case "stonfi_pool_v2":
return StonfiPoolV2
case "stonfi_router":
return StonfiRouter
case "stonfi_router_v2":
return StonfiRouterV2
case "stonfi_vault_v2":
return StonfiVaultV2
case "storage_contract":
return StorageContract
case "storage_provider":
Expand Down Expand Up @@ -465,6 +485,10 @@ var methodInvocationOrder = []MethodDescription{
Name: "get_lockup_data",
InvokeFn: GetLockupData,
},
{
Name: "get_lp_account_data",
InvokeFn: GetLpAccountData,
},
{
Name: "get_lp_data",
InvokeFn: GetLpData,
Expand Down Expand Up @@ -573,6 +597,10 @@ var methodInvocationOrder = []MethodDescription{
Name: "get_router_data",
InvokeFn: GetRouterData,
},
{
Name: "get_router_version",
InvokeFn: GetRouterVersion,
},
{
Name: "get_sale_data",
InvokeFn: GetSaleData,
Expand Down Expand Up @@ -843,12 +871,37 @@ var contractInterfacesOrder = []InterfaceDescription{
"GetPoolData_StonfiResult",
},
},
{
Name: StonfiPoolV2,
Results: []string{
"GetPoolData_StonfiV2Result",
},
},
{
Name: StonfiRouter,
Results: []string{
"GetRouterData_StonfiResult",
},
},
{
Name: StonfiRouterV2,
Results: []string{
"GetRouterData_StonfiV2Result",
"GetRouterVersion_StonfiV2Result",
},
},
{
Name: StonfiLpAccountV2,
Results: []string{
"GetLpAccountData_StonfiResult",
},
},
{
Name: StonfiVaultV2,
Results: []string{
"GetVaultData_StonfiV2Result",
},
},
{
Name: StorageProvider,
Results: []string{
Expand Down Expand Up @@ -1259,6 +1312,32 @@ func (c ContractInterface) IntMsgs() []msgDecoderFunc {
decodeFuncNftTransferMsgBody,
decodeFuncGetStaticDataMsgBody,
}
case StonfiLpAccountV2:
return []msgDecoderFunc{
decodeFuncStonfiAddLiquidityV2MsgBody,
decodeFuncPtonResetGasMsgBody,
}
case StonfiPoolV2:
return []msgDecoderFunc{
decodeFuncStonfiBurnNotificationExtV2MsgBody,
decodeFuncStonfiSwapV2MsgBody,
decodeFuncStonfiProvideLpV2MsgBody,
decodeFuncPtonResetGasMsgBody,
decodeFuncStonfiCbAddLiquidityV2MsgBody,
}
case StonfiRouterV2:
return []msgDecoderFunc{
decodeFuncJettonNotifyMsgBody,
decodeFuncPtonResetGasMsgBody,
decodeFuncStonfiPayToV2MsgBody,
decodeFuncStonfiPayVaultV2MsgBody,
decodeFuncStonfiVaultPayToV2MsgBody,
}
case StonfiVaultV2:
return []msgDecoderFunc{
decodeFuncStonfiWithdrawFeeV2MsgBody,
decodeFuncStonfiDepositRefFeeV2MsgBody,
}
case StormExecutor:
return []msgDecoderFunc{
decodeFuncStormMintExecutorMsgBody,
Expand Down
63 changes: 63 additions & 0 deletions abi/jetton_msg_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ func decodeTegroAddLiquidityJettonOpJetton(j *JettonPayload, c *boc.Cell) error
return err
}

func decodeStonfiProvideLpV2JettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StonfiProvideLpV2JettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = StonfiProvideLpV2JettonOp
j.Value = res
return nil
}
return err
}

func decodeDedustDepositLiquidityJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res DedustDepositLiquidityJettonPayload
err := tlb.Unmarshal(c, &res)
Expand All @@ -84,6 +95,17 @@ func decodeStonfiSwapOkRefJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
return err
}

func decodeStonfiSwapV2JettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StonfiSwapV2JettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil {
j.SumType = StonfiSwapV2JettonOp
j.Value = res
return nil
}
return err
}

func decodeTonkeeperRelayerFeeJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res TonkeeperRelayerFeeJettonPayload
err := tlb.Unmarshal(c, &res)
Expand Down Expand Up @@ -134,8 +156,10 @@ const (
EncryptedTextCommentJettonOp JettonOpName = "EncryptedTextComment"
StonfiSwapJettonOp JettonOpName = "StonfiSwap"
TegroAddLiquidityJettonOp JettonOpName = "TegroAddLiquidity"
StonfiProvideLpV2JettonOp JettonOpName = "StonfiProvideLpV2"
DedustDepositLiquidityJettonOp JettonOpName = "DedustDepositLiquidity"
StonfiSwapOkRefJettonOp JettonOpName = "StonfiSwapOkRef"
StonfiSwapV2JettonOp JettonOpName = "StonfiSwapV2"
TonkeeperRelayerFeeJettonOp JettonOpName = "TonkeeperRelayerFee"
StonfiSwapOkJettonOp JettonOpName = "StonfiSwapOk"
DedustSwapJettonOp JettonOpName = "DedustSwap"
Expand All @@ -146,8 +170,10 @@ const (
EncryptedTextCommentJettonOpCode JettonOpCode = 0x2167da4b
StonfiSwapJettonOpCode JettonOpCode = 0x25938561
TegroAddLiquidityJettonOpCode JettonOpCode = 0x287e167a
StonfiProvideLpV2JettonOpCode JettonOpCode = 0x37c096df
DedustDepositLiquidityJettonOpCode JettonOpCode = 0x40e108d6
StonfiSwapOkRefJettonOpCode JettonOpCode = 0x45078540
StonfiSwapV2JettonOpCode JettonOpCode = 0x6664de2a
TonkeeperRelayerFeeJettonOpCode JettonOpCode = 0x878da6e3
StonfiSwapOkJettonOpCode JettonOpCode = 0xc64370e5
DedustSwapJettonOpCode JettonOpCode = 0xe3a0d482
Expand All @@ -160,8 +186,10 @@ var KnownJettonTypes = map[string]any{
EncryptedTextCommentJettonOp: EncryptedTextCommentJettonPayload{},
StonfiSwapJettonOp: StonfiSwapJettonPayload{},
TegroAddLiquidityJettonOp: TegroAddLiquidityJettonPayload{},
StonfiProvideLpV2JettonOp: StonfiProvideLpV2JettonPayload{},
DedustDepositLiquidityJettonOp: DedustDepositLiquidityJettonPayload{},
StonfiSwapOkRefJettonOp: StonfiSwapOkRefJettonPayload{},
StonfiSwapV2JettonOp: StonfiSwapV2JettonPayload{},
TonkeeperRelayerFeeJettonOp: TonkeeperRelayerFeeJettonPayload{},
StonfiSwapOkJettonOp: StonfiSwapOkJettonPayload{},
DedustSwapJettonOp: DedustSwapJettonPayload{},
Expand All @@ -173,8 +201,10 @@ var JettonOpCodes = map[JettonOpName]JettonOpCode{
EncryptedTextCommentJettonOp: EncryptedTextCommentJettonOpCode,
StonfiSwapJettonOp: StonfiSwapJettonOpCode,
TegroAddLiquidityJettonOp: TegroAddLiquidityJettonOpCode,
StonfiProvideLpV2JettonOp: StonfiProvideLpV2JettonOpCode,
DedustDepositLiquidityJettonOp: DedustDepositLiquidityJettonOpCode,
StonfiSwapOkRefJettonOp: StonfiSwapOkRefJettonOpCode,
StonfiSwapV2JettonOp: StonfiSwapV2JettonOpCode,
TonkeeperRelayerFeeJettonOp: TonkeeperRelayerFeeJettonOpCode,
StonfiSwapOkJettonOp: StonfiSwapOkJettonOpCode,
DedustSwapJettonOp: DedustSwapJettonOpCode,
Expand All @@ -187,8 +217,10 @@ var funcJettonDecodersMapping = map[JettonOpCode]func(*JettonPayload, *boc.Cell)
EncryptedTextCommentJettonOpCode: decodeEncryptedTextCommentJettonOpJetton,
StonfiSwapJettonOpCode: decodeStonfiSwapJettonOpJetton,
TegroAddLiquidityJettonOpCode: decodeTegroAddLiquidityJettonOpJetton,
StonfiProvideLpV2JettonOpCode: decodeStonfiProvideLpV2JettonOpJetton,
DedustDepositLiquidityJettonOpCode: decodeDedustDepositLiquidityJettonOpJetton,
StonfiSwapOkRefJettonOpCode: decodeStonfiSwapOkRefJettonOpJetton,
StonfiSwapV2JettonOpCode: decodeStonfiSwapV2JettonOpJetton,
TonkeeperRelayerFeeJettonOpCode: decodeTonkeeperRelayerFeeJettonOpJetton,
StonfiSwapOkJettonOpCode: decodeStonfiSwapOkJettonOpJetton,
DedustSwapJettonOpCode: decodeDedustSwapJettonOpJetton,
Expand Down Expand Up @@ -224,6 +256,20 @@ type TegroAddLiquidityJettonPayload struct {
AbountB tlb.VarUInteger16
}

type StonfiProvideLpV2JettonPayload struct {
TokenWallet1 tlb.MsgAddress
RefundAddress tlb.MsgAddress
ExcessesAddress tlb.MsgAddress
TxDeadline uint64
CrossProvideLpBody struct {
MinLpOut tlb.VarUInteger16
ToAddress tlb.MsgAddress
BothPositive tlb.Uint1
FwdAmount tlb.Grams
CustomPayload *tlb.Any `tlb:"maybe^"`
} `tlb:"^"`
}

type DedustDepositLiquidityJettonPayload struct {
PoolParams DedustPoolParams
MinLpAmount tlb.Grams
Expand All @@ -235,6 +281,23 @@ type DedustDepositLiquidityJettonPayload struct {

type StonfiSwapOkRefJettonPayload struct{}

type StonfiSwapV2JettonPayload struct {
TokenWallet1 tlb.MsgAddress
RefundAddress tlb.MsgAddress
ExcessesAddress tlb.MsgAddress
TxDeadline uint64
CrossSwapBody struct {
MinOut tlb.VarUInteger16
Receiver tlb.MsgAddress
FwdGas tlb.Grams
CustomPayload *tlb.Any `tlb:"maybe^"`
RefundFwdGas tlb.Grams
RefundPayload *tlb.Any `tlb:"maybe^"`
RefFee uint16
RefAddress tlb.MsgAddress
} `tlb:"^"`
}

type TonkeeperRelayerFeeJettonPayload struct{}

type StonfiSwapOkJettonPayload struct{}
Expand Down
17 changes: 17 additions & 0 deletions abi/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ The list below contains the supported message operations, their names and opcode
| ProcessGovernanceDecision| 0x44beae41 |
| ProofStorage| 0x419d5d4d |
| ProveOwnership| 0x04ded148 |
| PtonDeployWallet| 0x4f5f4313 |
| PtonInternalDeploy| 0x6540cf85 |
| PtonResetGas| 0x29d22935 |
| PtonTonRefund| 0xae25d79e |
| PtonTonTransfer| 0x01f3835d |
| ReportRoyaltyParams| 0xa8cb00ad |
| ReportStaticData| 0x8b771735 |
| SbtDestroy| 0x1f04537a |
Expand All @@ -93,12 +98,24 @@ The list below contains the supported message operations, their names and opcode
| SbtRevoke| 0x6f89f5e3 |
| SettleChannelConditionals| 0x66f6f069 |
| StartUncooperativeChannelClose| 0x1f151acf |
| StonfiAddLiquidityV2| 0x50c6a654 |
| StonfiBurnNotificationExtV2| 0x297437cf |
| StonfiCbAddLiquidityV2| 0x06ecd527 |
| StonfiDepositRefFeeV2| 0x0490f09b |
| StonfiPayToV2| 0x657b54f5 |
| StonfiPayVaultV2| 0x63381632 |
| StonfiPaymentRequest| 0xf93bb43f |
| StonfiProvideLiquidity| 0xfcf9e58f |
| StonfiProvideLpV2| 0x37c096df |
| StonfiProvideLpV2| 0x37c096df |
| StonfiSwap| 0x25938561 |
| StonfiSwap| 0x25938561 |
| StonfiSwapOk| 0xc64370e5 |
| StonfiSwapOkRef| 0x45078540 |
| StonfiSwapV2| 0x6664de2a |
| StonfiSwapV2| 0x6664de2a |
| StonfiVaultPayToV2| 0x2100c922 |
| StonfiWithdrawFeeV2| 0x354bcdf4 |
| StorageContractConfirmed| 0xd4caedcd |
| StorageContractTerminated| 0xb6236d63 |
| StorageRewardWithdrawal| 0xa91baf56 |
Expand Down
Loading
Loading