Skip to content

Commit

Permalink
evm: Update NTT token interface (#309)
Browse files Browse the repository at this point in the history
* evm: add burn method to `INttTokenInterface`

* evm: add natspec for errors and events

* evm: document INTTToken interface methods

* evm: add old minter to NewMinter event

* evm: rename INTTToken -> INttToken

---------

Co-authored-by: Rahul Maganti <rahulmaganti@rahuls-mbp.mynetworksettings.com>
  • Loading branch information
RahulMaganti47 and Rahul Maganti authored Mar 15, 2024
1 parent 87bf873 commit cb57ed2
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
5 changes: 5 additions & 0 deletions evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,8 @@ bash sh/configure_wormhole_ntt.sh -n NETWORK_TYPE -c CHAIN_NAME -k PRIVATE_KEY
-n testnet, mainnet
-c avalanche, ethereum, sepolia
```

#### Additional Notes
Tokens powered by NTT in __burn__ mode require the `burn` method to be present. This method is not present in the standard ERC20 interface, but is found in the `ERC20Burnable` interface.

The `mint` and `setMinter` methods found in the [`INttToken` Interface](src/interfaces/INTTToken.sol) are not found in the standard `ERC20` interface.
4 changes: 2 additions & 2 deletions evm/src/NttManager/NttManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "wormhole-solidity-sdk/libraries/BytesParsing.sol";
import "../libraries/RateLimiter.sol";

import "../interfaces/INttManager.sol";
import "../interfaces/INTTToken.sol";
import "../interfaces/INttToken.sol";
import "../interfaces/ITransceiver.sol";

import {ManagerBase} from "./ManagerBase.sol";
Expand Down Expand Up @@ -455,7 +455,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
IERC20(token).safeTransfer(recipient, untrimmedAmount);
} else if (mode == Mode.BURNING) {
// mint tokens to the specified recipient
INTTToken(token).mint(recipient, untrimmedAmount);
INttToken(token).mint(recipient, untrimmedAmount);
} else {
revert InvalidMode(uint8(mode));
}
Expand Down
12 changes: 0 additions & 12 deletions evm/src/interfaces/INTTToken.sol

This file was deleted.

36 changes: 36 additions & 0 deletions evm/src/interfaces/INttToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// SPDX-License-Identifier: Apache 2
pragma solidity >=0.8.8 <0.9.0;

interface INttToken {
/// @notice Error when the caller is not the minter.
/// @dev Selector 0x5fb5729e.
/// @param caller The caller of the function.
error CallerNotMinter(address caller);

/// @notice Error when the minter is the zero address.
/// @dev Selector 0x04a208c7.
error InvalidMinterZeroAddress();

/// @notice Error when insufficient balance to burn the amount.
/// @dev Selector 0xcf479181.
/// @param balance The balance of the account.
/// @param amount The amount to burn.
error InsufficientBalance(uint256 balance, uint256 amount);

/// @notice The minter has been changed.
/// @dev Topic0
/// 0x0b5e7be615a67a819aff3f47c967d1535cead1b98db60fafdcbf22dcaa8fa5a9.
/// @param newMinter The new minter.
event NewMinter(address previousMinter, address newMinter);

// NOTE: the `mint` method is not present in the standard ERC20 interface.
function mint(address account, uint256 amount) external;

// NOTE: the `setMinter` method is not present in the standard ERC20 interface.
function setMinter(address newMinter) external;

// NOTE: NttTokens in `burn` mode require the `burn` method to be present.
// This method is not present in the standard ERC20 interface, but is
// found in the `ERC20Burnable` interface.
function burn(uint256 amount) external;
}

0 comments on commit cb57ed2

Please sign in to comment.