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: add contract needed for bridging funds to zkSync rollup #28

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

aliXsed
Copy link
Contributor

@aliXsed aliXsed commented Apr 10, 2024

This contract belongs to zkSync rollup project. It will allow us to have a single known endpoints for users who want to move their tokens from parachain to rollup. This would allow them to express their intention clearly on chain in a single transaction which moves their specified funds out of their control too. The event emitted from this contract can trigger our off chain oracle to go ahead and mint the requested fund on the rollup. Another benefit of this contract is the check for the validity of the destination address and prevent users from losing funds due to address mistakes. Also if the amount is less than a threshold this contract will fail the request as the fee for transferring could be larger than the amount.

#[ink::test]
fn eth_address_is_valid() {
let address = "0x2E7F3926Ae74FDCDcAde2c2AB50990C5daFD42bD";
assert_eq!(is_valid_ethereum_address(address), true);
Copy link
Contributor

Choose a reason for hiding this comment

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

Lint would dislike this style but I think it is readable

if !is_valid_ethereum_address(to.as_str()) {
return Err(Error::IncorrectRecipient);
}
let amount = self.env().transferred_value();
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't it be atomic?

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.

2 participants