ArkProjectNFTs / bridge

The ArkProject Bridge: seamless transfer of NFTs between ETH L1 & Starknet L2. Smart contracts, user-friendly interface, secure & efficient solution. Experience the future of NFT ownership today
https://bridge.arkproject.dev
Apache License 2.0
23 stars 20 forks source link

Implemented Cancellation Logic #159

Closed Gathin23 closed 10 months ago

Gathin23 commented 1 year ago

Fix: #142

Completed the implementation in the contract but unable to complete the testcases

vercel[bot] commented 1 year ago

@Gathin23 is attempting to deploy a commit to the Screenshot Team on Vercel.

A member of the Team first needs to authorize it.

glihm commented 1 year ago

Thank you @Gathin23 for this first pass.

As I mentioned, you should call the StarknetCore contract, and not re-implement what it already does.

So when someone is starting a cancelling, you just have to forward it to the StarknetCore contract. Same thing for the cancel. Now, we do want to ensure that a request can be cancelled ONLY if the request was not already processed on L2.

So as I mentioned, for that we need an indexer that provide such information to the contract on ethereum.

So for now, when you implement the function that is forwarding to StarknetCore contract the cancelling, you can add a simple check in a state variable that check if the request hash is cancellable (that always return false for now). And in an other PR we will figure out how we will have this info available. :+1:

I think the most reasonable way to do so without paying too much fees, is to have once a day for instance, all the requests that has been processed on L1, we send a Tx on L1 with all the hashes to ensure they are not cancellable. Or the opposite approach, by default nothing is cancellable, and the indexer only register the hashes of the request that failed on L2. This one seems better. :)