Snippets Collections
pragma solidity ^0.5.11;

contract A {
    address addressB;
    function setAddressB(address _addressB) external {
        addressB = _addressB;
    }
    function callHelloWorld() external view returns(string memory) {
        B b = B(addressB);
        return b.helloWorld();
    }
}

contract B {
    function helloWorld() external pure returns(string memory) {
        return 'HelloWorld';
    }
}



contract MyContract {
    uint a;
    function foo() external {
        if(a == 10) {
            revert('error');
        }
        require(a != 10, 'err');
        assert(a != 10);
    }
    function willThrow() external {
        require(true == false, 'the reasons');
    }
}
star

Wed Mar 02 2022 09:47:41 GMT+0000 (Coordinated Universal Time)

#react.js #solidity #contract

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension