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: make token manager the minter for interchain tokens #313

Conversation

Foivos
Copy link
Contributor

@Foivos Foivos commented Dec 11, 2024

No description provided.

@Foivos Foivos requested a review from a team as a code owner December 11, 2024 16:18
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.44%. Comparing base (a7439cd) to head (befb487).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #313      +/-   ##
==========================================
- Coverage   99.44%   99.44%   -0.01%     
==========================================
  Files          20       20              
  Lines         724      722       -2     
  Branches      170      171       +1     
==========================================
- Hits          720      718       -2     
  Misses          4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@milapsheth milapsheth changed the base branch from main to feat/achee-report-29-11-24 December 12, 2024 06:57
@@ -149,6 +149,8 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M
if (minter == address(interchainTokenService)) revert InvalidMinter(minter);

minterBytes = minter.toBytes();
} else {
revert EmptyInterchainToken();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong base branch?

Can you create the PR on top of main instead of another branch, so they can be merged in any order?

@@ -97,7 +98,7 @@ contract InterchainToken is InterchainTokenStandard, ERC20Permit, Minter, IInter
* Also add the provided address as a minter. If `address(0)` was provided,
* add it as a minter to allow anyone to easily check that no custom minter was set.
*/
_addMinter(interchainTokenService_);
_addMinter(IInterchainTokenService(interchainTokenService_).tokenManagerAddress(tokenId_));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like a weird re-entrancy to call ITS back during deployment. better to pass in the token manager, or have ITS call transferMintership after deployment. The latter avoids needing to change the token bytecode, and keeps the logic isolated in ITS

interchainToken = await deployContract(owner, 'InterchainToken', [owner.address]);
interchainTokenDeployer = await deployContract(owner, 'InterchainTokenDeployer', [interchainToken.address]);

({ interchainTokenDeployer } = await deployAll(owner, 'Test'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you make the previous suggested change, then you don't need to deploy all contracts for this to work

const name = 'tokenName';
const symbol = 'tokenSymbol';
const decimals = 18;
const MINTER_ROLE = 0;

before(async () => {
interchainToken = await deployContract(ownerWallet, 'InterchainToken', [service]);
interchainTokenDeployer = await deployContract(ownerWallet, 'InterchainTokenDeployer', [interchainToken.address]);
({ interchainTokenDeployer, service } = await deployAll(ownerWallet, 'Test'));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -334,7 +334,7 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M
if (!token.isMinter(minter)) revert NotMinter(minter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add changeset and briefly discuss the behaviour change reason

@@ -334,7 +334,7 @@ contract InterchainTokenFactory is IInterchainTokenFactory, ITokenManagerType, M
if (!token.isMinter(minter)) revert NotMinter(minter);

// Sanity check to prevent accidental use of the current ITS address as the token minter
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update DESIGN.md for this behaviour change

@Foivos Foivos closed this Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants