Skip to content

Commit

Permalink
fixup! [Polygon] feat: mainnet fork tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kyriediculous committed Dec 14, 2023
1 parent d9816a6 commit e0b49a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/adapters/PolygonAdapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ contract PolygonAdapterTest is Test {

function setUp() public {
adapter = new PolygonAdapter();
vm.etch(validatorShares, bytes("code"));
vm.etch(MATIC_STAKE_MANAGER, bytes("code"));

// Set default mock calls
Expand All @@ -55,7 +56,12 @@ contract PolygonAdapterTest is Test {
function test_previewDeposit() public {
uint256 assets = 100;
uint256 expected = assets;
uint256 actual = adapter.previewDeposit(validatorShares, assets);
vm.mockCall(MATIC_STAKE_MANAGER, abi.encodeCall(IPolygonStakeManager.delegatedAmount, (validatorId)), abi.encode(1 ether));
vm.mockCall(
validatorShares, abi.encodeCall(IPolygonValidatorShares.exchangeRate, ()), abi.encode(EXCHANGE_RATE_PRECISION_HIGH)
);
vm.mockCall(validatorShares, abi.encodeCall(IPolygonValidatorShares.totalSupply, ()), abi.encode(1 ether));
uint256 actual = adapter.previewDeposit(address(this), assets);
assertEq(actual, expected);
}

Expand Down

0 comments on commit e0b49a6

Please sign in to comment.