Skip to content

feat: add contract needed for bridging funds to zkSync rollup#28

Draft
aliXsed wants to merge 2 commits intomainfrom
aliX/bridge-contract
Draft

feat: add contract needed for bridging funds to zkSync rollup#28
aliXsed wants to merge 2 commits intomainfrom
aliX/bridge-contract

Conversation

@aliXsed
Copy link

@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