Expected primary expression: {from: proposers[0]}

According to the docs of TimelockController.sol The proposers are in charge of scheduling (and canceling) operations. This is a critical role, that should be given to governing entities. So, the schedule() function is only called by the proposer. The function is as below...

function schedule(
            address target,
            uint256 value,
            bytes calldata data,
            bytes32 predecessor,
            bytes32 salt,
            uint256 delay
        ) public virtual onlyRole(PROPOSER_ROLE) {
            bytes32 id = hashOperation(target, value, data, predecessor, salt);
            _schedule(id, delay);
            emit CallScheduled(id, 0, target, value, data, predecessor, delay);

So, after seeing the tests of TimelockController.sol here, they are giving the proposer address as

                  MINDELAY - 1,
                  { from: proposer },

Please only focus on { from: proposer } and then see the above-untested function signature.

Now, when I'm trying to give the proposer address the same as they tested, I'm getting this error Expected primary expression.. I'm trying to solve it for many hours, but I think I'm missing something. my code is below...

 pragma solidity ^0.8.10;
    import "@openzeppelin/contracts/governance/TimelockController.sol";
    interface Ierc20 {
        function mint(address to, uint amount) external; 
        function burn(uint amount) external;
        function findBalance(address _tokenOwner) external view returns(uint256);
    contract TimeLock is TimelockController {
        address[] proposers = new address[](1);
        address[] executors = new address[](1);
        uint256 minDelay;
        constructor(address proposer, address executor) TimelockController( minDelay, proposers, executors ) {
            minDelay = block.timestamp + 4 minutes;
            proposers[0] = proposer;       
            executors[0] = executor;
        function scheduleMintFuctionCall(address to, uint amount) public {
            address target = 0x5FbDB2315678afecb367f032d93F642f64180aa3;
            bytes memory data = abi.encodeWithSignature('Ierc20(target).mint(address, uint256)', to, amount);
            uint256 value = 10000000;
            bytes32 salt = keccak256("MY_SALT");
            uint256 delay = block.timestamp + 3 minutes;
            this.schedule(target, value, data, bytes32(0), salt, delay, { from: proposers[0] });
        function balanceOf(address _to) public view returns(uint256) {
            address target = 0x5FbDB2315678afecb367f032d93F642f64180aa3;
            return Ierc20(target).findBalance(_to);

{ from: proposers[0] } is not valid Solidity syntax!

You copied the JavaScript code and used it as Solidity.

TimelockController is ready to use, you don't need to extend it with inheritance. Just deploy it and use its functions directly.

1 Like