Can I set gas price in internal transactions, of my functions? For example:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

interface Itest {
     function sendToken(address to) external;

contract TestContract {

    Itest _Itest;

    constructor(address add) {
        _Itest = Itest(add);

    function sendTokens(address to1, address to2) external {

I call function sendTokens(address to1, address to2), which sent tokens on two addresses, with the help of Interface of another contract. I want to manipulate the gas price of this internal transactions.

Can I do this?


  • I am not sure I understand your answer correctly. Can you tell me what do you meant by manipulating gas prices?
    – Ad-h0c
    Commented Sep 26, 2022 at 4:20

2 Answers 2


You cannot set/update the gas price inside your transaction. The gas price is determined by the one signing and thus initializing the transaction.

  • and if I want to swap some tokens in DeFi (uniswap, pancakeswap) from the code in one function, will all of them have one gas price, which I chose in call of function?
    – dimokrit
    Commented Sep 27, 2022 at 13:30

The gas price is determined by the market, not by the contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.