optics-monorepo icon indicating copy to clipboard operation
optics-monorepo copied to clipboard

Create a demo xapp that allows bridging an asset like an NFT from Ethereum, Polygon, or Avalanche to Celo

Open ericnakagawa opened this issue 3 years ago • 20 comments

Cross chain applications (xapps) using Optics are a new way for moving assets between chains. We are looking for a live (testnet okay) example of this between one or more chains that Optics is running on to demonstrate the usefulness of this functionality.

Current xapp developer documentation can be found here. You may also review the token-bridge xapp docs here.

Review this video that walks through the concepts around xapp development.

This issue will be considered resolved once the following is completed:

  • There is a live example of a xapp deployed to testnet (Alfajores) or mainnet that allows bridging erc-721 and erc-1155 NFTs from Ethereum, Polygon, or Avalanche to Celo.
  • There is documentation:
    • explaining how the xapp works
    • design considerations and trade offs
  • At least one NFT has been bridged between Celo and two networks

The Gitcoin bounty will select multiple winners (up to 3) that fulfill the requirements listed above in the required time period. Up to three developers will be selected to submit solutions.

ericnakagawa avatar Jan 05 '22 16:01 ericnakagawa

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 2000.0 cUSD (2020.0 USD @ $1.01/cUSD) attached to it as part of the celo-org fund.

gitcoinbot avatar Jan 13 '22 21:01 gitcoinbot

Hey Eric 👋 Quick question for you: In the description it says, "The Gitcoin bounty will select multiple winners that fulfill the requirements listed above." How many winners? What is the limit on the number of winning submissions that will receive the bounty? 3? 10? 20?

alecj1240 avatar Jan 14 '22 01:01 alecj1240

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work has been started.

These users each claimed they can complete the work by 3 weeks, 1 day ago. Please review their action plans below:

1) dhruvjain1122 has been approved to start work.

Flow of NFT:-

  1. User send it's NFT to the BridgeRouter of source
  2. BridgeRouter Source hold the NFT ,sends enqueue this message to the Home which sends this to BridgeRouter Destination
  3. BridgeRouter Destination mint verifies and mint new NFT in the Destination chain which is then send to the user.
  4. To retrieve it's NFT at source User can just send this NFT back to the BridgeRouter which burn this and unlock the NFT at source 2) marcopereira27 has applied to start work (Funders only: approve worker | reject worker).

I'm going to implement a solution to bridge NFT assets between Celo and Polygon.

[ ] BridgeRouter contract implemented on the local domain. [ ] BridgeRouter contract implemented on the remote domain. [ ] Contract on local domain can lock NFT's and send messages to contract on remote domain. [ ] Contract on remote domain is able to authenticate the sender as a valid remote counterpart. [ ] Contract on remote domain can receive and decode messages and mint NFT's. [ ] To bridge an NFT back to the local domain, the remote contract is able to burn the NFT and send a message to the local contract, by which turn will unlock the NFT. 3) lucasespinosa28 has been approved to start work.

I read the documentation about Xapp and it does not look hard to create a bridge between eth and Celo for NFTs.

backend: a bridge contract to deposit the NFT on chain A or B, another contract to detect if some NFT was deposited and mint ou burn the NFT frontend in react to let everyone build your own bridge easy cloning the project 4) kostassagma has applied to start work (Funders only: approve worker | reject worker).

I will create a xapp where the user will be able to: • Send their nft to a smart contract on ethereum, which "freezes" the nft. • Receive a just minted nft, which represents the frozen one, on the celo network at the address specified when depositing the nft • Burn the nft in the celo network and receive the original nft on ethereum Im using react for frontend and will be using Goerli and Alfajores for ethereum and celo tesnets respectively. 5) zoek1 has been approved to start work.

  • deploy the corresponding contracts based on the examples of the optics monorepo
  • trigger and validate the assets' sending functionality
  • verify the reception of assets in test networks 6) surroundingart64 has been approved to start work.

I have completed the contracts with tests. But I needed further information for which I had tagged you here.

Can you please reply there?

https://github.com/celo-org/optics-monorepo/issues/941#issuecomment-1013954244 https://github.com/celo-org/optics-monorepo/issues/941#issuecomment-1013955659 https://github.com/celo-org/optics-monorepo/issues/941#issuecomment-1014444248

I also was able get the dispatch event in logs in Rinkeby: https://rinkeby.etherscan.io/tx/0xa802d5d2d80c0013416325f3e39bf60aab4da90198d3b8b8f4727c82656f884a#eventlog 7) maxx6262 has been approved to start work.

Solidity Smart Contract to

  • hold NFT sent into proxy wallet account
  • Extraction of all data and historical data from NFT
  • Mint ERC721 standard token on Celo chain Wrapping platform crosschain into ERC1155 8) rowlanja has applied to start work (Funders only: approve worker | reject worker).

creating a cross chain nft dapp shouldnt take too long. sending nft from one platform where theyre locked. Then a duplicate nft is issued to the sender 9) danijel-enoch has applied to start work (Funders only: approve worker | reject worker).

I basically plan to create a NFT smart contract both ERC721/1155 in all the listed chains and then create an sdk that allows all of them to interact with each other. The Interaction involves locking or burning of the NFT in the contract on one chain and then transfer it to another.

Learn more on the Gitcoin Issue Details page.

gitcoinbot avatar Jan 14 '22 03:01 gitcoinbot

Hey Eric 👋 Quick question for you:

In the description it says, "The Gitcoin bounty will select multiple winners that fulfill the requirements listed above."

How many winners? What is the limit on the number of winning submissions that will receive the bounty? 3? 10? 20?

@alecj1240 It'LL be awarded to more than one and up to 3. I'm open to extending it if it makes sense, too.

What are you thinking?

ericnakagawa avatar Jan 14 '22 15:01 ericnakagawa

@DhruvJain1122 please ensure the steps are documented and included in the xapp example. With the bridging of an nft, what additional metadata would be included?

ericnakagawa avatar Jan 14 '22 15:01 ericnakagawa

@ericnakagawa I will keep that in mind, thanks for the advice

amritkumarj avatar Jan 14 '22 17:01 amritkumarj

@ericnakagawa How does the user pay for the NFT minting fees in another chain, in the source side if so how do we calculate the fees?

amritkumarj avatar Jan 15 '22 14:01 amritkumarj

@ericnakagawa could I get your telegram or discord id, I have some questions to ask

amritkumarj avatar Jan 16 '22 08:01 amritkumarj

@ericnakagawa Check this out! optics nft transfer

amritkumarj avatar Jan 16 '22 09:01 amritkumarj

Hi @ericnakagawa I have completed the contracts with tests. But, I had to create a separate repo as I couldn't understand how to add tests in the Monorepo.

Should I add you as a collaborator for the same?

Currently the Router supports ERC721 transfers.

SurroundingArt64 avatar Jan 16 '22 21:01 SurroundingArt64

I found the XAppConnectionManager for Rinkeby

Can you confirm if the above address is the latest one?

Also, please share the same for following:

Celos Alfajores TestNet Polygon Mumbai Testnet

@ericnakagawa

I guess I should be able to fetch domain from them but they would be helpful as well.

SurroundingArt64 avatar Jan 16 '22 21:01 SurroundingArt64

I also was able get the dispatch event in logs in Rinkeby: https://rinkeby.etherscan.io/tx/0xa802d5d2d80c0013416325f3e39bf60aab4da90198d3b8b8f4727c82656f884a#eventlog

How can I track it on Remote? Any suggestions? @ericnakagawa

SurroundingArt64 avatar Jan 17 '22 11:01 SurroundingArt64

From what I understand no Updates have been pushed to Replicas in past 3 to 4 months on Alfajores, Kovan and Rinkeby.

How can I test my XApp @ericnakagawa

SurroundingArt64 avatar Jan 22 '22 05:01 SurroundingArt64

@ericnakagawa @gitcoinbot

Successfully bridged NFT from PolygonMumbai to Alfajores network. Had to deploy my own Homes and Replicas.

Relevant transactions: Send on Mumbai (1000): Call made to the ERC721Router

Transfers token id 1 of native NFT

You can see the dispatch event from home. Decode data:

{
    messageHash: '0x05e97104a73dcbd76e8178483e6f5d209675ff9a7e254b7e334822fc245841ea',
    leafIndex: 0,
    committedRoot: '0x0000000000000000000000000000000000000000000000000000000000000000',
    message: '0x000003e80000000000000000000000009365a6d7c89da1b6f22913aad65f000bb0f55dc900000000000007d00000000000000000000000009365a6d7c89da1b6f22913aad65f000bb0f55dc9000000000000000000000000379a056cb617ede30c56afb54e2f31850580676000000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000379a056cb617ede30c56afb54e2f318505806760000000000000000000000000fc77079c043b39a64ee9fa70863f25c9a0381d0800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001'
}

Update on Alfajores(200): Call made to Replica.

Transaction

Prove on Alfajores(2000): Call made to Replica.

Transaction

Process on Alfajores(2000): Call made to Replica which calls to Router which mints the non-native NFT.

Transaction

SurroundingArt64 avatar Jan 24 '22 02:01 SurroundingArt64

Setting up backend support for updates, prove and process for custom deployed Replica and Home.

@ericnakagawa

SurroundingArt64 avatar Feb 02 '22 13:02 SurroundingArt64

@SurroundingArt64 @DhruvJain1122 I can be contacted on Discord at ericnakagawa#0001 and Telegram at @ericnakagawa -- let's connect to review your progress!

ericnakagawa avatar Feb 09 '22 19:02 ericnakagawa

HI @ericnakagawa Will connect on discord.

SurroundingArt64 avatar Feb 13 '22 13:02 SurroundingArt64

Hi guys. Is this still open? I am having trouble with connecting with you guys.

SurroundingArt64 avatar Feb 22 '22 15:02 SurroundingArt64

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 2000.0 cUSD (1990.92 USD @ $1.0/cUSD) has been submitted by:

  1. @surroundingart64

@ericnakagawa please take a look at the submitted work:

  • PR by @surroundingart64

gitcoinbot avatar Apr 01 '22 16:04 gitcoinbot

https://github.com/SurroundingArt64/optics-nft-bridge @ericnakagawa

SurroundingArt64 avatar Apr 02 '22 16:04 SurroundingArt64