Skip to content

Commit

Permalink
Merge pull request #67 from BirthdayResearch/cuong/modifications_sc_t…
Browse files Browse the repository at this point in the history
…ests

Modifications to test file and new release for State Relayer launch on testnet
  • Loading branch information
pierregee authored Nov 15, 2023
2 parents de0cf7e + 45e6339 commit 04e5e63
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@waveshq/state-relayer-bot",
"version": "0.0.0-beta.5",
"version": "0.0.1",
"private": false,
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
22 changes: 17 additions & 5 deletions tests/StateRelayer.data.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SignerWithAddress } from '@nomicfoundation/hardhat-ethers/signers';
import { loadFixture, time } from '@nomicfoundation/hardhat-network-helpers';
import { loadFixture } from '@nomicfoundation/hardhat-network-helpers';
import { expect } from 'chai';

import { StateRelayer, StateRelayer__factory } from '../generated';
import { StateRelayer, IStateRelayer, StateRelayer__factory } from '../generated';
import { deployContract } from './utils/deployment';

type MasterNodeInformationStruct = StateRelayer.MasterNodeInformationStruct;
type VaultGeneralInformation = StateRelayer.VaultGeneralInformationStruct;
type DexInfo = StateRelayer.DEXInfoStruct;
type MasterNodeInformationStruct = IStateRelayer.MasterNodeInformationStruct;
type VaultGeneralInformation = IStateRelayer.VaultGeneralInformationStruct;
type DexInfo = IStateRelayer.DEXInfoStruct;

describe('State relayer contract data tests', () => {
let stateRelayerProxy: StateRelayer;
Expand Down Expand Up @@ -296,5 +296,17 @@ describe('State relayer contract data tests', () => {
`AccessControl: account ${(await stateRelayerProxy.getAddress()).toLowerCase()} is missing role ${botRole}`,
);
});

it('Return right error when not using the right call data', async () => {
({ stateRelayerProxy, bot } = await loadFixture(deployContract));
// check if 0xffffffff is among the signatures of the contract
expect(StateRelayer__factory.createInterface().hasFunction('0xffffffff')).to.be.false;

// use non-existent function signature
await expect(stateRelayerProxy.connect(bot).batchCallByBot(['0xffffffff'])).to.revertedWithCustomError(
stateRelayerProxy,
'ERROR_IN_LOW_LEVEL_CALLS()',
);
});
});
});

0 comments on commit 04e5e63

Please sign in to comment.