Skip to content

Commit db201fb

Browse files
committed
feat: implement wasm configuration
Signed-off-by: Artur Troian <[email protected]>
1 parent 01f2e37 commit db201fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+7579
-0
lines changed

go/cli/module_query.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package cli
2+
3+
import (
4+
"github.com/cosmos/cosmos-sdk/client"
5+
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
6+
"github.com/spf13/cobra"
7+
8+
cflags "pkg.akt.dev/go/cli/flags"
9+
)
10+
11+
func GetQueryModuleNameToAddressCmd() *cobra.Command {
12+
cmd := &cobra.Command{
13+
Use: "module-name-to-address [module-name]",
14+
Short: "module name to address",
15+
RunE: func(cmd *cobra.Command, args []string) error {
16+
clientCtx := client.GetClientContextFromCmd(cmd)
17+
address := authtypes.NewModuleAddress(args[0])
18+
return clientCtx.PrintString(address.String())
19+
},
20+
}
21+
22+
cflags.AddPaginationFlagsToCmd(cmd, cmd.Use)
23+
cflags.AddQueryFlagsToCmd(cmd)
24+
25+
return cmd
26+
}
790 KB
Binary file not shown.

go/cli/testdata/wasm/burner.wasm

Whitespace-only changes.

go/cli/testdata/wasm/contracts.go

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package testdata
2+
3+
import (
4+
_ "embed"
5+
6+
typwasmvmtypes "github.com/CosmWasm/wasmvm/v3/types"
7+
8+
"github.com/cosmos/cosmos-sdk/types"
9+
)
10+
11+
const (
12+
ChecksumHackatom = "3f4cd47c39c57fe1733fb41ed176eebd9d5c67baf5df8a1eeda1455e758f8514"
13+
)
14+
15+
var (
16+
//go:embed reflect_2_0.wasm
17+
reflectContract []byte
18+
//go:embed reflect_1_1.wasm
19+
migrateReflectContract []byte
20+
//go:embed cyberpunk.wasm
21+
cyberpunkContract []byte
22+
//go:embed ibc_reflect.wasm
23+
ibcReflectContract []byte
24+
//go:embed burner.wasm
25+
burnerContract []byte
26+
//go:embed hackatom.wasm
27+
hackatomContract []byte
28+
)
29+
30+
func ReflectContractWasm() []byte {
31+
return reflectContract
32+
}
33+
34+
func MigrateReflectContractWasm() []byte {
35+
return migrateReflectContract
36+
}
37+
38+
func CyberpunkContractWasm() []byte {
39+
return cyberpunkContract
40+
}
41+
42+
func IBCReflectContractWasm() []byte {
43+
return ibcReflectContract
44+
}
45+
46+
func BurnerContractWasm() []byte {
47+
return burnerContract
48+
}
49+
50+
func HackatomContractWasm() []byte {
51+
return hackatomContract
52+
}
53+
54+
// ReflectHandleMsg is used to encode handle messages
55+
type ReflectHandleMsg struct {
56+
Reflect *ReflectPayload `json:"reflect_msg,omitempty"`
57+
ReflectSubMsg *ReflectSubPayload `json:"reflect_sub_msg,omitempty"`
58+
ChangeOwner *OwnerPayload `json:"change_owner,omitempty"`
59+
}
60+
61+
type OwnerPayload struct {
62+
Owner types.Address `json:"owner"`
63+
}
64+
65+
type ReflectPayload struct {
66+
Msgs []typwasmvmtypes.CosmosMsg `json:"msgs"`
67+
}
68+
69+
type ReflectSubPayload struct {
70+
Msgs []typwasmvmtypes.SubMsg `json:"msgs"`
71+
}
72+
73+
// ReflectQueryMsg is used to encode query messages
74+
type ReflectQueryMsg struct {
75+
Owner *struct{} `json:"owner,omitempty"`
76+
Capitalized *Text `json:"capitalized,omitempty"`
77+
Chain *ChainQuery `json:"chain,omitempty"`
78+
SubMsgResult *SubCall `json:"sub_msg_result,omitempty"`
79+
}
80+
81+
type ChainQuery struct {
82+
Request *typwasmvmtypes.QueryRequest `json:"request,omitempty"`
83+
}
84+
85+
type Text struct {
86+
Text string `json:"text"`
87+
}
88+
89+
type SubCall struct {
90+
ID uint64 `json:"id"`
91+
}
92+
93+
type OwnerResponse struct {
94+
Owner string `json:"owner,omitempty"`
95+
}
96+
97+
type ChainResponse struct {
98+
Data []byte `json:"data,omitempty"`
99+
}
200 KB
Binary file not shown.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
set -o errexit -o nounset -o pipefail
3+
command -v shellcheck > /dev/null && shellcheck "$0"
4+
5+
if [ $# -ne 1 ]; then
6+
echo "Usage: ./download_releases.sh RELEASE_TAG"
7+
exit 1
8+
fi
9+
10+
tag="$1"
11+
12+
for contract in burner hackatom ibc_reflect ibc_reflect_send reflect staking cyberpunk; do
13+
url="https://github.com/CosmWasm/cosmwasm/releases/download/$tag/${contract}.wasm"
14+
echo "Downloading $url ..."
15+
wget -O "${contract}.wasm" "$url"
16+
done
17+
18+
# create the zip variant
19+
gzip -k hackatom.wasm
20+
mv hackatom.wasm.gz hackatom.wasm.gzip
21+
22+
rm -f version.txt
23+
echo "$tag" >version.tx

go/cli/testdata/wasm/hackatom.wasm

176 KB
Binary file not shown.
64.4 KB
Binary file not shown.
238 KB
Binary file not shown.
238 KB
Binary file not shown.

0 commit comments

Comments
 (0)