Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
saeed-zil committed Mar 4, 2024
1 parent 7d5bef0 commit 26af6a0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
1 change: 0 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ module.exports = {
"max-len": "off",
"new-parens": "off",
"newline-per-chained-call": "off",
"no-bitwise": "error",
"no-caller": "error",
"no-cond-assign": "error",
"no-console": "off",
Expand Down
5 changes: 3 additions & 2 deletions src/ScillaChaiMatchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const scillaChaiEventMatcher = function (
const tx: Transaction = this._obj;

const receipt = tx.getReceipt()!;
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
new Assertion(receipt.event_logs).not.to.be.null;

const event_logs = receipt.event_logs!;
Expand All @@ -42,14 +43,14 @@ export const scillaChaiEventMatcher = function (
);
});

Assertion.addMethod("eventLogWithParams", function (
Assertion.addMethod("eventLogWithParams", async function (
eventName: string,
...params: EventParam[]
) {
const tx: Transaction = this._obj;

const receipt = tx.getReceipt()!;
new Assertion(this._obj).to.eventLog(eventName);
await new Assertion(this._obj).to.eventLog(eventName);

const event_logs = simplifyLogs(receipt.event_logs!);
const desiredLog = event_logs.filter(
Expand Down
8 changes: 2 additions & 6 deletions src/ScillaContractDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ export async function deploy(
throw new Error(`Scilla contract ${contractName} doesn't exist.`);
}

let sc: ScillaContract;
let tx: Transaction;
let txParamsForContractDeployment = {};
if (contractInfo.parsedContract.constructorParams && args.length === contractInfo.parsedContract.constructorParams.length + 1) {
// The last param is Tx info such as amount, nonce, gasPrice
Expand All @@ -154,7 +152,7 @@ export async function deploy(
...args
);

[tx, sc] = await deployFromFile(contractInfo.path, init, txParamsForContractDeployment);
const [tx, sc] = await deployFromFile(contractInfo.path, init, txParamsForContractDeployment);
sc.deployed_by = tx;

ScillaContractProxy.injectProxies(setup!, contractInfo, sc);
Expand All @@ -171,11 +169,9 @@ export const deployLibrary = async (
throw new Error(`Scilla contract ${libraryName} doesn't exist.`);
}

let sc: ScillaContract;
let tx: Transaction;
const init: Init = fillLibraryInit();

[tx, sc] = await deployFromFile(contractInfo.path, init, {}); // FIXME: In #45
const [tx, sc] = await deployFromFile(contractInfo.path, init, {}); // FIXME: In #45
sc.deployed_by = tx;

return sc;
Expand Down
5 changes: 3 additions & 2 deletions src/ScillaContractProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Account } from "@zilliqa-js/account";
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 { ContractInfo } from "./ScillaContractsInfoUpdater";
Expand Down Expand Up @@ -62,8 +63,8 @@ function handleUnnamedParam(param: Field, arg: any): Value {
return arg.toString();
} else {
const values: Value[] = [];
param.typeJSON.argtypes.forEach((param: Field, index: number) => {
values.push(handleUnnamedParam(param, arg[index]));
param.typeJSON.argtypes.forEach((f: Field, index: number) => {
values.push(handleUnnamedParam(f, arg[index]));
});
const argtypes = param.typeJSON.argtypes.map((x) => x.type);
/*
Expand Down
2 changes: 1 addition & 1 deletion src/ScillaParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const parseScillaLibrary = async (
}

return {
name: libraryName,
name: libraryName || "",
transitions: [],
fields: [],
constructorParams: [],
Expand Down

0 comments on commit 26af6a0

Please sign in to comment.