Skip to content

Commit

Permalink
Initial setup (#2)
Browse files Browse the repository at this point in the history
* initial setup

* first deployment

* clean up

* add links
  • Loading branch information
julienbrg committed Feb 29, 2024
1 parent 1e554a0 commit 070213e
Show file tree
Hide file tree
Showing 24 changed files with 1,990 additions and 2,371 deletions.
30 changes: 4 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
# W3HC Hardhat Template
# Arthera Whitepaper NFT Contracts

This Hardhat template includes:
The NFT gives you access to the Arthera Whitepaper.

- [Typescript](https://www.typescriptlang.org/)
- [Ethers v6](https://docs.ethers.org/v6/)
- [OpenZeppelin Contracts v5.0.1](https://github.com/OpenZeppelin/openzeppelin-contracts/releases/tag/v5.0.1)
- [Hardhat Verify plugin](https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify)
- [Hardhat Deploy plugin](https://github.com/wighawag/hardhat-deploy)

## Supported networks

- [Arthera Mainnet](https://chainlist.org/chain/10242) ([docs](https://docs.arthera.net/build/networks#arthera-mainnet))
- [Arthera testnet](https://chainlist.org/chain/10243) ([docs](https://docs.arthera.net/build/networks#arthera-testnet))
- [Sepolia Testnet](https://chainlist.org/chain/11155111) ([docs](https://ethereum.org/nb/developers/docs/networks/#sepolia))
- [OP Sepolia Testnet](https://chainlist.org/chain/11155420) ([docs](https://docs.optimism.io/chain/networks#op-sepolia))
- UI Github repo: https://github.com/w3hc/awp-ui
- Web app: https://whitepaper.arthera.net/

## Install

Expand Down Expand Up @@ -55,18 +45,6 @@ pnpm bal <NETWORK_NAME>
pnpm sourcify:<NETWORK_NAME>
```

## Mint

```
pnpm mint:<NETWORK_NAME> 42
```

## Send

```
pnpm send:<NETWORK_NAME> 8
```

## Versions

- Node [v20.9.0](https://nodejs.org/uk/blog/release/v20.9.0/)
Expand Down
75 changes: 75 additions & 0 deletions contracts/ArtheraWhitepaper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/cryptography/EIP712.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Votes.sol";

/// @custom:security-contact julien.arthera@arthera.net
contract ArtheraWhitepaper is
ERC721,
ERC721Enumerable,
ERC721URIStorage,
ERC721Burnable,
Ownable,
EIP712,
ERC721Votes
{
uint256 private _nextTokenId;

string public uri;

constructor(
string memory _uri,
address initialOwner
) ERC721("Arthera Whitepaper", "WP") EIP712("Arthera Whitepaper", "1") Ownable(initialOwner) {
uri = _uri;
}

// Overrides IERC6372 functions to make the token & governor timestamp-based
function clock() public view override returns (uint48) {
return uint48(block.timestamp);
}

// solhint-disable-next-line func-name-mixedcase
function CLOCK_MODE() public pure override returns (string memory) {
return "mode=timestamp";
}

function safeMint() public {
uint256 tokenId = _nextTokenId++;
_safeMint(msg.sender, tokenId);
_setTokenURI(tokenId, uri);
}

function _update(
address to,
uint256 tokenId,
address auth
) internal override(ERC721, ERC721Enumerable, ERC721Votes) returns (address) {
return super._update(to, tokenId, auth);
}

function _increaseBalance(
address account,
uint128 value
) internal override(ERC721, ERC721Enumerable, ERC721Votes) {
super._increaseBalance(account, value);
}

function tokenURI(
uint256 tokenId
) public view override(ERC721, ERC721URIStorage) returns (string memory) {
return super.tokenURI(tokenId);
}

function supportsInterface(
bytes4 interfaceId
) public view override(ERC721, ERC721Enumerable, ERC721URIStorage) returns (bool) {
return super.supportsInterface(interfaceId);
}
}
14 changes: 0 additions & 14 deletions contracts/Basic.sol

This file was deleted.

61 changes: 61 additions & 0 deletions deploy/deploy-arthera-whitepaper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import "@nomiclabs/hardhat-ethers"
import color from "cli-color"
var msg = color.xterm(39).bgXterm(128)
import hre, { ethers, network } from "hardhat"

const initialMint = ethers.parseEther("10000")

export default async ({ getNamedAccounts, deployments }: any) => {
const { deploy } = deployments

const { deployer } = await getNamedAccounts()

const uri =
"https://bafybeifkpdwa4tkbbze5qui3yn2ph5cntiiojmdlkoxah5fs4mc55b3vt4.ipfs.w3s.link/arthera-whitepaper-nft-metadata.json"

console.log("deployer:", deployer)

const awp = await deploy("ArtheraWhitepaper", {
from: deployer,
args: [uri, deployer],
log: true
})

switch (hre.network.name) {
case "arthera":
console.log(
"Arthera Whitepaper NFT contract deployed:",
msg(awp.receipt.contractAddress)
)

break
case "arthera-testnet":
console.log(
"Arthera Whitepaper NFT contract deployed:",
msg(awp.receipt.contractAddress)
)

break
case "sepolia":
try {
console.log(
"Arthera Whitepaper NFT contract deployed:",
msg(awp.receipt.contractAddress)
)
console.log("\nEtherscan verification in progress...")
console.log(
"\nWaiting for 6 block confirmations (you can skip this part)"
)
await hre.run("verify:verify", {
network: network.name,
address: awp.receipt.contractAddress,
constructorArguments: [initialMint]
})
console.log("Etherscan verification done. ✅")
} catch (error) {
console.error(error)
}
break
}
}
export const tags = ["ArtheraWhitepaper"]
122 changes: 0 additions & 122 deletions deploy/deploy-basic.ts

This file was deleted.

Loading

0 comments on commit 070213e

Please sign in to comment.