Am trying to create an ERC-20 wrapping DAI contract on the Goerli network. Only am not succeeding to properly use the ERC20Wrapper.sol. The goal is to send DAI to the contract and to receive Wrapped DAI back in the sender address.
When I use the depositFor
function, I get a stack limit reached 1024
error. And when I include the overlyingToken
address in the contract (address underlyingToken = "0x11fe4b6ae13d2a6055c8d9cf65c55bac32b5d844";
) I receive errors as well.
Code to reproduce
// contracts/GLDToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Wrapper.sol";
contract AfriToken is ERC20 {
constructor(uint256 initialSupply) ERC20("Wrapped DAI", "wDAI") {
_mint(msg.sender, initialSupply);
}
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
function burnFrom(address account, uint256 amount) public {
_burn(account, amount);
}
function _mint(uint256 amount) public {
_mint(msg.sender, amount);
}
function depositFor(address account, uint256 amount) public {
depositFor(account, amount);
}
}
Environment
I am using Remix 0.8.10