File tree Expand file tree Collapse file tree 4 files changed +36
-65
lines changed
Expand file tree Collapse file tree 4 files changed +36
-65
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import {
2525 WorkerpoolRegistry__factory ,
2626 Workerpool__factory ,
2727} from '../../typechain' ;
28- import { IexecPoco1__factory } from '../../typechain/factories/contracts/modules/interfaces/IexecPoco1.v8.sol' ;
28+ import { IexecPoco1__factory } from '../../typechain/factories/contracts/modules/interfaces/IexecPoco1.v8.sol/IexecPoco1__factory ' ;
2929import {
3030 IexecOrders ,
3131 OrderOperation ,
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // SPDX-FileCopyrightText: 2020-2025 IEXEC BLOCKCHAIN TECH <[email protected] > 2+ // SPDX-License-Identifier: Apache-2.0
3+
4+ import { assert } from 'chai' ;
5+ import type { BigNumber } from 'ethers' ;
6+ import { ethers } from 'hardhat' ;
7+
8+ import { ContractReceipt , Event } from '@ethersproject/contracts' ;
9+
10+ export function extractEventsFromReceipt (
11+ txReceipt : ContractReceipt ,
12+ address : string ,
13+ name : string ,
14+ ) : Event [ ] {
15+ const receiptEvents = txReceipt ?. events || [ ] ;
16+ const events = receiptEvents . filter ( ( event ) => {
17+ return event . address == address && event . event == name ;
18+ } ) ;
19+ assert . isNotEmpty ( events , `Fail to extract '${ name } ' event` ) ;
20+ return events ;
21+ }
22+
23+ export function compactSignature ( signature : string ) : string {
24+ const split = ethers . utils . splitSignature ( signature ) ;
25+ let vs = ethers . utils . arrayify ( split . s ) ;
26+ if ( split . v == 1 || split . v == 28 ) {
27+ vs [ 0 ] |= 0x80 ;
28+ }
29+ return ethers . utils . hexlify ( ethers . utils . concat ( [ split . r , vs ] ) ) ;
30+ }
31+
32+ export function BN2Address ( bignumber : BigNumber ) {
33+ const lowercaseAddress = ethers . utils . hexZeroPad ( bignumber . toHexString ( ) , 20 ) ;
34+ return ethers . utils . getAddress ( lowercaseAddress ) ;
35+ }
You can’t perform that action at this time.
0 commit comments