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: EVM locker implementation #74

Merged
merged 22 commits into from
Nov 5, 2024
Merged

feat: EVM locker implementation #74

merged 22 commits into from
Nov 5, 2024

Conversation

karim-en
Copy link
Collaborator

@karim-en karim-en commented Oct 14, 2024

  • Implemented EVM locker
  • Changed the interface of the EVM::initTransfer, so it now accepts the token address instead of the token ID and message instead of near_account_id:msg.
  • Map the token address and ID in both directions on the Near side to get the token ID by the address.
  • Added the SolAddress type with validation.

Todo in follow-up PRs:

  • Rename the factory contract and move the hardhat project to evm dir.
  • Implement factory on Near

@karim-en karim-en marked this pull request as draft October 14, 2024 22:04
@karim-en karim-en changed the base branch from develop to erc20-connector October 15, 2024 11:53
@karim-en karim-en marked this pull request as ready for review October 15, 2024 12:28
@karim-en karim-en marked this pull request as draft October 16, 2024 14:02
@karim-en
Copy link
Collaborator Author

karim-en commented Oct 16, 2024

I think it is better to open separate PR for these changes, so we can include it into the post-audit review:

  • Removed the unused whitelist logic to improve code readability and contract size.
  • Move types to separate libraries to improve code readability.

@karim-en karim-en changed the base branch from erc20-connector to main October 25, 2024 14:42
@karim-en karim-en linked an issue Oct 28, 2024 that may be closed by this pull request
@karim-en karim-en changed the title feat: basic locker implementation feat: EVM locker implementation Oct 29, 2024
@karim-en karim-en marked this pull request as ready for review October 29, 2024 14:49
@karim-en karim-en requested a review from kiseln October 29, 2024 14:49
if (fee >= amount) {
revert InvalidFee();
}

address tokenAddress = nearToEthToken[token];
uint256 extensionValue = msg.value - nativeFee;
Copy link
Contributor

Choose a reason for hiding this comment

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

Still feels like calculating value inside the extension method is more appropriate

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, the difference should be calculated here for two reasons:
1- we could implement a refund later.
2- it works as a verification of msg.value >= nativeFee

@karim-en karim-en merged commit 288da91 into main Nov 5, 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.

[OmniBridge]: implement EVM locker
4 participants