Skip to content

Commit 2ecb8e0

Browse files
committed
add auto association explanation to the docs
1 parent a64202d commit 2ecb8e0

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

contracts/InterchainTokenFactory.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ contract InterchainTokenFactory is IInterchainTokenFactory, Multicall, Upgradabl
127127
* @param name The name of the token.
128128
* @param symbol The symbol of the token.
129129
* @param decimals The number of decimals for the token.
130-
* @param initialSupply The amount of tokens to mint initially (can be zero), allocated to the msg.sender.
130+
* @param initialSupply The amount of tokens to mint initially (can be zero), allocated to the msg.sender. Not supported for HTS tokens.
131131
* @param minter The address to receive the minter and operator role of the token, in addition to ITS. If it is set to `address(0)`,
132132
* the additional minter isn't set, and can't be added later. This allows creating tokens that are managed only by ITS, reducing trust assumptions.
133133
* Reverts if the minter is the ITS address since it's already added as a minter.

contracts/hedera/README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ The responsibility of keeping ITS funded on the WHBAR contract lies with the dep
1212

1313
![Deploy New Interchain Token Flow](./diagrams/deploy_interchain_token.png)
1414

15+
### Deploying with Initial Supply
16+
17+
Initial supply is not supported when deploying a new Interchain Token on Hedera. To receive tokens, an account needs to previously associate with the token, thus it cannot immediately receive tokens after creation.
18+
19+
However there is an [Automatic Token Associations](https://docs.hedera.com/hedera/core-concepts/accounts/account-properties#automatic-token-associations) feature in Hedera, which allows accounts to approve a number of automatic token associations (airdrops) without needing to explicitly associate with each token. The only way to reliably tell if an account can receive a new token is by reading the property for the account and checking if the value is `-1` (unlimited associations).
20+
21+
There is an optimistic approach to this, where it is assumed the account has unlimited associations and can receive the token. However if the transaction reverts due to it not being able to receive the token, [gas will be nonetheless charged](https://docs.hedera.com/hedera/core-concepts/smart-contracts/gas-and-fees). This is undesirable, since Hedera charges at minimum 80% of the gas limit.
22+
23+
Another approach is to have the Relayer [check](https://docs.hedera.com/hedera/sdks-and-apis/rest-api/accounts#get-api-v1-accounts-idoraliasorevmaddress) if the account can receive the token before deploying it, but this requires customisations to the Relayer, which is again not desirable.
24+
25+
This behaviour can be changed in the future by upgrading the `InterchainTokenFactory` contract to support initial supply, but for now it is not supported.
26+
1527
### Hedera-related Notes
1628

1729
- Hedera contract and token "rent" and "expiry" are disabled on Hedera and not supported in this implementation.
@@ -31,6 +43,5 @@ The responsibility of keeping ITS funded on the WHBAR contract lies with the dep
3143
- `InterchainTokenDeployer.sol` `deployedAddress` is not supported, since HTS tokens don't have deterministic addresses.
3244
- `interchainTokenAddress` was removed from `InterchainTokenService.sol`, since HTS tokens don't have deterministic addresses. `registeredTokenAddress` should be used instead.
3345
- `transmitInterchainTransfer` was removed from `InterchainTokenService.sol` since it's meant to be called from an `InterchainToken` contract, which is not used.
34-
- When creating a new interchain token, `InterchainTokenService` and `TokenManager` are associated with the token.
35-
- `initialSupply` isn't supported when deploying a new interchain token. To receive tokens, an account needs to previously associate with the token, thus it cannot immediately receive tokens after creation. (TODO explain why auto associations aren't used.)
46+
- When creating a new interchain token, `TokenManager` is automatically associated with the token, as the creator.
3647
- Both HTS tokens and ERC20 tokens are supported for registration.

0 commit comments

Comments
 (0)