From 9a83ce7f17884b265f5761e02784eb246a6b639f Mon Sep 17 00:00:00 2001 From: GitGuru7 <128375421+GitGuru7@users.noreply.github.com> Date: Wed, 21 Feb 2024 18:03:29 +0530 Subject: [PATCH] feat: add decimals() functionalitity in Multichain token --- contracts/Token/TokenBridgeController.sol | 4 ++++ contracts/interfaces/IMultichainToken.sol | 2 ++ contracts/test/MockToken.sol | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/contracts/Token/TokenBridgeController.sol b/contracts/Token/TokenBridgeController.sol index c6785e6..b72c8a6 100644 --- a/contracts/Token/TokenBridgeController.sol +++ b/contracts/Token/TokenBridgeController.sol @@ -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. diff --git a/contracts/interfaces/IMultichainToken.sol b/contracts/interfaces/IMultichainToken.sol index 54c0a63..a1c0173 100644 --- a/contracts/interfaces/IMultichainToken.sol +++ b/contracts/interfaces/IMultichainToken.sol @@ -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); } diff --git a/contracts/test/MockToken.sol b/contracts/test/MockToken.sol index 8f8f337..d43c10c 100644 --- a/contracts/test/MockToken.sol +++ b/contracts/test/MockToken.sol @@ -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 { + _mint(account, amount); + } + + function burn(address account, uint256 amount) external { + _burn(account, amount); + } }