Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
11fe3b3
descriptor v2 spike initial commit
eladmallel Jun 15, 2022
4425043
cleanup
eladmallel Jun 15, 2022
b2dc276
support retiring backgrounds
eladmallel Jun 15, 2022
36376ce
remove MultiPartRLEToSVG
eladmallel Jun 15, 2022
e0553af
add example fork renderer
eladmallel Jun 15, 2022
658b425
add functions that add images from a contract pointer
eladmallel Jun 15, 2022
88b7c68
make descriptor variables public
eladmallel Jun 15, 2022
1cfc895
add natspec to clarify inputs
eladmallel Jun 15, 2022
8371af4
refactor
eladmallel Jun 15, 2022
2bef4b2
add storage->virtual index mapping
eladmallel Jun 15, 2022
706fedb
refactor descriptor storage out to NounsArt
eladmallel Jun 15, 2022
a18efa9
palette is passed as bytes array param
davidbrai Jun 20, 2022
dc1dce4
Merge branch 'master' into verbs-descriptor-v2-spike
eladmallel Jun 27, 2022
991ed78
fix broken tests
eladmallel Jun 27, 2022
32f126f
cleanup: remove example fork contract
eladmallel Jun 27, 2022
f206326
cleanup image retirement code
eladmallel Jun 27, 2022
5754eb5
add natspec to NounsArt
eladmallel Jun 27, 2022
619faf7
back to solidity 0.8.6
eladmallel Jun 27, 2022
5c52db4
Merge branch 'master' into verbs-descriptor-v2
eladmallel Jun 27, 2022
9363783
get NounsToken test working with descriptor v2
eladmallel Jun 27, 2022
ce466a4
add descriptor v1 back
eladmallel Jun 27, 2022
c831476
add descriptor upgrade test
eladmallel Jun 27, 2022
988985b
add test natspec
eladmallel Jun 27, 2022
fc39a27
add some tests for NounsArt
eladmallel Jun 27, 2022
d13163d
add NounsArt tests using body trait setters and getters
eladmallel Jun 27, 2022
21e7623
update local addresses
eladmallel Jun 28, 2022
ce4ee7f
fix descriptorv2 missing args
eladmallel Jun 28, 2022
6f72169
fix deploy-and-configure param types
eladmallel Jun 28, 2022
a06c4e0
fix deploy-and-configure descriptor name
eladmallel Jun 28, 2022
dfb1b5d
add NounsArt tests
eladmallel Jun 28, 2022
509ef6e
add descriptor v2 tests
eladmallel Jun 28, 2022
ebb8ab5
add test: descriptor upgrade via proposal
eladmallel Jun 29, 2022
ad44679
add descriptor v2 tests
eladmallel Jun 29, 2022
60cf466
remove redundant art functions
eladmallel Jun 30, 2022
cf922a1
inflate: add dev natspec
eladmallel Jun 30, 2022
35eaa18
add @notice natspec on public state vars
eladmallel Jun 30, 2022
c8ffe3c
sdk: add multiline RLE support
davidbrai Jun 30, 2022
07c57cd
temp skip the test that causes CI memory issues
eladmallel Jun 30, 2022
15d27b6
cleanup per code review
eladmallel Jun 30, 2022
c388c0e
art: add puff function as 'public good' per CR comment
eladmallel Jun 30, 2022
75002d0
rename
eladmallel Jun 30, 2022
a368b6e
rename
eladmallel Jun 30, 2022
38b5163
art test cleanup: discovered hex literals
eladmallel Jun 30, 2022
7d18356
test cleanup
eladmallel Jun 30, 2022
8988ec2
remove comment
eladmallel Jun 30, 2022
606826b
cleanup per CR
eladmallel Jun 30, 2022
19097d5
get coverage working with custom errors
eladmallel Jun 30, 2022
5a2df0d
multi rle encoder: limit at 255 length, and added tests
davidbrai Jul 1, 2022
fb54fa8
update rle encoding to use multiline RLE
davidbrai Jul 2, 2022
044887b
update test to use mutliline rle encoded data
davidbrai Jul 2, 2022
7552ed2
update yarn.lock
davidbrai Jul 2, 2022
59d689f
add tests comparing descriptor v1 and descriptor v2
davidbrai Jul 2, 2022
97d0601
rle encoder: small fix to make empty image return 0x0
davidbrai Jul 2, 2022
ce8fba7
rename per CR
eladmallel Jul 3, 2022
d8e87e7
Merge branch 'verbs-descriptor-v2' of github.com:nounsDAO/nouns-monor…
eladmallel Jul 3, 2022
ccec39e
art: add tests
eladmallel Jul 3, 2022
cc699aa
art: rename trait state vars and their getters
eladmallel Jul 4, 2022
110f7c8
art: remove puff from interface
eladmallel Jul 4, 2022
d983065
art: add events on storage updates
eladmallel Jul 4, 2022
8cdb65c
art: add a test with 5 pages of art
eladmallel Jul 4, 2022
fed6162
lil natspec love
davidbrai Jul 5, 2022
fe6a08c
reverting spacing to minimize diff
davidbrai Jul 5, 2022
a532d13
add hardhat task that deploys descriptor v2 and submits an upgrade prop
eladmallel Jul 6, 2022
e118f71
fix descriptor v2 deploy script
eladmallel Jul 6, 2022
534c88b
increase javascript heap max memory
eladmallel Jul 6, 2022
71f7c80
upgrade solidity compiler to 0.8.15
davidbrai Jul 6, 2022
f4c1e4a
unskip descriptor test that failed bc of low JS heap
eladmallel Jul 6, 2022
b71a14b
increase tokenURI test timeout
eladmallel Jul 6, 2022
aa18199
hardhat task: deploy with no constraints on gov times
eladmallel Jul 6, 2022
723f134
cleanup
eladmallel Jul 6, 2022
05c7f13
hardhat task: populate descriptor via proposal
eladmallel Jul 6, 2022
e0336c9
cleanup
eladmallel Jul 6, 2022
62ac515
increase node heap max memory again
eladmallel Jul 6, 2022
2f95961
bump the descriptor v2 test timeout again
eladmallel Jul 6, 2022
68917fa
Revert "unskip descriptor test that failed bc of low JS heap"
davidbrai Jul 7, 2022
0780d4e
only skipping the URI test when using coverage
eladmallel Jul 7, 2022
5beda42
added test minter which uses descriptor v2
davidbrai Jul 8, 2022
a95f872
Merge branch 'verbs-descriptor-v2' of github.com:nounsDAO/nouns-monor…
davidbrai Jul 8, 2022
8b16ca7
add setPalettePointer function
eladmallel Jul 10, 2022
a015e8a
add some dev natspec
eladmallel Jul 10, 2022
dd10cbd
add ownable tests to descriptor v2 functions
eladmallel Jul 10, 2022
9fda3f8
descriptorv2: add a function to set art's pendingDescriptor
eladmallel Jul 10, 2022
5840d96
art: change setDescriptor to single-step per CR
eladmallel Jul 10, 2022
28b5e03
cleanup
eladmallel Jul 11, 2022
ae513f8
update deploy tasks to deploy descriptor v1 to rinkeby
eladmallel Jul 11, 2022
cc47d00
add a task to upgrade to descriptor v2 via a proposal
eladmallel Jul 11, 2022
c9cda8b
deploy-short-times: shorten proposal wait times even more
eladmallel Jul 11, 2022
615a1c2
run-local task transfers ownership of contracts
davidbrai Jul 11, 2022
ec3bc10
populate descriptor: set gaslimit manually to bypass some hardhat issue
davidbrai Jul 11, 2022
23e5d1e
add task for encoding an additional json art file
davidbrai Jul 11, 2022
bdb2696
extract Inflate to contract to support upgrades
eladmallel Jul 12, 2022
2f3f3d9
cleanup
eladmallel Jul 12, 2022
daa58af
add inflator setter to art and descriptor v2
eladmallel Jul 12, 2022
29a0ce3
fix descriptorv2 deployment task
eladmallel Jul 12, 2022
c494674
point deploy preview to rinkeby
eladmallel Jul 12, 2022
41ccf22
update rinkeby addresses to latest deployment
eladmallel Jul 12, 2022
5e4ebd6
point webapp to latest subgraph
eladmallel Jul 12, 2022
eda03d1
append new test art to the webapp's art file
eladmallel Jul 12, 2022
b16a480
fix NounsArt verification in the v2 deploy task
eladmallel Jul 12, 2022
c6ba2fb
update image json with latest encoding version
davidbrai Jul 13, 2022
2fc18a1
also update image json in contracts package
davidbrai Jul 13, 2022
59dd834
update test with latest encoded images file
davidbrai Jul 13, 2022
bb01313
reorg image-data.json files
davidbrai Jul 13, 2022
353ebfe
fix a trait images, these will affect already minted nouns as well
davidbrai Jul 13, 2022
c8afc17
remove unneeded test minter, just use token harness for testing
davidbrai Jul 14, 2022
9ff4625
update body-foggrey.png
davidbrai Jul 14, 2022
14bb588
update rinkeby addresses
eladmallel Jul 14, 2022
d753999
Merge remote-tracking branch 'origin/master' into verbs-descriptor-v2
davidbrai Jul 14, 2022
b9316aa
update proposal descriptions to look nicer
eladmallel Jul 14, 2022
854788c
Merge branch 'verbs-descriptor-v2' of github.com:nounsDAO/nouns-monor…
eladmallel Jul 14, 2022
acea2fa
reencode test file for new art and move to contracts directory
davidbrai Jul 14, 2022
b3badda
add script to merge image-data.json files
davidbrai Jul 14, 2022
d1ed961
revert change before going back to master
davidbrai Jul 18, 2022
1d146ac
rename Image2 to Image and bump sdk package version
davidbrai Jul 18, 2022
8a86406
bump sdk package to 0.2.0
davidbrai Jul 18, 2022
08faada
update rinkeby subgraph url to point to new contracts
davidbrai Jul 18, 2022
1aacd6f
update webapp to use sdk version 0.2.0 with multiline rle
davidbrai Jul 18, 2022
8d657b9
bump assets package to 0.3.0
davidbrai Jul 18, 2022
f0c5bb1
update webapp to use assets package v0.3.0
davidbrai Jul 18, 2022
2f7176c
cleanups
davidbrai Jul 18, 2022
b90bc13
cleanup
davidbrai Jul 18, 2022
4fd4937
remove default values from deploy-and-configure
davidbrai Jul 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/contracts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ on:
- master
pull_request:
paths:
- "packages/nouns-contracts/**"
- "packages/nouns-subgraph/**"
- 'packages/nouns-contracts/**'
- 'packages/nouns-subgraph/**'
branches:
- "**"
- '**'

env:
NODE_OPTIONS: --max_old_space_size=5120

jobs:
build_and_test:
Expand Down Expand Up @@ -50,4 +53,4 @@ jobs:
- name: Run Forge tests
run: |
cd packages/nouns-contracts
forge test -vvv
forge test -vvv --ffi
Binary file modified packages/nouns-assets/images/1-bodies/body-foggrey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/nouns-assets/images/3-heads/head-beer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/nouns-assets/images/3-heads/head-piggybank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions packages/nouns-assets/images_test/create_duplicates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
Copies all the images in the subfolders
This is just used for testing purposes
"""

import os
import shutil


def get_subfolders(directory):
return [f.path for f in os.scandir(directory) if f.is_dir()]


def run():
for folder in get_subfolders('.'):
print(f"Going into {folder}")
f = os.listdir(folder)[0]
print(f"Found {f}, duplicating it")
for i in range(100):
dst_file = f.replace('.png', '_%03d.png' % i)
shutil.copyfile(os.path.join(folder, f),
os.path.join(folder, dst_file))

print("Done")


if __name__ == "__main__":
run()
6 changes: 4 additions & 2 deletions packages/nouns-assets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nouns/assets",
"version": "0.2.0",
"version": "0.3.0",
"description": "Nouns run-length encoded image data",
"author": "Nounders",
"homepage": "https://nouns.wtf",
Expand All @@ -9,13 +9,15 @@
"types": "dist/index.d.ts",
"scripts": {
"encode": "ts-node scripts/encode.ts",
"encode-more": "ts-node scripts/encode-more.ts",
"append-image-data": "ts-node scripts/append-image-data.ts",
"clean": "rimraf dist tsconfig.build.tsbuildinfo",
"build": "tsc -p tsconfig.build.json",
"prepare": "yarn build",
"test": "mocha -r ts-node/register \"test/**/*.test.ts\""
},
"devDependencies": {
"@nouns/sdk": "^0.1.4",
"@nouns/sdk": "^0.2.0",
"@types/pngjs": "^6.0.1",
"chai": "^4.2.0",
"mocha": "^8.4.0",
Expand Down
20 changes: 20 additions & 0 deletions packages/nouns-assets/scripts/append-image-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ImageData } from '@nouns/sdk/src/image/types';
import { promises as fs } from 'fs';

/**
* Appends an image-data.json file to an existing one.
* The purpose is for the webapp to have one file with all the art, not split to pages like in the contracts storage
*/
const merge = async (baseFile: string, newFile: string, destinationFile: string) => {
const baseData: ImageData = JSON.parse((await fs.readFile(baseFile)).toString());
const newData: ImageData = JSON.parse((await fs.readFile(newFile)).toString());

for (const [k, v] of Object.entries(newData.images)) {
baseData.images[k].push(...v);
}

await fs.writeFile(destinationFile, JSON.stringify(baseData, null, 2));
console.log(`Wrote merged file to: ${destinationFile}`);
};

merge(process.argv[2], process.argv[3], process.argv[4]);
37 changes: 37 additions & 0 deletions packages/nouns-assets/scripts/encode-more.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { PNGCollectionEncoder } from '@nouns/sdk';
import { promises as fs } from 'fs';
import path from 'path';
import { readPngImage } from './utils';
import { palette } from '../src/image-data.json';

/**
* @notice creates an additional art json file. it assumes it's not the first one.
* it also assumes the existing palette from the first one has all the needed colors.
* @sourceFolder a folder containing subfolders with the names: ['1-bodies', '2-accessories', '3-heads', '4-glasses']
* @destinationFilepath where to save the new json file
*/
const encode = async (sourceFolder: string, destinationFilepath: string) => {
const encoder = new PNGCollectionEncoder(palette);

const partfolders = ['1-bodies', '2-accessories', '3-heads', '4-glasses'];
for (const folder of partfolders) {
const folderpath = path.join(sourceFolder, folder);
const files = await fs.readdir(folderpath);
for (const file of files) {
const image = await readPngImage(path.join(folderpath, file));
encoder.encodeImage(file.replace(/\.png$/, ''), image, folder.replace(/^\d-/, ''));
}
}
await fs.writeFile(
destinationFilepath,
JSON.stringify(
{
images: encoder.data.images,
},
null,
2,
),
);
};

encode(process.argv[2], process.argv[3]);
26 changes: 1 addition & 25 deletions packages/nouns-assets/scripts/encode.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,10 @@
import { PNGCollectionEncoder, PngImage } from '@nouns/sdk';
import { promises as fs } from 'fs';
import { PNG } from 'pngjs';
import path from 'path';
import { readPngImage } from './utils';

const DESTINATION = path.join(__dirname, '../src/image-data.json');

/**
* Read a PNG image file and return a `PngImage` object.
* @param path The path to the PNG file
*/
const readPngImage = async (path: string): Promise<PngImage> => {
const buffer = await fs.readFile(path);
const png = PNG.sync.read(buffer);

return {
width: png.width,
height: png.height,
rgbaAt: (x: number, y: number) => {
const idx = (png.width * y + x) << 2;
const [r, g, b, a] = [png.data[idx], png.data[idx + 1], png.data[idx + 2], png.data[idx + 3]];
return {
r,
g,
b,
a,
};
},
};
};

const encode = async () => {
const encoder = new PNGCollectionEncoder();

Expand Down
27 changes: 27 additions & 0 deletions packages/nouns-assets/scripts/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { PngImage } from '@nouns/sdk';
import { promises as fs } from 'fs';
import { PNG } from 'pngjs';

/**
* Read a PNG image file and return a `PngImage` object.
* @param path The path to the PNG file
*/
export const readPngImage = async (path: string): Promise<PngImage> => {
const buffer = await fs.readFile(path);
const png = PNG.sync.read(buffer);

return {
width: png.width,
height: png.height,
rgbaAt: (x: number, y: number) => {
const idx = (png.width * y + x) << 2;
const [r, g, b, a] = [png.data[idx], png.data[idx + 1], png.data[idx + 2], png.data[idx + 3]];
return {
r,
g,
b,
a,
};
},
};
};
Loading