staking/test/mocks/BrokenERC20.s.sol
r4bbit 74ff357142 fix(StakeVault): make unstaking actually work
Unstaking didn't actually work because it was using `transferFrom()` on the
`StakeVault` with the `from` address being the vault itself.
This would result in an approval error because the vault isn't creating
any approvals to spend its own funds.

The solution is to use `transfer` instead and ensuring the return value
is checked.
2024-01-19 09:57:34 +01:00

21 lines
630 B
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract BrokenERC20 is ERC20 {
constructor() ERC20("Mock SNT", "SNT") {
_mint(msg.sender, 1_000_000_000_000_000_000);
}
// solhint-disable-next-line no-unused-vars
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
return false;
}
// solhint-disable-next-line no-unused-vars
function transfer(address recipient, uint256 amount) public override returns (bool) {
return false;
}
}