forked from crytic/properties
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVaultProxy.sol
66 lines (57 loc) · 2.4 KB
/
VaultProxy.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity ^0.8.0;
import {CryticERC4626PropertyBase} from "../util/ERC4626PropertyTestBase.sol";
import {CryticIERC4626Internal} from "../util/IERC4626Internal.sol";
contract CryticERC4626VaultProxy is CryticERC4626PropertyBase {
function recognizeProfitProxy(uint256 profit) public {
require(supportsInternalTestingIface);
require(vault.totalSupply() > 0);
CryticIERC4626Internal(address(vault)).recognizeProfit(profit);
}
function recognizeLossProxy(uint256 loss) public {
require(supportsInternalTestingIface);
require(vault.totalSupply() > 0);
CryticIERC4626Internal(address(vault)).recognizeLoss(loss);
}
/// @dev intended to be used when property violations are being shrunk
function depositForSelfSimple(uint256 assets) public {
asset.mint(address(this), assets);
asset.approve(address(vault), assets);
vault.deposit(assets, address(this));
}
function redeemForSelfSimple(uint256 shares) public {
shares = clampLte(shares, vault.balanceOf(address(this)));
vault.redeem(shares, address(this), address(this));
}
// consider removing/refactoring the following since they're so unlikely to be useful during testing
function deposit(uint256 assets, uint256 receiverId) public {
address receiver = restrictAddressToThirdParties(receiverId);
vault.deposit(assets, receiver);
}
function withdraw(
uint256 assets,
uint256 ownerId,
uint256 receiverId
) public {
address receiver = restrictAddressToThirdParties(receiverId);
address owner = restrictAddressToThirdParties(ownerId);
vault.withdraw(assets, receiver, owner);
}
function mint(uint256 shares, uint256 receiverId) public {
address receiver = restrictAddressToThirdParties(receiverId);
vault.mint(shares, receiver);
}
function redeem(
uint256 shares,
uint256 ownerId,
uint256 receiverId
) public {
address receiver = restrictAddressToThirdParties(receiverId);
address owner = restrictAddressToThirdParties(ownerId);
vault.redeem(shares, receiver, owner);
}
function mintAsset(uint256 assets, uint256 receiverId) public {
address receiver = restrictAddressToThirdParties(receiverId);
asset.mint(receiver, assets);
}
}