Git Product home page Git Product logo

pixel-avatars's Introduction

Derivatives Project

All Contributors

Solidity contract tests

Project

The Derivatives project, originally known as the pixel-avatars project is created initially to allow the minting of a derived Pixel Avatar ERC721 NFT token generated based on the traits of the original DeveloperDAO genesis NFTs; similar to how Loot has its own derivatives projects.

It was later renamed to a derivatives project to include initiatives that will form a roadmap beyond the initial pixel avatars token.

Developer Setup

For Developers, see FULL_LOCAL_SETUP.md to be able to change, run and test all three major pieces locally. Or visit individual README.md files if you only want to setup one piece, such as the front-end, and then use the hosted web server and deployed contract.

The servers are deployed at:

Historical notes

User by the name of Neoc id the DeveloperDao Discord was offering to do an avatar versions of the developer dao NFT genesis token. Another user goldzulu spotted the potential and suggested a project which upon some initial consensus was put to lead the project. Officially the project kicked off on the 12th September 2021 via an online discord meeting hosted by goldzulu.

Areas Of Interest

There are three different areas in which devs can be actively involved in.

Backend

This is where solidity smart contracts are being planned, created, tested and deployed. It also covers IPFS, Oracles and generally, anything that is supporting the Web3 frontends.

Frontend

The web3 frontend that will support users in minting, previewing and other utilities and apps further down in the roadmap including possibly NFT Games and Metaverses.

Graphics Design

Where the artwork design and generation is being done. Initially it will be a unique artwork "component" for each of the different possible traits.

Active Projects

Status Updates

Fortnightly Status updates can be found here

Meetings

The derivatives project hold fortnightly meeting on wednesdays 1600 UTC.

The first kickoff meeting was recorded on 12th September 2021 UTC 1700 and can be found here:

Meeting notes will be provided in future meetings.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


VoiceTechGuy

πŸ’» πŸ€” πŸ“†

Rasmus Nielsen

πŸ’» πŸ‘€ πŸ€”

Erik Knobl

🎨 πŸ€”

etherinsight

πŸ’» πŸ€”

Carlo Miguel Dy

πŸ’» πŸ€”

Alex

πŸ’»

Brian Gershon

πŸ’» πŸš‡

Dhaiwat Pandya

πŸ’¬

This project follows the all-contributors specification. Contributions of any kind welcome!

pixel-avatars's People

Contributors

7i7o avatar alexni245 avatar allcontributors[bot] avatar briangershon avatar carlomigueldy avatar dhaiwat10 avatar dtaib avatar eknobl avatar etherinsight avatar fiigmnt avatar frankiefab100 avatar goldzulu avatar kempsterrrr avatar mirage007 avatar rai-rakesh avatar rasmuscnielsen 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar

pixel-avatars's Issues

Generator script for images

import os
import json
import asyncio

ASSET_DIR = f"{os.getcwd()}/assets"

with open(f"{ASSET_DIR}/developers.json") as f:
    developers = json.load(f)

# output folder mode
mode = 0o777

# Path
path = os.getcwd() + "/final-images"

try:
    os.mkdir(path, mode)
except:
    pass

# for multiprocessing/ async processing https://stackoverflow.com/a/59385935
def background(f):
    def wrapped(*args, **kwargs):
        return asyncio.get_event_loop().run_in_executor(None, f, *args, **kwargs)

    return wrapped



@background
def generate(i):

       
        dev=developers[i-1]
        print(dev)

        # remove space and convert location to lowercase

        background = str.lower(dev["background"])
        background = background.replace(" ", "")

        clothing = str.lower(dev["clothing"])
        clothing = clothing.replace(" ", "")

        industry = str.lower(dev["industry"])
        industry = industry.replace(" ", "")

        language = str.lower(dev["language"])
        language = language.replace(" ", "")

        flag = str.lower(dev["location"])
        flag = flag.replace(" ", "")

        mind = str.lower(dev["mind"])
        mind = mind.replace(" ", "")

        o_system = str.lower(dev["os"])
        o_system = o_system.replace(" ", "")
        o_system = o_system.replace("/", "")
        o_system = o_system.replace(".", "")

        text_editor = str.lower(dev["textEditor"])
        text_editor = text_editor.replace(" ", "")
        text_editor = text_editor.replace("&", "and")
        text_editor = text_editor.replace("++", "")

        vibe = str.lower(dev["vibe"])
        vibe = vibe.replace(" ", "")

        background = Image.open(f"{ASSET_DIR}/traits/background/{background}.png")
        background_size = background.size

        flag = Image.open(f"{ASSET_DIR}/traits/location/{flag}.png")
        flag = flag.resize(background_size)

 

        industry = Image.open(f"{ASSET_DIR}/traits/industry/{industry}.png")
        industry = industry.resize(background_size)

        language = Image.open(f"{ASSET_DIR}/traits/language/{language}.png")
        language = language.resize(background_size)

        mind = Image.open(f"{ASSET_DIR}/traits/mind/{mind}.png")
        mind = mind.resize(background_size)

        o_system = Image.open(f"{ASSET_DIR}/traits/os/{o_system}.png")
        o_system = o_system.resize(background_size)

        text_editor = Image.open(f"{ASSET_DIR}/traits/texteditor/{text_editor}.png")
        text_editor = text_editor.resize(background_size)

        vibe = Image.open(f"{ASSET_DIR}/traits/vibe/{vibe}.png")
        vibe = vibe.resize(background_size)
        
        clothing = Image.open(f"{ASSET_DIR}/traits/clothing/{clothing}.png")
        clothing = clothing.resize(background_size)
        # computer = Image.open(f'{ASSET_DIR}/traits/computer/computer.png')

        background.paste(industry, (0, 0), industry)
        background.paste(flag, (0, 0), flag)
        

        background.paste(mind, (0, 0), mind)
        background.paste(o_system, (0, 0), o_system)
        background.paste(text_editor, (0, 0), text_editor)
        background.paste(vibe, (0, 0), vibe)
        background.paste(language, (0, 0), language)
        background.paste(clothing, (0, 0), clothing)


        # Setting the points for cropped image
        left = 295
        top = 555
        right = 3330
        # this will give a 3035*3035 image
        bottom_without_cropped_pixels=background_size[1]-1144

        im1 = background.crop((left, top, right, bottom_without_cropped_pixels))


        # background.paste(computer, (0,0), computer)
        # resized_img = background.resize((878, 1136), resample=Image.NEAREST)
        im1.save(f'final-images/dev_{dev["id"]}.png', "PNG")


for dev in developers:
    generate(int(dev["id"]))

Add TypeScript support

Would be great to maintain a codebase written on TypeScript and leverage on Hardhat's Typechain where it auto-generates TypeScript typings for the smart contracts that gets compiled and deployed locally. Also TypeScript would be awesome too when we're creating those tests in Chai.

If you guys would approve then I'll take a look and find a way to migrate everything into TypeScript.

Apply Vercel staging domain when deploying staging server through GH Actions

Right now it's relying on the latest deployment getting the domain https://pixel-avatars-api-rasmus-developdao.vercel.app

This also means that if production was deployed last, the staging website displays inventory from live genesis contract.

It's only a problem on staging, as production is always tagged with --prod during deploy

Smart Contract Brainstorm

Here's my thoughts on how to deploy smart contract for the pixel avatars. Basically we want to create a way for existing DevDao token holders to claim a token on pixel avatar contract. All the image metadata can be added at mint time or after mint.
A good discussion about this topic can be found here:
Openzepplin discussion forum

Stack exchange


Let's look at other projects that have implement this kind of requirement. Which is If msg.sender is a token holder in original contract , let them mint a token form the new contract.

Gan Apes is a project that is mintable by Bloot token holders( bloot is similar to loot and launched by making small changes to the Loot contract, similar to Developer dao project. )

Opensea for Gan Apes: https://opensea.io/collection/gan-apes-nft
Etherscan for Gan Apes: https://etherscan.io/address/0xbae6f981dc151cfc633212f06a9c5b4e37920454#code

Gan Ape images are stored in IPFS and this metadata location can be queried by reading the contract's tokenURI method
image

image

This is the metadata for token 1003 when I view the IPFS string returned from the step avobe
https://bafybeicnsgu6unnctx4hczjv7jgo6cohqckh33kcy4l5bnsxtyzak6btoy.ipfs.dweb.link/1003

{
    "name": "GAPE #1003",
    "image": "ipfs://QmcLrdSvoiTtFhABitH59NoSBRsFAUbibVLjCydspcZj8T/1003.jpg"
}

This metadata has a image location on ipfs and when I navigate to that image uri ( via a browser like Brave which supports ipfs) I get the image. That image is used by Opensea and other NFT platforms.


So testing plan for our project can be something like:

  1. find the testnet version of developer dao contract.

  2. Create a Dummy metadata file for a few tokens based on this tutorial. Basically we can create a metadata server by a file hosted on github repo:

  1. Deploy another contract based on the GAN Ape contract above and allow list the DevDao Rinkeby contract so only Dev Dao token holders on Riknkeby can mint pixel tokens. Set the tokenURI to the uri we create in step 2.

Thoughts?

Project Setup

Hope no one minds but I went ahead and set up the repo and open a PR ( #1 ) with a basic hardhat project.

Like me, I think there are quite a few people new to Solidity so thought it would be good to collaborate on how the to get a good dev / test environment set up from scratch in here so it's documented and an opportunity for everyone to learn.

My understanding is the next steps for are to get a good localnetwork and testnet configured but have seen a few different configurations (and think we might need an account at infura) so before pushing ahead wanted to get others input and feedback on how we should set this up.

Enhancement: Dark mode

Should follow the system preferences.

Before adding the dark mode itself it would make sense to first upgrade to Tailwind 3

OpenSea: Collection metadata updates

We can update various metadata directly in OpenSea for https://opensea.io/collection/pixel-devs

  • Logo image - This image will also be used for navigation. 350 x 350 recommended.
  • Featured image - This image will be used for featuring your collection on the homepage, category pages, or other promotional areas of OpenSea. 600 x 400 recommended.
  • Banner image - This image will appear at the top of your collection page. Avoid including too much text in this banner image, as the dimensions change on different devices. 1400 x 400 recommended.
  • Description Markdown syntax is supported. 10 of 1000 characters used.
  • Category - Adding a category will help make your item discoverable on OpenSea.

The Developer DAO Pixel Devs Dream House

Speaking of wearables, makes me think that we'll need a site to house a person's PixelDev collection with all their outfits.

The Developer DAO Dream House ❀️

Can't download/save the avatar properly

Someone in the Discord server reported that when they try to save their pixel avatar, they are not being able to save the entire avatar. Instead, they are being able to save only one part of the avatar at once. (eg. pants) Link to the message: https://discord.com/channels/883478451850473483/883482557809852416/899139138396258374

This has probably got to do with the fact that we are just placing PNGs for different parts of the avatar on top of each other. But we should definitely add a download functionality.

Analytics

Do we need to put on Google analytics before launch?

Add `meta` tags for better link preview

I shared the link to Pixel Avatars in Discord and it resulted in just a boring old link! If we add meta tags we can attach an image and a description to make it more likely others will check out the project! We implemented them for developerdao.com and you can see the difference here:

image

https://metatags.io/ makes this really easy!

Future proofing the contract before launch

On the subject of preparing for future games etc. I have been pondering if we could do anything to future-proof our smart contract further.
While it can be difficult to foresee every possible future idea I have thought of an example use-case of offering special mints where people choose their own traits (outside of the 8000 reserved combinations) - potentially branding it as another kind of token that doesn't hold the D_D necklace but some other visual identifier.

Basically I think it would offer a lot of flexibility if we could adjust these parameters:

Authorization / eligibility
Different mints requires different pre-requisites. This is already achieved today by server signature as we can change the server code as we please.

Mint price
Different kinds of mints / variations could trigger different prices. This would be easily achievable by tweaking the current contract/server integration. Basically I propose we continue to enforce a minimum mint-price in the contract which should be the cost of minting the current DAO member NFT's.
However additionally we could allow the server to also enforce a "tipping fee" or similar which would be useful in case we wanted to offer other variations that incurs extra fees.

Trait combinations
It would be very powerful if we could also add more variations / meta data beyond the existing traits and their 8000 existing combinations.
I believe this should already be possible after launching the contract but honestly I'm still not completely familiar with the full palette of the ERC 721 contract such as meta data and uploading assets to IPFS.
If we were ever to allow people to make their own combinations I suppose it would have to be the server that generated & uploaded the image to IPFS + issues that token with proper meta data to the contract. I'm not sure whether this is a bad idea or even possible, but thought I'd share it and get a conversation going. As long as the current contract would allow such an extension we don't have to work on this right now.


The alternative to all of the above of course is to just create new contracts every time we hit a roadblock with the current one. While that's possible too it might make it more cumbersome to create an ecosystem of games etc. around the avatars if they are all spread across different contracts.

With the flexibility the server gives us I thought it might give us an advantage in terms of adding new functionality, and perhaps allow us to have everything hosted on the same contract by using the server to incorporate business logic for the minting part.

Interested to hear your thoughts!

Auto-select initial token to mint

Suggestion

After user connects with wallet, most users will probably only have 1 or 2 tokens.

I'd suggest a small change: Let's auto-select the first token.

This will

  • take out one manual step of having to find/select your token you want to claim - makes that a bit easier and more obvious
  • will automatically show the preview of the user's token (instead of the default 1).
  • Claim Avatar button will also be visible and be ready to click on

So the new version would show the token pre-selected like this:

Screen Shot 2022-01-08 at 12 37 40 PM

Without the default token selected, the current "token picking process" seems slightly hidden:

Screen Shot 2022-01-08 at 12 19 49 PM

Related

  • This relates to #66 too and what we should display if token is already minted.

  • A nice to have could be to show tokens in more of a preview format -- list of boxes (maybe even a preview of the token if already minted) versus a drop-down, but that's a bigger project.

Derivatives Project Website

@goldzulu was mentioning we need a derivatives project website

  • with links to mint page
  • a roadmap

like any other nft projects

and as part polygon sponsorship page

Add UkraineDAO Treasury Mock Unit Tests

Since we are planning to hardcode the treasury address for UkraineDAO on the smart contract, then this could be tricky to test. But a solution to that is to use mocking then we can test things out and make the assertions we desire.

Vercel Deployment

An Automated Vercel deployment would be great.

Probably need to chat with the website team and/or have our own pixel avatar Vercel account

Wrong NFT is shown when visiting URL

Bug

If user saves link to their NFT preview and then revisits that URL at a later time, users will see the wrong NFT.

The link contains the ?developerId query param but site doesn't show that NFT when visiting link directly.

Repro

To reproduce, click on any example link below. They all show same NFT (default Developer ID 1).

https://pixel-avatars.developerdao.com/?developerId=123
https://pixel-avatars.developerdao.com/?developerId=456
https://pixel-avatars.developerdao.com/?developerId=999

I had discovered this by adding a link to my own NFT and when I later visited that link, realized the image didn't match the data in https://raw.githubusercontent.com/Developer-DAO/pixel-avatars/main/web-previewer/data/developers.js.

Workaround

User can see their NFT if they manually select it in the UI.

Add automatic code styling

As we're getting more people involved it'd be great to have some ESlint / TSlint / Prettier setup.

Bonus if run automatically with Github Actions on PR commits πŸš€

Highlight FAQ at the top?

Hey @rasmuscnielsen I wonder if "FAQ" link is too subtle in the bottom corner? What do you think about a notice toward the top of the page? Since the minting UI always fills the full window as window size changes, I didn't notice there's a FAQ below the fold.

Some ideas:

  • if at the top it could be titled something like "Learn more about this project"
  • or "Click here for FAQs about this project"?

Improve successful mint message and / or share modal / screen

A successful mint is cause for celebration - perhaps some champagne popping and confetti πŸŽ‰ πŸŽ‰ πŸŽ‰

Perhaps related, perhaps not.. But when a NFT is successfully claimed and you're authenticated as the owner, we should have some download + share buttons that easily lets you share on ie twitter

Setup continuous deployment using Github Actions and Vercel CLI

Currently all environment variables on Vercel can be inspected by anyone with access to our Vercel account. This is not ideal, as the server private key should be kept rather secret.

An alternative is to setup a Github Action that deploys a cloud function using the Vercel CLI or REST API.

  • Private key is generated once and kept as Github Action secret SERVER_PRIVATE_KEY
  • On push to main it deploys a fresh serverless function to Vercel and links it to the correct domain

Public Mint option of Pixel Avatars

We had brainstormed on our meeting last week that we wanted to have an option for public without dao tokens to mint Pixel Avatars. We will charge a small fee ( to be decided ) for the public mint and allow a certain amount(TBD) of public mints.

Pixel Avatars will be generated form metadata of Developer Dao token. For public mints, we can randomize the metadata and create a headless avatar that doesn't depend on the Dao token.

To decide:

  • How many public mints to allow?
  • Should we limit public mints per address? For example only let one address publicly mint one avatar. This will stop someone buying all public mints since we plan to keep the cost low.
  • What price to charge for public mint
  • How to market the public mint option

Todo:

  • test out the contract to ensure the collected funds can only be withdraw by the allow listed wallet or the contract deployer address. We will use the dao address to deploy contract.

Add test(s) for smart contract

#23 added the foundation for the smart contract's source code. Would be a good idea to have some tests in place since we probably will iterate on the contract.

Create a FAQ Page on Pixel Devs Website

Why?

Lots of publicity from @goldzulu's twitter post (and amplified with Nader's repost) show a need for a FAQ page.

What?

Idea is to add a static FAQ page to Pixel Devs, with an obvious link at the top of the home page.

Which FAQs?

Marc just added probably the most important one:

"Heads up that we may need to get more explicit with β€œpixel devs != genesis nft/membership”. Not sure exactly where and how to say it, but looks like we should address that. The timing of this launch coincides with our messaging about the dao opening back up unfortunately" Thread: https://discord.com/channels/883478451850473483/884980325653049367/945140811408998410

You can view replies from Twitter thread with questions being asked: https://twitter.com/developer_dao/status/1495547491881820162

Also notes from @goldzulu:

I think we can do anything quick would be good. then we think of long term "website"
with roadmaps etc
i think simple
mint price
url
questions
and what are these
what is Dev4Rev

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.