Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolev-igor committed Jul 23, 2021
0 parents commit 49609c1
Show file tree
Hide file tree
Showing 30 changed files with 58,098 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
5 changes: 5 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
INFURA_API_KEY="infura_api_key"
MNEMONIC="twelve words mnemonic"
ETHERSCAN_API_KEY="etherscan_api_key"
PRIVATE_KEY="privete_key_starting_with_0x"
REPORT_GAS=true
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
coverage
artifacts
build
docs
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"browser": true,
"es6": true
},
"extends": ["airbnb-base"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"indent": ["error", 2],
"no-undef": "off",
"prefer-const": "off",
"no-console": "off",
"linebreak-style": "off",
"operator-linebreak": "off",
"object-curly-newline": "off",
"arrow-body-style": "off"
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sol linguist-language=Solidity
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: build
on: push

jobs:
coverage:
name: build
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup-node
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: install
run: npm ci
- name: build
run: npm run compile
- name: upload artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts
path: artifacts/contracts
26 changes: 26 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: coverage
on: push

jobs:
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup-node
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: install
run: npm ci
- name: test+coverage
run: npm run coverage
env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
- name: upload artifacts
uses: actions/upload-artifact@v1
if: always()
with:
name: coverage
path: coverage
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: lint
on: push

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup-node
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: install
run: npm ci
- name: build
run: npm run compile
- name: lint
run: npm run lint
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: test
on: push

jobs:
coverage:
name: test
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup-node
uses: actions/setup-node@v1
with:
node-version: "10.x"
- name: install
run: npm ci
- name: test
run: npm run test
env:
INFURA_API_KEY: ${{ secrets.INFURA_API_KEY }}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
.env
cache
artifacts
.DS_Store
coverage
coverage.json
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no lint-staged
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
coverage
artifacts
build
cache
28 changes: 28 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"overrides": [
{
"files": "*.sol",
"options": {
"printWidth": 99,
"tabWidth": 4,
"useTabs": false,
"singleQuote": false,
"bracketSpacing": true,
"explicitTypes": "always",
"trailingComma": "none"
}
},
{
"files": "*.js",
"options": {
"printWidth": 99,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"bracketSpacing": true,
"explicitTypes": "always",
"trailingComma": "all"
}
}
]
}
54 changes: 54 additions & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require('dotenv').config();

module.exports = {
skipFiles: [],
providerOptions: {
accounts: [
{
secretKey: `${process.env.PRIVATE_KEY}`,
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0xbe5d6e330de6c44c137f8fb45fa44dada079fb8bc29d290cadd8f882035dd189',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x473acc210edb35998de9dc65495bafbf0a3804950482cd2b48af7bba7046d7de',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x3893470a6bcee2e2652eea6dddd6c677925453529313bddd86ce61fd29e06313',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x8bcaeea38f9d2ecb9719dc31b7dd8ef4d3a7c27fed7d2a5e29c15677f1d70a2d',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x159496cd9b1532e326dbb1759fb57dfca6722568690713032bab3b7a0aaf0fbd',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x3ce40f93372672923bda9fc1e8581428d02510c09418d9ebb8182b232234446d',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x92070709cd34955ec8aaf14b1b4cd8197ee4743189391072629538e52ef18014',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x0af73f5c72996143627524d0b22134e66d47e594b9598a94ef94ab1b781e7460',
balance: '0x56BC75E2D63100000',
},
{
secretKey: '0x0272de3730704f4150e3c691cb2538ff22146affb578a845399a5def59f24e17',
balance: '0x56BC75E2D63100000',
},
],
fork: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
gasLimit: 0x1fffffffffffff,
},
mocha: {
enableTimeouts: false,
},
};
19 changes: 19 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"extends": "solhint:all",
"plugins": ["prettier"],
"rules": {
"mark-callable-contracts": ["off"],
"reason-string": ["error", { "maxLength": 50 }],
"function-max-lines": ["error", 99],
"compiler-version": ["off"],
"private-vars-leading-underscore": ["off"],
"func-visibility": [
"warn",
{
"ignoreConstructors": true
}
],
"prettier/prettier": "warn",
"comprehensive-interface": ["off"]
}
}
1 change: 1 addition & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Igor Sobolev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# zerion-genesis-nft

This is a project with a simple NFT token.

The main functionality of this token is `claim()` function.
It can be called once per EOA (Ethereum address) and only within a deadline (5 days after the deployment).
For every account, `call()` function 'randomly' mints 1 of 10 NFT tokens with the following probabilities:

0. Legendary – 0.1%
1. Rare – 5.1%
2. Rare – 5.1%
3. Rare – 5.1%
4. Common – 14.1%
5. Common – 14.1%
6. Common – 14.1%
7. Common – 14.1%
8. Common – 14.1%
9. Common – 14.1%

The mainnet address is the following: [0x0000000000000000000000000000000000000000](https://etherscan.io/address/0x0000000000000000000000000000000000000000#code).

Call `claim()` function within a deadline and try your luck!
32 changes: 32 additions & 0 deletions contracts/IZerionGenesisNFT.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

interface IZerionGenesisNFT is IERC1155 {
/// @notice Claims a random Zerion NFT for the `msg.sender`.
/// @dev Can be called only by an EOA.
/// @dev Can be called once per account.
/// @dev Can be called only prior to the deadline.
function claim() external;

/// @notice Shows the latest time Zerion NFTs can be claimed.
/// @return Timestamp of minting deadline.
function deadline() external view returns (uint256);

/// @notice Shows the rarities for Zerion NFTs.
/// @return Rarity for a given id, multiplied by 1000.
function rarity(uint256 tokenId) external view returns (uint256);

/// @notice Indicates whether the account has already claimed Zerion NFT.
function claimed(address account) external view returns (bool);

/// @notice Collection name.
function name() external view returns (string memory);

/// @notice Collection symbol.
function symbol() external view returns (string memory);

/// @notice Collection metadata URI.
function contractURI() external view returns (string memory);
}
Loading

0 comments on commit 49609c1

Please sign in to comment.