I am receiving the above mentioned error when compling the code. Can you understand what's the issue?


pragma solidity 0.6.12;

interface ITRC20 {
  function transfer(address to, uint256 value) external returns (bool);
  function approve(address spender, uint256 value) external returns (bool);
  function transferFrom(address from, address to, uint256 value) external returns (bool);
  function totalSupply() external view returns (uint256);
  function balanceOf(address who) external view returns (uint256);
  function allowance(address owner, address spender) external view returns (uint256);
  event Transfer(address indexed from, address indexed to, uint256 value);
  event Approval(address indexed owner, address indexed spender, uint256 value);


contract Testing {
   ITRC20 trc = ITRC20(0xaf9f549774ecEDbD0966C52f250aCc548D3F36E5);
   trc.transfer(address(this), 255);

1 Answer 1


You are trying to execute code outside a function.

If you wrap that code in a function it should work on that function invokation.

function foobar() public {
   trc.transfer(address(this), 255);
  • 1
    Hey, thanks for your answer, Ismael. It worked. Oct 30, 2020 at 10:04

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.