@@ -124,7 +124,7 @@ func (p PrecompileExecutor) send(accessibleState contract.AccessibleState,
124
124
readOnly bool ,
125
125
value * big.Int ) (ret []byte , remainingGas uint64 , rerr error ) {
126
126
127
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
127
+ ctx , initialGas , rerr := pcommon .GetPrecompileCtx (accessibleState )
128
128
if rerr != nil {
129
129
return
130
130
}
@@ -182,7 +182,7 @@ func (p PrecompileExecutor) send(accessibleState contract.AccessibleState,
182
182
}
183
183
184
184
ret , rerr = method .Outputs .Pack (true )
185
- remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ())
185
+ remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ()- initialGas )
186
186
return
187
187
}
188
188
@@ -195,7 +195,7 @@ func (p PrecompileExecutor) burn(
195
195
readOnly bool ,
196
196
value * big.Int ,
197
197
) (ret []byte , remainingGas uint64 , rerr error ) {
198
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
198
+ ctx , initialGas , rerr := pcommon .GetPrecompileCtx (accessibleState )
199
199
if rerr != nil {
200
200
return
201
201
}
@@ -313,7 +313,7 @@ func (p PrecompileExecutor) burn(
313
313
}
314
314
315
315
ret , rerr = method .Outputs .Pack (true )
316
- remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ())
316
+ remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ()- initialGas )
317
317
return
318
318
}
319
319
@@ -325,7 +325,7 @@ func (p PrecompileExecutor) balance(accessibleState contract.AccessibleState,
325
325
readOnly bool ,
326
326
value * big.Int ) (ret []byte , remainingGas uint64 , rerr error ) {
327
327
328
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
328
+ ctx , initialGas , rerr := pcommon .GetPrecompileCtx (accessibleState )
329
329
if rerr != nil {
330
330
return
331
331
}
@@ -369,7 +369,7 @@ func (p PrecompileExecutor) balance(accessibleState contract.AccessibleState,
369
369
balance := p .bankKeeper .GetBalance (ctx , cosmosAddr , denom )
370
370
371
371
ret , rerr = method .Outputs .Pack (balance .Amount .BigInt ())
372
- remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ())
372
+ remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ()- initialGas )
373
373
return
374
374
}
375
375
@@ -381,7 +381,7 @@ func (p PrecompileExecutor) allBalances(accessibleState contract.AccessibleState
381
381
readOnly bool ,
382
382
value * big.Int ) (ret []byte , remainingGas uint64 , rerr error ) {
383
383
384
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
384
+ ctx , initialGas , rerr := pcommon .GetPrecompileCtx (accessibleState )
385
385
if rerr != nil {
386
386
return
387
387
}
@@ -428,7 +428,7 @@ func (p PrecompileExecutor) allBalances(accessibleState contract.AccessibleState
428
428
}
429
429
430
430
ret , rerr = method .Outputs .Pack (coinBalances )
431
- remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ())
431
+ remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ()- initialGas )
432
432
return
433
433
}
434
434
@@ -440,7 +440,7 @@ func (p PrecompileExecutor) name(accessibleState contract.AccessibleState,
440
440
readOnly bool ,
441
441
value * big.Int ) (ret []byte , remainingGas uint64 , rerr error ) {
442
442
443
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
443
+ ctx , initialGas , rerr := pcommon .GetPrecompileCtx (accessibleState )
444
444
if rerr != nil {
445
445
return
446
446
}
@@ -463,7 +463,7 @@ func (p PrecompileExecutor) name(accessibleState contract.AccessibleState,
463
463
}
464
464
465
465
ret , rerr = method .Outputs .Pack (metadata .Name )
466
- remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ())
466
+ remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ()- initialGas )
467
467
return
468
468
}
469
469
@@ -475,7 +475,7 @@ func (p PrecompileExecutor) symbol(accessibleState contract.AccessibleState,
475
475
readOnly bool ,
476
476
value * big.Int ) (ret []byte , remainingGas uint64 , rerr error ) {
477
477
478
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
478
+ ctx , initialGas , rerr := pcommon .GetPrecompileCtx (accessibleState )
479
479
if rerr != nil {
480
480
return
481
481
}
@@ -498,7 +498,7 @@ func (p PrecompileExecutor) symbol(accessibleState contract.AccessibleState,
498
498
}
499
499
500
500
ret , rerr = method .Outputs .Pack (metadata .Symbol )
501
- remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ())
501
+ remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ()- initialGas )
502
502
return
503
503
}
504
504
@@ -510,7 +510,7 @@ func (p PrecompileExecutor) decimals(accessibleState contract.AccessibleState,
510
510
readOnly bool ,
511
511
value * big.Int ) (ret []byte , remainingGas uint64 , rerr error ) {
512
512
513
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
513
+ ctx , _ , rerr := pcommon .GetPrecompileCtx (accessibleState )
514
514
if rerr != nil {
515
515
return
516
516
}
@@ -539,7 +539,7 @@ func (p PrecompileExecutor) supply(accessibleState contract.AccessibleState,
539
539
readOnly bool ,
540
540
value * big.Int ) (ret []byte , remainingGas uint64 , rerr error ) {
541
541
542
- ctx , rerr := pcommon .GetPrecompileCtx (accessibleState )
542
+ ctx , initialGas , rerr := pcommon .GetPrecompileCtx (accessibleState )
543
543
if rerr != nil {
544
544
return
545
545
}
@@ -574,7 +574,7 @@ func (p PrecompileExecutor) supply(accessibleState contract.AccessibleState,
574
574
denom := args [0 ].(string )
575
575
coin := p .bankKeeper .GetSupply (ctx , denom )
576
576
ret , rerr = method .Outputs .Pack (coin .Amount .BigInt ())
577
- remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ())
577
+ remainingGas , rerr = contract .DeductGas (suppliedGas , ctx .GasMeter ().GasConsumed ()- initialGas )
578
578
return
579
579
}
580
580
0 commit comments