Skip to content

Commit

Permalink
Fix unit test hardhat
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Nov 6, 2023
1 parent b3d25f4 commit 1a0e06d
Show file tree
Hide file tree
Showing 11 changed files with 903 additions and 329 deletions.
9 changes: 5 additions & 4 deletions packages/hardhat/contracts/mocks/OwnableCelesteMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ interface IArbitrator {
* @param _evidence Data submitted for the evidence related to the dispute
*/
function submitEvidence(
IArbitrable _subject,
uint256 _disputeId,
address _submitter,
bytes calldata _evidence
) external;

/**
* @dev Close the evidence period of a dispute
* @param _subject Arbitrable instance submitting the dispute
* @param _disputeId Identification number of the dispute to close its evidence submitting period
*/
function closeEvidencePeriod(
Expand Down Expand Up @@ -395,7 +395,6 @@ contract OwnableCeleste is IArbitrator {

/**
* @notice Submit evidence for a dispute #`_disputeId`
* @param _subject Arbitrable instance submitting the dispute
* @param _disputeId Identification number of the dispute receiving new evidence
* @param _submitter Address of the account submitting the evidence
* @param _evidence Data submitted for the evidence of the dispute
Expand All @@ -405,9 +404,11 @@ contract OwnableCeleste is IArbitrator {
address _submitter,
bytes calldata _evidence
) external disputeExists(_disputeId) {
IArbitrable _subject = IArbitrable(msg.sender);
Dispute storage dispute = disputes[_disputeId];
require(dispute.subject == _subject, "DM_SUBJECT_NOT_DISPUTE_SUBJECT");
require(
dispute.subject == IArbitrable(msg.sender),
"DM_SUBJECT_NOT_DISPUTE_SUBJECT"
);
emit EvidenceSubmitted(_disputeId, _submitter, _evidence);
}

Expand Down
1 change: 0 additions & 1 deletion packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { config as dotenvConfig } from "dotenv";
import "hardhat-deploy";
import fs from "fs";
import chalk from "chalk";
import "@tenderly/hardhat-tenderly";
import "@nomiclabs/hardhat-etherscan";
import "@openzeppelin/hardhat-upgrades";
import "@nomiclabs/hardhat-ethers";
Expand Down
1 change: 0 additions & 1 deletion packages/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@openzeppelin/contracts": "^4.9.2",
"@openzeppelin/contracts-upgradeable": "^4.9.3",
"@openzeppelin/hardhat-upgrades": "^1.0.0",
"@tenderly/hardhat-tenderly": "^1.7.7",
"@typechain/ethers-v5": "^5.0.0",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
Expand Down
56 changes: 56 additions & 0 deletions packages/hardhat/typechain/IArbitrable.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */

import {
ethers,
EventFilter,
Signer,
BigNumber,
BigNumberish,
PopulatedTransaction,
} from "ethers";
import { Contract, ContractTransaction } from "@ethersproject/contracts";
import { BytesLike } from "@ethersproject/bytes";
import { Listener, Provider } from "@ethersproject/providers";
import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi";

interface IArbitrableInterface extends ethers.utils.Interface {
functions: {};

events: {
"Ruled(address,uint256,uint256)": EventFragment;
};

getEvent(nameOrSignatureOrTopic: "Ruled"): EventFragment;
}

export class IArbitrable extends Contract {
connect(signerOrProvider: Signer | Provider | string): this;
attach(addressOrName: string): this;
deployed(): Promise<this>;

on(event: EventFilter | string, listener: Listener): this;
once(event: EventFilter | string, listener: Listener): this;
addListener(eventName: EventFilter | string, listener: Listener): this;
removeAllListeners(eventName: EventFilter | string): this;
removeListener(eventName: any, listener: Listener): this;

interface: IArbitrableInterface;

functions: {};

callStatic: {};

filters: {
Ruled(
arbitrator: string | null,
disputeId: BigNumberish | null,
ruling: null
): EventFilter;
};

estimateGas: {};

populateTransaction: {};
}
124 changes: 67 additions & 57 deletions packages/hardhat/typechain/IArbitrator.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ interface IArbitratorInterface extends ethers.utils.Interface {
functions: {
"getDisputeFees()": FunctionFragment;
"submitEvidence(uint256,address,bytes)": FunctionFragment;
"closeEvidencePeriod(uint256)": FunctionFragment;
"createDispute(uint256,bytes)": FunctionFragment;
"closeEvidencePeriod(address,uint256)": FunctionFragment;
"rule(uint256)": FunctionFragment;
};

Expand All @@ -37,14 +37,14 @@ interface IArbitratorInterface extends ethers.utils.Interface {
functionFragment: "submitEvidence",
values: [BigNumberish, string, BytesLike]
): string;
encodeFunctionData(
functionFragment: "closeEvidencePeriod",
values: [BigNumberish]
): string;
encodeFunctionData(
functionFragment: "createDispute",
values: [BigNumberish, BytesLike]
): string;
encodeFunctionData(
functionFragment: "closeEvidencePeriod",
values: [string, BigNumberish]
): string;
encodeFunctionData(functionFragment: "rule", values: [BigNumberish]): string;

decodeFunctionResult(
Expand All @@ -56,11 +56,11 @@ interface IArbitratorInterface extends ethers.utils.Interface {
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "closeEvidencePeriod",
functionFragment: "createDispute",
data: BytesLike
): Result;
decodeFunctionResult(
functionFragment: "createDispute",
functionFragment: "closeEvidencePeriod",
data: BytesLike
): Result;
decodeFunctionResult(functionFragment: "rule", data: BytesLike): Result;
Expand Down Expand Up @@ -116,16 +116,6 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<ContractTransaction>;

closeEvidencePeriod(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

"closeEvidencePeriod(uint256)"(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

createDispute(
_possibleRulings: BigNumberish,
_metadata: BytesLike,
Expand All @@ -138,6 +128,18 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<ContractTransaction>;

closeEvidencePeriod(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

"closeEvidencePeriod(address,uint256)"(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

rule(
_disputeId: BigNumberish,
overrides?: Overrides
Expand Down Expand Up @@ -183,16 +185,6 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<ContractTransaction>;

closeEvidencePeriod(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

"closeEvidencePeriod(uint256)"(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

createDispute(
_possibleRulings: BigNumberish,
_metadata: BytesLike,
Expand All @@ -205,6 +197,18 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<ContractTransaction>;

closeEvidencePeriod(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

"closeEvidencePeriod(address,uint256)"(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<ContractTransaction>;

rule(
_disputeId: BigNumberish,
overrides?: Overrides
Expand Down Expand Up @@ -250,16 +254,6 @@ export class IArbitrator extends Contract {
overrides?: CallOverrides
): Promise<void>;

closeEvidencePeriod(
_disputeId: BigNumberish,
overrides?: CallOverrides
): Promise<void>;

"closeEvidencePeriod(uint256)"(
_disputeId: BigNumberish,
overrides?: CallOverrides
): Promise<void>;

createDispute(
_possibleRulings: BigNumberish,
_metadata: BytesLike,
Expand All @@ -272,6 +266,18 @@ export class IArbitrator extends Contract {
overrides?: CallOverrides
): Promise<BigNumber>;

closeEvidencePeriod(
_subject: string,
_disputeId: BigNumberish,
overrides?: CallOverrides
): Promise<void>;

"closeEvidencePeriod(address,uint256)"(
_subject: string,
_disputeId: BigNumberish,
overrides?: CallOverrides
): Promise<void>;

rule(
_disputeId: BigNumberish,
overrides?: CallOverrides
Expand Down Expand Up @@ -304,16 +310,6 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<BigNumber>;

closeEvidencePeriod(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<BigNumber>;

"closeEvidencePeriod(uint256)"(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<BigNumber>;

createDispute(
_possibleRulings: BigNumberish,
_metadata: BytesLike,
Expand All @@ -326,6 +322,18 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<BigNumber>;

closeEvidencePeriod(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<BigNumber>;

"closeEvidencePeriod(address,uint256)"(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<BigNumber>;

rule(_disputeId: BigNumberish, overrides?: Overrides): Promise<BigNumber>;

"rule(uint256)"(
Expand Down Expand Up @@ -355,16 +363,6 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<PopulatedTransaction>;

closeEvidencePeriod(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>;

"closeEvidencePeriod(uint256)"(
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>;

createDispute(
_possibleRulings: BigNumberish,
_metadata: BytesLike,
Expand All @@ -377,6 +375,18 @@ export class IArbitrator extends Contract {
overrides?: Overrides
): Promise<PopulatedTransaction>;

closeEvidencePeriod(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>;

"closeEvidencePeriod(address,uint256)"(
_subject: string,
_disputeId: BigNumberish,
overrides?: Overrides
): Promise<PopulatedTransaction>;

rule(
_disputeId: BigNumberish,
overrides?: Overrides
Expand Down
Loading

0 comments on commit 1a0e06d

Please sign in to comment.