@@ -54,6 +54,7 @@ pub enum Chain {
54
54
IOTEX ,
55
55
SCROLL ,
56
56
VANA ,
57
+ STORY ,
57
58
}
58
59
59
60
pub trait PriceOracle : Debug {
@@ -89,6 +90,7 @@ impl FromStr for Chain {
89
90
"iotex" => Ok ( Self :: IOTEX ) ,
90
91
"scroll" => Ok ( Self :: SCROLL ) ,
91
92
"vana" => Ok ( Self :: VANA ) ,
93
+ "story" => Ok ( Self :: STORY ) ,
92
94
_ => Err ( ( ) ) ,
93
95
}
94
96
}
@@ -155,6 +157,7 @@ impl Chain {
155
157
4689 => Self :: IOTEX ,
156
158
534352 => Self :: SCROLL ,
157
159
1480 => Self :: VANA ,
160
+ 1514 => Self :: STORY ,
158
161
31337 => Self :: LOCAL ,
159
162
_ => return Err ( anyhow ! ( "Unknown chain id: {}" , chain_id) ) ,
160
163
} )
@@ -183,6 +186,7 @@ impl Chain {
183
186
Chain :: IOTEX => 4689 ,
184
187
Chain :: SCROLL => 534352 ,
185
188
Chain :: VANA => 1480 ,
189
+ Chain :: STORY => 1514 ,
186
190
Chain :: LOCAL => 31337 ,
187
191
}
188
192
}
@@ -211,6 +215,7 @@ impl Chain {
211
215
Chain :: IOTEX => "iotex" ,
212
216
Chain :: SCROLL => "scroll" ,
213
217
Chain :: VANA => "vana" ,
218
+ Chain :: STORY => "story" ,
214
219
}
215
220
. to_string ( )
216
221
}
@@ -241,6 +246,7 @@ impl Chain {
241
246
Chain :: IOTEX => "https://rpc.ankr.com/iotex" ,
242
247
Chain :: SCROLL => "https://rpc.ankr.com/scroll" ,
243
248
Chain :: VANA => "https://rpc.vana.org" ,
249
+ Chain :: STORY => "https://mainnet.storyrpc.io" ,
244
250
Chain :: LOCAL => "http://localhost:8545" ,
245
251
}
246
252
. to_string ( )
@@ -270,6 +276,7 @@ impl Chain {
270
276
Chain :: IOTEX => "https://babel-api.mainnet.IoTeX.io" ,
271
277
Chain :: SCROLL => "https://api.scrollscan.com/api" ,
272
278
Chain :: VANA => "https://api.vanascan.io/api/v2" ,
279
+ Chain :: STORY => "https://www.storyscan.xyz/api/v2" ,
273
280
}
274
281
. to_string ( )
275
282
}
@@ -401,6 +408,7 @@ impl ChainConfig for OnChainConfig {
401
408
"bsc" => return pegged_token. get ( "WBNB" ) . unwrap ( ) . to_string ( ) ,
402
409
"polygon" => return pegged_token. get ( "WMATIC" ) . unwrap ( ) . to_string ( ) ,
403
410
"vana" => return pegged_token. get ( "WVANA" ) . unwrap ( ) . to_string ( ) ,
411
+ "story" => return pegged_token. get ( "WIP" ) . unwrap ( ) . to_string ( ) ,
404
412
"local" => return pegged_token. get ( "ZERO" ) . unwrap ( ) . to_string ( ) ,
405
413
// "mumbai" => panic!("Not supported"),
406
414
_ => {
@@ -477,10 +485,29 @@ impl ChainConfig for OnChainConfig {
477
485
. iter ( )
478
486
. map ( |( k, v) | ( k. to_string ( ) , v. to_string ( ) ) )
479
487
. collect ( ) ,
488
+
489
+ "story" => [
490
+ ( "WETH" , "0xBAb93B7ad7fE8692A878B95a8e689423437cc500" ) ,
491
+ ( "uWETH" , "0x28B931354098D6863817dFDce7A2D7c52B25d76a" ) ,
492
+ ( "storyWETH" , "0x2D08d948fC0BD2Db5411E8Ab3c49E0bB89A2B428" ) ,
493
+ ( "USDC.e" , "0xF1815bd50389c46847f0Bda824eC8da914045D14" ) ,
494
+ ( "USDC" , "0x49Fe4CbB645CfE997465CA9F70f03DD9c58d1acF" ) ,
495
+ ( "storyUSDC" , "0x968B9a5603ddEb2A78Aa08182BC44Ece1D9E5bf0" ) ,
496
+ ( "uStoryUSDC" , "0xa9651875651Ff7F303605C23EF5c20C8f7BE8266" ) ,
497
+ ( "sdaiUSDC" , "0x06578bE47CF7D19784A07DB64DCF95B84EE88671" ) ,
498
+ ( "USDT" , "0x6c9b999D33C612cCd8721b0e349adcAE151fcbBf" ) ,
499
+ ( "bridgedUSDT" , "0x674843C06FF83502ddb4D37c2E09C01cdA38cbc8" ) ,
500
+ ( "WIP" , "0x1514000000000000000000000000000000000000" ) ,
501
+ ]
502
+ . iter ( )
503
+ . map ( |( k, v) | ( k. to_string ( ) , v. to_string ( ) ) )
504
+ . collect ( ) ,
505
+
480
506
"local" => [ ( "ZERO" , "0x0000000000000000000000000000000000000000" ) ]
481
507
. iter ( )
482
508
. map ( |( k, v) | ( k. to_string ( ) , v. to_string ( ) ) )
483
509
. collect ( ) ,
510
+
484
511
_ => {
485
512
warn ! ( "[Flashloan] Network is not supported" ) ;
486
513
HashMap :: new ( )
@@ -714,8 +741,8 @@ impl OnChainConfig {
714
741
}
715
742
716
743
pub fn fetch_abi_uncached ( & self , address : EVMAddress ) -> Option < String > {
717
- if self . chain_name == "vana" {
718
- return self . fetch_vana_abi_uncached ( address) ;
744
+ if self . is_blockscout_api ( ) {
745
+ return self . blockscout_fetch_abi_uncached ( address) ;
719
746
}
720
747
721
748
#[ cfg( feature = "no_etherscan" ) ]
@@ -760,7 +787,7 @@ impl OnChainConfig {
760
787
}
761
788
}
762
789
763
- fn fetch_vana_abi_uncached ( & self , address : EVMAddress ) -> Option < String > {
790
+ fn blockscout_fetch_abi_uncached ( & self , address : EVMAddress ) -> Option < String > {
764
791
let endpoint = format ! ( "{}/smart-contracts/{:?}" , self . etherscan_base, address) ;
765
792
766
793
// info!(">> {}", endpoint);
@@ -771,17 +798,24 @@ impl OnChainConfig {
771
798
json. get ( "abi" ) . map ( |abi| abi. to_string ( ) )
772
799
}
773
800
Err ( _) => {
774
- error ! ( "Failed to parse JSON response from Vana API" ) ;
801
+ error ! ( "Failed to parse JSON response from Blockscout API" ) ;
775
802
None
776
803
}
777
804
} ,
778
805
None => {
779
- error ! ( "Failed to fetch ABI from Vana API: {}" , endpoint) ;
806
+ error ! ( "Failed to fetch ABI from Blockscout API: {}" , endpoint) ;
780
807
None
781
808
}
782
809
}
783
810
}
784
811
812
+ fn is_blockscout_api ( & self ) -> bool {
813
+ match self . chain_name . as_str ( ) {
814
+ "vana" | "story" => true ,
815
+ _ => false ,
816
+ }
817
+ }
818
+
785
819
pub fn fetch_abi ( & mut self , address : EVMAddress ) -> Option < String > {
786
820
if self . abi_cache . contains_key ( & address) {
787
821
return self . abi_cache . get ( & address) . unwrap ( ) . clone ( ) ;
0 commit comments