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: implement NEAR token factory #104

Merged
merged 30 commits into from
Nov 14, 2024
Merged

feat: implement NEAR token factory #104

merged 30 commits into from
Nov 14, 2024

Conversation

karim-en
Copy link
Collaborator

@karim-en karim-en commented Nov 5, 2024

The PR implement the NEAR token factory to bridge the none-NEAR first tokens to Near and other chains.

  1. Added token deployer contract.
  2. Added the token contract with mint and burn methods.
  3. Implemented the factory logic in the locker contract.
  4. Added support for native tokens transfers from the EVMs

amount_to_transfer,
(!transfer_message.msg.is_empty())
.then(|| transfer_message.msg.clone()),
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Now, I don’t like that we call ft_transfer_call without handling errors… And we only provide 50 TGas, which isn’t much. It could just return an error due to an out-of-gas issue or because some inner account doesn’t have storage. But in this case, the transaction will already be finalized.

Copy link
Contributor

@kiseln kiseln left a comment

Choose a reason for hiding this comment

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

Is this missing external token transfers to a 3rd (non-near) chain?

address.is_zero()
}
OmniAddress::Near(address) => address.len() == 0,
OmniAddress::Sol(address) => address.is_zero(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Just making note that since we're using Wrapped SOL we wouldn't have a zero address

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Deploy native token has been added here
ac3979a

if self.deployed_tokens.contains(&token_id) {
ext_token::ext(token_id.clone())
.with_static_gas(BURN_TOKEN_GAS)
.burn(amount);
Copy link
Contributor

Choose a reason for hiding this comment

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

My original understanding was that we burn tokens only when withdrawing to the original chain, otherwise we lock them just like near-native tokens. Would that be simpler or not?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think if we are transferring from ETH to SOL an erc20 token, then we should consider it as a direct transfer, and the NEAR protocol is used just as a mediator for this transfer.
Also it will be hard to track the total supply in this case, because for now the locked amount should equal to the sum of all total supplies on other chains.

@karim-en
Copy link
Collaborator Author

Is this missing external token transfers to a 3rd (non-near) chain?

Can you please clarify

@karim-en karim-en requested a review from frolvanya November 12, 2024 21:25
@karim-en karim-en marked this pull request as ready for review November 12, 2024 21:30
@karim-en karim-en merged commit c4a34c5 into main Nov 14, 2024
4 checks passed
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