This repository has been archived by the owner on Sep 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7181a3c
commit 4234632
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import ape | ||
from ape import Contract | ||
|
||
# This test should not be overridden and checks that | ||
# no function signature collisions occurred from the custom functions. | ||
# Does not check functions that are strategy dependant and will be checked in other tests | ||
def test_function_collisions(strategy, asset, management, rewards, user, keeper): | ||
wad = int(1e18) | ||
|
||
with ape.reverts("initialized"): | ||
strategy.init(asset, "name", management, rewards, keeper, sender=management) | ||
|
||
# Check view functions | ||
assert strategy.convertToAssets(wad) == wad | ||
assert strategy.convertToShares(wad) == wad | ||
assert strategy.previewDeposit(wad) == wad | ||
assert strategy.previewMint(wad) == wad | ||
assert strategy.previewWithdraw(wad) == wad | ||
assert strategy.previewRedeem(wad) == wad | ||
assert strategy.totalAssets() == 0 | ||
assert strategy.totalSupply() == 0 | ||
assert strategy.unlockedShares() == 0 | ||
assert strategy.asset() == asset | ||
assert strategy.apiVersion() == "3.0.1" | ||
assert strategy.totalIdle() == 0 | ||
assert strategy.totalDebt() == 0 | ||
assert strategy.MAX_FEE() == 5_000 | ||
assert strategy.MIN_FEE() == 500 | ||
assert strategy.fullProfitUnlockDate() == 0 | ||
assert strategy.profitUnlockingRate() == 0 | ||
assert strategy.lastReport() > 0 | ||
assert strategy.pricePerShare() == 10 ** asset.decimals() | ||
assert not strategy.isShutdown() | ||
assert strategy.symbol() == f"ys{asset.symbol()}" | ||
assert strategy.decimals() == asset.decimals() | ||
|
||
# Assure modifiers are working | ||
with ape.reverts("!management"): | ||
strategy.setPendingManagement(user, sender=user) | ||
with ape.reverts("!pending"): | ||
strategy.acceptManagement(sender=user) | ||
with ape.reverts("!management"): | ||
strategy.setKeeper(user, sender=user) | ||
with ape.reverts("!management"): | ||
strategy.setEmergencyAdmin(user, sender=user) | ||
with ape.reverts("!management"): | ||
strategy.setPerformanceFee(int(2_000), sender=user) | ||
with ape.reverts("!management"): | ||
strategy.setPerformanceFeeRecipient(user, sender=user) | ||
with ape.reverts("!management"): | ||
strategy.setProfitMaxUnlockTime(1, sender=user) | ||
|
||
# Assure checks are being used | ||
with ape.reverts("MIN FEE"): | ||
strategy.setPerformanceFee(int(0), sender=management) | ||
with ape.reverts("Cannot be self"): | ||
strategy.setPerformanceFeeRecipient(strategy.address, sender=management) | ||
with ape.reverts("too long"): | ||
strategy.setProfitMaxUnlockTime(int(2**256 - 1), sender=management) | ||
|
||
assert strategy.balanceOf(user) == 0 | ||
assert strategy.allowance(keeper, user) == 0 | ||
assert strategy.approve(user, wad, sender=keeper) | ||
assert strategy.allowance(keeper, user) == wad |