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

[nft-minter by OP Games] : Add support for NFT tokens minted on NEAR Protocol #2

Open
polats opened this issue Mar 15, 2021 · 31 comments

Comments

@polats
Copy link
Collaborator

polats commented Mar 15, 2021

[nft-minter by OPGames]: Add support for NFT tokens minted on NEAR Protocol

Prize Bounty

Up to $3000 USD in NEAR (with matching grants)
One grand prize and two runner up prizes

Challenge Description

nft-minter is an open-source framework for minting NFTs, currently using IPFS and the Ethereum blockchain. We would love for it to be built upon by hackers so it will eventually become blockchain agnostic.

The challenge is to provide an option to users of nft-minter to mint their tokens on NEAR protocol instead of on the Ethereum blockchain, in the most developer friendly way possible.

The first step is probably to create an npm script similar to yarn contract:deploy:rinkeby that will deploy the contracts on NEAR instead of Ethereum. Once done, hackers should then update the frontend on packages/client to allow developers to create and mint the tokens via the web form.

This could be a stretch goal for the challenge, but we envision the ideal flow to be as simple as just changing an variable in the .env files. For example, adding a "blockchain=near" .env variable will automatically deploy the contract to the desired blockchain.

Submission Requirements

Hackers should create a pull request for this challenge, tagging this issue for reference. The completed submission should include the updated code (backend and frontend) and an updated README.md file discussing how to use nft-minter for NEAR tokens.

The application must be (1) the original work of the individual participant or the participating team; (2) third-party technology used by the individual participant or the participating team must be subject to valid perpetual, irrevocable licenses.

By submitting an application, the individual participant and each member of a participating team, jointly and severally, represent and warrant that the application, and all components thereof, will not violate any rights of any person or entity, including without limitation, any copyright, trademark, patent or other intellectual property rights, or violate any applicable national, federal, state, or local laws, regulations, or policies, including those relating to export control.

Judging Criteria

  1. Robustness and completeness of solution
  2. Developer experience (the more documented and the less steps for developers needed, the better)
  3. Potential reusability across blockchains (how well the solution is able to abstract away blockchain specific code)

Helpful References

NEAR NFT discussions

Other Links

Winner Announcement Date

April 9th 10am PST

More Info

For questions, please comment on this issue. For more long-form discussions, we can also use Github Discussions.

@gitcoinbot
Copy link

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


This issue now has a funding of 3000.0 DAI (3000.0 USD @ $1.0/DAI) attached to it.

@gitcoinbot
Copy link

gitcoinbot commented Mar 20, 2021

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


Work has been started.

These users each claimed they can complete the work by 51 minutes from now.
Please review their action plans below:

1) bardinpetr has started work.

The goal is to add support in nft-minter for NEAR blockchain by creating an unified solution which allows developers to add support for any blockchain with ease
2) secretshardul has started work.

Add support for Near NFT smart contracts. It will be possible to choose between Rust or WebAssembly contract variants through environment variables.
3) brianspha has started work.

Mint NFTs on NEAR
4) lyledavids has started work.

nft minter with option for near
5) sekmet has started work.

A NFT minter for ethereum and Near Network

Learn more on the Gitcoin Issue Details page.

@secretshardul
Copy link

secretshardul commented Mar 23, 2021

There are two possible solutions:

  1. Migrate existing solidity code to Near. Near EVM is in active development and is available on betanet. Or
  2. Write fresh AssemblyScript / Rust contracts

What solution are you looking for? The latter option has some caveats:

AssemblyScript / Rust contract caveats

ERC1155 multi token contract compatibility issue with NEP-4

nft-miner uses the ERC1155 multi-token standard. This standard lets you mint both:

  • Fungible tokens (ERC20-like): By minting multiple tokens for a given token ID
  • NFTs: By minting a single token for a token ID.

Near protocol has a standard spec NEP-4 for NFTs, but there isn't a multi-token spec yet. From the NEP-4 page:

A multi-token standard was considered, as well a standard that allowed for the transfer of any type of token along with the assets associated with this contract. This was foregone for the sake of decoupling the market contracts from the token contract

Implementing NEP-4 would require frontend changes for the following operations:

  1. Create new token: This will create a new NEP-4 contract with the user as owner. Owner and initial supply fields will be absent.
  2. Mint token: No token ID and quantity fields.
  3. Check token balance: No token ID field

Metadata issue

The NEP-4 spec leaves out metadata storage:

Finally, in the original draft, metadata was included in the model for tokens. It was clear through some basic implementations that this is not ideal since users may want to store metadata elsewhere. This could be entirely offchain, or in a separate contract.

There is a recent proposal on metadata storage but it has not been finalized.

I suggest leaving out on-chain metadata for now. Changes can be made once the above proposal is accepted.

@polats
Copy link
Collaborator Author

polats commented Mar 23, 2021

Thank you for the interest @secretshardul. We would prefer option 2 for now, as we were hoping for the code to be usable by more NEAR developers.

Instead of using NEP-4, is it possible to use the ERC-721 format used by Mintable as a reference instead? https://github.com/Mintbase/near-nft-standards/blob/main/ERC721_reference.md#rust-equivalent

There's also a new proposal still being finalized over at near/NEPs#171 that might be useful, and that might get it closer to the ERC-1155. I admit I still need to read through it though.

@secretshardul
Copy link

Mintbase ERC721 only defines function signatures, with the actual implementation is left out. Same can be said about NEP#171. Plus it's a working draft that is yet to be finalized.

I can can try implementing the contract but it may be hacky. What do you say?

@polats
Copy link
Collaborator Author

polats commented Mar 24, 2021

Hacky for now is fine, we can start with that and steadily improve it as NEP#171 becomes finalized. Looking forward to it!

@gitcoinbot
Copy link

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


Work for 3000.0 DAI (3000.0 USD @ $1.0/DAI) has been submitted by:


@Brianspha
Copy link

Hello @polats is it possible to get an extension i just need more time to test i have something but its not working so great

@polats
Copy link
Collaborator Author

polats commented Apr 1, 2021

It seems doable @Brianspha , i'll check if we can extend it

@Brianspha
Copy link

@polats any feedback?

@polats
Copy link
Collaborator Author

polats commented Apr 3, 2021

Hey @Brianspha we can extend it for one more week, is that enough time?

@Brianspha
Copy link

Yeah more than enough

@Brianspha
Copy link

Starting when? I had already stopped

@polats
Copy link
Collaborator Author

polats commented Apr 4, 2021

Just extended it now @Brianspha until next Sunday

@Brianspha
Copy link

@polats just an update because of my lack of experience with react I'm creating a new package which will use a vue front end

@Brianspha
Copy link

@polats the files in the temp_meta_data are missing

@Brianspha
Copy link

Been trying to figure out why the contracts are deploying

@polats
Copy link
Collaborator Author

polats commented Apr 10, 2021

Hi @Brianspha here's the one that I use: temp_metadata.zip . The scripts should generate temp_metadata automatically though, I'll take a look

@Brianspha
Copy link

Alright nah it doesn't it fails but thank you for the file

@Brianspha
Copy link

@polats this folder seems to be missing as well contracts.json as required in the nftutils.ts file I'm not sure if I'm meant to create this file and what is the structure of this file?

@Brianspha
Copy link

@polats

@polats
Copy link
Collaborator Author

polats commented Apr 10, 2021

Hey @Brianspha, contracts.json is created by the contract:deploy:rinkeby step by hardhat.

It's a json file containing the contract ABI and looks like:
{ "name": "rinkeby", "chainId": "4", "contracts": { "ERC1155Opensea": { "address": "...", "abi": ... } } }

@gitcoinbot
Copy link

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


Work for 3000.0 DAI (3000.00 USD @ $1.0/DAI) has been submitted by:

  1. @sekmet

@polats please take a look at the submitted work:


@Brianspha
Copy link

@polats I will be updating the forked repo later on in the day I'm just a bit tired now this is what I've done

  1. Created an equivalent erc721 token near
  2. Unit tested functions
  3. Created a new package since I'm not familiar with react that uses vue only to test mint NEAR nfts
  4. Edited and commented out the web3 code on the nftutils.ts file I couldn't get the files to work mainly due to missing documentation of how the files referenced are generated

@Brianspha
Copy link

@polats I did my best there so many limitations when working with near

@polats
Copy link
Collaborator Author

polats commented Apr 13, 2021

Thank you @Brianspha i'll be checking out the repo today

@Brianspha
Copy link

@polats cool I ran out of stamina to document everything because of the issues with near which I did report to their team

@polats
Copy link
Collaborator Author

polats commented Apr 14, 2021

Hey @Brianspha , can you write out some steps on how I can test? I see the new scripts on package.json, how would I mint the NFTs and view them?

@Brianspha
Copy link

Hey @polats i didnt develop the front end for that but please look at the unit tests here: https://github.com/Brianspha/nft-minter/blob/master/packages/near-contracts/assembly/__tests__/main.spec.ts

@Brianspha
Copy link

I was only to develop the minting option on the front end but due to near returning an error at times wasm execution failed with error: FunctionCallError(CompilationError(PrepareError(Deserialization))) I gave up continuing you don't have to accept the solution anyone else can continue. I spent most of the time trying to figure out why this error was occuring

@gitcoinbot
Copy link

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


The funding of 3000.0 DAI (3000.0 USD @ $1.0/DAI) attached to this issue has been cancelled by the bounty submitter

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

No branches or pull requests

4 participants