Skip to content

Commit

Permalink
initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
julienbrg committed Feb 27, 2024
1 parent 1e554a0 commit 5b67f33
Show file tree
Hide file tree
Showing 22 changed files with 201 additions and 2,346 deletions.
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 [email protected]
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.

77 changes: 77 additions & 0 deletions deploy/deploy-arthera-whitepaper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
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)
)

try {
console.log(
"Please use `pnpm sourcify:arthera` to verify your contract."
)
} catch (error) {
console.error(error)
}

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

try {
console.log(
"Please use `pnpm sourcify:arthera-testnet` to verify your contract."
)
} catch (error) {
console.error(error)
}

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.

1 change: 0 additions & 1 deletion deployments/arthera-testnet/.chainId

This file was deleted.

Loading

0 comments on commit 5b67f33

Please sign in to comment.