1

I'm deploying a contract that is the owner of a token. In that contract i want to say that the token increaseAllowance to msg.sender and the amount that msg.send have putted in arguments of the function. Example:

function setAllowance(uint256 _amount){ token.increaseAllowance(address(msg.sender),_amount) }

How can i do this?

1 Answer 1

0

Should probably look something like this:

//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

interface ISPCT is IERC20 {
    function increaseAllowance(address, uint256) external virtual returns (bool);
}


contract canAllow {
    ISPCT public spctContract;
    address public SPCTaddress;

    constructor(address _SPCT) {
        SPCTaddress = _SPCT;
        spctContract = ISPCT(SPCTaddress);
    }

    function setAllowance(uint256 _amount){
        bool increasedAllowance = spctContract.increaseAllowance(msg.sender, _amount);
        require(increasedAllowance, "no_allowance");
    }
}

Your Answer

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

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