staking/test/script/DeployBroken.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
765 B
Solidity

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;
import { BaseScript } from "../../script/Base.s.sol";
import { StakeManager } from "../../contracts/StakeManager.sol";
import { VaultFactory } from "../../contracts/VaultFactory.sol";
import { BrokenERC20 } from "../mocks/BrokenERC20.s.sol";
contract DeployBroken is BaseScript {
function run() public returns (VaultFactory, StakeManager, address) {
BrokenERC20 token = new BrokenERC20();
vm.startBroadcast(broadcaster);
StakeManager stakeManager = new StakeManager(address(token), address(0));
VaultFactory vaultFactory = new VaultFactory(address(stakeManager));
vm.stopBroadcast();
return (vaultFactory, stakeManager, address(token));
}
}