Skip to content

Commit 5fe10c0

Browse files
test(strategy): <- deposit eth
1 parent 9120a1a commit 5fe10c0

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test/BasedAppManager.t.sol

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ contract BasedAppManagerTest is Test, OwnableUpgradeable {
2525
address SERVICE1 = makeAddr("Service1");
2626
address SERVICE2 = makeAddr("Service2");
2727

28+
address constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
29+
2830
uint256 constant INITIAL_USER1_BALANCE_ERC20 = 1000 * 10 ** 18;
31+
uint256 constant INITIAL_USER1_BALANCE_ETH = 10 ether;
2932
uint256 constant INITIAL_RECEIVER_BALANCE_ERC20 = 1000 * 10 ** 18;
33+
uint256 constant INITIAL_RECEIVER_BALANCE_ETH = 10 ether;
3034

3135
function setUp() public {
3236
vm.label(OWNER, "Owner");
@@ -44,6 +48,9 @@ contract BasedAppManagerTest is Test, OwnableUpgradeable {
4448

4549
vm.label(address(proxiedManager), "BasedAppManagerProxy");
4650

51+
vm.deal(USER1, INITIAL_USER1_BALANCE_ETH);
52+
vm.deal(RECEIVER, INITIAL_RECEIVER_BALANCE_ETH);
53+
4754
erc20mock = new ERC20Mock();
4855
erc20mock.transfer(USER1, INITIAL_USER1_BALANCE_ERC20);
4956
erc20mock.transfer(RECEIVER, INITIAL_RECEIVER_BALANCE_ERC20);
@@ -499,17 +506,30 @@ contract BasedAppManagerTest is Test, OwnableUpgradeable {
499506
vm.stopPrank();
500507
}
501508

509+
function testStrategyOwnerDepositETHWithNoObligation() public {
510+
testStrategyOptInToService();
511+
vm.startPrank(USER1);
512+
uint256 strategyTokenBalance = proxiedManager.strategyTokenBalances(1, USER1, address(erc20mock));
513+
assertEq(strategyTokenBalance, 0, "User strategy balance should be 0");
514+
proxiedManager.depositETH{value: 1 ether}(1);
515+
strategyTokenBalance = proxiedManager.strategyTokenBalances(1, USER1, ETH_ADDRESS);
516+
assertEq(strategyTokenBalance, 1 ether, "User strategy balance not matching");
517+
vm.stopPrank();
518+
}
519+
502520
function testRevertObligationNotMatchTokensService() public {
503521
testStrategyOptInToService();
504522
vm.startPrank(USER1);
505523
vm.expectRevert("Strategy: token not supported by service");
506524
proxiedManager.createObligation(1, SERVICE1, address(erc20mock2), 100);
507525
uint256 strategyTokenBalance = proxiedManager.strategyTokenBalances(1, USER1, address(erc20mock2));
508526
assertEq(strategyTokenBalance, 0, "User strategy balance should be 0");
527+
address[] memory tokens = proxiedManager.getServiceTokens(SERVICE1);
528+
assertEq(tokens[0], address(erc20mock), "Service token");
529+
assertEq(tokens.length, 1, "Service token length");
509530
vm.stopPrank();
510531
}
511532

512-
function testRevertDepositNonSupportedTokensIntoStrategy() public {}
513533
function testRevertDepositNonSupportedETHIntoStrategy() public {}
514534
function testRevertObligationHigherThanMaxPercentage() public {}
515535
function testCreateObligationToNonExistingServiceRevert() public {}

0 commit comments

Comments
 (0)