Skip to content

Commit

Permalink
add protocol contracts solana pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
skosito committed Oct 24, 2024
1 parent 8c9c5bd commit 3d071ca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 (
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
13 changes: 7 additions & 6 deletions pkg/contracts/solana/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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
Expand Down

0 comments on commit 3d071ca

Please sign in to comment.