diff --git a/README.md b/README.md index 091d728..c687251 100644 --- a/README.md +++ b/README.md @@ -102,10 +102,29 @@ TxParams { let contract: ScillaContract = await hre.deployScillaContract("HelloWorld", "Hello World", {gasLimit: 8000}); // Override a parameter ``` +Alternatively, you can deploy them using the `contractDeployer` object injected to `hre`: +```typescript + const contract = await hre.contractDeployer + .withName("Codehash") + .deploy(); + + const contract = await this.hre.contractDeployer + .withName("HelloWorld") + .withContractParams("Hello world!") + .deploy(); + + const contract = await this.hre.contractDeployer + .withName("HelloWorld") + .withContractParams("sss") + .withContractCompression() // To enable contract compression. + .deploy(); +``` + In the same way, you can deploy your libraries with their names: ```typescript -let library: ScillaContract = await hre.deployScillaLibrary("MyLibrary"); +let library: ScillaContract = await hre.deployScillaLibrary("MyLibrary", false); ``` +Pass `true` as the second parameter if you want your library's contract gets compressed before deployment. and finally, here is how you can deploy a contract importing a user-defined library: ```typescript diff --git a/scripts/force-scilla-download.ts b/scripts/force-scilla-download.ts index 0c9baf3..3b146a7 100644 --- a/scripts/force-scilla-download.ts +++ b/scripts/force-scilla-download.ts @@ -1,3 +1,3 @@ -import { parseScilla } from "../src/ScillaParser" +import { parseScilla } from "../src/parser/ScillaParser" parseScilla("test/fixture-projects/hardhat-project/contracts/scilla/HelloWorld.scilla"); diff --git a/src/ZilliqaHardhatObject.ts b/src/ZilliqaHardhatObject.ts index d7fee01..d4a168c 100644 --- a/src/ZilliqaHardhatObject.ts +++ b/src/ZilliqaHardhatObject.ts @@ -5,7 +5,7 @@ import { Zilliqa } from "@zilliqa-js/zilliqa"; import { HardhatPluginError } from "hardhat/plugins"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import * as ScillaContractDeployer from "./ScillaContractDeployer"; +import * as ScillaContractDeployer from "./deployer/ScillaContractDeployer"; // We carefully don't cache the setup object, in case it changes underneath us. export class ZilliqaHardhatObject { @@ -27,7 +27,7 @@ export class ZilliqaHardhatObject { return this.getZilliqaSetup().accounts; } - // Retrieve the default acount used to sign transactions. + // Retrieve the default account used to sign transactions. public getDefaultAccount(): Account | undefined { const wallet = this.getZilliqaSetup().zilliqa.wallet; const defaultAccount = wallet.defaultAccount; diff --git a/src/LogsSimplifier.ts b/src/chai-matcher/LogsSimplifier.ts similarity index 96% rename from src/LogsSimplifier.ts rename to src/chai-matcher/LogsSimplifier.ts index f5f2683..38c23c8 100644 --- a/src/LogsSimplifier.ts +++ b/src/chai-matcher/LogsSimplifier.ts @@ -1,6 +1,6 @@ import { BigNumber } from "@ethersproject/bignumber"; -import { isNumeric } from "./ScillaParser"; +import { isNumeric } from "../parser/ScillaParser"; export const simplifyLogs = function (logs: any) { for (const log of logs) { diff --git a/src/ScillaChaiMatchers.ts b/src/chai-matcher/ScillaChaiMatchers.ts similarity index 100% rename from src/ScillaChaiMatchers.ts rename to src/chai-matcher/ScillaChaiMatchers.ts diff --git a/src/deployer/Deployer.ts b/src/deployer/Deployer.ts new file mode 100644 index 0000000..91897e0 --- /dev/null +++ b/src/deployer/Deployer.ts @@ -0,0 +1,82 @@ +import { TxParams } from "@zilliqa-js/account"; +import { HardhatPluginError } from "hardhat/plugins"; +import { HardhatRuntimeEnvironment } from "hardhat/types"; + +import { + OptionalUserDefinedLibraryList, + ScillaContract, + UserDefinedLibrary, + deploy, +} from "./ScillaContractDeployer"; + +export class ContractDeployer { + private contractName: string; + private compress: boolean; + private userDefinedLibraries: OptionalUserDefinedLibraryList; + private txParams: TxParams | null; + private contractParams: any[]; + + constructor(private hre: HardhatRuntimeEnvironment) { + this.contractName = ""; + this.compress = false; + this.userDefinedLibraries = null; + this.txParams = null; + this.contractParams = []; + } + + reset(): ContractDeployer { + this.contractName = ""; + this.compress = false; + this.userDefinedLibraries = null; + this.txParams = null; + this.contractParams = []; + return this; + } + + withName(contractName: string): ContractDeployer { + this.contractName = contractName; + return this; + } + + withContractParams(...params: any[]): ContractDeployer { + this.contractParams = params; + return this; + } + + withTxParams(params: TxParams): ContractDeployer { + this.txParams = params; + return this; + } + + withContractCompression(): ContractDeployer { + this.compress = true; + return this; + } + + withUserDefinedLibraries(libraries: UserDefinedLibrary[]) { + this.userDefinedLibraries = libraries; + return this; + } + + async deploy(): Promise { + if (this.contractName.trim().length === 0) { + throw new HardhatPluginError( + "hardhat-scilla-plugin", + "You must specify the contract name in order to deploy it." + ); + } + if (this.txParams) { + this.contractParams.push(this.txParams); + } + + const contract = await deploy( + this.hre, + this.contractName, + this.compress, + this.userDefinedLibraries, + ...this.contractParams + ); + this.reset(); + return contract; + } +} diff --git a/src/ScillaContractDeployer.ts b/src/deployer/ScillaContractDeployer.ts similarity index 90% rename from src/ScillaContractDeployer.ts rename to src/deployer/ScillaContractDeployer.ts index 5653908..3998b38 100644 --- a/src/ScillaContractDeployer.ts +++ b/src/deployer/ScillaContractDeployer.ts @@ -8,9 +8,9 @@ import fs from "fs"; import { HardhatPluginError } from "hardhat/plugins"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import * as ScillaContractProxy from "./ScillaContractProxy"; -import { ContractInfo } from "./ScillaContractsInfoUpdater"; -import { Field, Fields, isNumeric } from "./ScillaParser"; +import * as ScillaContractProxy from "../parser/ScillaContractProxy"; +import { ContractInfo } from "../parser/ScillaContractsInfoUpdater"; +import { Field, Fields, isNumeric } from "../parser/ScillaParser"; export interface Value { vname: string; @@ -124,11 +124,12 @@ export interface UserDefinedLibrary { address: string; } -type OptionalUserDefinedLibraryList = UserDefinedLibrary[] | null; +export type OptionalUserDefinedLibraryList = UserDefinedLibrary[] | null; export async function deploy( hre: HardhatRuntimeEnvironment, contractName: string, + compress: boolean, userDefinedLibraries: OptionalUserDefinedLibraryList, ...args: any[] ): Promise { @@ -156,6 +157,7 @@ export async function deploy( const [tx, sc] = await deployFromFile( contractInfo.path, init, + compress, txParamsForContractDeployment ); sc.deployed_by = tx; @@ -167,7 +169,8 @@ export async function deploy( export const deployLibrary = async ( hre: HardhatRuntimeEnvironment, - libraryName: string + libraryName: string, + compress: boolean ): Promise => { const contractInfo: ContractInfo = hre.scillaContracts[libraryName]; if (contractInfo === undefined) { @@ -176,7 +179,7 @@ export const deployLibrary = async ( const init: Init = fillLibraryInit(); - const [tx, sc] = await deployFromFile(contractInfo.path, init, {}); // FIXME: In #45 + const [tx, sc] = await deployFromFile(contractInfo.path, init, compress, {}); // FIXME: In #45 sc.deployed_by = tx; return sc; @@ -261,6 +264,7 @@ const fillInit = ( export async function deployFromFile( path: string, init: Init, + compress: boolean, txParamsForContractDeployment: any ): Promise<[Transaction, ScillaContract]> { if (setup === null) { @@ -271,7 +275,10 @@ export async function deployFromFile( } const deployer = setup.zilliqa.wallet.defaultAccount ?? setup.accounts[0]; - const code = read(path); + let code = read(path); + if (compress) { + code = compressContract(code); + } const contract = setup.zilliqa.contracts.new(code, init); const [tx, sc] = await contract.deploy( { ...setup, pubKey: deployer.publicKey, ...txParamsForContractDeployment }, @@ -287,3 +294,14 @@ export async function deployFromFile( return [tx, sc]; } + +export function compressContract(code: string): string { + // Remove comments + code = code.replace(/(\(\*.*?\*\))/gms, ""); + + // Remove empty lines + code = code.replace(/(^[ \t]*\n)/gm, ""); + + // Remove extra whitespace at the end of the lines + return code.replace(/[ \t]+$/gm, ""); +} diff --git a/src/ScillaContractInteractor.ts b/src/deployer/ScillaContractInteractor.ts similarity index 86% rename from src/ScillaContractInteractor.ts rename to src/deployer/ScillaContractInteractor.ts index 5da3844..4fae125 100644 --- a/src/ScillaContractInteractor.ts +++ b/src/deployer/ScillaContractInteractor.ts @@ -2,13 +2,14 @@ import fs from "fs"; import { HardhatPluginError } from "hardhat/plugins"; import { HardhatRuntimeEnvironment } from "hardhat/types"; -import { ScillaContract } from "./ScillaContractDeployer"; +import * as ScillaContractProxy from "../parser/ScillaContractProxy"; +import { ContractInfo } from "../parser/ScillaContractsInfoUpdater"; +import * as ScillaContractsInfoUpdater from "../parser/ScillaContractsInfoUpdater"; +import { parseScilla } from "../parser/ScillaParser"; +import * as ZilliqaUtils from "../ZilliqaUtils"; + import * as ScillaContractDeployer from "./ScillaContractDeployer"; -import * as ScillaContractProxy from "./ScillaContractProxy"; -import { ContractInfo } from "./ScillaContractsInfoUpdater"; -import * as ScillaContractsInfoUpdater from "./ScillaContractsInfoUpdater"; -import { parseScilla } from "./ScillaParser"; -import * as ZilliqaUtils from "./ZilliqaUtils"; +import { ScillaContract } from "./ScillaContractDeployer"; export async function contractFromAddress( hre: HardhatRuntimeEnvironment, diff --git a/src/ScillaChecker.ts b/src/hardhat-tasks/ScillaChecker.ts similarity index 96% rename from src/ScillaChecker.ts rename to src/hardhat-tasks/ScillaChecker.ts index afbedef..8b8deaa 100644 --- a/src/ScillaChecker.ts +++ b/src/hardhat-tasks/ScillaChecker.ts @@ -3,7 +3,7 @@ import clc from "cli-color"; import { glob } from "glob"; import path from "path"; -import * as ZilliqaUtils from "./ZilliqaUtils"; +import * as ZilliqaUtils from "../ZilliqaUtils"; export async function runScillaChecker(contracts: any, libdir: any) { let files: string[] = []; diff --git a/src/index.ts b/src/index.ts index b074721..a729c53 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,7 @@ import { Init } from "@zilliqa-js/contract"; import { extendEnvironment } from "hardhat/config"; import { lazyFunction, lazyObject } from "hardhat/plugins"; +import { ContractDeployer } from "./deployer/Deployer"; import { deploy, deployFromFile, @@ -11,9 +12,9 @@ import { UserDefinedLibrary, updateSetup, setAccount, -} from "./ScillaContractDeployer"; -import { contractFromAddress } from "./ScillaContractInteractor"; -import { loadScillaContractsInfo } from "./ScillaContractsInfoUpdater"; +} from "./deployer/ScillaContractDeployer"; +import { contractFromAddress } from "./deployer/ScillaContractInteractor"; +import { loadScillaContractsInfo } from "./parser/ScillaContractsInfoUpdater"; import "./task-extensions"; // This import is needed to let the TypeScript compiler know that it should include your type // extensions in your npm package's types file. @@ -25,17 +26,18 @@ export { Setup, initZilliqa, UserDefinedLibrary, -} from "./ScillaContractDeployer"; +} from "./deployer/ScillaContractDeployer"; export { ZilliqaHardhatObject } from "./ZilliqaHardhatObject"; export { BN } from "@zilliqa-js/util"; -export { scillaChaiEventMatcher } from "./ScillaChaiMatchers"; +export { scillaChaiEventMatcher } from "./chai-matcher/ScillaChaiMatchers"; extendEnvironment((hre) => { // We add a field to the Hardhat Runtime Environment here. // We use lazyObject to avoid initializing things until they are actually // needed. hre.scillaContracts = lazyObject(() => loadScillaContractsInfo()); + hre.contractDeployer = lazyObject(() => new ContractDeployer(hre)); hre.setScillaDefaults = lazyFunction(() => (params) => { return updateSetup(params); }); @@ -50,7 +52,7 @@ extendEnvironment((hre) => { hre.deployScillaContract = lazyFunction( () => async (contractName: string, ...args: any[]): Promise => { - return deploy(hre, contractName, [], ...args); + return deploy(hre, contractName, false, [], ...args); } ); @@ -61,14 +63,17 @@ extendEnvironment((hre) => { userDefinedLibraries: UserDefinedLibrary[], ...args: any[] ): Promise => { - return deploy(hre, contractName, userDefinedLibraries, ...args); + return deploy(hre, contractName, false, userDefinedLibraries, ...args); } ); hre.deployScillaLibrary = lazyFunction( () => - async (libraryName: string): Promise => { - return deployLibrary(hre, libraryName); + async ( + libraryName: string, + compress: boolean + ): Promise => { + return deployLibrary(hre, libraryName, compress); } ); @@ -76,9 +81,10 @@ extendEnvironment((hre) => { () => async ( contractPath: string, - init: Init + init: Init, + compress: boolean ): Promise<[Transaction, ScillaContract]> => { - return deployFromFile(contractPath, init, {}); + return deployFromFile(contractPath, init, compress, {}); } ); diff --git a/src/ScillaContractProxy.ts b/src/parser/ScillaContractProxy.ts similarity index 97% rename from src/ScillaContractProxy.ts rename to src/parser/ScillaContractProxy.ts index 0ec0a2c..7bf8533 100644 --- a/src/ScillaContractProxy.ts +++ b/src/parser/ScillaContractProxy.ts @@ -4,8 +4,13 @@ import { CallParams, State } from "@zilliqa-js/contract"; import { BN } from "@zilliqa-js/util"; import { HardhatPluginError } from "hardhat/plugins"; -import * as ScillaContractDeployer from "./ScillaContractDeployer"; -import { ScillaContract, Value, Setup } from "./ScillaContractDeployer"; +import * as ScillaContractDeployer from "../deployer/ScillaContractDeployer"; +import { + ScillaContract, + Value, + Setup, +} from "../deployer/ScillaContractDeployer"; + import { ContractInfo } from "./ScillaContractsInfoUpdater"; import { Field, diff --git a/src/ScillaContractsInfoUpdater.ts b/src/parser/ScillaContractsInfoUpdater.ts similarity index 100% rename from src/ScillaContractsInfoUpdater.ts rename to src/parser/ScillaContractsInfoUpdater.ts diff --git a/src/ScillaParser.ts b/src/parser/ScillaParser.ts similarity index 99% rename from src/ScillaParser.ts rename to src/parser/ScillaParser.ts index ea3953d..b475399 100644 --- a/src/ScillaParser.ts +++ b/src/parser/ScillaParser.ts @@ -4,7 +4,7 @@ import { HardhatPluginError } from "hardhat/plugins"; import path from "path"; import readline from "readline"; -import * as ZilliqaUtils from "./ZilliqaUtils"; +import * as ZilliqaUtils from "../ZilliqaUtils"; // eslint-disable-next-line @typescript-eslint/no-var-requires const parse: any = require("s-expression"); diff --git a/src/task-extensions.ts b/src/task-extensions.ts index 21ef93a..1ccffcd 100644 --- a/src/task-extensions.ts +++ b/src/task-extensions.ts @@ -1,8 +1,8 @@ import clc from "cli-color"; import { task } from "hardhat/config"; -import { runScillaChecker } from "./ScillaChecker"; -import { updateContractsInfo as updateScillaContractsInfo } from "./ScillaContractsInfoUpdater"; +import { runScillaChecker } from "./hardhat-tasks/ScillaChecker"; +import { updateContractsInfo as updateScillaContractsInfo } from "./parser/ScillaContractsInfoUpdater"; task( "scilla-check", diff --git a/src/type-extensions.ts b/src/type-extensions.ts index e28caad..97b7bac 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -6,16 +6,23 @@ import { Init } from "@zilliqa-js/contract"; import "hardhat/types/config"; import "hardhat/types/runtime"; -import { ScillaContract, UserDefinedLibrary } from "./ScillaContractDeployer"; -import { ScillaContracts } from "./ScillaContractsInfoUpdater"; +import { ContractDeployer } from "./deployer/Deployer"; +import { + ScillaContract, + UserDefinedLibrary, +} from "./deployer/ScillaContractDeployer"; +import { ScillaContracts } from "./parser/ScillaContractsInfoUpdater"; // Called ZilliqaHardhatObject to distinguish it from @zilliqa-js/zilliqa:Zilliqa import { ZilliqaHardhatObject } from "./ZilliqaHardhatObject"; declare module "hardhat/types/runtime" { export interface HardhatRuntimeEnvironment { + zilliqa: ZilliqaHardhatObject; scillaContracts: ScillaContracts; + contractDeployer: ContractDeployer; + interactWithScillaContract: ( - contractAdress: string + contractAddress: string ) => Promise; deployScillaContract: ( contractName: string, @@ -26,12 +33,15 @@ declare module "hardhat/types/runtime" { userDefinedLibraries: UserDefinedLibrary[], ...args: any[] ) => Promise; - deployScillaLibrary: (contractName: string) => Promise; + deployScillaLibrary: ( + contractName: string, + compress: boolean + ) => Promise; deployScillaFile: ( contractName: string, - init: Init + init: Init, + compress: boolean ) => Promise<[Transaction, ScillaContract]>; - zilliqa: ZilliqaHardhatObject; getZilliqaChainId: () => number; getNetworkUrl: () => string; getPrivateKeys: () => string[]; diff --git a/test/connect.live.test.ts b/test/connect.live.test.ts index 0dcb43a..7b60a94 100644 --- a/test/connect.live.test.ts +++ b/test/connect.live.test.ts @@ -1,6 +1,6 @@ import chai, { expect } from "chai"; -import { scillaChaiEventMatcher } from "../src/ScillaChaiMatchers"; +import { scillaChaiEventMatcher } from "../src/chai-matcher/ScillaChaiMatchers"; import { useEnvironment } from "./helpers"; diff --git a/test/contract-compression.test.ts b/test/contract-compression.test.ts new file mode 100644 index 0000000..92cb33b --- /dev/null +++ b/test/contract-compression.test.ts @@ -0,0 +1,43 @@ +import { expect } from "chai"; + +import { compressContract } from "../src/deployer/ScillaContractDeployer"; + +describe("Contract Compression", function () { + it("#1", async function () { + const code = `(***************************************************) +(* The contract definition *) +(***************************************************) +contract HelloWorld +(owner: ByStr20)` + const compressed = compressContract(code); + expect(compressed).to.be.eq(`contract HelloWorld +(owner: ByStr20)`) + }); + + it("#2", async function () { + const code = `(*something*)contract HelloWorld +(owner: ByStr20)` + const compressed = compressContract(code); + expect(compressed).to.be.eq(`contract HelloWorld +(owner: ByStr20)`) + }); + + it("#3", async function () { + const code = `contract HelloWorld (* a dummy comment*) +(owner: ByStr20)` + const compressed = compressContract(code); + expect(compressed).to.be.eq(`contract HelloWorld +(owner: ByStr20)`) + }); + + it("#4", async function () { + const code = `contract WithComment (*contract name*) +() +(*fields*) +field welcome_msg : String = "" (*welcome*) (*another comment*) ` + const compressed = compressContract(code); + expect(compressed).to.be.eq(`contract WithComment +() +field welcome_msg : String = ""`) + }); +}); diff --git a/test/defaults.test.ts b/test/defaults.test.ts index 7cd52a4..ecc1733 100644 --- a/test/defaults.test.ts +++ b/test/defaults.test.ts @@ -1,8 +1,8 @@ import { BN, Long } from "@zilliqa-js/util"; import chai, { expect } from "chai"; -import { scillaChaiEventMatcher } from "../src/ScillaChaiMatchers"; -import { setup } from "../src/ScillaContractDeployer"; +import { scillaChaiEventMatcher } from "../src/chai-matcher/ScillaChaiMatchers"; +import { setup } from "../src/deployer/ScillaContractDeployer"; import { useEnvironment } from "./helpers"; diff --git a/test/deploy.live.test.ts b/test/deploy.live.test.ts index 51c5f16..760cd82 100644 --- a/test/deploy.live.test.ts +++ b/test/deploy.live.test.ts @@ -1,6 +1,6 @@ import chai, { expect } from "chai"; -import { scillaChaiEventMatcher } from "../src/ScillaChaiMatchers"; +import { scillaChaiEventMatcher } from "../src/chai-matcher/ScillaChaiMatchers"; import { useEnvironment } from "./helpers"; @@ -21,4 +21,40 @@ describe("", function () { }); }); }); + + describe("Contract deployment using deployer", function () { + it("Should be able to deploy a contract", async function () { + const contract = await this.hre.contractDeployer + .withName("Codehash") + .deploy(); + + expect(contract.address).not.null; + }); + + it("Should be able to deploy a contract with initial params", async function () { + const contract = await this.hre.contractDeployer + .withName("HelloWorld") + .withContractParams("Hello world!") + .deploy(); + + console.log(contract.isDeployed()); + expect(contract.address).not.null; + }); + + it("Should be able to deploy a contract with compression", async function () { + const contract = await this.hre.contractDeployer + .withName("HelloWorld") + .withContractParams("sss") + .withContractCompression() + .deploy(); + + console.log(contract.error); + + const tx = await contract.getHello(); + await expect(tx).to.have.eventLogWithParams("getHello()", { + value: "", + vname: "msg", + }); + }); + }); }); diff --git a/test/fixture-projects/hardhat-project/contracts/scilla/WithComment.scilla b/test/fixture-projects/hardhat-project/contracts/scilla/WithComment.scilla new file mode 100644 index 0000000..0194a51 --- /dev/null +++ b/test/fixture-projects/hardhat-project/contracts/scilla/WithComment.scilla @@ -0,0 +1,31 @@ + +(***************************************************) +(* The contract definition *) +(***************************************************) +scilla_version 0 (*version*) + +contract WithComment (*contract name*) +() +(*fields*) +field welcome_msg : String = "" (*welcome*) + +(*first transition*) +transition setHello (msg : String) + is_owner = builtin eq owner _sender; + match is_owner with + | False => + e = {_eventname : "setHello()"; code : not_owner_code}; + event e + | True => + welcome_msg := msg; + e = {_eventname : "setHello()"; code : set_hello_code}; + event e + end +end + +(*second transition*) +transition getHello () + r <- welcome_msg; (*dummy comment*) + e = {_eventname: "getHello()"; msg: r}; + event e +end diff --git a/test/helpers.ts b/test/helpers.ts index c9dab8c..08aa054 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -2,8 +2,8 @@ import { resetHardhatContext } from "hardhat/plugins-testing"; import { HardhatRuntimeEnvironment } from "hardhat/types"; import path from "path"; -import { initZilliqa } from "../src/ScillaContractDeployer"; -import { updateContractsInfo } from "../src/ScillaContractsInfoUpdater"; +import { initZilliqa } from "../src/deployer/ScillaContractDeployer"; +import { updateContractsInfo } from "../src/parser/ScillaContractsInfoUpdater"; import * as ZilliqaHardhatObject from "../src/ZilliqaHardhatObject"; declare module "mocha" { @@ -17,7 +17,7 @@ export function useEnvironment(fixtureProjectName: string) { before("Loading hardhat environment", async function () { process.chdir(path.join(__dirname, "fixture-projects", fixtureProjectName)); this.hre = require("hardhat"); - await initZilliqa( + initZilliqa( process.env.ZILLIQA_API_URL || this.hre.getNetworkUrl(), this.hre.getZilliqaChainId(), this.hre.getPrivateKeys(), diff --git a/test/logs-simplifier.test.ts b/test/logs-simplifier.test.ts index 89125d6..b471be6 100644 --- a/test/logs-simplifier.test.ts +++ b/test/logs-simplifier.test.ts @@ -1,7 +1,7 @@ import { BigNumber } from "@ethersproject/bignumber"; import { expect } from "chai"; -import { simplifyLogs } from "../src/LogsSimplifier"; +import { simplifyLogs } from "../src/chai-matcher/LogsSimplifier"; describe("", function () { describe("Logs simplifier", function () { diff --git a/test/scilla-checker.test.ts b/test/scilla-checker.test.ts index 8bf3af5..108c5ab 100644 --- a/test/scilla-checker.test.ts +++ b/test/scilla-checker.test.ts @@ -1,7 +1,7 @@ import chai from "chai"; import chaiSubset from "chai-subset"; -import { runScillaChecker } from "../src/ScillaChecker"; +import { runScillaChecker } from "../src/hardhat-tasks/ScillaChecker"; chai.use(chaiSubset); describe("", function () { diff --git a/test/scilla-contracts-updater.test.ts b/test/scilla-contracts-updater.test.ts index 548fc78..f539ecd 100644 --- a/test/scilla-contracts-updater.test.ts +++ b/test/scilla-contracts-updater.test.ts @@ -6,7 +6,7 @@ import { ContractInfo, loadScillaContractsInfo, updateContractsInfo, -} from "../src/ScillaContractsInfoUpdater"; +} from "../src/parser/ScillaContractsInfoUpdater"; chai.use(chaiSubset); describe("", function () { diff --git a/test/scilla-generate-adt-type.test.ts b/test/scilla-generate-adt-type.test.ts index 44d9ee1..259ef94 100644 --- a/test/scilla-generate-adt-type.test.ts +++ b/test/scilla-generate-adt-type.test.ts @@ -1,7 +1,7 @@ import chai, { expect } from "chai"; import chaiSubset from "chai-subset"; -import { ParsedContract, parseScilla } from "../src/ScillaParser"; +import { ParsedContract, parseScilla } from "../src/parser/ScillaParser"; chai.use(chaiSubset); describe("Scilla Parser should parse contracts successfully", function () { diff --git a/test/scilla-parser.test.ts b/test/scilla-parser.test.ts index eb68deb..ecc7863 100644 --- a/test/scilla-parser.test.ts +++ b/test/scilla-parser.test.ts @@ -6,7 +6,7 @@ import { ParsedContract, parseScilla, parseScillaLibrary, -} from "../src/ScillaParser"; +} from "../src/parser/ScillaParser"; chai.use(chaiSubset); describe("", function () { diff --git a/test/zilliqa.test.ts b/test/zilliqa.test.ts index 9e60dfd..32367fd 100644 --- a/test/zilliqa.test.ts +++ b/test/zilliqa.test.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { initZilliqa } from "../src/ScillaContractDeployer"; +import { initZilliqa } from "../src/deployer/ScillaContractDeployer"; import * as ZilliqaHardhatObject from "../src/ZilliqaHardhatObject"; describe("", function () {