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

CAT-207: setup devops for catalog contracts #1

Merged
merged 2 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ MNEMONIC=<mnemonic>
# coinmarketcap api key for gas report
COINMARKETCAP_API_KEY=

# boolean value for gas reporting
REPORT_GAS=

# etherscan api key
ETHERSCAN_API_KEY=
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ artists.json
metadata.json
types
./types/typechain
/types/typechain/
/types
./bin
/bin
./bin/contracts/
Expand Down
5 changes: 4 additions & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"extends": "solhint:default"
"extends": "solhint:default",
"rules" : {
"max-line-length": ["off",500 ]
}
}
42 changes: 37 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,17 @@ running tests
yarn test
```

running tests with gas reporter output

```bash
yarn test:gas
```

running tests without logs

```bash
yarn test:nolog
```

generating coverage reports

Expand Down Expand Up @@ -117,6 +128,7 @@ tests are written with mocha + chai.
tests use deployment fixtures from `hardhat-deploy`



## Utility Scripts

The [./scripts](./scripts) directory contains several utility scripts for testing and
Expand All @@ -129,23 +141,37 @@ Merkle Tree utility script.
Generates a merkle root and proof given input wallet address
Used for Allowlisting.

run with `yarn tree`

run with

```bash
yarn tree
```

**ipfsUpload.ts**

IPFS URI utility script.
Setup to upload a basic metadata.json to ipfs, presents a URI for input
Use for easy testing.

run with `yarn ipfs`
run with

```bash
yarn ipfs
```

**getArtists.ts**

Wallet Address List utility scripts.
Pulls valid artist wallet addresses from hasura, and saves them in `artists.json`
Intended for use with Allowlisting utilities.

run with `yarn getartists`
run with

```bash
yarn getartists
```




Expand All @@ -157,9 +183,15 @@ Types are auto generated using `typechain`, and are generated postinstall and up
Types are located in `./types/typechain`


## TODO
- linting/prettier setup
## Documentation

Autogenerated markdown docs for Solidity contracts (compatible with docusaurus) are located at
[./docs](./docs)


## Linting

Repo is setup with ESLint/Prettier/Solhint


## License
Expand Down
9 changes: 6 additions & 3 deletions contracts/catalog/TD606.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ contract TD606 is
/**
mint Function
@param _data TokenData struct, see ITB303
@param _proof bytes32[] merkle proof of artist wallet. this is created off-chain. e.g (proof = tree.getHexProof(keccak256(address)))
@param _proof bytes32[] merkle proof of artist wallet.
this is created off-chain. e.g (proof = tree.getHexProof(keccak256(address)))
@return uint256 tokenId of minted token (useful since we are not using Enumerable)
@dev mints a new token to allowlisted msg.sender with a valid merkle proof. params can and should
be changed to calldata for gas efficiency. rename to "allowlist"
Expand Down Expand Up @@ -218,7 +219,8 @@ contract TD606 is
updateMetadataURI Function
@param _tokenId uint256 token id corresponding to the token to update
@param _metadataURI string containing new/updated metadata (e.g IPFS URI pointing to metadata.json)
@dev access controlled, restricted to contract owner when they own the tokenId or the creator (when they own the token)
@dev access controlled, restricted to contract owner
when they own the tokenId or the creator (when they own the token)
*/
function updateMetadataURI(
uint256 _tokenId,
Expand All @@ -235,7 +237,8 @@ contract TD606 is
updateRoyaltyInfo Function
@param _tokenId uint256 token id corresponding to the token of which to update royalty payout
@param _royaltyPayoutAddress address of new royalty payout address
@dev access controlled to owner only, subject to change. this function allows for emergency royalty control (i.e compromised wallet)
@dev access controlled to owner only, subject to change.
this function allows for emergency royalty control (i.e compromised wallet)
*/
function updateRoyaltyInfo(uint256 _tokenId, address _royaltyPayoutAddress) external onlyOwner {

Expand Down
12 changes: 8 additions & 4 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import 'hardhat-tracer';
import 'solidity-coverage';
import '@primitivefi/hardhat-dodoc';


// trying
import '@openzeppelin/hardhat-upgrades';

Expand Down Expand Up @@ -152,7 +151,9 @@ const config: HardhatUserConfig = {
},

paths: {
artifacts: './data/artifacts',
artifacts: './artifacts',
cache: './cache',
tests: './test',
deployments: './data/deployments',
sources: './contracts',
},
Expand All @@ -161,6 +162,7 @@ const config: HardhatUserConfig = {
typechain: {
outDir: './types/typechain',
target: 'ethers-v5',
externalArtifacts: ['artifacts/!(build-info)/**/!(*.dbg*)*.json']
},

mocha: {
Expand Down Expand Up @@ -205,9 +207,11 @@ const config: HardhatUserConfig = {
: undefined,

dodoc: {
runOnCompile: true,
runOnCompile: false,
exclude: ['CatalogNFT.sol','BasicContract.sol', 'Royalties.sol']
}
},




};
Expand Down
2 changes: 0 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
// TS transpilation for library usage
export * from './types/typechain';

19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
"version": "0.0.1",
"private": true,
"main": "./dist/index.js",
"types": "./types/index.ts",
"types": "./dist/index.d.ts",
"engines": {
"node": ">=14.0.0"
},
"files": [
"./dist/**/*",
"./dist/*"
"./dist/*",
"/dist/**/*.d.ts",
"/dist/**/*.d.ts.map",
"/dist/**/*.js",
"/dist/**/*.js.map",
"CHANGELOG.md"
],
"scripts": {
"lint": "yarn lint:sol && yarn lint:ts && yarn prettier:ckeck",
Expand All @@ -22,14 +27,15 @@
"postinstall": "npx hardhat typechain",
"dev": "npx hardhat node --verbose --show-stack-traces",
"test": "npx hardhat test --logs",
"test-nolog": "npx hardhat test",
"test:gas": "cross-env REPORT_GAS=true npx hardhat test --logs",
"test:nolog": "npx hardhat test",
"typechain": "rm -rf ./types/typechain && hardhat typechain --show-stack-traces",
"coverage": "npx hardhat coverage",
"compile": "npx hardhat compile",
"typechain": "rm -rf ./types/typechain && typechain --show-stack-traces --target ethers-v5 --outDir ./types/typechain 'artifacts/!(build-info)/**/!(*.dbg*).json'",
"build": "yarn build:contracts && yarn build:package",
"build:contracts": "yarn compile --no-typechain && yarn typechain",
"build:package": "rm -rf ./dist && tsc && cp types/typechain/*.d.ts dist/types/typechain && cp -R addresses dist && cp -R artifacts/contracts dist/artifacts && cp -R contracts dist",
"prepublishOnly": "yarn build",
"build:contracts": "yarn compile && yarn typechain",
"build:package": "rm -rf ./dist && tsc && cp ./types/typechain/*.d.ts dist/types/typechain && cp -R artifacts/contrafts dist/artifacts && cp -R contracts dist",
"tree": "npx hardhat run scripts/tree.ts",
"ipfs": "npx hardhat run scripts/ipfsUpload.ts",
"getartists": "npx hardhat run scripts/getArtists.ts"
Expand Down Expand Up @@ -60,7 +66,6 @@
"hardhat": "^2.6.4",
"hardhat-abi-exporter": "^2.2.1",
"hardhat-deploy": "^0.9.3",
"hardhat-docgen": "^1.2.0",
"hardhat-gas-reporter": "^1.0.4",
"hardhat-spdx-license-identifier": "^2.0.3",
"hardhat-tracer": "^1.0.0-alpha.6",
Expand Down
4 changes: 3 additions & 1 deletion scripts/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ async function main(inputAddress?: string) {
const leaf = await keccak256(address);

const proof = tree.getHexProof(leaf);
console.log('\x1b[33m%s\x1b[0m','proof for address: (copy the red)');
console.log('\x1b[33m%s\x1b[0m','proof for address: (copy the red for etherscan, green for tenderly)');
console.log('\x1b[36m%s\x1b[0m', `${address}`, '\n \n', '\x1b[31m', proof.toString(), '\x1b[0m');
console.log('\n \n', '\x1b[32m', JSON.stringify(proof), '\x1b[0m');



return {root, proof};
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

},
"exclude": ["node_modules"],
"include": ["./scripts", "./test", "./deploy", "./types/typechain", "index.ts","test/**/*", "types/**/*"],
"include": [ "./types/typechain", "index.ts",],
"files": ["./hardhat.config.ts"]
}
2 changes: 1 addition & 1 deletion types/typechain/factories/AngelaList__factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const _abi = [
];

const _bytecode =
"0x6080604052348015600f57600080fd5b50607d8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80632eb4a7ab14602d575b600080fd5b603560005481565b60405190815260200160405180910390f3fea26469706673582212209dd1ea49c1bc2a51787b92430f5149aa47bf914cbbe136453007d0bcb8400c4364736f6c63430008090033";
"0x6080604052348015600f57600080fd5b50607d8061001e6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80632eb4a7ab14602d575b600080fd5b603560005481565b60405190815260200160405180910390f3fea264697066735822122026c05ce915e0595527a4010a9180de6dddc911ef00a7e4a42555a8603c77441a64736f6c63430008090033";

export class AngelaList__factory extends ContractFactory {
constructor(
Expand Down
Loading