Skip to content

Commit

Permalink
feat: add decimals() functionalitity in Multichain token
Browse files Browse the repository at this point in the history
  • Loading branch information
GitGuru7 committed Feb 21, 2024
1 parent f333995 commit 9a83ce7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/Token/TokenBridgeController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ contract TokenBridgeController is MultichainTokenController {
_increaseMintLimit(msg.sender, amount_);
}

function decimals() external view returns (uint8) {
return INNER_TOKEN.decimals();
}

/**
* @notice Hook that is called before any transfer of tokens. This includes
* minting and burning.
Expand Down
2 changes: 2 additions & 0 deletions contracts/interfaces/IMultichainToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ interface IMultichainToken {
function mint(address to, uint256 amount) external;

function burn(address from, uint256 amount) external;

function decimals() external view returns (uint8);
}
8 changes: 8 additions & 0 deletions contracts/test/MockToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@ contract MockToken is ERC20 {
function decimals() public view virtual override returns (uint8) {
return _decimals;
}

function mint(address account, uint256 amount) external {

Check failure on line 25 in contracts/test/MockToken.sol

View workflow job for this annotation

GitHub Actions / Lint

Function order is incorrect, external function can not go after public view function (line 21)
_mint(account, amount);
}

function burn(address account, uint256 amount) external {
_burn(account, amount);
}
}

0 comments on commit 9a83ce7

Please sign in to comment.