@@ -25,6 +25,9 @@ contract BasedAppManagerTest is Test, OwnableUpgradeable {
2525 address SERVICE1 = makeAddr ("Service1 " );
2626 address SERVICE2 = makeAddr ("Service2 " );
2727
28+ uint256 constant INITIAL_USER1_BALANCE_ERC20 = 1000 * 10 ** 18 ;
29+ uint256 constant INITIAL_RECEIVER_BALANCE_ERC20 = 1000 * 10 ** 18 ;
30+
2831 function setUp () public {
2932 vm.label (OWNER, "Owner " );
3033 vm.label (USER1, "User1 " );
@@ -42,12 +45,12 @@ contract BasedAppManagerTest is Test, OwnableUpgradeable {
4245 vm.label (address (proxiedManager), "BasedAppManagerProxy " );
4346
4447 erc20mock = new ERC20Mock ();
45- erc20mock.transfer (USER1, 1000 * 10 ** 18 );
46- erc20mock.transfer (RECEIVER, 1000 * 10 ** 18 );
48+ erc20mock.transfer (USER1, INITIAL_USER1_BALANCE_ERC20 );
49+ erc20mock.transfer (RECEIVER, INITIAL_RECEIVER_BALANCE_ERC20 );
4750
4851 erc20mock2 = new ERC20Mock ();
49- erc20mock2.transfer (USER1, 1000 * 10 ** 18 );
50- erc20mock2.transfer (RECEIVER, 1000 * 10 ** 18 );
52+ erc20mock2.transfer (USER1, INITIAL_USER1_BALANCE_ERC20 );
53+ erc20mock2.transfer (RECEIVER, INITIAL_RECEIVER_BALANCE_ERC20 );
5154
5255 vm.stopPrank ();
5356 }
@@ -387,15 +390,13 @@ contract BasedAppManagerTest is Test, OwnableUpgradeable {
387390 uint256 strategyId = proxiedManager.createStrategy (1 );
388391 erc20mock.approve (address (proxiedManager), 200_000 );
389392 proxiedManager.depositERC20 (strategyId, erc20mock, 100_000 );
390-
391393 assertEq (
392394 proxiedManager.strategyTokenBalances (strategyId, USER1, address (erc20mock)),
393395 100_000 ,
394396 "User strategy balance should be 100_000 "
395397 );
396398 proxiedManager.fastWithdrawERC20 (strategyId, erc20mock, 50_000 );
397399 proxiedManager.fastWithdrawERC20 (strategyId, erc20mock, 10_000 );
398-
399400 assertEq (
400401 proxiedManager.strategyTokenBalances (strategyId, USER1, address (erc20mock)),
401402 40_000 ,
@@ -483,7 +484,19 @@ contract BasedAppManagerTest is Test, OwnableUpgradeable {
483484 vm.stopPrank ();
484485 }
485486
486- function checkUserTotalAndObligationNumber () public {}
487+ function testStrategyOwnerDepositERC20 (uint256 amount ) public
488+ { vm.assume (amount > 0 && amount < INITIAL_USER1_BALANCE_ERC20);
489+ testStrategyOptInToService ();
490+ vm.startPrank (USER1);
491+ uint256 strategyTokenBalance = proxiedManager.strategyTokenBalances (1 , USER1, address (erc20mock));
492+ assertEq (strategyTokenBalance, 0 , "User strategy balance should be 0 " );
493+ proxiedManager.depositERC20 (1 , erc20mock, amount);
494+ strategyTokenBalance = proxiedManager.strategyTokenBalances (1 , USER1, address (erc20mock));
495+ assertEq (strategyTokenBalance, amount, "User strategy balance not matching " );
496+ vm.stopPrank ();
497+ }
498+
499+
487500 function testRevertNotMatchTokensServiceAndStrategy () public {}
488501 function testRevertDepositNonSupportedTokensIntoStrategy () public {}
489502 function testRevertDepositNonSupportedETHIntoStrategy () public {}
0 commit comments