Skip to content

Commit

Permalink
feat(deployment): read mnemonic from env var
Browse files Browse the repository at this point in the history
  • Loading branch information
pacmanifold committed Jun 19, 2023
1 parent 4125993 commit 4cc842a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ This compiles and optimizes all contracts, storing them in `/artifacts` director

## Deployment

When the deployment scripts run for the first time, it will upload code IDs for each contract, instantiate each contract, initialize assets, and set oracles. If you want to redeploy, you must locally delete the `osmo-test-4.json` file in the artifacts directory.
When the deployment scripts run for the first time, it will upload code IDs for each contract, instantiate each contract, initialize assets, and set oracles. If you want to redeploy, you must locally delete the `osmo-test-4.json` file in the artifacts directory. The contracts will be uploaded and instantiated using a wallet created from a 24-word BIP-39 seed phrase in the environment variable `MNEMONIC`. This variable must be set.

Everything related to deployment must be ran from the `scripts` directory.

Expand Down
8 changes: 7 additions & 1 deletion scripts/deploy/base/setupDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import { Deployer } from './deployer'
import { Storage } from './storage'

const getWallet = async (config: DeploymentConfig) => {
return await DirectSecp256k1HdWallet.fromMnemonic(config.deployerMnemonic, {
const mnemonic = process.env.MNEMONIC

if (!mnemonic) {
throw new Error('The environment variable MNEMONIC is not set.')
}

return await DirectSecp256k1HdWallet.fromMnemonic(mnemonic, {
prefix: config.chainPrefix,
})
}
Expand Down
2 changes: 0 additions & 2 deletions scripts/deploy/neutron/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ export const neutronTestnetConfig: DeploymentConfig = {
rewardCollectorTimeoutSeconds: 600,
rpcEndpoint: 'https://rpc-palvus.pion-1.ntrn.tech:443',
safetyFundFeeShare: '0.5',
deployerMnemonic:
'bundle bundle orchard jeans office umbrella bird around taxi arrive infant discover elder they joy misery photo crunch gift fancy pledge attend adult eight', // TODO: Set mnemonic before deploying
slippage_tolerance: '0.01',
base_asset_symbol: 'NTRN',
second_asset_symbol: 'ATOM',
Expand Down
7 changes: 0 additions & 7 deletions scripts/deploy/osmosis/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ export const osmosisTestnetConfig: DeploymentConfig = {
rewardCollectorTimeoutSeconds: 600,
rpcEndpoint: 'https://rpc-test.osmosis.zone',
safetyFundFeeShare: '0.5',
deployerMnemonic:
'elevator august inherit simple buddy giggle zone despair marine rich swim danger blur people hundred faint ladder wet toe strong blade utility trial process',
slippage_tolerance: '0.01',
base_asset_symbol: 'OSMO',
second_asset_symbol: 'ATOM',
Expand Down Expand Up @@ -236,8 +234,6 @@ export const osmosisTestMultisig: DeploymentConfig = {
rewardCollectorTimeoutSeconds: 600,
rpcEndpoint: 'https://rpc-test.osmosis.zone',
safetyFundFeeShare: '0.5',
deployerMnemonic:
'elevator august inherit simple buddy giggle zone despair marine rich swim danger blur people hundred faint ladder wet toe strong blade utility trial process',
slippage_tolerance: '0.01',
base_asset_symbol: 'OSMO',
second_asset_symbol: 'ATOM',
Expand Down Expand Up @@ -272,7 +268,6 @@ export const osmosisMainnet: DeploymentConfig = {
rewardCollectorTimeoutSeconds: 600,
rpcEndpoint: 'https://rpc.osmosis.zone',
safetyFundFeeShare: '0.5',
deployerMnemonic: 'TO BE INSERTED AT TIME OF DEPLOYMENT',
slippage_tolerance: '0.01',
base_asset_symbol: 'OSMO',
second_asset_symbol: 'ATOM',
Expand Down Expand Up @@ -336,8 +331,6 @@ export const osmosisLocalConfig: DeploymentConfig = {
rewardCollectorTimeoutSeconds: 600,
rpcEndpoint: 'http://localhost:26657',
safetyFundFeeShare: '0.2',
deployerMnemonic:
'notice oak worry limit wrap speak medal online prefer cluster roof addict wrist behave treat actual wasp year salad speed social layer crew genius',
slippage_tolerance: '0.05',
base_asset_symbol: 'OSMO',
second_asset_symbol: 'ATOM',
Expand Down
1 change: 0 additions & 1 deletion scripts/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export interface DeploymentConfig {
safetyFundDenom: string
chainId: string
rpcEndpoint: string
deployerMnemonic: string
slippage_tolerance: string
base_asset_symbol: string
second_asset_symbol: string
Expand Down

0 comments on commit 4cc842a

Please sign in to comment.