Skip to content

Commit

Permalink
fix: local deploy script problem with generateRandomName (#53)
Browse files Browse the repository at this point in the history
* fix: error on local deployment

* refactor: move generateName to avoid circular dependency
  • Loading branch information
heueristik authored Apr 11, 2024
1 parent 39a3b87 commit 5d892e4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
5 changes: 5 additions & 0 deletions packages/contracts/deploy/00_info/01_info.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {PLUGIN_REPO_ENS_SUBDOMAIN_NAME} from '../../plugin-settings';
import {
AragonOSxAsciiArt,
getProductionNetworkName,
Expand Down Expand Up @@ -52,6 +53,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
await deployer.getBalance()
)} native tokens.`
);

console.log(
`Chosen PluginRepo ENS subdomain name: '${PLUGIN_REPO_ENS_SUBDOMAIN_NAME}'`
);
};

export default func;
Expand Down
12 changes: 11 additions & 1 deletion packages/contracts/plugin-settings.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import buildMetadata from './src/build-metadata.json';
import releaseMetadata from './src/release-metadata.json';
import {generateRandomName} from './utils/helpers';
import {VersionTag} from '@aragon/osx-commons-sdk';

export function generateRandomName(length: number): string {
const allowedCharacters = 'abcdefghijklmnopqrstuvwxyz-0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += allowedCharacters.charAt(
Math.floor(Math.random() * allowedCharacters.length)
);
}
return result;
}

// Specify your plugin implementation and plugin setup contract name.
export const PLUGIN_CONTRACT_NAME = 'MyPlugin'; // See `packages/contracts/src/MyPlugin.sol`.
export const PLUGIN_SETUP_CONTRACT_NAME = 'MyPluginSetup'; // See `packages/contracts/src/MyPluginSetup.sol`.
Expand Down
11 changes: 0 additions & 11 deletions packages/contracts/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,5 @@ export async function createVersion(
return tx;
}

export function generateRandomName(length: number): string {
const allowedCharacters = 'abcdefghijklmnopqrstuvwxyz-0123456789';
let result = '';
for (let i = 0; i < length; i++) {
result += allowedCharacters.charAt(
Math.floor(Math.random() * allowedCharacters.length)
);
}
return result;
}

export const AragonOSxAsciiArt =
" ____ _____ \n /\\ / __ \\ / ____| \n / \\ _ __ __ _ __ _ ___ _ __ | | | | (_____ __ \n / /\\ \\ | '__/ _` |/ _` |/ _ \\| '_ \\ | | | |\\___ \\ \\/ / \n / ____ \\| | | (_| | (_| | (_) | | | | | |__| |____) > < \n /_/ \\_\\_| \\__,_|\\__, |\\___/|_| |_| \\____/|_____/_/\\_\\ \n __/ | \n |___/ \n";

0 comments on commit 5d892e4

Please sign in to comment.