Skip to content

Commit

Permalink
(feat) More tests - including a scale test that fails. Next step is t…
Browse files Browse the repository at this point in the history
…o fix it.
  • Loading branch information
rrw-zilliqa committed Jan 7, 2025
1 parent b2a3f4c commit 8eaa798
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {TestToken} from "test/Helpers.sol";
import {LockAndReleaseTokenManagerDeployer} from "test/periphery/TokenManagerDeployers/LockAndReleaseTokenManagerDeployer.sol";


contract TestTokenManagerUpgradeableV4 is TokenManagerUpgradeableV4 {
event Fish();
event TransferEvent(address indexed token, address indexed from, uint indexed amount);
event AcceptEvent(address indexed token, address indexed from, uint indexed amount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/Pau
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {TestToken} from "test/Helpers.sol";
import { TestTokenManagerDeployer } from "test/periphery/TokenManagerDeployers/TestTokenManagerDeployer.sol";
import { TestTokenManagerDeployer, TestTokenManagerUpgradeableV4 } from "test/periphery/TokenManagerDeployers/TestTokenManagerDeployer.sol";


contract TokenManagerUpgradeableV4Tests is Tester, ITokenManagerStructs, ITokenManagerEvents, ITokenManagerV4Events, TestTokenManagerDeployer {
Expand All @@ -30,6 +30,10 @@ contract TokenManagerUpgradeableV4Tests is Tester, ITokenManagerStructs, ITokenM
});
uint transferAmount = 10 ether;

event TransferEvent(address indexed token, address indexed from, uint indexed amount);
event AcceptEvent(address indexed token, address indexed from, uint indexed amount);


function setUp() external {
vm.startPrank(deployer);
tokenManager = deployTestTokenManagerV4(fees);
Expand Down Expand Up @@ -111,4 +115,16 @@ contract TokenManagerUpgradeableV4Tests is Tester, ITokenManagerStructs, ITokenM

vm.stopPrank();
}

function test_scaling() external {
startHoax(deployer);
tokenManager.registerTokenWithScale(address(token1), remoteToken, 2);
vm.stopPrank();
startHoax(user);
vm.expectEmit();
emit TransferEvent(address(token1), user,1_000_000 );
tokenManager.transfer{value: fees}(address(token1), remoteChainId, remoteTokenAddr, 1_000_000);
vm.stopPrank();
}

}

0 comments on commit 8eaa798

Please sign in to comment.