Skip to content

Commit

Permalink
develop dapp
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiawpohr committed Mar 21, 2021
1 parent 35ed9d5 commit facbb1d
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ yarn-debug.log*
yarn-error.log*

.idea

# Local Netlify folder
.netlify
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ This project is a tool for estimating the price of NFT arts based on how many li
## How it works?

![like2price system](./like2price_system.png)
[ProfileRegistry Contract](https://rinkeby.etherscan.io/address/0x1747ac559d1373591d2bb9692639b6b4e7df5725)

This project use IPFS to store the reputation data, including like count, dislike count, and so forth. Every NFT art will have an IPNS hash that is represented as the community profile of the art. The IPNS hash is recorded on Ethereum. Each reputation file is signed by users, which means the like can be verifiable.

This project is integrated with Zora protocol, which consists of media and market contracts. And the estimated price is calculated by both reputation data on IPFS and history quote on Ethereum using Hedonic regression.

Hedonic regression is the use of a regression model to estimate the influence that various factors have on the price of a good, or sometimes the demand for a good.


## Teams

- [@Xiawpohr](https://github.com/Xiawpohr)
Expand Down
6 changes: 6 additions & 0 deletions metadata-human.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": "zora-20210101",
"name": "Human",
"description": "Human",
"mimeType": "image/jpg"
}
11 changes: 11 additions & 0 deletions packages/hardhat/netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# build
[build]
base = ""
publish = "build/"
command = "npm run build"

# support SPA setup
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
1 change: 1 addition & 0 deletions packages/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@nomiclabs/hardhat-waffle": "^2.0.0",
"@openzeppelin/contracts": "^3.2.0",
"@tenderly/hardhat-tenderly": "^1.0.10",
"@zoralabs/zdk": "^1.0.7",
"chai": "^4.2.0",
"chalk": "^4.1.0",
"ethereum-waffle": "^3.1.1",
Expand Down
40 changes: 40 additions & 0 deletions packages/hardhat/scripts/mint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const { ethers } = require("hardhat");
const {
Zora,
constructMediaData,
constructBidShares,
sha256FromBuffer,
} = require("@zoralabs/zdk");

async function main() {
const signers = await ethers.getSigners();
const zora = new Zora(signers[0], 4);

const contentHash = await sha256FromBuffer(Buffer.from("human"));
const metadataHash = await sha256FromBuffer(Buffer.from("human"));

const mediaData = constructMediaData(
"https://ipfs.io/ipfs/QmTmFdHtNxepMRJFeqxgBKd5Hx2HmcmHDcbaHqiNUKAUom",
"https://ipfs.io/ipfs/QmXRUpbLCGUFpgtSikwa94NjkQCrPqhbHY4NQHo1dVMxgp",
contentHash,
metadataHash
);

const bidShares = constructBidShares(
10, // creator share
90, // owner share
0 // prevOwner share
);

const tx = await zora.mint(mediaData, bidShares);
console.log("Transaction Hash: ", tx.hash);
await tx.wait(8); // 8 confirmations to finalize

}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
138 changes: 135 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,13 @@
dependencies:
"@types/node" "*"

"@types/bn.js@^5.1.0":
version "5.1.0"
resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.0.tgz#32c5d271503a12653c62cf4d2b45e6eab8cebc68"
integrity sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==
dependencies:
"@types/node" "*"

"@types/chai@*":
version "4.2.13"
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.2.13.tgz#8a3801f6655179d1803d81e94a2e4aaf317abd16"
Expand Down Expand Up @@ -2798,6 +2805,13 @@
resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee"
integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4=

"@types/jsonschema@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/jsonschema/-/jsonschema-1.1.1.tgz#08703dfe074010e8e829123111594af731f57b1a"
integrity sha1-CHA9/gdAEOjoKRIxEVlK9zH1exo=
dependencies:
jsonschema "*"

"@types/lodash@^4.14.159":
version "4.14.162"
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.162.tgz#65d78c397e0d883f44afbf1f7ba9867022411470"
Expand Down Expand Up @@ -3333,6 +3347,40 @@
resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31"
integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ==

"@zoralabs/core@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@zoralabs/core/-/core-1.0.3.tgz#a4ca994510a0fa4e3de82639c682fb1124bef35b"
integrity sha512-yLCbZMmjf59R2/BtUQiIxytHYKZRtGFhHLGwnN26FdAW8kN9lTmuZ41ijMujA14z0RT+xHpTa4L6DvfACc+Aag==
dependencies:
ethers "^5.0.19"

"@zoralabs/media-metadata-schemas@^0.1.2":
version "0.1.2"
resolved "https://registry.yarnpkg.com/@zoralabs/media-metadata-schemas/-/media-metadata-schemas-0.1.2.tgz#b6f3532e7bca95197fa8a7ca136ad70dbdce1d2d"
integrity sha512-QcvPNb4RkdU9xKfOxnmKRKKVI4Z5oammiz2wYHmqzOvkIgHvm7tjV/MQcTelaRJfjksYx8k6bqsmbSbKIMUJTQ==
dependencies:
"@types/jsonschema" "^1.1.1"
jsonschema "^1.4.0"
ts-node "^9.1.1"
tslib "^2.0.3"
typescript "^4.1.3"

"@zoralabs/zdk@^1.0.7":
version "1.0.7"
resolved "https://registry.yarnpkg.com/@zoralabs/zdk/-/zdk-1.0.7.tgz#b3434f41cfb78b432e21df88334db3cc930e8dfa"
integrity sha512-a2HgrcVjnRqpYoL20yivRLqCfL/7fKnEScEpB+pzGoYHmx26EG3mcEciBCj2Sk93ntD6WeXY3KXWbk9zE1hzaQ==
dependencies:
"@zoralabs/core" "^1.0.3"
"@zoralabs/media-metadata-schemas" "^0.1.2"
axios "^0.21.1"
eth-sig-util "^3.0.0"
ethereumjs-util "^7.0.7"
ethers "^5.0.19"
sjcl "^1.0.8"
tiny-invariant "^1.1.0"
tiny-warning "^1.0.3"
ts-node "^9.1.1"

[email protected]:
version "1.3.2"
resolved "https://registry.yarnpkg.com/JSONStream/-/JSONStream-1.3.2.tgz#c102371b6ec3a7cf3b847ca00c20bb0fce4c6dea"
Expand Down Expand Up @@ -3849,6 +3897,11 @@ are-we-there-yet@~1.1.2:
delegates "^1.0.0"
readable-stream "^2.0.6"

arg@^4.1.0:
version "4.1.3"
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==

argparse@^1.0.7:
version "1.0.10"
resolved "https://registry.yarnpkg.com/argparse/-/argparse-1.0.10.tgz#bcd6791ea5ae09725e17e5ad988134cd40b3d911"
Expand Down Expand Up @@ -6484,6 +6537,11 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==

cross-fetch@^2.1.0, cross-fetch@^2.1.1:
version "2.2.3"
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-2.2.3.tgz#e8a0b3c54598136e037f8650f8e823ccdfac198e"
Expand Down Expand Up @@ -7149,6 +7207,11 @@ [email protected]:
resolved "https://registry.yarnpkg.com/diff/-/diff-3.5.0.tgz#800c0dd1e0a8bfbc95835c202ad220fe317e5a12"
integrity sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==

diff@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==

diffie-hellman@^5.0.0:
version "5.0.3"
resolved "https://registry.yarnpkg.com/diffie-hellman/-/diffie-hellman-5.0.3.tgz#40e8ee98f55a2149607146921c63e1ae5f3d2875"
Expand Down Expand Up @@ -8343,6 +8406,16 @@ eth-sig-util@^2.5.2, eth-sig-util@^2.5.3:
tweetnacl "^1.0.0"
tweetnacl-util "^0.15.0"

eth-sig-util@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/eth-sig-util/-/eth-sig-util-3.0.1.tgz#8753297c83a3f58346bd13547b59c4b2cd110c96"
integrity sha512-0Us50HiGGvZgjtWTyAI/+qTzYPMLy5Q451D0Xy68bxq1QMWdoOddDwGvsqcFT27uohKgalM9z/yxplyt+mY2iQ==
dependencies:
ethereumjs-abi "^0.6.8"
ethereumjs-util "^5.1.1"
tweetnacl "^1.0.3"
tweetnacl-util "^0.15.0"

eth-tx-summary@^3.1.2:
version "3.2.4"
resolved "https://registry.yarnpkg.com/eth-tx-summary/-/eth-tx-summary-3.2.4.tgz#e10eb95eb57cdfe549bf29f97f1e4f1db679035c"
Expand Down Expand Up @@ -8572,6 +8645,18 @@ ethereumjs-util@^7.0.2:
ethjs-util "0.1.6"
rlp "^2.2.4"

ethereumjs-util@^7.0.7:
version "7.0.9"
resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.0.9.tgz#2038baeb30f370a3e576ec175bd70bbbb6807d42"
integrity sha512-cRqvYYKJoitq6vMKMf8pXeVwvTrX+dRD0JwHaYqm8jvogK14tqIoCWH/KUHcRwnVxVXEYF/o6pup5jRG4V0xzg==
dependencies:
"@types/bn.js" "^5.1.0"
bn.js "^5.1.2"
create-hash "^1.1.2"
ethereum-cryptography "^0.1.3"
ethjs-util "0.1.6"
rlp "^2.2.4"

[email protected]:
version "4.2.0"
resolved "https://registry.yarnpkg.com/ethereumjs-vm/-/ethereumjs-vm-4.2.0.tgz#e885e861424e373dbc556278f7259ff3fca5edab"
Expand Down Expand Up @@ -8676,7 +8761,7 @@ ethers@^5.0.0, ethers@^5.0.1, ethers@^5.0.17:
"@ethersproject/web" "5.0.9"
"@ethersproject/wordlists" "5.0.5"

ethers@^5.0.31:
ethers@^5.0.19, ethers@^5.0.31:
version "5.0.32"
resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.0.32.tgz#f009970be31d96a589bf0ce597a39c10c7e297a6"
integrity sha512-rORfGWR0HsA4pjKMMcWZorw12DHsXqfIAuPVHJsXt+vI24jvXcVqx+rLsSvgOoLdaCMdxiN5qlIq2+4axKG31g==
Expand Down Expand Up @@ -12531,6 +12616,11 @@ jsonparse@^1.2.0:
resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280"
integrity sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=

jsonschema@*, jsonschema@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/jsonschema/-/jsonschema-1.4.0.tgz#1afa34c4bc22190d8e42271ec17ac8b3404f87b2"
integrity sha512-/YgW6pRMr6M7C+4o8kS+B/2myEpHCrxO4PEWnqJNBFMjn7EWXqlQ4tGwL6xTHeRplwuZmcAncdvfOad1nT2yMw==

jsprim@^1.2.2:
version "1.4.1"
resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-1.4.1.tgz#313e66bc1e5cc06e438bc1b7499c2e5c56acb6a2"
Expand Down Expand Up @@ -13367,6 +13457,11 @@ make-dir@^3.0.2:
dependencies:
semver "^6.0.0"

make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==

make-iterator@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6"
Expand Down Expand Up @@ -18238,6 +18333,11 @@ sisteransi@^1.0.4:
resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"
integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==

sjcl@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/sjcl/-/sjcl-1.0.8.tgz#f2ec8d7dc1f0f21b069b8914a41a8f236b0e252a"
integrity sha512-LzIjEQ0S0DpIgnxMEayM1rq9aGwGRG4OnZhCdjx7glTaJtf4zRfpg87ImfjSJjoW9vKpagd82McDOwbRT5kQKQ==

slash@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/slash/-/slash-1.0.0.tgz#c41f2f6c39fc16d1cd17ad4b5d896114ae470d55"
Expand Down Expand Up @@ -18399,7 +18499,7 @@ source-map-support@^0.4.15:
dependencies:
source-map "^0.5.6"

source-map-support@^0.5.11, source-map-support@^0.5.13, source-map-support@^0.5.6, source-map-support@~0.5.12, source-map-support@~0.5.19:
source-map-support@^0.5.11, source-map-support@^0.5.13, source-map-support@^0.5.17, source-map-support@^0.5.6, source-map-support@~0.5.12, source-map-support@~0.5.19:
version "0.5.19"
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
Expand Down Expand Up @@ -19024,6 +19124,11 @@ swarm-js@^0.1.40:
tar "^4.0.2"
xhr-request "^1.0.1"

swr@^0.5.4:
version "0.5.4"
resolved "https://registry.yarnpkg.com/swr/-/swr-0.5.4.tgz#9516af6ffd84ba2c23a804ff771be2eb83ba8d46"
integrity sha512-TUSxxuC8uP/4JKV22ml91WQ0tbif+9HVhm683xm8KYfwZIW5ogwcnU634dg3x6N7azpIDIOLokoIi+z5vCz/yA==

symbol-observable@^1.0.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804"
Expand Down Expand Up @@ -19430,6 +19535,18 @@ ts-invariant@^0.4.0, ts-invariant@^0.4.4:
dependencies:
tslib "^1.9.3"

ts-node@^9.1.1:
version "9.1.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d"
integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==
dependencies:
arg "^4.1.0"
create-require "^1.1.0"
diff "^4.0.1"
make-error "^1.1.1"
source-map-support "^0.5.17"
yn "3.1.1"

[email protected]:
version "1.1.6"
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.6.tgz#389a24396d425a0d3162e96d2b4638900fdc289a"
Expand All @@ -19455,6 +19572,11 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2.0.3:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/tsort/-/tsort-0.0.1.tgz#e2280f5e817f8bf4275657fd0f9aebd44f5a2786"
Expand Down Expand Up @@ -19489,7 +19611,7 @@ tweetnacl@^0.14.3, tweetnacl@~0.14.0:
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=

tweetnacl@^1.0.0:
tweetnacl@^1.0.0, tweetnacl@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596"
integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==
Expand Down Expand Up @@ -19563,6 +19685,11 @@ typescript@^3.9.5:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==

typescript@^4.1.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==

typewise-core@^1.2, typewise-core@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/typewise-core/-/typewise-core-1.2.0.tgz#97eb91805c7f55d2f941748fa50d315d991ef195"
Expand Down Expand Up @@ -21197,6 +21324,11 @@ yargs@~3.10.0:
decamelize "^1.0.0"
window-size "0.1.0"

[email protected]:
version "3.1.1"
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==

zen-observable-ts@^0.8.21:
version "0.8.21"
resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-0.8.21.tgz#85d0031fbbde1eba3cd07d3ba90da241215f421d"
Expand Down

0 comments on commit facbb1d

Please sign in to comment.