Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(token-handler)!: added automatic token migration #317

Merged
merged 35 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5b1b544
Added the basic changes.
Foivos Dec 23, 2024
3be2fda
made lint happy
Foivos Jan 2, 2025
8e0c290
Added some functions to migrate tokens
Foivos Jan 6, 2025
58e956e
added automatic token migration
Foivos Jan 6, 2025
af995b8
Merge branch 'main' into feat/token-manager-mint-interchain-tokens-2
milapsheth Jan 7, 2025
4c7e551
Merge branch 'feat/token-manager-mint-interchain-tokens-2' into feat/…
milapsheth Jan 7, 2025
6cd5926
Merge branch 'feat/manual-migrate-tokens' into feat/automcatic-migrat…
milapsheth Jan 7, 2025
a833844
Update contracts/InterchainTokenService.sol
Foivos Jan 9, 2025
123c9c1
removed migrate legacy token and added tests
Foivos Jan 9, 2025
3c63b22
added a docstring
Foivos Jan 9, 2025
70a0796
Merge branch 'feat/manual-migrate-tokens' into feat/automcatic-migrat…
Foivos Jan 9, 2025
b2b367b
fixed tests
Foivos Jan 9, 2025
716fb46
made lint happy
Foivos Jan 9, 2025
de53714
addressed comments
Foivos Jan 10, 2025
5bcb97a
prettier
Foivos Jan 10, 2025
e4f3152
Merge branch 'feat/token-manager-mint-interchain-tokens-2' into feat/…
Foivos Jan 10, 2025
1f6eb3f
Merge branch 'feat/manual-migrate-tokens' into feat/automcatic-migrat…
Foivos Jan 10, 2025
9c9f5f2
fix tests
Foivos Jan 10, 2025
2a606ec
Apply suggestions from code review
milapsheth Jan 10, 2025
09de417
Merge branch 'main' into feat/token-manager-mint-interchain-tokens-2
milapsheth Jan 13, 2025
cd4341f
Merge branch 'main' into feat/token-manager-mint-interchain-tokens-2
milapsheth Jan 15, 2025
bc6d739
Merge branch 'feat/token-manager-mint-interchain-tokens-2' into feat/…
milapsheth Jan 15, 2025
69f8dc6
cleanup
milapsheth Jan 15, 2025
d7e6c39
cs
milapsheth Jan 15, 2025
ac912cf
fmt
milapsheth Jan 15, 2025
a21d366
stash
Foivos Jan 15, 2025
7edef20
Merge branch 'main' into feat/manual-migrate-tokens
Foivos Jan 16, 2025
379a08c
Fixed tests
Foivos Jan 16, 2025
cd3826a
Merge branch 'feat/manual-migrate-tokens' into feat/automcatic-migrat…
Foivos Jan 16, 2025
c3ae998
made lint happy
Foivos Jan 16, 2025
9a729bd
Merge branch 'feat/manual-migrate-tokens' into feat/automcatic-migrat…
Foivos Jan 16, 2025
a5ad995
fixed tests
Foivos Jan 16, 2025
ba0334d
prettier
Foivos Jan 16, 2025
0d7dbfc
Merge branch 'feat/manual-migrate-tokens' into feat/automcatic-migrat…
Foivos Jan 16, 2025
593c674
Merge branch 'main' into feat/automcatic-migrate-tokens
milapsheth Jan 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
made lint happy
Foivos committed Jan 2, 2025
commit 3be2fda56967e584765853629f1fbe99b2f62744
11 changes: 8 additions & 3 deletions contracts/TokenHandler.sol
Original file line number Diff line number Diff line change
@@ -11,7 +11,6 @@ import { Create3AddressFixed } from './utils/Create3AddressFixed.sol';
import { ITokenManagerType } from './interfaces/ITokenManagerType.sol';
import { ITokenManager } from './interfaces/ITokenManager.sol';
import { ITokenManagerProxy } from './interfaces/ITokenManagerProxy.sol';
import { IERC20MintableBurnable } from './interfaces/IERC20MintableBurnable.sol';
import { IERC20BurnableFrom } from './interfaces/IERC20BurnableFrom.sol';
import { IMinter } from './interfaces/IMinter.sol';

@@ -40,7 +39,11 @@ contract TokenHandler is ITokenHandler, ITokenManagerType, ReentrancyGuard, Crea
/// @dev Track the flow amount being received via the message
ITokenManager(tokenManager).addFlowIn(amount);

if (tokenManagerType == uint256(TokenManagerType.NATIVE_INTERCHAIN_TOKEN) || tokenManagerType == uint256(TokenManagerType.MINT_BURN) || tokenManagerType == uint256(TokenManagerType.MINT_BURN_FROM)) {
if (
tokenManagerType == uint256(TokenManagerType.NATIVE_INTERCHAIN_TOKEN) ||
tokenManagerType == uint256(TokenManagerType.MINT_BURN) ||
tokenManagerType == uint256(TokenManagerType.MINT_BURN_FROM)
) {
_mintToken(tokenManager, tokenAddress, to, amount);
return (amount, tokenAddress);
}
@@ -73,7 +76,9 @@ contract TokenHandler is ITokenHandler, ITokenManagerType, ReentrancyGuard, Crea

if (tokenOnly && msg.sender != tokenAddress) revert NotToken(msg.sender, tokenAddress);

if (tokenManagerType == uint256(TokenManagerType.NATIVE_INTERCHAIN_TOKEN) || tokenManagerType == uint256(TokenManagerType.MINT_BURN)) {
if (
tokenManagerType == uint256(TokenManagerType.NATIVE_INTERCHAIN_TOKEN) || tokenManagerType == uint256(TokenManagerType.MINT_BURN)
) {
_burnToken(tokenManager, tokenAddress, from, amount);
} else if (tokenManagerType == uint256(TokenManagerType.MINT_BURN_FROM)) {
_burnTokenFrom(tokenAddress, from, amount);