From 3d071cacb4a28c6843e0c46a27a28cb400fa06b5 Mon Sep 17 00:00:00 2001 From: skosito Date: Fri, 25 Oct 2024 01:21:00 +0200 Subject: [PATCH] add protocol contracts solana pkg --- go.mod | 5 ++--- go.sum | 4 ++++ pkg/contracts/solana/gateway.go | 13 +++++++------ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 524a63d8be..b80f4af402 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/zeta-chain/node -go 1.22.2 - -toolchain go1.22.5 +go 1.22.8 require ( cosmossdk.io/errors v1.0.1 @@ -336,6 +334,7 @@ require ( github.com/bnb-chain/tss-lib v1.5.0 github.com/showa-93/go-mask v0.6.2 github.com/tonkeeper/tongo v1.9.3 + github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20241024230448-593397669504 ) require ( diff --git a/go.sum b/go.sum index 04150048bc..39449e8024 100644 --- a/go.sum +++ b/go.sum @@ -2186,6 +2186,8 @@ github.com/fzipp/gocyclo v0.5.1/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlya github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= github.com/gagliardetto/binary v0.8.0 h1:U9ahc45v9HW0d15LoN++vIXSJyqR/pWw8DDlhd7zvxg= github.com/gagliardetto/binary v0.8.0/go.mod h1:2tfj51g5o9dnvsc+fL3Jxr22MuWzYXwx9wEoN0XQ7/c= +github.com/gagliardetto/gofuzz v1.2.2 h1:XL/8qDMzcgvR4+CyRQW9UGdwPRPMHVJfqQ/uMvSUuQw= +github.com/gagliardetto/gofuzz v1.2.2/go.mod h1:bkH/3hYLZrMLbfYWA0pWzXmi5TTRZnu4pMGZBkqMKvY= github.com/gagliardetto/solana-go v1.10.0 h1:lDuHGC+XLxw9j8fCHBZM9tv4trI0PVhev1m9NAMaIdM= github.com/gagliardetto/solana-go v1.10.0/go.mod h1:afBEcIRrDLJst3lvAahTr63m6W2Ns6dajZxe2irF7Jg= github.com/gagliardetto/treeout v0.1.4 h1:ozeYerrLCmCubo1TcIjFiOWTTGteOOHND1twdFpgwaw= @@ -4210,6 +4212,8 @@ github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138 h1:vck/Fc github.com/zeta-chain/keystone/keys v0.0.0-20240826165841-3874f358c138/go.mod h1:U494OsZTWsU75hqoriZgMdSsgSGP1mUL1jX+wN/Aez8= github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241021075719-d40d2e28467c h1:ZoFxMMZtivRLquXVq1sEVlT45UnTPMO1MSXtc88nDv4= github.com/zeta-chain/protocol-contracts v1.0.2-athens3.0.20241021075719-d40d2e28467c/go.mod h1:SjT7QirtJE8stnAe1SlNOanxtfSfijJm3MGJ+Ax7w7w= +github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20241024230448-593397669504 h1:0h1yiSiCnh5g9Zp/ReDyeQZh7hp1UZ76A6BFDvnAX8Q= +github.com/zeta-chain/protocol-contracts-solana/go-idl v0.0.0-20241024230448-593397669504/go.mod h1:AaM8C6ygo7Ms7BjRx5243cyRyMZItFsu7PWXedX8u4g= github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901 h1:9whtN5fjYHfk4yXIuAsYP2EHxImwDWDVUOnZJ2pfL3w= github.com/zeta-chain/tss-lib v0.0.0-20240916163010-2e6b438bd901/go.mod h1:d2iTC62s9JwKiCMPhcDDXbIZmuzAyJ4lwso0H5QyRbk= github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= diff --git a/pkg/contracts/solana/gateway.go b/pkg/contracts/solana/gateway.go index 5049a3c668..3c1f1a2425 100644 --- a/pkg/contracts/solana/gateway.go +++ b/pkg/contracts/solana/gateway.go @@ -4,6 +4,7 @@ package solana import ( "github.com/gagliardetto/solana-go" "github.com/pkg/errors" + idlgateway "github.com/zeta-chain/protocol-contracts-solana/go-idl/generated" ) const ( @@ -20,32 +21,32 @@ const ( // DiscriminatorInitialize returns the discriminator for Solana gateway 'initialize' instruction func DiscriminatorInitialize() [8]byte { - return [8]byte{175, 175, 109, 31, 13, 152, 155, 237} + return idlgateway.IDLGateway.GetDiscriminator("initialize") } // DiscriminatorDeposit returns the discriminator for Solana gateway 'deposit' instruction func DiscriminatorDeposit() [8]byte { - return [8]byte{242, 35, 198, 137, 82, 225, 242, 182} + return idlgateway.IDLGateway.GetDiscriminator("deposit") } // DiscriminatorDepositSPL returns the discriminator for Solana gateway 'deposit_spl_token' instruction func DiscriminatorDepositSPL() [8]byte { - return [8]byte{86, 172, 212, 121, 63, 233, 96, 144} + return idlgateway.IDLGateway.GetDiscriminator("deposit_spl_token") } // DiscriminatorWithdraw returns the discriminator for Solana gateway 'withdraw' instruction func DiscriminatorWithdraw() [8]byte { - return [8]byte{183, 18, 70, 156, 148, 109, 161, 34} + return idlgateway.IDLGateway.GetDiscriminator("withdraw") } // DiscriminatorWithdrawSPL returns the discriminator for Solana gateway 'withdraw_spl_token' instruction func DiscriminatorWithdrawSPL() [8]byte { - return [8]byte{156, 234, 11, 89, 235, 246, 32} + return idlgateway.IDLGateway.GetDiscriminator("withdraw_spl_token") } // DiscriminatorWhitelist returns the discriminator for Solana gateway 'whitelist_spl_mint' instruction func DiscriminatorWhitelistSplMint() [8]byte { - return [8]byte{30, 110, 162, 42, 208, 147, 254, 219} + return idlgateway.IDLGateway.GetDiscriminator("whitelist_spl_mint") } // ParseGatewayAddressAndPda parses the gateway id and program derived address from the given string