Skip to content

Commit

Permalink
Merge pull request #71 from flood-protocol/chain-ops
Browse files Browse the repository at this point in the history
handling NotAContract()
  • Loading branch information
fulminmaxi authored Jul 11, 2023
2 parents 99b6a04 + 67a594d commit d251ada
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/decoders/extensions/DecoderWithRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,23 @@ contract DecoderWithRegistry is IDecoder, Ownable2Step {
constructor() Ownable2Step() {}

function setZone(uint8 zoneId, address zone) external onlyOwner {
if (zone.code.length == 0) {
revert IFloodPlain.NotAContract();
}
_zones.set(zoneId, zone);
}

function setFulfiller(uint8 fulfillerId, address fulfiller) external onlyOwner {
if (fulfiller.code.length == 0) {
revert IFloodPlain.NotAContract();
}
_fulfillers.set(fulfillerId, fulfiller);
}

function setToken(uint16 tokenId, address token) external onlyOwner {
if (token.code.length == 0) {
revert IFloodPlain.NotAContract();
}
_tokens.set(tokenId, token);
}

Expand Down
6 changes: 3 additions & 3 deletions test/utils/TokenFixture.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ address constant ARBITRUM_DAI = 0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1;
address constant ARBITRUM_USDT = 0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9;

contract MockToken is ERC20 {
uint8 public immutable __decimals;
uint8 internal immutable innerDecimals;

constructor(string memory name, string memory symbol, uint8 _decimals) ERC20(name, symbol) {
__decimals = _decimals;
innerDecimals = _decimals;
}

function decimals() public view override returns (uint8) {
return __decimals;
return innerDecimals;
}
}

Expand Down

0 comments on commit d251ada

Please sign in to comment.