Skip to content

Commit

Permalink
Update license & prepare to publish on NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
boyuanx committed Jan 11, 2024
1 parent 37e286c commit 956aa22
Show file tree
Hide file tree
Showing 30 changed files with 95 additions and 210 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cache
cache-zk
contracts/old
docs
deployments

# TypeChain
typechain-types
Expand Down
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ tsconfig.json
.prettierrc
.solhint.json
.solhintignore
.env
.env.example
.npmrc
config/

# Test contracts and files
test/
Expand All @@ -20,6 +24,14 @@ contracts/test
# Hardhat
artifacts
cache
docs
storageLayout
subgraph
deployments
scripts
deploy
contracts/hooks
contracts/mock

# TypeChain
typechain-types
Expand Down
55 changes: 1 addition & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1 @@
# Solidity Project Template

Providing a project with a template for the files, folder structure, dependencies, scripting, configuration (local & remote) and development standards used in a Soldity project with TypeScript tests.

---

## Development Process

Development follows these processes outlined in [development process](docs/development_process.md)

---

## Install, build and run

Start by cloning the git repo locally.

#### Install

To retrieve the project dependencies and before any further tasks will run correctly.

```shell
bun install --frozen-lockfile
```

#### Husky Git Commit Hooks

To enable Husky commit hooks to trigger the lint-staged behaviour of formatting and linting the staged files prior
before committing, prepare your repo with `prepare`.

```shell
npm run prepare
```

#### Build and Test

```shell
npm run build
npm test
```

If you make changes that don't get picked up then add a clean into the process

```shell
npm run clean
npm run build
npm test
```

## Tools

Setup and run instructions:

- [Hardhat](./docs/tools/hardhat.md)
- [Slither](./docs/tools/slither.md); Trail of Bits Solidity static analyzer.
See full documentation at [https://docs.ethsign.xyz/tokentable/developers/v2.5](https://docs.ethsign.xyz/tokentable/developers/v2.5)
2 changes: 1 addition & 1 deletion contracts/core/TTFutureTokenV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ITTFutureTokenV2} from "../interfaces/ITTFutureTokenV2.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/TTTrackerTokenV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ITTTrackerTokenV2} from "../interfaces/ITTTrackerTokenV2.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/TTUFeeCollector.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ITTUFeeCollector, IOwnable} from "../interfaces/ITTUFeeCollector.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/TTUProjectTokenStorage.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/TokenTableUnlockerV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/extensions/ERC2771/TTFTV2Gasless.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/extensions/ERC2771/TTUV2Gasless.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ContextUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/core/extensions/native-token/TTUV2Native.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {TokenTableUnlockerV2} from "../../TokenTableUnlockerV2.sol";
Expand Down
11 changes: 10 additions & 1 deletion contracts/hooks/KYCHook.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ITTHook} from "../interfaces/ITTHook.sol";
Expand All @@ -7,9 +7,18 @@ import {IVersionable} from "../interfaces/IVersionable.sol";
import {ITTFutureTokenV2} from "../interfaces/ITTFutureTokenV2.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

// @dev https://github.com/EthSign/sign-protocol-evm/blob/main/src/models/DataLocation.sol
enum DataLocation {
ONCHAIN,
ARWEAVE,
IPFS,
CUSTOM
}

// @dev https://github.com/EthSign/sign-protocol-evm/blob/main/src/models/Attestation.sol
struct Attestation {
uint256 schemaId;
DataLocation dataLocation;
uint256 linkedAttestationId;
address attester;
uint64 validUntil;
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IOwnable.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IOwnable {
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ITTFutureTokenV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IERC721AQueryableUpgradeable} from "erc721a-upgradeable/contracts/interfaces/IERC721AQueryableUpgradeable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ITTHook.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ITTTrackerTokenV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IVersionable} from "./IVersionable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ITTUDeployer.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ITokenTableUnlockerV2} from "./ITokenTableUnlockerV2.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ITTUFeeCollector.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IOwnable} from "./IOwnable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/ITokenTableUnlockerV2.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {IOwnable} from "./IOwnable.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/IVersionable.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
Expand Down
2 changes: 1 addition & 1 deletion contracts/interfaces/TokenTableUnlockerV2DataModels.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
Expand Down
110 changes: 0 additions & 110 deletions contracts/libraries/Clones.sol

This file was deleted.

2 changes: 1 addition & 1 deletion contracts/mock/MockERC20.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.0;

import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock/MockKYCHook.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ITTHook} from "../interfaces/ITTHook.sol";
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock/MockZETA.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.0;

import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
Expand Down
4 changes: 2 additions & 2 deletions contracts/proxy/TTUDeployerLite.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3
pragma solidity ^0.8.20;

import {ITTUDeployer} from "../interfaces/ITTUDeployer.sol";
Expand All @@ -9,7 +9,7 @@ import {ITTFutureTokenV2} from "../interfaces/ITTFutureTokenV2.sol";
import {ITTTrackerTokenV2} from "../interfaces/ITTTrackerTokenV2.sol";
import {ITTUFeeCollector} from "../interfaces/ITTUFeeCollector.sol";
import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol";
import {Clones} from "../libraries/Clones.sol";
import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IVersionable} from "../interfaces/IVersionable.sol";

Expand Down
2 changes: 1 addition & 1 deletion contracts/proxy/TTUV2BeaconManager.sol
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: AGPL v3

pragma solidity ^0.8.20;

Expand Down
20 changes: 20 additions & 0 deletions deploy/95-deploy-kychook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-explicit-any */
import {DeployFunction} from 'hardhat-deploy/dist/types'
import {HardhatRuntimeEnvironment} from 'hardhat/types'

const deployClone: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
// eslint-disable-next-line @typescript-eslint/unbound-method
const {deploy} = hre.deployments
const {deployer} = await hre.getNamedAccounts()

await deploy('KYCHook', {
from: deployer,
log: true,
args: ['0x4E89Bc227eeFbA85cAad8Ca0BaA103480e01Dc59'],
waitConfirmations: 1
})
}

export default deployClone
deployClone.tags = ['KYCHook']
Loading

0 comments on commit 956aa22

Please sign in to comment.