// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Test, console} from "forge-std/Test.sol";
import { IBridgeAdapter,Counter, Messages} from "../src/Counter.sol";
contract CounterTest is Test {
Counter public counter;
address admin = makeAddr("admin");
//address manager = makeAddr('manager');
function setUp() public {
//vm.startPrank(admin);
counter = new Counter(admin);
// counter.grantRole(counter.MANAGER_ROLE(),manager); // Already set
}
// adapter Id cannot be removed
function testImpactOfAddressZeroInputCannotBeRemoved() public {
vm.startPrank(admin);
// adds 5 instances of adapter (For instance)
for(uint160 i =0; i < 5; i++){ //makes 5 address (address(0) as first)
IBridgeAdapter adapter = IBridgeAdapter(address(i)); //address(0) will be first
counter.addAdapter(uint16(i),adapter);
console.log('addapterInstances',address(adapter));
}
uint16 adapterId = 0; //adapterId of addressZero adapter
vm.expectRevert(abi.encodeWithSelector(Counter.AdapterNotInitialized.selector, 0));
//attepmpt to reverse this error is impossible.
counter.removeAdapter(adapterId);
}
/**
=========Signatures
function isAdapterInitialized(uint16 adapterId) public view returns (bool)
function getAdapter(uint16 adapterId) public view returns (IBridgeAdapter)
function addAdapter(uint16 adapterId, IBridgeAdapter adapter) external
*/
}