Skip to content

Commit

Permalink
remove unused scripts + specs
Browse files Browse the repository at this point in the history
  • Loading branch information
RnkSngh committed Aug 27, 2024
1 parent 7bf8fd5 commit 48622c0
Show file tree
Hide file tree
Showing 10 changed files with 0 additions and 330 deletions.
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
"main": "dist/index.js",
"bin": {
"verify-vibc-core-smart-contracts": "./dist/scripts/verify-contract-script.js",
"deploy-vibc-core-smart-contracts": "./dist/scripts/deploy-script.js",
"update-vibc-core-smart-contracts": "./dist/scripts/update-contracts-script.js",
"setup-vibc-core-dispatcher": "./dist/scripts/setup-dispatcher-script.js",
"vibc-core-deploy-test": "./dist/scripts/fork-deployment-test.js",
"vibc-core-deploy-multisig": "./dist/scripts/deploy-multisig.js",
"vibc-core-execute-multisig-tx": "./dist/scripts/execute-multisig-tx.js"
Expand Down
29 changes: 0 additions & 29 deletions specs/contracts.setup.spec.yaml

This file was deleted.

94 changes: 0 additions & 94 deletions specs/contracts.spec.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions specs/upgrade.spec.yaml

This file was deleted.

60 changes: 0 additions & 60 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,63 +175,3 @@ export const deployContract = async (
throw err;
}
};

export async function deployToChain(
chain: Chain,
accountRegistry: AccountRegistry,
deploySpec: ContractRegistry,
logger: Logger,
dryRun = false,
forceDeployNewContracts = false, // True if you want to use existing deployments when possible
writeContracts: boolean = true, // True if you want to save persisted artifact files.
extraContractFactories: Record<string, any> = {}
) {
logger.info(
`deploying ${deploySpec.size} contract(s) to chain ${chain.chainName}-${
chain.deploymentEnvironment
} with contractNames: [${deploySpec.keys()}]`
);

let nonces: Record<string, number> = {}; // maps addresses to nonces
if (!dryRun) {
accountRegistry = connectProviderAccounts(accountRegistry, chain.rpc);
}

// @ts-ignore
const env: StringToStringMap = { ...process.env, chain };
if (!forceDeployNewContracts) {
// Only read from existing contract files if we want to deploy new ones
await readDeploymentFilesIntoEnv(env, chain);
}

// result is the final contract registry after deployment, modified in place
const cleanedSourceSpec = ContractRegistryLoader.loadSingle(
JSON.parse(JSON.stringify(deploySpec.serialize()))
);

const result = ContractRegistryLoader.emptySingle(); // Contains the filled in deployed addresses

for (const contract of cleanedSourceSpec.values()) {
const deployedContract = await deployContract(
chain,
accountRegistry,
contract,
logger,
dryRun,
writeContracts,
extraContractFactories,
nonces,
env
);
result.set(deployedContract.name, deployedContract);
}

logger.info(
`[${chain.chainName}-${chain.deploymentEnvironment}]: finished deploying ${result.size} contracts`
);

return {
chainName: chain.chainName,
contracts: result,
};
}
4 changes: 0 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import { Registry } from "./utils/registry";
import { ContractRegistryLoader } from "./evm/schemas/contract";
import { parseObjFromFile } from "./utils/io";
import { loadEvmAccounts } from "./evm/schemas/account";
import { deployToChain } from "./deploy";
import { sendTxToChain } from "./tx";
import { updateContractsForChain } from "./updateContract";

export {
deployToChain,
sendTxToChain,
updateContractsForChain,
Chain,
Registry,
Expand Down
23 changes: 0 additions & 23 deletions src/scripts/deploy-script.ts

This file was deleted.

31 changes: 0 additions & 31 deletions src/scripts/setup-dispatcher-script.ts

This file was deleted.

50 changes: 0 additions & 50 deletions src/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,53 +121,3 @@ export async function sendTx(
throw err;
}
}

/**
* Send a tx to an existing contract. Reads contract from the _existingContracts args. Can be used for upgrading proxy to new implementation contracts as well
*/
export async function sendTxToChain(
chain: Chain, // existing contract registry for this chain
accountRegistry: AccountRegistry, // Set of accounts to send txs from
existingContracts: ContractRegistry, // Used as a supplementary address source for tests where the contract address is not saved as artifacts
transactionSpec: TxRegistry, // The txs to send
logger: Logger,
dryRun = false
) {
logger.debug(
`sending ${transactionSpec.size} transaction(s) to chain ${
chain.chainName
}-${
chain.deploymentEnvironment
} with contractNames: [${transactionSpec.keys()}]`
);

if (!dryRun) {
accountRegistry = connectProviderAccounts(accountRegistry, chain.rpc);
}

// result is the final contract registry after deployment, modified in place
const result = loadTxRegistry(
JSON.parse(JSON.stringify(transactionSpec.serialize()))
);
const existingContractAddresses: Record<string, string> = {};
existingContracts.toList().forEach((item) => {
existingContractAddresses[item.name] = item.address ? item.address : "0x";
});

// @ts-ignore
let env = await readDeploymentFilesIntoEnv({}, chain); // Read from existing deployment files first, then overwrite with explicitly given contract addresses
env = { ...env, ...existingContractAddresses, chain };

for (const tx of result.values()) {
await sendTx(
chain,
accountRegistry,
existingContracts,
tx,
logger,
dryRun,
{},
env
);
}
}
2 changes: 0 additions & 2 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ export default defineConfig({
"src/evm/chain.ts",
"src/evm/contracts/*.ts",
"src/evm/schemas/*.ts",
"src/scripts/deploy-script.ts",
"src/scripts/update-contracts-script.ts",
"src/scripts/verify-contract-script.ts",
"src/scripts/fork-deployment-test.ts",
"src/scripts/setup-dispatcher-script.ts",
"src/scripts/deploy-multisig.ts",
"src/scripts/execute-multisig-tx.ts",
],
Expand Down

0 comments on commit 48622c0

Please sign in to comment.