From 72e78d756f0922c3d48c297b6cedf21602347be6 Mon Sep 17 00:00:00 2001 From: MartinGbz Date: Wed, 15 Jan 2025 12:27:34 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20issue=20on=20RiskStewards?= =?UTF-8?q?=20contract=20name=20(#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generator/common.ts | 4 ++++ generator/templates/proposal.template.ts | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/generator/common.ts b/generator/common.ts index 19c2131..8881fce 100644 --- a/generator/common.ts +++ b/generator/common.ts @@ -50,6 +50,10 @@ export function getPoolChain(pool: PoolIdentifier) { return chain; } +export function getPoolSuffix(pool: PoolIdentifier) { + return pool.replace('AaveV3', ''); +} + export function getDate() { const date = new Date(); const years = date.getFullYear(); diff --git a/generator/templates/proposal.template.ts b/generator/templates/proposal.template.ts index 2c88db0..bf2ea36 100644 --- a/generator/templates/proposal.template.ts +++ b/generator/templates/proposal.template.ts @@ -1,4 +1,10 @@ -import {generateContractName, getPoolChain, generateFolderName, getChainAlias} from '../common'; +import { + generateContractName, + getPoolChain, + generateFolderName, + getChainAlias, + getPoolSuffix, +} from '../common'; import {Options, PoolConfig, PoolIdentifier} from '../types'; import {prefixWithImports} from '../utils/importsResolver'; import {prefixWithPragma} from '../utils/constants'; @@ -10,6 +16,7 @@ export const proposalTemplate = ( ) => { const {title, author, discussion} = options; const chain = getPoolChain(pool); + const poolSuffix = getPoolSuffix(pool); const folderName = generateFolderName(options); const contractName = generateContractName(options, pool); @@ -24,11 +31,13 @@ export const proposalTemplate = ( * @title ${title || 'TODO'} * @author ${author || 'TODO'} * - discussion: ${discussion || 'TODO'} - * - deploy-command: make run-script contract=${chain == 'ZkSync' ? 'zksync/' : ''}src/contracts/updates/${folderName}/${contractName}.sol:${contractName} network=${getChainAlias( + * - deploy-command: make run-script contract=${ + chain == 'ZkSync' ? 'zksync/' : '' + }src/contracts/updates/${folderName}/${contractName}.sol:${contractName} network=${getChainAlias( chain )} broadcast=false generate_diff=true skip_timelock=false */ - contract ${contractName} is ${`RiskStewards${chain === 'Base' ? 'BaseChain' : chain}`} { + contract ${contractName} is ${`RiskStewards${poolSuffix === 'Base' ? 'BaseChain' : poolSuffix}`} { function name() public pure override returns (string memory) { return '${contractName}'; }