@@ -21,7 +21,7 @@ describe('CurveOracle', function () {
21
21
assertRoughlyEqualValues ( rate . rate . toString ( ) , expectedRate . rate . toString ( ) , '0.05' ) ;
22
22
} ) ;
23
23
24
- it ( 'wbtc -> usdc ' , async function ( ) {
24
+ it ( 'wbtc -> usdt ' , async function ( ) {
25
25
const { curveOracle, uniswapV3Oracle } = await loadFixture ( initContracts ) ;
26
26
const expectedRate = await uniswapV3Oracle . getRate ( tokens . WBTC , tokens . USDT , tokens . NONE , thresholdFilter ) ;
27
27
const rate = await curveOracle . getRate ( tokens . WBTC , tokens . USDT , tokens . NONE , thresholdFilter ) ;
@@ -41,6 +41,31 @@ describe('CurveOracle', function () {
41
41
expect ( rate . rate ) . to . gt ( '0' ) ;
42
42
} ) ;
43
43
44
+ describe ( 'measure gas' , function ( ) {
45
+ it ( 'usdt -> wbtc' , async function ( ) {
46
+ const { curveOracle, uniswapV3Oracle } = await loadFixture ( initContracts ) ;
47
+ await measureGas ( await curveOracle . getFunction ( 'getRate' ) . send ( tokens . USDT , tokens . WBTC , tokens . NONE , thresholdFilter ) , 'CurveOracle usdt -> wbtc' ) ;
48
+ await measureGas ( await uniswapV3Oracle . getFunction ( 'getRate' ) . send ( tokens . USDT , tokens . WBTC , tokens . NONE , thresholdFilter ) , 'UniswapV3Oracle usdt -> wbtc' ) ;
49
+ } ) ;
50
+
51
+ it ( 'wbtc -> usdt' , async function ( ) {
52
+ const { curveOracle, uniswapV3Oracle } = await loadFixture ( initContracts ) ;
53
+ await measureGas ( await curveOracle . getFunction ( 'getRate' ) . send ( tokens . WBTC , tokens . USDT , tokens . NONE , thresholdFilter ) , 'CurveOracle wbtc -> usdt' ) ;
54
+ await measureGas ( await uniswapV3Oracle . getFunction ( 'getRate' ) . send ( tokens . WBTC , tokens . USDT , tokens . NONE , thresholdFilter ) , 'UniswapV3Oracle wbtc -> usdt' ) ;
55
+ } ) ;
56
+
57
+ it ( 'wbtc -> weth' , async function ( ) {
58
+ const { curveOracle, uniswapV3Oracle } = await loadFixture ( initContracts ) ;
59
+ await measureGas ( await curveOracle . getFunction ( 'getRate' ) . send ( tokens . WBTC , tokens . WETH , tokens . NONE , thresholdFilter ) , 'CurveOracle wbtc -> weth' ) ;
60
+ await measureGas ( await uniswapV3Oracle . getFunction ( 'getRate' ) . send ( tokens . WBTC , tokens . WETH , tokens . NONE , thresholdFilter ) , 'UniswapV3Oracle wbtc -> weth' ) ;
61
+ } ) ;
62
+
63
+ async function measureGas ( tx , comment ) {
64
+ const receipt = await tx . wait ( ) ;
65
+ console . log ( 'gasUsed' , comment , receipt . gasUsed . toString ( ) ) ;
66
+ }
67
+ } ) ;
68
+
44
69
describe ( 'doesn\'t ruin various registry with different selectors' , function ( ) {
45
70
it ( 'Main Registry' , async function ( ) {
46
71
await testNotRuins ( 0 , 2n ) ;
0 commit comments