This repository was archived by the owner on Nov 8, 2023. It is now read-only.
File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { type UserOperationStruct } from "../typechain-types/contracts/SCBridgeW
14
14
import { IAccount } from "./utils" ;
15
15
import { hashState } from "./State" ;
16
16
import { convertInvoice } from "./Accounting" ;
17
+ import { chains } from "../src/chains" ;
17
18
18
19
/**
19
20
* The IntermediaryCoordinator orchestrates an intermediary's participation in the network. It contains
@@ -72,7 +73,23 @@ export class IntermediaryCoordinator {
72
73
const targetNetwork = await targetClient . getHostNetwork ( ) ;
73
74
74
75
if ( targetNetwork !== htlc . invoice . chain ) {
76
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
77
+ const sourceChain = chains . find ( ( c ) => c . chainID === htlc . invoice . chain ) ! ;
78
+
79
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
80
+ const targetChain = chains . find ( ( c ) => c . chainID === targetNetwork ) ! ;
81
+
82
+ const sourceAmount = htlc . invoice . amount ;
83
+
75
84
htlc . invoice = convertInvoice ( htlc . invoice , targetNetwork ) ;
85
+ const targetAmount = htlc . invoice . amount ;
86
+
87
+ this . uiLog (
88
+ `currency conversion from ${ sourceAmount } ${ sourceChain . symbol } to ${ targetAmount } ${ targetChain . symbol } ` ,
89
+ ) ;
90
+ this . uiLog (
91
+ ` at [${ sourceChain . exchangeRate } / ${ targetChain . exchangeRate } ] exchange rate` ,
92
+ ) ;
76
93
}
77
94
78
95
const fee = 0 ; // for example
Original file line number Diff line number Diff line change @@ -63,8 +63,8 @@ export const chains: ChainData[] = [
63
63
chainID : 534351n ,
64
64
url : "https://sepolia-rpc.scroll.io" ,
65
65
name : "scroll" ,
66
- symbol : "ETH" ,
67
66
explorer : "https://sepolia.scrollscan.com/" ,
67
+ symbol : "scrETH" ,
68
68
exchangeRate : 1 ,
69
69
} ,
70
70
] ;
You can’t perform that action at this time.
0 commit comments