nico
c2b5e15106
|
2 years ago | |
---|---|---|
contracts | 2 years ago | |
scripts | 2 years ago | |
test | 2 years ago | |
.gitignore | 2 years ago | |
LICENSE | 2 years ago | |
README.md | 2 years ago | |
hardhat.config.js | 2 years ago | |
package.json | 2 years ago | |
yarn.lock | 2 years ago |
README.md
Degen Domain Name Service contracts
Degen Domain Name Service (DegenDNS) allows anyone to create a top-level domain (TLD) such as .pepe
or a normal domain such as degen.pepe
. In addition, users can add some other data to their domain:
- description
- redirect URL (useful together with the DegenDNS browser extension)
- profile picture (an address and token ID of an NFT)
See instructions below to run the code on localhost and for blockchain deployment.
.env
Create a .env
file with the following keys:
ALCHEMY_API_KEY_MUMBAI=enter-key-here
ALCHEMY_API_KEY_OPTIMISM=enter-key-here
ALCHEMY_API_KEY_RINKEBY=enter-key-here
ALCHEMY_API_KEY_ROPSTEN=enter-key-here
DEPLOYER_PRIVATE_KEY=enter-key-here
ETHERSCAN_API_KEY=enter-key-here
POLYGONSCAN_API_KEY=enter-key-here
OPTIMISTIC_ETHERSCAN_API_KEY=enter-key-here
ARBISCAN_API_KEY=enter-key-here
Compile
npx hardhat compile
Test
npx hardhat test
Run tests in a specific folder:
npx hardhat test test/factories/flexi/*test.js
Run a specific test:
npx hardhat test test/factories/flexi/TLD.owner.test.js
Run on localhost
Start a localhost node:
npx hardhat node
Make sure to add one of the private keys presented as deployer key in .env
file.
In a separate terminal tab then run the following command:
npx hardhat run scripts/deploy.js --network localhost
Deploy to testnets
npx hardhat run scripts/deploy.js --network polygonMumbai
npx hardhat run scripts/deploy.js --network ropsten
Verify contract on Etherscan/Polygonscan:
Make sure to enter correct network names (see here):
etherscan: {
apiKey: {
polygonMumbai: process.env.POLYGONSCAN_API_KEY,
ropsten: process.env.ETHERSCAN_API_KEY
}
},
Then run this command:
npx hardhat verify --network mumbai <contract-address> "argument"
Verify TLD contracts
Verifying TLD contracts generated through the factory is a bit tricky, but there is a way around the issue. See scripts/temp/deployTld.js
for instructions.
Audit tools
Flatten the contracts
Most audit tools will require you to flatten the contracts. This means that all contracts that are defined under the imports will actually be imported into one .sol file, so all code is in one place.
First create a new folder called flattened:
mkdir flattened
To flatten a contract, run this command:
npx hardhat flatten <path-to-contract> >> flattened/<flat-contract-name>.sol
You may also need to give all contracts in the flattened file the same Solidity version. And you may need to delete all SPDX lines except the very first one.
Mythrill
myth -v4 analyze flattened/DegenForbiddenTlds.sol
Flags:
v4
: verboseo
: outputa
: address onchainl
: automatically retrieve dependenciesmax-depth
: maximum recursion depth
Docs: https://mythril-classic.readthedocs.io/en/master/security-analysis.html
Slither
Install Slither:
pip3 install slither-analyzer --user
Run it in the flattened
folder:
slither .