Merge pull request #456 from CosmWasm/cosmwasm-0.11-simon

Update CosmWasm to 0.11
This commit is contained in:
Simon Warta 2020-10-09 12:17:36 +02:00 committed by GitHub
commit fa1c2833b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 277 additions and 164 deletions

View File

@ -136,7 +136,7 @@ jobs:
- run:
environment:
WASMD_ENABLED: 1
ERC20_ENABLED: 1
# ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
@ -245,7 +245,7 @@ jobs:
- run:
environment:
WASMD_ENABLED: 1
ERC20_ENABLED: 1
# ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1
@ -335,7 +335,7 @@ jobs:
- run:
environment:
WASMD_ENABLED: 1
ERC20_ENABLED: 1
# ERC20_ENABLED: 1
SIMAPP_ENABLED: 1
TENDERMINT_ENABLED: 1
SOCKETSERVER_ENABLED: 1

View File

@ -11,7 +11,7 @@ const msg: MsgDelegate = {
delegator_address: senderAddress,
// To get the proper validator address, start the demo chain (./scripts/wasmd/start.sh), then run:
// curl http://localhost:1317/staking/validators | jq '.result[0].operator_address'
validator_address: "cosmosvaloper103c7vm0c5mz85ecdy4ldftk4a3ydcyp2sscqrz",
validator_address: "cosmosvaloper1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r3arurr",
amount: coin(300000, "ustake"),
},
};

View File

@ -6,11 +6,12 @@ An SDK to build CosmWasm clients.
## Compatibility
| CosmWasm | x/wasm | @cosmjs/cosmwasm |
| -------- | ------ | ---------------- |
| 0.10 | 0.10 | `^0.22.0` |
| 0.9 | 0.9 | `^0.21.0` |
| 0.8 | 0.8 | `^0.20.1` |
| CosmWasm | x/wasm | @cosmjs/cosmwasm |
| --------- | --------- | ---------------- |
| 0.10-0.11 | 0.10-0.11 | `^0.23.0` |
| 0.10 | 0.10 | `^0.22.0` |
| 0.9 | 0.9 | `^0.21.0` |
| 0.8 | 0.8 | `^0.20.1` |
## Development
@ -18,7 +19,7 @@ Updating Hackatom development contract in `src/testdata/contract.json`:
```sh
cd packages/cosmwasm
export HACKATOM_URL=https://github.com/CosmWasm/cosmwasm/releases/download/v0.10.0-alpha2/hackatom.wasm
export HACKATOM_URL=https://github.com/CosmWasm/cosmwasm/releases/download/v0.11.0-alpha4/hackatom.wasm
echo "{\"// source\": \"$HACKATOM_URL\", \"data\": \"$(curl -sS --location $HACKATOM_URL | base64)\" }" | jq > src/testdata/contract.json
```

View File

@ -19,10 +19,9 @@ import { SigningCosmWasmClient } from "./signingcosmwasmclient";
import cosmoshub from "./testdata/cosmoshub.json";
import {
alice,
deployedErc20,
deployedHackatom,
getHackatom,
makeRandomAddress,
pendingWithoutErc20,
pendingWithoutWasmd,
tendermintIdMatcher,
unused,
@ -255,16 +254,15 @@ describe("CosmWasmClient", () => {
describe("getCodes", () => {
it("works", async () => {
pendingWithoutWasmd();
pendingWithoutErc20(); // TODO: Adapt test to use hackatom instead
const client = new CosmWasmClient(wasmd.endpoint);
const result = await client.getCodes();
expect(result.length).toBeGreaterThanOrEqual(1);
const [first] = result;
expect(first).toEqual({
id: deployedErc20.codeId,
source: deployedErc20.source,
builder: deployedErc20.builder,
checksum: deployedErc20.checksum,
id: deployedHackatom.codeId,
source: deployedHackatom.source,
builder: deployedHackatom.builder,
checksum: deployedHackatom.checksum,
creator: alice.address0,
});
});
@ -273,15 +271,14 @@ describe("CosmWasmClient", () => {
describe("getCodeDetails", () => {
it("works", async () => {
pendingWithoutWasmd();
pendingWithoutErc20(); // TODO: Adapt test to use hackatom instead
const client = new CosmWasmClient(wasmd.endpoint);
const result = await client.getCodeDetails(1);
const expectedInfo: Code = {
id: deployedErc20.codeId,
source: deployedErc20.source,
builder: deployedErc20.builder,
checksum: deployedErc20.checksum,
id: deployedHackatom.codeId,
source: deployedHackatom.source,
builder: deployedHackatom.builder,
checksum: deployedHackatom.checksum,
creator: alice.address0,
};
@ -293,13 +290,12 @@ describe("CosmWasmClient", () => {
it("caches downloads", async () => {
pendingWithoutWasmd();
pendingWithoutErc20(); // TODO: Adapt test to use hackatom instead
const client = new CosmWasmClient(wasmd.endpoint);
const openedClient = (client as unknown) as PrivateCosmWasmClient;
const getCodeSpy = spyOn(openedClient.lcdClient.wasm, "getCode").and.callThrough();
const result1 = await client.getCodeDetails(deployedErc20.codeId); // from network
const result2 = await client.getCodeDetails(deployedErc20.codeId); // from cache
const result1 = await client.getCodeDetails(deployedHackatom.codeId); // from network
const result2 = await client.getCodeDetails(deployedHackatom.codeId); // from cache
expect(result2).toEqual(result1);
expect(getCodeSpy).toHaveBeenCalledTimes(1);
@ -309,31 +305,30 @@ describe("CosmWasmClient", () => {
describe("getContracts", () => {
it("works", async () => {
pendingWithoutWasmd();
pendingWithoutErc20(); // TODO: Adapt test to use hackatom instead
const client = new CosmWasmClient(wasmd.endpoint);
const result = await client.getContracts(1);
expect(result.length).toBeGreaterThanOrEqual(3);
const [hash, isa, jade] = result;
expect(hash).toEqual({
address: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
codeId: 1,
const [zero, one, two] = result;
expect(zero).toEqual({
address: deployedHackatom.instances[0].address,
codeId: deployedHackatom.codeId,
creator: alice.address0,
admin: undefined,
label: "HASH",
label: deployedHackatom.instances[0].label,
});
expect(isa).toEqual({
address: "cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd",
codeId: 1,
expect(one).toEqual({
address: deployedHackatom.instances[1].address,
codeId: deployedHackatom.codeId,
creator: alice.address0,
admin: undefined,
label: "ISA",
label: deployedHackatom.instances[1].label,
});
expect(jade).toEqual({
address: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c",
codeId: 1,
expect(two).toEqual({
address: deployedHackatom.instances[2].address,
codeId: deployedHackatom.codeId,
creator: alice.address0,
admin: alice.address1,
label: "JADE",
label: deployedHackatom.instances[2].label,
});
});
});
@ -341,27 +336,27 @@ describe("CosmWasmClient", () => {
describe("getContract", () => {
it("works for instance without admin", async () => {
pendingWithoutWasmd();
pendingWithoutErc20(); // TODO: Adapt test to use hackatom instead
const client = new CosmWasmClient(wasmd.endpoint);
const hash = await client.getContract("cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5");
expect(hash).toEqual({
address: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
codeId: 1,
const zero = await client.getContract(deployedHackatom.instances[0].address);
expect(zero).toEqual({
address: deployedHackatom.instances[0].address,
codeId: deployedHackatom.codeId,
creator: alice.address0,
label: "HASH",
label: deployedHackatom.instances[0].label,
admin: undefined,
});
});
it("works for instance with admin", async () => {
pendingWithoutWasmd();
pendingWithoutErc20(); // TODO: Adapt test to use hackatom instead
const client = new CosmWasmClient(wasmd.endpoint);
const jade = await client.getContract("cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c");
expect(jade).toEqual(
const two = await client.getContract(deployedHackatom.instances[2].address);
expect(two).toEqual(
jasmine.objectContaining({
address: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c",
label: "JADE",
address: deployedHackatom.instances[2].address,
codeId: deployedHackatom.codeId,
creator: alice.address0,
label: deployedHackatom.instances[2].label,
admin: alice.address1,
}),
);
@ -452,7 +447,10 @@ describe("CosmWasmClient", () => {
const client = new CosmWasmClient(wasmd.endpoint);
await client.queryContractSmart(contract.address, { broken: {} }).then(
() => fail("must not succeed"),
(error) => expect(error).toMatch(/query wasm contract failed: parsing hackatom::contract::QueryMsg/i),
(error) =>
expect(error).toMatch(
/query wasm contract failed: Error parsing into type hackatom::contract::QueryMsg: unknown variant/i,
),
);
});

View File

@ -33,11 +33,10 @@ import {
base64Matcher,
bech32AddressMatcher,
ContractUploadInstructions,
deployedErc20,
deployedHackatom,
fromOneElementArray,
getHackatom,
makeRandomAddress,
pendingWithoutErc20,
pendingWithoutWasmd,
wasmd,
wasmdEnabled,
@ -350,7 +349,10 @@ describe("WasmExtension", () => {
const request = { nosuchkey: {} };
await client.wasm.queryContractSmart(hackatomContractAddress, request).then(
() => fail("shouldn't succeed"),
(error) => expect(error).toMatch(/query wasm contract failed: parsing hackatom::contract::QueryMsg/),
(error) =>
expect(error).toMatch(
/query wasm contract failed: Error parsing into type hackatom::contract::QueryMsg: unknown variant/,
),
);
});
@ -369,45 +371,48 @@ describe("WasmExtension", () => {
describe("txsQuery", () => {
it("can query by tags (module + code_id)", async () => {
pendingWithoutWasmd();
pendingWithoutErc20();
const client = makeWasmClient(wasmd.endpoint);
const result = await client.txsQuery(`message.module=wasm&message.code_id=${deployedErc20.codeId}`);
const result = await client.txsQuery(`message.module=wasm&message.code_id=${deployedHackatom.codeId}`);
expect(parseInt(result.count, 10)).toBeGreaterThanOrEqual(4);
// Check first 4 results
const [store, hash, isa, jade] = result.txs.map((tx) => fromOneElementArray(tx.tx.value.msg));
const [store, zero, one, two] = result.txs.map((tx) => fromOneElementArray(tx.tx.value.msg));
assert(isMsgStoreCode(store));
assert(isMsgInstantiateContract(hash));
assert(isMsgInstantiateContract(isa));
assert(isMsgInstantiateContract(jade));
assert(isMsgInstantiateContract(zero));
assert(isMsgInstantiateContract(one));
assert(isMsgInstantiateContract(two));
expect(store.value).toEqual(
jasmine.objectContaining({
sender: alice.address0,
source: deployedErc20.source,
builder: deployedErc20.builder,
source: deployedHackatom.source,
builder: deployedHackatom.builder,
}),
);
expect(hash.value).toEqual({
code_id: deployedErc20.codeId.toString(),
expect(zero.value).toEqual({
code_id: deployedHackatom.codeId.toString(),
init_funds: [],
init_msg: jasmine.objectContaining({
symbol: "HASH",
beneficiary: deployedHackatom.instances[0].beneficiary,
}),
label: "HASH",
label: deployedHackatom.instances[0].label,
sender: alice.address0,
});
expect(isa.value).toEqual({
code_id: deployedErc20.codeId.toString(),
expect(one.value).toEqual({
code_id: deployedHackatom.codeId.toString(),
init_funds: [],
init_msg: jasmine.objectContaining({ symbol: "ISA" }),
label: "ISA",
init_msg: jasmine.objectContaining({
beneficiary: deployedHackatom.instances[1].beneficiary,
}),
label: deployedHackatom.instances[1].label,
sender: alice.address0,
});
expect(jade.value).toEqual({
code_id: deployedErc20.codeId.toString(),
expect(two.value).toEqual({
code_id: deployedHackatom.codeId.toString(),
init_funds: [],
init_msg: jasmine.objectContaining({ symbol: "JADE" }),
label: "JADE",
init_msg: jasmine.objectContaining({
beneficiary: deployedHackatom.instances[2].beneficiary,
}),
label: deployedHackatom.instances[2].label,
sender: alice.address0,
admin: alice.address1,
});
@ -416,12 +421,11 @@ describe("WasmExtension", () => {
// Like previous test but filtered by message.action=store-code and message.action=instantiate
it("can query by tags (module + code_id + action)", async () => {
pendingWithoutWasmd();
pendingWithoutErc20();
const client = makeWasmClient(wasmd.endpoint);
{
const uploads = await client.txsQuery(
`message.module=wasm&message.code_id=${deployedErc20.codeId}&message.action=store-code`,
`message.module=wasm&message.code_id=${deployedHackatom.codeId}&message.action=store-code`,
);
expect(parseInt(uploads.count, 10)).toEqual(1);
const store = fromOneElementArray(uploads.txs[0].tx.value.msg);
@ -429,42 +433,46 @@ describe("WasmExtension", () => {
expect(store.value).toEqual(
jasmine.objectContaining({
sender: alice.address0,
source: deployedErc20.source,
builder: deployedErc20.builder,
source: deployedHackatom.source,
builder: deployedHackatom.builder,
}),
);
}
{
const instantiations = await client.txsQuery(
`message.module=wasm&message.code_id=${deployedErc20.codeId}&message.action=instantiate`,
`message.module=wasm&message.code_id=${deployedHackatom.codeId}&message.action=instantiate`,
);
expect(parseInt(instantiations.count, 10)).toBeGreaterThanOrEqual(3);
const [hash, isa, jade] = instantiations.txs.map((tx) => fromOneElementArray(tx.tx.value.msg));
assert(isMsgInstantiateContract(hash));
assert(isMsgInstantiateContract(isa));
assert(isMsgInstantiateContract(jade));
expect(hash.value).toEqual({
code_id: deployedErc20.codeId.toString(),
const [zero, one, two] = instantiations.txs.map((tx) => fromOneElementArray(tx.tx.value.msg));
assert(isMsgInstantiateContract(zero));
assert(isMsgInstantiateContract(one));
assert(isMsgInstantiateContract(two));
expect(zero.value).toEqual({
code_id: deployedHackatom.codeId.toString(),
init_funds: [],
init_msg: jasmine.objectContaining({
symbol: "HASH",
beneficiary: deployedHackatom.instances[0].beneficiary,
}),
label: "HASH",
label: deployedHackatom.instances[0].label,
sender: alice.address0,
});
expect(isa.value).toEqual({
code_id: deployedErc20.codeId.toString(),
expect(one.value).toEqual({
code_id: deployedHackatom.codeId.toString(),
init_funds: [],
init_msg: jasmine.objectContaining({ symbol: "ISA" }),
label: "ISA",
init_msg: jasmine.objectContaining({
beneficiary: deployedHackatom.instances[1].beneficiary,
}),
label: deployedHackatom.instances[1].label,
sender: alice.address0,
});
expect(jade.value).toEqual({
code_id: deployedErc20.codeId.toString(),
expect(two.value).toEqual({
code_id: deployedHackatom.codeId.toString(),
init_funds: [],
init_msg: jasmine.objectContaining({ symbol: "JADE" }),
label: "JADE",
init_msg: jasmine.objectContaining({
beneficiary: deployedHackatom.instances[2].beneficiary,
}),
label: deployedHackatom.instances[2].label,
sender: alice.address0,
admin: alice.address1,
});

View File

@ -158,9 +158,15 @@ export function setupWasmExtension(base: LcdClient): WasmExtension {
queryContractRaw: async (address: string, key: Uint8Array) => {
const hexKey = toHex(key);
const path = `/wasm/contract/${address}/raw/${hexKey}?encoding=hex`;
const responseData = (await base.get(path)) as WasmResponse<WasmData[]>;
const responseData = (await base.get(path)) as WasmResponse<WasmData[] | null | string>;
const data = unwrapWasmResponse(responseData);
return data.length === 0 ? null : fromBase64(data[0].val);
if (Array.isArray(data)) {
// The CosmWasm 0.10 interface
return data.length === 0 ? null : fromBase64(data[0].val);
} else {
// The CosmWasm 0.11 interface
return !data ? null : fromBase64(data); // Yes, we cannot differentiate empty fields from non-existent fields :(
}
},
queryContractSmart: async (address: string, query: Record<string, unknown>) => {
const encoded = toHex(toUtf8(JSON.stringify(query)));

View File

@ -17,14 +17,7 @@ import { assert } from "@cosmjs/utils";
import { PrivateCosmWasmClient } from "./cosmwasmclient";
import { setupWasmExtension, WasmExtension } from "./lcdapi/wasm";
import { PrivateSigningCosmWasmClient, SigningCosmWasmClient, UploadMeta } from "./signingcosmwasmclient";
import {
alice,
getHackatom,
makeRandomAddress,
pendingWithoutWasmd,
unused,
validatorAddress,
} from "./testutils.spec";
import { alice, getHackatom, makeRandomAddress, pendingWithoutWasmd, unused, wasmd } from "./testutils.spec";
const httpUrl = "http://localhost:1317";
@ -49,11 +42,11 @@ describe("SigningCosmWasmClient", () => {
upload: {
amount: [
{
amount: "3140000",
amount: "4710000",
denom: "utest",
},
],
gas: "1000000",
gas: "1500000",
},
init: {
amount: [
@ -114,11 +107,11 @@ describe("SigningCosmWasmClient", () => {
upload: {
amount: [
{
amount: "25000",
amount: "37500",
denom: "ucosm",
},
],
gas: "1000000",
gas: "1500000",
},
init: {
amount: [
@ -180,11 +173,11 @@ describe("SigningCosmWasmClient", () => {
upload: {
amount: [
{
amount: "3140000",
amount: "4710000",
denom: "utest",
},
],
gas: "1000000",
gas: "1500000",
},
init: {
amount: [
@ -549,7 +542,7 @@ describe("SigningCosmWasmClient", () => {
type: "cosmos-sdk/MsgDelegate",
value: {
delegator_address: alice.address0,
validator_address: validatorAddress,
validator_address: wasmd.validator.address,
amount: coin(1234, "ustake"),
},
};

View File

@ -56,12 +56,12 @@ function prepareBuilder(buider: string | undefined): string {
const defaultGasPrice = GasPrice.fromString("0.025ucosm");
const defaultGasLimits: GasLimits<CosmWasmFeeTable> = {
upload: 1000000,
init: 500000,
migrate: 200000,
exec: 200000,
send: 80000,
changeAdmin: 80000,
upload: 1_500_000,
init: 500_000,
migrate: 200_000,
exec: 200_000,
send: 80_000,
changeAdmin: 80_000,
};
export interface UploadMeta {

File diff suppressed because one or more lines are too long

View File

@ -29,26 +29,6 @@ export const base64Matcher = /^(?:[a-zA-Z0-9+/]{4})*(?:|(?:[a-zA-Z0-9+/]{3}=)|(?
// https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32
export const bech32AddressMatcher = /^[\x21-\x7e]{1,83}1[02-9ac-hj-np-z]{38}$/;
/** Deployed as part of scripts/wasmd/init.sh */
export const deployedErc20 = {
codeId: 1,
source: "https://crates.io/api/v1/crates/cw-erc20/not-yet-released/download",
builder: "cosmwasm/rust-optimizer:0.9.0",
checksum: "0f14abcc6fed08f2dd06896db974989db97dbcc6e8e30188b73fe5ab427c7785",
instances: [
"cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", // HASH
"cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd", // ISA
"cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c", // JADE
],
};
export const wasmd = {
endpoint: "http://localhost:1317",
chainId: "testing",
};
export const validatorAddress = "cosmosvaloper103c7vm0c5mz85ecdy4ldftk4a3ydcyp2sscqrz";
export const alice = {
mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park",
pubkey0: {
@ -73,6 +53,52 @@ export const unused = {
sequence: 0,
};
/** Deployed as part of scripts/wasmd/init.sh */
export const deployedHackatom = {
codeId: 1,
source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download",
builder: "cosmwasm/rust-optimizer:0.9.1",
checksum: "3defc33a41f58c71d38b176d521c411d8e74d26403fde7660486930c7579a016",
instances: [
{
beneficiary: alice.address0,
address: "cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5",
label: "From deploy_hackatom.js (0)",
},
{
beneficiary: alice.address1,
address: "cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd",
label: "From deploy_hackatom.js (1)",
},
{
beneficiary: alice.address2,
address: "cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c",
label: "From deploy_hackatom.js (2)",
},
],
};
/** Deployed as part of scripts/wasmd/init.sh */
export const deployedErc20 = {
codeId: 2,
source: "https://crates.io/api/v1/crates/cw-erc20/not-yet-released/download",
builder: "cosmwasm/rust-optimizer:0.9.0",
checksum: "0f14abcc6fed08f2dd06896db974989db97dbcc6e8e30188b73fe5ab427c7785",
instances: [
"cosmos18vd8fpwxzck93qlwghaj6arh4p7c5n89uzcee5", // HASH
"cosmos1hqrdl6wstt8qzshwc6mrumpjk9338k0lr4dqxd", // ISA
"cosmos18r5szma8hm93pvx6lwpjwyxruw27e0k5uw835c", // JADE
],
};
export const wasmd = {
endpoint: "http://localhost:1317",
chainId: "testing",
validator: {
address: "cosmosvaloper1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r3arurr",
},
};
export function wasmdEnabled(): boolean {
return !!process.env.WASMD_ENABLED;
}

View File

@ -17,7 +17,7 @@ describe("SlashingExtension", () => {
height: jasmine.stringMatching(nonNegativeIntegerMatcher),
result: [
{
address: "cosmosvalcons1zxds6samewvdpgt8cwpjtk3e8rdf26xu63dlqd",
address: "cosmosvalcons1m74e42saykuj34ugc7weqq4kc97fn5ecqpdl2q",
start_height: "0",
index_offset: jasmine.stringMatching(nonNegativeIntegerMatcher),
jailed_until: "1970-01-01T00:00:00Z",

View File

@ -27,11 +27,11 @@ export const wasmd = {
endpoint: "http://localhost:1317",
chainId: "testing",
moniker: "node001",
commissionUpdateTime: "2020-09-23T15:11:14.6660427Z",
commissionUpdateTime: "2020-10-08T10:18:11.2275025Z",
validator: {
pubkey: "cosmosvalconspub1zcjduepq2dayuk3xq8rxqq6lyw6aqp2jaywdr8d855g09jf9h527zqwhqxgq7vf6kf",
address: "cosmosvaloper103c7vm0c5mz85ecdy4ldftk4a3ydcyp2sscqrz",
delegatorAddress: "cosmos103c7vm0c5mz85ecdy4ldftk4a3ydcyp24yv403",
pubkey: "cosmosvalconspub1zcjduepqf62c9h86qqn4g9s4khcng86quanw8rn5mm6lf69c99vxff0302ksv2ljyl",
address: "cosmosvaloper1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r3arurr",
delegatorAddress: "cosmos1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r5fhf0s",
},
};

View File

@ -1,2 +1,3 @@
0f14abcc6fed08f2dd06896db974989db97dbcc6e8e30188b73fe5ab427c7785 cw-erc20.wasm
ebc2b11e2afa50d5dcd4234840cd581e948a59d888bb8d651598bba3732cd8ee cw-nameservice.wasm
3defc33a41f58c71d38b176d521c411d8e74d26403fde7660486930c7579a016 hackatom.wasm

BIN
scripts/wasmd/contracts/hackatom.wasm (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,76 @@
#!/usr/bin/env node
/* eslint-disable @typescript-eslint/naming-convention */
const { SigningCosmWasmClient } = require("@cosmjs/cosmwasm");
const { Secp256k1HdWallet } = require("@cosmjs/launchpad");
const fs = require("fs");
const httpUrl = "http://localhost:1317";
const alice = {
mnemonic: "enlist hip relief stomach skate base shallow young switch frequent cry park",
address0: "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada",
address1: "cosmos1hhg2rlu9jscacku2wwckws7932qqqu8x3gfgw0",
address2: "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5",
address3: "cosmos17yg9mssjenmc3jkqth6ulcwj9cxujrxxzezwta",
address4: "cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce",
};
const codeMeta = {
source: "https://crates.io/api/v1/crates/hackatom/not-yet-released/download",
builder: "cosmwasm/rust-optimizer:0.9.1",
};
const inits = [
{
label: "From deploy_hackatom.js (0)",
msg: {
beneficiary: alice.address0,
verifier: alice.address0,
},
admin: undefined,
},
{
label: "From deploy_hackatom.js (1)",
msg: {
beneficiary: alice.address1,
verifier: alice.address1,
},
admin: undefined,
},
{
label: "From deploy_hackatom.js (2)",
msg: {
beneficiary: alice.address2,
verifier: alice.address2,
},
admin: alice.address1,
},
];
async function main() {
const wallet = await Secp256k1HdWallet.fromMnemonic(alice.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, alice.address0, wallet);
const wasm = fs.readFileSync(__dirname + "/contracts/hackatom.wasm");
const uploadReceipt = await client.upload(wasm, codeMeta, "Upload hackatom contract");
console.info(`Upload succeeded. Receipt: ${JSON.stringify(uploadReceipt)}`);
for (const { label, msg, admin } of inits) {
const { contractAddress } = await client.instantiate(uploadReceipt.codeId, msg, label, {
memo: `Create a hackatom instance in deploy_hackatom.js`,
admin: admin,
});
console.info(`Contract instantiated at ${contractAddress}`);
}
}
main().then(
() => {
console.info("All done, let the coins flow.");
process.exit(0);
},
(error) => {
console.error(error);
process.exit(1);
},
);

View File

@ -1,5 +1,5 @@
# Choose from https://hub.docker.com/r/cosmwasm/wasmd/tags
REPOSITORY="cosmwasm/wasmd"
VERSION="v0.10.0"
VERSION="v0.11.1"
CONTAINER_NAME="wasmd"

View File

@ -24,5 +24,6 @@ SCRIPT_DIR="$(realpath "$(dirname "$0")")"
cd "$SCRIPT_DIR/contracts"
sha256sum --check checksums.sha256
)
"$SCRIPT_DIR/deploy_erc20.js"
"$SCRIPT_DIR/deploy_nameservice.js"
"$SCRIPT_DIR/deploy_hackatom.js"
# "$SCRIPT_DIR/deploy_erc20.js"
# "$SCRIPT_DIR/deploy_nameservice.js"

View File

@ -1 +0,0 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wOS0yMyAxNToxMToxNS4zOTU5Nzc5ICswMDAwIFVUQyBtPSswLjM0NjczNjMwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6Im1FYkRfZlZoWjUyR1BYVjIifQ.ZTFudH1lWZFVe_vBBV73K48D5C7nj4D0jI9XIWtHlN28BloP6CWHKw.kdPuBtWiEaw6Q7yF.u5k6dvT1IufD_KzXi6rXAqVU6s5MQ9I5bbi5HRY7Cm3wRDIsWaiAkhMdRCX8l0DYj2MqXH7IzGSWOAsmHw2Xbovwp3_CV0-QZn1ALb8hDuoWAcVat2KQxd2ilmsgPVy2PyUR9g7QJllIBcr-uUfBTp2XoXsmdYClVHS67JVu7EdQ410vDU4gUsOqquNKIqdNP5ZfIH9Sz_TsYckQwQRnqR3sDKUr28uXl2Pqs0G9lVhn1XxlWoUIrPxMsRL5q6M.fBJYWSAGRv1DB4JVBqmbNg

View File

@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMDoxODoxMS41Nzk5MTc2ICswMDAwIFVUQyBtPSswLjIwODQ1NTkwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6IlBtZXB4NExXMlk4bFM2cXEifQ.NgxU8Oa0GROusbronyRkzPRHIngrFnnfNKxCVCYtsQX6rhKU8eQrig.SXfPznlVJlsFGvPi.jSjG-b9uurXrTRdXHbCi14O_XwOV-ob6cRbmWNwIcSxoib2X-zByj20XRyHzJbpJ2S7CBq-Xop0tiY6x3AIgrUSlpMdUYxEr1pHsB1pVtWVJ9QNym3KN4DFL0zDrIXKQGZZLSZddfTTe9HP7iVqApqA2uK0DSMVEAUYLe_GWqpgaIkbrZYO1YUhCaVWgZkXO7d9OLknmWtIrhE5SpC0evSkbsWlfbPulsYhEflxQA5d77-dogshyys0F4h-L410.GudaoqjS4Tzj8E4JwTXM9Q

View File

@ -1 +1 @@
$2a$10$KjCoH2Ogpta5l9JGDwzkkusW9z9NYCv0kFgQXYf8ZpAKgz7ARQwva
$2a$10$YzaMyzpLWAscnjy9KQ7ujORZSelnaBAVF9WpTjrG/7L2ylc9iaEjC

View File

@ -1 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wOS0yMyAxNToxMToxNS4zODE4MTAxICswMDAwIFVUQyBtPSswLjMzMjY0MzAwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6Ik5HR0xVeEZ4eHVvUUVBMjcifQ.2pPJONN22K88-ldWr3cLTC1IkTsBumZGn7hzU2FZysQrtfKuUhXopA.7hqZmyPddwRGa4Xg.h29Y4fGduamp6W5IzjRoWNIiyD8n3zsF6t-5t_eK_VEuyQEt0hGrwb3CYEV6g1ld4gF16iqNlzAfWsv-kkREno5_diZZAlLWDgpQDOUhxrQaKZYmrFPU70alpnzOSlFWIsxXG0a-XDsBRq583N-Yfrof_UQWH5dJ4PmLHnlt-dVhM7yPkTF1eRJgN4UnHJid2zaO7zPyzrw_dA76goNRStjfv95W2B8RE8by_2tr_ZIfQWDZv-44tNCgOoUzEFLLW50LJ4FQrS-PL5iJPI4Frp3ExMbSKFqLNw_JGWeYTutY6GrcT_OOGzlYcCouC7HJLONt7IOp-_QVfRb4FEnDkKFggKqpVCoKS4Xa-0b9x8wgIIcp.a_x-yHs1mOdAPRWYIfW8ig
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0wOCAxMDoxODoxMS41NTkzMjQgKzAwMDAgVVRDIG09KzAuMTg3ODYwODAxIiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiV19XUWlpakllT2VNakNGSiJ9.yszrRkA7Z1aAjKwPPyQebxsMEB57B_OXryuMuZnR2cIeAfchu5x4Rg.W4qQ-Kc7TkvjH7Gr.yPYQV6Wlb-M_spbO5o2CTYMwdJUxWkUpEEZ9a72zoR3AzH3AKdv34vPHDB5bYbNXdt-f0qPWnpr2B-UsoBXSIbpY4ZjD68ry2Ct6X9cMZMN1XOCXqpN4qBG7W8Il_qcIKVMt_S9Ct1utMwhnht7uvItW3AQmp6CIj35f4mk8R3U5u3pSczI8gnuiAhrVWgjWghznsVLG2fArOs1akGIMJaQm7FaldU7gsvW_vOwD8h9zVnAGypmI37J1XDJWZVhNQAupOdaIWtzJkJSW8cEAjTIF9GhA_ysLk11nw5jXc8NR6r9Bqk3sfDph0_NFC5uSmAUCqMuGePdjmgPaQWBlmRkOzG4AXB6_PI-D83ZtRZ215PPe.UyvabgVuUaaHQWcHigiK2g

View File

@ -7,7 +7,7 @@
"type": "cosmos-sdk/Account",
"value": {
"account_number": "0",
"address": "cosmos103c7vm0c5mz85ecdy4ldftk4a3ydcyp24yv403",
"address": "cosmos1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r5fhf0s",
"coins": [
{
"amount": "1000000000",
@ -606,7 +606,7 @@
"amount": [],
"gas": "200000"
},
"memo": "3d253cc5185f6dcfdb2084a6bba902d70b0bbd0d@172.17.0.5:26656",
"memo": "aaf7eb061829f888de02b377eeb64009317c330d@172.17.0.2:26656",
"msg": [
{
"type": "cosmos-sdk/MsgCreateValidator",
@ -616,7 +616,7 @@
"max_rate": "0.200000000000000000",
"rate": "0.100000000000000000"
},
"delegator_address": "cosmos103c7vm0c5mz85ecdy4ldftk4a3ydcyp24yv403",
"delegator_address": "cosmos1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r5fhf0s",
"description": {
"details": "",
"identity": "",
@ -625,8 +625,8 @@
"website": ""
},
"min_self_delegation": "1",
"pubkey": "cosmosvalconspub1zcjduepq2dayuk3xq8rxqq6lyw6aqp2jaywdr8d855g09jf9h527zqwhqxgq7vf6kf",
"validator_address": "cosmosvaloper103c7vm0c5mz85ecdy4ldftk4a3ydcyp2sscqrz",
"pubkey": "cosmosvalconspub1zcjduepqf62c9h86qqn4g9s4khcng86quanw8rn5mm6lf69c99vxff0302ksv2ljyl",
"validator_address": "cosmosvaloper1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r3arurr",
"value": {
"amount": "250000000",
"denom": "ustake"
@ -638,9 +638,9 @@
{
"pub_key": {
"type": "tendermint/PubKeySecp256k1",
"value": "Aw/GXguVCZWw03ADgT0n0RdYChOId8TJxzrmvDJzhhJQ"
"value": "Atm7XWIgFRE+ONf4mOD15/1f8hst97O8efn8b6o2nP6Q"
},
"signature": "fHFXV5EdCw9uRC1Abk+slDHrXB3l25iKCDfp5+rVhm5M1/KiHD4prKq/2hru4l3hHVm+UkfK0TxYGiz8J4TEJQ=="
"signature": "nc7CR9iYk1QrQX/gRkBIXh2T2/7Os0IxegsFsVuZBL1pDO4KdzjyokuS2pNdxCiL3+v9pJqVsEJ2LVhSqwGqQQ=="
}
]
}
@ -742,5 +742,5 @@
]
}
},
"genesis_time": "2020-09-23T15:11:14.6660427Z"
"genesis_time": "2020-10-08T10:18:11.2275025Z"
}

View File

@ -1 +0,0 @@
{"type":"cosmos-sdk/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgCreateValidator","value":{"description":{"moniker":"node001","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"cosmos103c7vm0c5mz85ecdy4ldftk4a3ydcyp24yv403","validator_address":"cosmosvaloper103c7vm0c5mz85ecdy4ldftk4a3ydcyp2sscqrz","pubkey":"cosmosvalconspub1zcjduepq2dayuk3xq8rxqq6lyw6aqp2jaywdr8d855g09jf9h527zqwhqxgq7vf6kf","value":{"denom":"ustake","amount":"250000000"}}}],"fee":{"amount":[],"gas":"200000"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"Aw/GXguVCZWw03ADgT0n0RdYChOId8TJxzrmvDJzhhJQ"},"signature":"fHFXV5EdCw9uRC1Abk+slDHrXB3l25iKCDfp5+rVhm5M1/KiHD4prKq/2hru4l3hHVm+UkfK0TxYGiz8J4TEJQ=="}],"memo":"3d253cc5185f6dcfdb2084a6bba902d70b0bbd0d@172.17.0.5:26656"}}

View File

@ -0,0 +1 @@
{"type":"cosmos-sdk/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgCreateValidator","value":{"description":{"moniker":"node001","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"cosmos1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r5fhf0s","validator_address":"cosmosvaloper1yfkkk04ve8a0sugj4fe6q6zxuvmvza8r3arurr","pubkey":"cosmosvalconspub1zcjduepqf62c9h86qqn4g9s4khcng86quanw8rn5mm6lf69c99vxff0302ksv2ljyl","value":{"denom":"ustake","amount":"250000000"}}}],"fee":{"amount":[],"gas":"200000"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"Atm7XWIgFRE+ONf4mOD15/1f8hst97O8efn8b6o2nP6Q"},"signature":"nc7CR9iYk1QrQX/gRkBIXh2T2/7Os0IxegsFsVuZBL1pDO4KdzjyokuS2pNdxCiL3+v9pJqVsEJ2LVhSqwGqQQ=="}],"memo":"aaf7eb061829f888de02b377eeb64009317c330d@172.17.0.2:26656"}}

View File

@ -1 +1 @@
{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"onuFneEXM0vUuxUL8tky4HQ0HE6MYGraDNUugxXWadYWTd8ZkGWUCJA8k1zUCCQ7or51gDByvwHG6a+cR420/w=="}}
{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"rWvxJlMCesZt37kdUbHXzN/KDkDfivFFXhoHMR82inld5iugvAJDG+0NDWC0wHmUUhZ91qk1WMpaQ0ugyJ0gmg=="}}

View File

@ -1,11 +1,11 @@
{
"address": "119B0D43BBCB98D0A167C38325DA3938DA9568DC",
"address": "DFAB9AAA1D25B928D788C79D9002B6C17C99D338",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "U3pOWiYBxmADXyO10AVS6RzRnaelEPLJJb0V4QHXAZA="
"value": "TpWC3PoAJ1QWFbXxNB9A52bjjnTe9fTouClYZKXxeq0="
},
"priv_key": {
"type": "tendermint/PrivKeyEd25519",
"value": "tI5T8cr1zXPo/cRlSSzIT5wS7muXy9Bu6fx0+c6MkfRTek5aJgHGYANfI7XQBVLpHNGdp6UQ8sklvRXhAdcBkA=="
"value": "LL3jL3sv9AdrNkFBrc3QmucjDC7W/xVUWsBsjnfkIx5OlYLc+gAnVBYVtfE0H0DnZuOOdN719Oi4KVhkpfF6rQ=="
}
}