Skip to content

Commit

Permalink
feat(scripts): Minor refactorings & improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
wottpal committed Sep 17, 2023
1 parent cefb08c commit bf8bf02
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion scripts/deploy/deployDomainGiveaway.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { deployContract } from '@scio-labs/use-inkathon'
import { DeployFn } from 'scripts/types/DeployFn.type'
import { DeployFn } from '../types/DeployFn.type'
import { getDeploymentData } from '../utils/getDeploymentData'

/**
Expand Down
8 changes: 3 additions & 5 deletions scripts/deployAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ const main = async () => {
const secretMerkleRoot = constructMerkleTree(secretCodes).encodedRoot

// Deploy domain-giveaway contract
const domainGiveaway = await deployDomainGiveaway(initParams, {
const domain_giveaway = await deployDomainGiveaway(initParams, {
...(process.env.ADMIN ? { admin: process.env.ADMIN } : {}),
registryAddress,
couponMerkleRoot,
secretMerkleRoot,
})

// Write contract addresses to `{contract}/{network}.ts` files
await writeContractAddresses(chain.network, {
domain_giveaway: domainGiveaway,
})
// Write contract addresses to `{contract}/{network}.ts` file(s)
await writeContractAddresses(chain.network, { domain_giveaway })
}

main()
Expand Down
4 changes: 2 additions & 2 deletions scripts/utils/initPolkadotJs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ export const initPolkadotJs = async (chain: SubstrateChain, uri: string): Promis
// Initialize api
const { api } = await initApi(chain)

// Get chain info
// Print chain info
const network = (await api.rpc.system.chain())?.toString() || ''
const version = (await api.rpc.system.version())?.toString() || ''
console.log(`Initialized API on ${network} (${version})`)

// Get decimals & prefix
const decimals = api.registry.chainDecimals?.[0] || 12
const prefix = api.registry.chainSS58
const prefix = api.registry.chainSS58 || 42
const toBNWithDecimals = (n: number | string) => new BN(n).mul(new BN(10).pow(new BN(decimals)))

// Initialize account & set signer
Expand Down

0 comments on commit bf8bf02

Please sign in to comment.