Skip to content

Commit

Permalink
improve naming for getgems interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-tron committed Mar 9, 2024
1 parent cc09294 commit 67ab742
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 30 deletions.
51 changes: 51 additions & 0 deletions abi/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ const (
LockupVesting
MegatonfiExchange
MegatonfiRouter
NftAuctionGetgemsV3
NftAuctionV1
NftCollection
NftItem
NftItemSimple
NftSale
NftSaleGetgemsV2
NftSaleGetgemsV3
NftSaleV1
NftSaleV2
PaymentChannel
Expand Down Expand Up @@ -82,6 +85,8 @@ func (c ContractInterface) String() string {
return "megatonfi_exchange"
case MegatonfiRouter:
return "megatonfi_router"
case NftAuctionGetgemsV3:
return "nft_auction_getgems_v3"
case NftAuctionV1:
return "nft_auction_v1"
case NftCollection:
Expand All @@ -92,6 +97,10 @@ func (c ContractInterface) String() string {
return "nft_item_simple"
case NftSale:
return "nft_sale"
case NftSaleGetgemsV2:
return "nft_sale_getgems_v2"
case NftSaleGetgemsV3:
return "nft_sale_getgems_v3"
case NftSaleV1:
return "nft_sale_v1"
case NftSaleV2:
Expand Down Expand Up @@ -181,6 +190,8 @@ func ContractInterfaceFromString(s string) ContractInterface {
return MegatonfiExchange
case "megatonfi_router":
return MegatonfiRouter
case "nft_auction_getgems_v3":
return NftAuctionGetgemsV3
case "nft_auction_v1":
return NftAuctionV1
case "nft_collection":
Expand All @@ -191,6 +202,10 @@ func ContractInterfaceFromString(s string) ContractInterface {
return NftItemSimple
case "nft_sale":
return NftSale
case "nft_sale_getgems_v2":
return NftSaleGetgemsV2
case "nft_sale_getgems_v3":
return NftSaleGetgemsV3
case "nft_sale_v1":
return NftSaleV1
case "nft_sale_v2":
Expand Down Expand Up @@ -647,10 +662,16 @@ var contractInterfacesOrder = []InterfaceDescription{

func (c ContractInterface) recursiveImplements(other ContractInterface) bool {
switch c {
case NftAuctionGetgemsV3:
return NftAuctionV1.Implements(other)
case NftAuctionV1:
return NftSale.Implements(other)
case NftItemSimple:
return NftItem.Implements(other)
case NftSaleGetgemsV2:
return NftSaleV2.Implements(other)
case NftSaleGetgemsV3:
return NftSaleV2.Implements(other)
case NftSaleV1:
return NftSale.Implements(other)
case NftSaleV2:
Expand Down Expand Up @@ -692,10 +713,22 @@ var knownContracts = map[ton.Bits256]knownContractDescription{
contractInterfaces: []ContractInterface{WalletHighloadV1R2},
getMethods: []InvokeFn{},
},
ton.MustParseHash("1bd9c5a39bffb7a0f341588b5dd92b813a842bf65ef14109382200ceaf8f72df"): {
contractInterfaces: []ContractInterface{NftAuctionGetgemsV3},
getMethods: []InvokeFn{
GetSaleData,
},
},
ton.MustParseHash("203dd4f358adb49993129aa925cac39916b68a0e4f78d26e8f2c2b69eafa5679"): {
contractInterfaces: []ContractInterface{WalletHighloadV2R2},
getMethods: []InvokeFn{},
},
ton.MustParseHash("32050dfac44f64866bcc86f2cd9e1305fe9dcadb3959c002237cfb0902d44323"): {
contractInterfaces: []ContractInterface{NftSaleGetgemsV3},
getMethods: []InvokeFn{
GetSaleData,
},
},
ton.MustParseHash("4c9123828682fa6f43797ab41732bca890cae01766e0674100250516e0bf8d42"): {
contractInterfaces: []ContractInterface{NftItemSimple},
getMethods: []InvokeFn{
Expand Down Expand Up @@ -724,6 +757,18 @@ var knownContracts = map[ton.Bits256]knownContractDescription{
Seqno,
},
},
ton.MustParseHash("6668872fa79705443ffd47523e8e9ea9f76ab99f9a0b59d27de8f81a1c27b9d4"): {
contractInterfaces: []ContractInterface{NftAuctionGetgemsV3},
getMethods: []InvokeFn{
GetSaleData,
},
},
ton.MustParseHash("8278f4c5233de6fbedc969af519344a7a9bffc544856dba986a95c0bcf8571c9"): {
contractInterfaces: []ContractInterface{NftSaleGetgemsV2},
getMethods: []InvokeFn{
GetSaleData,
},
},
ton.MustParseHash("84dafa449f98a6987789ba232358072bc0f76dc4524002a5d0918b9a75d2d599"): {
contractInterfaces: []ContractInterface{WalletV3R2},
getMethods: []InvokeFn{
Expand Down Expand Up @@ -759,6 +804,12 @@ var knownContracts = map[ton.Bits256]knownContractDescription{
contractInterfaces: []ContractInterface{WalletHighloadV1R1},
getMethods: []InvokeFn{},
},
ton.MustParseHash("deb53b6c5765c1e6cd238bf47bc5e83ba596bdcc04b0b84cd50ab1e474a08f31"): {
contractInterfaces: []ContractInterface{NftSaleGetgemsV3},
getMethods: []InvokeFn{
GetSaleData,
},
},
ton.MustParseHash("fe9530d3243853083ef2ef0b4c2908c0abf6fa1c31ea243aacaa5bf8c7d753f1"): {
contractInterfaces: []ContractInterface{WalletV2R2},
getMethods: []InvokeFn{
Expand Down
20 changes: 0 additions & 20 deletions abi/jetton_msg_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,6 @@ func decodeStonfiSwapOkRefJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
return err
}

func decodeStofiProvideLiquidityJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StofiProvideLiquidityJettonPayload
err := tlb.Unmarshal(c, &res)
if err == nil && completedRead(c) {
j.SumType = StofiProvideLiquidityJettonOp
j.Value = res
return nil
}
return err
}

func decodeStonfiSwapOkJettonOpJetton(j *JettonPayload, c *boc.Cell) error {
var res StonfiSwapOkJettonPayload
err := tlb.Unmarshal(c, &res)
Expand Down Expand Up @@ -124,7 +113,6 @@ const (
StonfiSwapJettonOp JettonOpName = "StonfiSwap"
TegroAddLiquidityJettonOp JettonOpName = "TegroAddLiquidity"
StonfiSwapOkRefJettonOp JettonOpName = "StonfiSwapOkRef"
StofiProvideLiquidityJettonOp JettonOpName = "StofiProvideLiquidity"
StonfiSwapOkJettonOp JettonOpName = "StonfiSwapOk"
DedustSwapJettonOp JettonOpName = "DedustSwap"
StonfiProvideLiquidityJettonOp JettonOpName = "StonfiProvideLiquidity"
Expand All @@ -135,7 +123,6 @@ const (
StonfiSwapJettonOpCode JettonOpCode = 0x25938561
TegroAddLiquidityJettonOpCode JettonOpCode = 0x287e167a
StonfiSwapOkRefJettonOpCode JettonOpCode = 0x45078540
StofiProvideLiquidityJettonOpCode JettonOpCode = 0x8fe5f9fc
StonfiSwapOkJettonOpCode JettonOpCode = 0xc64370e5
DedustSwapJettonOpCode JettonOpCode = 0xe3a0d482
StonfiProvideLiquidityJettonOpCode JettonOpCode = 0xfcf9e58f
Expand All @@ -148,7 +135,6 @@ var KnownJettonTypes = map[string]any{
StonfiSwapJettonOp: StonfiSwapJettonPayload{},
TegroAddLiquidityJettonOp: TegroAddLiquidityJettonPayload{},
StonfiSwapOkRefJettonOp: StonfiSwapOkRefJettonPayload{},
StofiProvideLiquidityJettonOp: StofiProvideLiquidityJettonPayload{},
StonfiSwapOkJettonOp: StonfiSwapOkJettonPayload{},
DedustSwapJettonOp: DedustSwapJettonPayload{},
StonfiProvideLiquidityJettonOp: StonfiProvideLiquidityJettonPayload{},
Expand All @@ -160,7 +146,6 @@ var JettonOpCodes = map[JettonOpName]JettonOpCode{
StonfiSwapJettonOp: StonfiSwapJettonOpCode,
TegroAddLiquidityJettonOp: TegroAddLiquidityJettonOpCode,
StonfiSwapOkRefJettonOp: StonfiSwapOkRefJettonOpCode,
StofiProvideLiquidityJettonOp: StofiProvideLiquidityJettonOpCode,
StonfiSwapOkJettonOp: StonfiSwapOkJettonOpCode,
DedustSwapJettonOp: DedustSwapJettonOpCode,
StonfiProvideLiquidityJettonOp: StonfiProvideLiquidityJettonOpCode,
Expand All @@ -173,7 +158,6 @@ var funcJettonDecodersMapping = map[JettonOpCode]func(*JettonPayload, *boc.Cell)
StonfiSwapJettonOpCode: decodeStonfiSwapJettonOpJetton,
TegroAddLiquidityJettonOpCode: decodeTegroAddLiquidityJettonOpJetton,
StonfiSwapOkRefJettonOpCode: decodeStonfiSwapOkRefJettonOpJetton,
StofiProvideLiquidityJettonOpCode: decodeStofiProvideLiquidityJettonOpJetton,
StonfiSwapOkJettonOpCode: decodeStonfiSwapOkJettonOpJetton,
DedustSwapJettonOpCode: decodeDedustSwapJettonOpJetton,
StonfiProvideLiquidityJettonOpCode: decodeStonfiProvideLiquidityJettonOpJetton,
Expand Down Expand Up @@ -210,10 +194,6 @@ type TegroAddLiquidityJettonPayload struct {

type StonfiSwapOkRefJettonPayload struct{}

type StofiProvideLiquidityJettonPayload struct {
MinLpOut tlb.VarUInteger16
}

type StonfiSwapOkJettonPayload struct{}

type DedustSwapJettonPayload struct {
Expand Down
1 change: 0 additions & 1 deletion abi/messages.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ The list below contains the supported message operations, their names and opcode
| SbtRevoke| 0x6f89f5e3 |
| SettleChannelConditionals| 0x66f6f069 |
| StartUncooperativeChannelClose| 0x1f151acf |
| StofiProvideLiquidity| 0x8fe5f9fc |
| StonfiPaymentRequest| 0xf93bb43f |
| StonfiProvideLiquidity| 0xfcf9e58f |
| StonfiSwap| 0x25938561 |
Expand Down
2 changes: 1 addition & 1 deletion abi/schemas/dedust.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<slice name="asset1">DedustAsset</slice>
</output>
</get_method>
<get_method name="get_asset"> <!-- todo: add to index -->
<get_method name="get_asset">
<output version="dedust" fixed_length="true">
<slice name="asset">DedustAsset</slice>
</output>
Expand Down
16 changes: 11 additions & 5 deletions abi/schemas/nft_sale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@
<interface name="nft_auction_v1" inherits="nft_sale">
<get_method name="get_sale_data" version="getgems_auction"/>
</interface>
<!-- <interface name="nft_sale_getgems" inherits="nft_sale_v2"> todo: uncomment but fix get methods inheritance-->
<!-- <code_hash>8278f4c5233de6fbedc969af519344a7a9bffc544856dba986a95c0bcf8571c9</code_hash>-->
<!-- <code_hash>32050dfac44f64866bcc86f2cd9e1305fe9dcadb3959c002237cfb0902d44323</code_hash>-->
<!-- <code_hash>deb53b6c5765c1e6cd238bf47bc5e83ba596bdcc04b0b84cd50ab1e474a08f31</code_hash>-->
<!-- </interface>-->
<interface name="nft_sale_getgems_v3" inherits="nft_sale_v2">
<code_hash>deb53b6c5765c1e6cd238bf47bc5e83ba596bdcc04b0b84cd50ab1e474a08f31</code_hash> <!-- https://github.com/getgems-io/nft-contracts/blob/main/packages%2Fcontracts%2Fsources%2Fnft-fixprice-sale-v3r2.fc -->
<code_hash>32050dfac44f64866bcc86f2cd9e1305fe9dcadb3959c002237cfb0902d44323</code_hash> <!-- https://github.com/getgems-io/nft-contracts/blob/main/packages%2Fcontracts%2Fsources%2Fnft-fixprice-sale-v3.fc -->
</interface>
<interface name="nft_sale_getgems_v2" inherits="nft_sale_v2">
<code_hash>8278f4c5233de6fbedc969af519344a7a9bffc544856dba986a95c0bcf8571c9</code_hash> <!-- https://github.com/getgems-io/nft-contracts/blob/main/packages%2Fcontracts%2Fsources%2Fnft-fixprice-sale-v2.fc -->
</interface>
<interface name="nft_auction_getgems_v3" inherits="nft_auction_v1">
<code_hash>1bd9c5a39bffb7a0f341588b5dd92b813a842bf65ef14109382200ceaf8f72df</code_hash> <!-- https://github.com/getgems-io/nft-contracts/blob/main/packages%2Fcontracts%2Fsources%2Fnft-auction-v3r2%2Fnft-auction-v3r2.func -->
<code_hash>6668872fa79705443ffd47523e8e9ea9f76ab99f9a0b59d27de8f81a1c27b9d4</code_hash> <!-- https://github.com/getgems-io/nft-contracts/blob/main/packages%2Fcontracts%2Fsources%2Fnft-auction-v2%2Fnft-auction-v2.func -->
</interface>
<get_method name="get_sale_data">
<output version="basic" fixed_length="true">
<slice name="marketplace">msgaddress</slice>
Expand Down
3 changes: 0 additions & 3 deletions abi/schemas/ston-fi.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
<jetton_payload name="stonfi_swap" >
swap#25938561 token_wallet:MsgAddress min_out:(VarUInteger 16) to_address:MsgAddress referral_address:(Maybe MsgAddress) = JettonPayload;
</jetton_payload>
<jetton_payload name="stofi_provide_liquidity" fixed_length="true">
provide_liquidity#8fe5f9fc min_lp_out:(VarUInteger 16) = JettonPayload; <!-- todo: remove kludge after reindex -->
</jetton_payload>
<jetton_payload name="stonfi_provide_liquidity">
provide_liquidity#fcf9e58f token_wallet:MsgAddress min_lp_out:(VarUInteger 16) = JettonPayload;
</jetton_payload>
Expand Down

0 comments on commit 67ab742

Please sign in to comment.