Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: store hexed address #119

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions script/deploy/warp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export async function deployNativeTokenWarp(
{ ctx, client, network }: Dependencies,
mailbox: string,
config: WarpTokenConfig<'native'>,
): Promise<{ type: 'hpl_warp_native'; address: string } | undefined> {
): Promise<
{ type: 'hpl_warp_native'; address: string; hexed: string } | undefined
> {
const deployments = ctx.deployments;

const preload = deployments?.warp?.native?.find((v) => v.id === config.id);
Expand Down Expand Up @@ -102,7 +104,9 @@ export async function deployCw20TokenWarp(
{ ctx, client, network }: Dependencies,
mailbox: string,
config: WarpTokenConfig<'cw20'>,
): Promise<{ type: 'hpl_warp_cw20'; address: string } | undefined> {
): Promise<
{ type: 'hpl_warp_cw20'; address: string; hexed: string } | undefined
> {
const deployments = ctx.deployments;

const preload = deployments?.warp?.cw20?.find((v) => v.id === config.id);
Expand Down
6 changes: 5 additions & 1 deletion script/shared/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import path from 'path';
import { defaultContextPath } from './constants';
import { ContractNames } from './contract';

type typed<T extends ContractNames> = { type: T; address: string };
type typed<T extends ContractNames> = {
type: T;
address: string;
hexed: string;
};

export type ContextIsm =
| (typed<'hpl_ism_aggregate'> & {
Expand Down
10 changes: 7 additions & 3 deletions script/shared/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Client } from './config';
import { contractNames } from './constants';
import { Context } from './context';
import { Logger } from './logger';
import { waitTx } from './utils';
import { extractByte32AddrFromBech32, waitTx } from './utils';

const logger = new Logger('contract');

Expand All @@ -15,7 +15,7 @@ export async function deployContract<T extends ContractNames>(
{ wasm, stargate, signer }: Client,
contractName: T,
initMsg: object,
): Promise<{ type: T; address: string }> {
): Promise<{ type: T; address: string; hexed: string }> {
logger.debug(`deploying ${contractName}`);

const codeId = ctx.artifacts[contractName];
Expand All @@ -36,7 +36,11 @@ export async function deployContract<T extends ContractNames>(
}

logger.info(`deployed ${contractName} at ${res.contractAddress}`);
return { type: contractName, address: res.contractAddress };
return {
type: contractName,
address: res.contractAddress,
hexed: extractByte32AddrFromBech32(res.contractAddress),
};
}

export async function executeContract(
Expand Down
Loading