I used ERC4626mock as a base for a contract but for some reason when I copy it to remix it's not recognizing constructor() ERC20(name, symbol), ERC4626(asset) {};
I get ParsedError: Function, variable, struct or modifier declaration expected. Can someone help?
Hello @0xPhant0m
We would need to see your contract. You should inherit from your imported contract first.
imports...
contract YourContract is ERC20, ERC4626 {
constructor(string memory name, string memory symbol) ERC20(name, symbol) ERC4626(asset) {};
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.14;
import {ERC20} from "Contracts/Support/ERC20.sol";
import "Contracts/Support/ERC4626.sol";
interface UserProxyInterface{
function depositLpandStake(address solidPoolAddress, uint256 amount);
function unstakeLpAndWithdraw(address solidPoolAddress, uint256 amount);
function claimStakingRewards(address stakingPoolAddress );
}
Contract 0xVault is ERC4626{
IUserProxyInterface Proxy = UserProxyInterface(0xD2f585C41cca33dce5227C8DF6aDF604085690c2);
uint256 public beforeWithdrawHookCalledCounter = 0;
uint256 public afterDepositHookCalledCounter = 0;
constructor(
IERC20Metadata asset,
string memory name,
string memory symbol,
address memory GhostFarmer,
address memory Rewards,
address memory StakingPoolAddress
) ERC20(name, symbol) ERC4626(asset) {};
StakingPoolAddress = _StakingPoolAddress;
Reward = _reward;
GhostFarmer = _ghostFarmer;
function totalAssets() public view override returns (uint256) {
return asset.balanceOf(address(this));
}
function beforeWithdraw (uint256 assets, uint256 shares) internal override{
SafeIncreaseAllowance(_asset, Proxy, amount);
Proxy.UnstakeLpandWithdraw(address(_asset), uint amount);
SafeDecreaseAllowance(_asset, Proxy, 0);
beforeWithdrawHookCalledCounter++;
}
function afterDeposit(uint256 assets, uint256 shares) internal override{
SafeIncreaseAllowance(_asset, Proxy, amount);
Proxy.depositLPandStake(address(_asset), uint256 amount);
SafeDecreaseAllowance(_asset, Proxy, 0);
afterDepositHookCalledCounter++;
}
function Harvest() public{
Proxy.claimStakingRewards(_StakingPoolAddress);
SafeERC20.safeTransfer(_Reward, address(this), _GhostFarmer, balanceOf(address(_Reward)));
}
}
I assumed It inherited ERC20 automatically by ERC4626 inheriting ERC20. I'll make the changes and see if it makes a difference.