Skip to content
Open
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
1 change: 0 additions & 1 deletion .github/FUNDING.yaml
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
custom: ["https://gitcoin.co/grants/1657/paulrberg-open-source-engineering"]
164 changes: 164 additions & 0 deletions contracts/IHumanboundToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;

// Generated by calling `getCurrentInterface` on HumanboundToken contract
interface IHumanboundToken {
// Events are added by hand
event Minted(address indexed to, uint256 indexed tokenId);

function replace(address oldExtension, address newExtension) external;

function extend(address extension) external;

function getFullInterface() external returns (string memory);

function getExtensionsInterfaceIds() external returns (bytes4[] memory);

function getExtensionsFunctionSelectors() external returns (bytes4[] memory);

function getExtensionAddresses() external returns (address[] memory);

function balanceOf(address owner) external returns (uint256);

function ownerOf(uint256 tokenId) external returns (address);

function getApproved(uint256 tokenId) external returns (address);

function isApprovedForAll(address owner, address operator) external returns (bool);

function _exists(uint256 tokenId) external returns (bool);

function _isApprovedOrOwner(address spender, uint256 tokenId) external returns (bool);

function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) external returns (bool);

function transferFrom(
address from,
address to,
uint256 tokenId
) external;

function safeTransferFrom(
address from,
address to,
uint256 tokenId
) external;

function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory _data
) external;

function transferFrom(
uint8 v,
bytes32 r,
bytes32 s,
uint256 expiry,
address from,
address to,
uint256 tokenId
) external;

function safeTransferFrom(
uint8 v,
bytes32 r,
bytes32 s,
uint256 expiry,
address from,
address to,
uint256 tokenId
) external;

function safeTransferFrom(
uint8 v,
bytes32 r,
bytes32 s,
uint256 expiry,
address from,
address to,
uint256 tokenId,
bytes memory data
) external;

function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) external;

function _afterTokenTransfer(
address from,
address to,
uint256 tokenId
) external;

function init() external;

function updateOwner(address newOwner) external;

function renounceOwnership() external;

function getOwner() external returns (address);

function updateOperator(address newOperator) external;

function getOperator() external returns (address);

function approve(address to, uint256 tokenId) external;

function setApprovalForAll(address operator, bool approved) external;

function _approve(address to, uint256 tokenId) external;

function burn(uint256 tokenId, string memory burnProofURI) external;

function burn(uint256 tokenId) external;

function _setTokenURI(uint256 tokenId, string memory _tokenURI) external;

function _setBaseURI(string memory _tokenURI) external;

function setTokenURI(uint256 tokenId, string memory _tokenURI) external;

function setBaseURI(string memory _tokenURI) external;

function name() external returns (string memory);

function symbol() external returns (string memory);

function tokenURI(uint256 tokenId) external returns (string memory);

function baseURI() external returns (string memory);

function contractURI() external returns (string memory);

function setContractURI(string memory uri) external;

function depositFunds() external;

function withdrawFunds(uint256 amount) external;

function refundExecution(uint256 amount) external;

function setVerifier(address verifier) external;

function getVerifier() external returns (address);

function retract(address extension) external;

function mint(
uint8 v,
bytes32 r,
bytes32 s,
uint256 expiry,
address to,
uint256 tokenId
) external;
}
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@nomiclabs/hardhat-waffle": "^2.0.3",
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@typechain/ethers-v5": "^10.1.0",
"@typechain/ethers-v5": "^10.2.0",
"@typechain/hardhat": "^6.1.0",
"@types/chai": "^4.3.1",
"@types/fs-extra": "^9.0.13",
Expand Down Expand Up @@ -53,9 +53,9 @@
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.21",
"ts-generator": "^0.1.1",
"ts-node": "^10.8.1",
"typechain": "^8.1.0",
"typescript": "^4.7.3"
"ts-node": "^10.5.0",
"typechain": "^8.1.1",
"typescript": "^4.6.2"
},
"files": [
"/contracts"
Expand All @@ -81,6 +81,7 @@
"lint:sol": "solhint --config ./.solhint.json --max-warnings 0 \"contracts/**/*.sol\"",
"lint:ts": "eslint --config ./.eslintrc.yaml --ignore-path ./.eslintignore --ext .js,.ts .",
"postinstall": "husky install",
"prepare": "yarn clean && env COMPILE_MODE=production yarn compile && yarn typechain",
"postpublish": "pinst --enable",
"prepublishOnly": "pinst --disable",
"prettier": "prettier --config ./.prettierrc.yaml --write \"**/*.{js,json,md,sol,ts,yaml,yml}\"",
Expand Down
7 changes: 7 additions & 0 deletions scripts/prepare-artifacts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

# cd to the root of the repo
cd "$(git rev-parse --show-toplevel)"

rm -rf src/dist
yarn prepare
55 changes: 55 additions & 0 deletions src/deployments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
export enum Web3ChainReference {
// Ethereum
EIP155_ETHEREUM_MAINNET = 1,
EIP155_ETHEREUM_RINKEBY = 4,
EIP155_ETHEREUM_KOVAN = 42,
// Optimism
EIP155_OPTIMISM = 10,
EIP155_OPTIMISM_GOERLI = 420,
// Arbitrum
EIP155_ARBITRUM_ONE = 42161,
EIP155_ARBITRUM_GOERLI = 421613,
// Polygon
EIP155_POLYGON_MAINNET = 137,
EIP155_POLYGON_MUMBAI = 80001,
}

export const humanboundDeployments: Record<Web3ChainReference, string> = {
[Web3ChainReference.EIP155_ETHEREUM_MAINNET]: "0x594E5550ecE2c10e5d580e538871914F55884f5d",

[Web3ChainReference.EIP155_ETHEREUM_RINKEBY]: "0x88339f95a4d7daaf868bd44eafac0559be946589",

[Web3ChainReference.EIP155_ETHEREUM_KOVAN]: "0x6b591325Db5Bc220F98B6f09bD0C4E60B12821A6",

[Web3ChainReference.EIP155_OPTIMISM]: "0xFF439bA52825Ffd65E39Fd2bF519566d0cd91827",

[Web3ChainReference.EIP155_OPTIMISM_GOERLI]: "0x5e5007bdd3eb92575499e17eabdd411b42cf79c0",

[Web3ChainReference.EIP155_ARBITRUM_ONE]: "0x5beB956A9Af054956c5C6c0aFac7b109236f86Aa",

[Web3ChainReference.EIP155_ARBITRUM_GOERLI]: "0x8d39Fe83eD158F1B7e21A6434e0878D6c11F02B9",

[Web3ChainReference.EIP155_POLYGON_MAINNET]: "0x41be3a6c17cf76442d9e7b150de4870027d36f52",

[Web3ChainReference.EIP155_POLYGON_MUMBAI]: "0x1888649d566908e0a4ac17978740f6a04f600a51",
};

export const AlchemyNetworkNames: Record<Web3ChainReference, string> = {
[Web3ChainReference.EIP155_ETHEREUM_MAINNET]: "eth-mainnet",

[Web3ChainReference.EIP155_ETHEREUM_RINKEBY]: "deprecated",

[Web3ChainReference.EIP155_ETHEREUM_KOVAN]: "deprecated",

[Web3ChainReference.EIP155_OPTIMISM]: "opt-mainnet",

[Web3ChainReference.EIP155_OPTIMISM_GOERLI]: "opt-goerli",

[Web3ChainReference.EIP155_ARBITRUM_ONE]: "arb-mainnet",

[Web3ChainReference.EIP155_ARBITRUM_GOERLI]: "arb-goerli",

[Web3ChainReference.EIP155_POLYGON_MAINNET]: "polygon-mainnet",

[Web3ChainReference.EIP155_POLYGON_MUMBAI]: "polygon-mumbai",
};
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from "./useHumanbound";
export { Web3ChainReference } from "./deployments";
40 changes: 40 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "@violetprotocol/humanbound-helpers",
"description": "Typescript bindings and utilities for Humanbound Token",
"version": "0.1.0",
"main": "dist/index.js",
"files": [
"dist/**"
],
"scripts": {
"prepare": "bash ../scripts/prepare-artifacts.sh && tsc"
},
"repository": {
"type": "git",
"url": "git+https://github.com/violetprotocol/HumanboundToken.git"
},
"keywords": [
"solidity",
"ethereum",
"smart",
"contracts",
"access",
"token"
],
"author": "Violet",
"license": "MIT",
"bugs": {
"url": "https://github.com/violetprotocol/HumanboundToken/issues"
},
"homepage": "https://github.com/violetprotocol/HumanboundToken#readme",
"dependencies": {
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"ethers": "^5.7.2",
"react": "latest",
"react-scripts": "^5.0.1"
},
"devDependencies": {
"@types/react": "^18.0.25"
}
}
24 changes: 24 additions & 0 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"declaration": true,
"declarationMap": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"lib": ["es6", "dom"],
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "dist",
"removeComments": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"target": "es6"
},
"exclude": ["node_modules"],
"files": ["./index.ts"],
"include": ["useHumanbound.ts", "deployments.ts", "types/**/*"]
}
Loading