Skip to content

Commit 1b3a7d0

Browse files
add the is_stable get method to dedust
1 parent c06d188 commit 1b3a7d0

File tree

3 files changed

+48
-3
lines changed

3 files changed

+48
-3
lines changed

abi/get_methods.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ var KnownGetMethodsDecoder = map[string][]func(tlb.VmStack) (string, any, error)
9797
"get_wallet_params": {DecodeGetWalletParamsResult},
9898
"is_active": {DecodeIsActiveResult},
9999
"is_plugin_installed": {DecodeIsPluginInstalledResult},
100+
"is_stable": {DecodeIsStable_DedustResult},
100101
"jetton_wallet_lock_data": {DecodeJettonWalletLockDataResult},
101102
"list_nominators": {DecodeListNominatorsResult},
102103
"list_votes": {DecodeListVotesResult},
@@ -154,6 +155,7 @@ var KnownSimpleGetMethods = map[int][]func(ctx context.Context, executor Executo
154155
102351: {GetNftData},
155156
102491: {GetCollectionData},
156157
103232: {GetValidatorControllerData},
158+
103723: {IsStable},
157159
104122: {GetLpMiningData},
158160
104346: {GetStorageParams},
159161
105070: {GetTimeout},
@@ -277,6 +279,7 @@ var resultTypes = []interface{}{
277279
&GetWalletParamsResult{},
278280
&IsActiveResult{},
279281
&IsPluginInstalledResult{},
282+
&IsStable_DedustResult{},
280283
&JettonWalletLockDataResult{},
281284
&ListNominatorsResult{},
282285
&ListVotesResult{},
@@ -3620,6 +3623,39 @@ func DecodeIsPluginInstalledResult(stack tlb.VmStack) (resultType string, result
36203623
return "IsPluginInstalledResult", result, err
36213624
}
36223625

3626+
type IsStable_DedustResult struct {
3627+
IsStable bool
3628+
}
3629+
3630+
func IsStable(ctx context.Context, executor Executor, reqAccountID ton.AccountID) (string, any, error) {
3631+
stack := tlb.VmStack{}
3632+
3633+
// MethodID = 103723 for "is_stable" method
3634+
errCode, stack, err := executor.RunSmcMethodByID(ctx, reqAccountID, 103723, stack)
3635+
if err != nil {
3636+
return "", nil, err
3637+
}
3638+
if errCode != 0 && errCode != 1 {
3639+
return "", nil, fmt.Errorf("method execution failed with code: %v", errCode)
3640+
}
3641+
for _, f := range []func(tlb.VmStack) (string, any, error){DecodeIsStable_DedustResult} {
3642+
s, r, err := f(stack)
3643+
if err == nil {
3644+
return s, r, nil
3645+
}
3646+
}
3647+
return "", nil, fmt.Errorf("can not decode outputs")
3648+
}
3649+
3650+
func DecodeIsStable_DedustResult(stack tlb.VmStack) (resultType string, resultAny any, err error) {
3651+
if len(stack) != 1 || (stack[0].SumType != "VmStkTinyInt" && stack[0].SumType != "VmStkInt") {
3652+
return "", nil, fmt.Errorf("invalid stack format")
3653+
}
3654+
var result IsStable_DedustResult
3655+
err = stack.Unmarshal(&result)
3656+
return "IsStable_DedustResult", result, err
3657+
}
3658+
36233659
type JettonWalletLockDataResult struct {
36243660
FullBalance tlb.Int257
36253661
IndividualUnlockTime uint32

abi/interfaces.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,10 @@ var methodInvocationOrder = []MethodDescription{
650650
Name: "is_active",
651651
InvokeFn: IsActive,
652652
},
653+
{
654+
Name: "is_stable",
655+
InvokeFn: IsStable,
656+
},
653657
{
654658
Name: "jetton_wallet_lock_data",
655659
InvokeFn: JettonWalletLockData,

abi/schemas/dedust.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
</msg_out>
4141
</interface>
4242

43-
<get_method name="get_reserves" >
43+
<get_method name="get_reserves">
4444
<output version="dedust" fixed_length="true">
4545
<int name="reserve0">int257</int>
4646
<int name="reserve1">int257</int>
4747
</output>
4848
</get_method>
49-
<get_method name="get_assets" >
49+
<get_method name="get_assets">
5050
<output version="dedust" fixed_length="true">
5151
<slice name="asset0">DedustAsset</slice>
5252
<slice name="asset1">DedustAsset</slice>
@@ -57,6 +57,11 @@
5757
<slice name="asset">DedustAsset</slice>
5858
</output>
5959
</get_method>
60+
<get_method name="is_stable">
61+
<output version="dedust" fixed_length="true">
62+
<int name="is_stable">bool</int>
63+
</output>
64+
</get_method>
6065

6166
<internal name="dedust_deposit_liquidity_all">
6267
deposit_liquidity_all#b56b9598 query_id:uint64 proof:^Cell
@@ -87,7 +92,7 @@
8792
</internal>
8893

8994
<jetton_payload name="dedust_swap">
90-
dedust_swap#e3a0d482 step:DedustSwapStep swap_params:^DedustSwapParams = ForwardPayload;
95+
dedust_swap#e3a0d482 step:DedustSwapStep swap_params:^DedustSwapParams = ForwardPayload;
9196
</jetton_payload>
9297

9398
<ext_out name="dedust_swap">

0 commit comments

Comments
 (0)