2

I heard external functions are a nice performance improvement, when called from outside the contract. Can I use an external function when it's called from another contract ( not by ethereum account )? Example

contract One {
    Two two;
    function makeCall() {
         two.someExternalFunction();
    }
}

contract Two {
    function someExternalFunction() external {
       //...
    }
}

it compiles well, but should it be used that way, or may there arise some consequences ?

1

external functions are readonly functions that have the ability to return dynamic arrays (which was not possible before solidity 0.4.23). These functions can not be called internally (unless you explicitly use the keyword this : this.externalfn()) but are supposed to be called from outside the contract.

The good thing about external functions that they are read only so they work great when only read access is allowed from a certain smart contract.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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