-
Notifications
You must be signed in to change notification settings - Fork 17
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(its): add custom token support with auto scaling #311
base: main
Are you sure you want to change the base?
Conversation
contracts/InterchainTokenService.sol
Outdated
tokenId = linkToken(salt, destinationChain, destinationTokenAddress.toBytes(), tokenManagerType, false, linkParams, gasValue); | ||
} | ||
|
||
function linkToken(bytes32 salt, string calldata destinationChain, bytes memory destinationTokenAddress, TokenManagerType tokenManagerType, bool autoScaling, bytes memory linkParams, uint256 gasValue) public payable whenNotPaused returns (bytes32 tokenId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is to be used for local deployments too then linkToken is confusing.
// Restricted on ITS contracts deployed to Amplifier chains until ITS Hub adds support | ||
revert NotSupported(); | ||
} else if (bytes(destinationChain).length == 0) { | ||
// TODO: Only support linking new tokens via ITS factory, to include chain name in token id derivation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens to already deployed custom tokens?
} | ||
|
||
tokenId = interchainTokenId(deployer, salt); | ||
|
||
emit InterchainTokenIdClaimed(tokenId, deployer, salt); | ||
|
||
if (bytes(destinationChain).length == 0) { | ||
_deployTokenManager(tokenId, tokenManagerType, params); | ||
_deployTokenManager(tokenId, tokenManagerType, destinationTokenAddress.toAddress(), linkParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
linkParams are just the operator for local deployments it seems.
); | ||
|
||
if (tokenManagerType == TokenManagerType.NATIVE_INTERCHAIN_TOKEN) revert CannotDeploy(tokenManagerType); | ||
|
||
_deployTokenManager(tokenId, tokenManagerType, params); | ||
_deployTokenManager(tokenId, tokenManagerType, destinationTokenAddress.toAddress(), linkParams); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think even if the only param left in EVM is the operator, we should have it be abi encoded when it is passed as params.
937dd92
to
6d65c01
Compare
deployTokenManager
to reduce ITS bytecode after tests are updated to uselinkToken
Two new message types are introduced:
RegisterTokenMetadata
: Sends a message to ITS hub to register token decimals by token addressLinkToken
: Allows linking custom tokens across chains. LinkToken needs to be submitted from the same origin chain to other remote chains for the sametokenId
. Existing custom tokens can still be linked by callinglinkToken
from a chain that has a registered token for thattokenId
.