Giter Club home page Giter Club logo

ethernauts's Introduction

Ethernauts

Implementation for https://forum.ethernautdao.io/t/deploy-ethernaut-avatar-nfts-to-bootstrap-the-dao-s-tokenomics/299

Requirements

  • Node.js v16.8.0
  • NPM v7.21.0
  • Docker
  • Docker Compose

Solidity development

The following hardhat tasks will help you to:

  • Start a local node: npx hardhat node
  • Deploy the contract: npx hardhat deploy
  • Open the sale: npx hardhat sale-state
  • Mint sample tokens: npx hardhat mint

DAPP/Keeper development

We use Docker and Docker Compose to run the development environment.

Run docker compose up -d to start the whole project. It includes the following services:

  • hardhat-node: (http://localhost:4585)
  • hardhat-deploy: Takes care of deploying the Ethernauts.sol contract to the docker hardhat network for development
  • dapp (Next.js) (http://localhost:3000)
  • redis (https://localhost:6379)
  • keeper-queue: Node server that listens to mint & batch events and enqueues the necessary jobs to be processed.
  • keeper-worker: Node server processes the enqueued jobs by keeper-queue and executes them with the desired concurrency.

Run docker compose ps to check the status of the running services and docker compose down to stop them.


You can also run/stop a single service using:

  • docker compose up service-name
  • docker compose down service-name

Interacting with the Ethernauts Contract

You can run hardhat tasks inside running docker containers using the docker compose exec ... command.

So, first you want to open the sale state, and you can do it with the sale-state hardhat task, like so:

docker compose exec hardhat-node sh -c 'cd /src/packages/hardhat && npx hardhat --network docker sale-state'

Then, you will be able to mint any amount of tokens using the mint task:

docker compose exec hardhat-node sh -c 'cd /src/packages/hardhat && npx hardhat --network docker mint'

Finally, you can also set the base URL changer address, with:

docker compose exec hardhat-node sh -c 'cd /src/packages/hardhat && npx hardhat --network docker exec --method setUrlChanger --args ["0x000"]'

Assets Validation

The provenanceHash saved at the contract was generated using the IPFS hash for each asset, concatenated in order and getting an MD5 hash from that.

The final deployed provenanceHash, which can be read at the Deployed Contract using the method Ethernauts.provenanceHash() is the following:

f04a636d10f42ec5a9d4885d30834a70

And all the assets in order can be seen at provenanceHash-concatenated.txt

There's also available the script command node bin/check-provenance.js which will parse the mentioned file and show all the hashes in order, which allows you to easily check that the assigned asset for your NFT is valid, in the correct order and wasn't tempered with.

ProTip: Only show you assetId specifying it on the command, like so: node bin/check-provenance.js 3

ethernauts's People

Contributors

alebanfi avatar avichalp avatar bayological avatar deadpine avatar eloigarrido avatar koloz193 avatar mariobyn avatar mjlescano avatar stermi avatar theethernaut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ethernauts's Issues

Custom badges with ERC1155 NFT tokens

The DAO wants a way to award things to avatar holders, such as a "mentor" badge etc. Similarly, mentors would like to award their trainees custom badges that don't necessarily involve the DAO's decision or approval. A mentor, for example, may award a certain "challenge" badge for something they use during training.

Previous attempts like have been made, for example this one involving adding a mapping to the avatar NFTs, on which the DAO could flick some properties on in an avatar:
#14

The problem with this is that when an avatar is transferred, all its properties are transferred with it. We wouldn't want the mentor badge to persist when a mentor sells the avatar NFT. And we wouldn't want the mentor to loose that badge either.

Alternatively, the badges could be assigned to addresses, and the ideal contract for this kind of record keeping could be ERC1155 NFTs.

The DAO could issue these in future stages to avatar holders, as could mentors, etc.

Move DAO multisig to L2

Subtasks

  • Confirm decision
  • Audit https://ogg.scopelift.co/
  • Create new multisig with same addresses as L1 - Done 0x8cbecc838DEA01d3dd6828615a38fc4486D9F326
  • Validate multisig instance bytecode - Matches
  • Test L2 multisig - Sent it 0.03 ETH and back
  • Send existing funds to L2
    • Agree on method - will send 12k sUSD to one of the signer addresses, swap it to USDC or DAI, bridge it to L2, then send it to the multisig on L2
    • Send all sUSD to an EOA - sending to 0x45a10F35BeFa4aB841c77860204b133118B7CcAE
    • Swap all sUSD to DAI
    • Bridge all DAI to L2
    • Send DAI to multisig
  • Verify multisig on Etherscan

Research fair randomness on the KiaSedona NFT

Resources

https://jaypegsautomart.com/
Contract: https://etherscan.io/address/0xf210d5d9dcf958803c286a6f8e278e4ac78e136e#code

Notes

Since it's expensive (and complicated) to randomly assign each tokenId to an assetId, and its not really transparent to just get a single random number like ethereans, they generate a few random numbers for the whole set.

Each tokenId belongs to one of 20 "lots". Each lot has its own random number. If the number has not yet been generated, or is not yet available, tokens have a place holder URI.

Recognize sale states in dapp

It should recognize the sale states and display different React components to dispatch a transaction that execute the associated Ethernauts contract function.

Ensure non-priviledged rarity knowledge with randomness

When we design bot.js to publish assets to IPFS, we will be in control of some mechanism that picks an assetId to associate it with a minted tokenId. We can be as honest as we want in this process, but the community has no way of knowing that we are actually being honest. We could know this rig this algorithm to be predictible by us, and thus be able to mint super rare NFTs from anon addresses we create. If the community cannot see a guarantee to mitigate this, the NFTs will be less valuable.

Other projects seem to be using oracles like Chainlink's VRF to generate a single random number that offsets the association:

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        uint _tokenId = randomisedOffset(tokenId,rand);
        return string(abi.encodePacked(baseURI(), _tokenId.toString()));
    }

Atm, Chainlink VRF is not supported in Optimism. They say it will be supported at some point. If we don't want to wait for them, we could deploy a contract on mainnet that relays a message with the random number to L2.

It might be slightly harder for us if we want to implement a dynamic randomness algorithm depending on ETH paid.

Ability to flag roles on NFTs

We'd like to have a generic and flexible mechanism by which the DAO can identify or mark certain NFTs as having a particular role, i.e. "mentor".

These should clear out when transfer.

Emit events where appropriate

So far, main Ethernauts.sol is being developed completely disregarding event emission. It'd be good to review existing functions and see which should emit an event.

Keep in mind that events are already being emitted from the ERC721 contract that is inherited from.

Design variable rarity algorithm

We'd like to be able to give people the ability to make donations while minting an NFT. This will increase the rarity with which an assetId is associated with a tokenId.

This is rather controversial, but it would allow buyers to signal their support for the DAO. The DAO could use these donations to create a mentors pool, that only NFT holders marked with the mentor flag can claim on.

Design fair pre-sale mechanism

We want to give community members a chance to get an NFT, without having to wake up at 4 am, and even consider giving them a discount (i.e. they shouldn't have to worry about affording it).

Ethereans solved this pretty nicely, by doing a pre-sale, where only community members can purchase tokens for 2-3 days, and only after that the public sale starts.

The mechanism by which community members can vary. One possibility is to mint poaps in xdai, and use that to produce a list of addresses. The owner can then sign messages and hand them over to poap holders, which they can use to access the early sale with a discount.

Design early sale dates mechanism

Tasks

  • Sale state enum
  • Ability to set state by owner
  • Early mint function
  • Modifiers to protect mint functions
  • General tests
  • Mint tests
  • Early mints with fixed price + tests

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.