From b53134738449ab9b5c16df3fc73d8bb1cac17c70 Mon Sep 17 00:00:00 2001 From: smart_ex Date: Wed, 11 May 2022 23:21:48 +1000 Subject: [PATCH 1/2] Basic types definition for torn-token package --- .eslintrc | 3 +- .prettierignore | 1 + index.d.ts | 109 ++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- yarn.lock | 31 ++++++++++++++ 5 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 index.d.ts diff --git a/.eslintrc b/.eslintrc index b244509..5459a81 100644 --- a/.eslintrc +++ b/.eslintrc @@ -22,5 +22,6 @@ "object-curly-spacing": ["error", "always"], "comma-dangle": ["error", "always-multiline"], "require-await": "error" - } + }, + "ignorePatterns": ["*.d.ts"] } diff --git a/.prettierignore b/.prettierignore index 0186d2e..f017d6f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,3 +2,4 @@ build scripts contracts/ECDSA.sol +*.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..f80b276 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,109 @@ +export const torn: Torn +export const governance: Address +export const governanceImpl: Address +export const voucher: Voucher +export const miningV2: Mining +export const rewardSwap: RewardSwap +export const tornadoTrees: TornadoTrees +export const tornadoProxy: Address +export const tornadoProxyLight: Address +export const rewardVerifier: Address +export const treeUpdateVerifier: Address +export const withdrawVerifier: Address +export const poseidonHasher2: Address +export const poseidonHasher3: Address +export const feeManager: Address +export const tornadoStakingRewards: Address +export const relayerRegistry: Address +export const tornadoRouter: Address +export const instanceRegistry: Address +export const deployer: Address +export const vesting: Vesting +export const instances: Instances + + +export type availableIds = 1 | 5 | 10 | 56 | 100 | 137 | 42161 | 43114 +export type availableTokens = 'eth' | 'dai' | 'cdai' | 'usdc' | 'usdt' | 'wbtc' | 'xdai' | 'matic' | 'avax' | 'bnb' +export type netIds = `netId${availableIds}` + +export type Address = { + address: string +} + +export type Instances = { + [p in netIds]: NetInstances; +}; + +export type NetInstances = { + [p in availableTokens]?: TInstance; +} + +export type TInstance = { + instanceAddress: InstanceAddress + tokenAddress?: string + symbol: string + decimals: number +} + +export type InstanceAddress = { + '0.1'?: string + '1'?: string + '10'?: string + '100'?: string + '500'?: string + '1000'?: string + '5000'?: string + '10000'?: string + '50000'?: string + '100000'?: string + '500000'?: string + '5000000'?: string +} + +export type Mining = Address & { + initialBalance: string + rates: Rate[] +} + +export type Rate = { + instance: string + value: string +} + +export type RewardSwap = Address & { + poolWeight: number +} + +export type Torn = Address & { + cap: string + pausePeriod: number + distribution: { [key: string]: Distribution } +} + +export type Distribution = { + to: string + amount: string +} + +export type TornadoTrees = Address & { + levels: number +} + +export interface Vesting { + team1: Governance; + team2: Governance; + team3: Governance; + team4: Governance; + team5: Governance; + governance: Governance; +} + +export type Governance = Address & { + cliff: number + duration: number + beneficiary?: string +} + +export type Voucher = Address & { + duration: number +} diff --git a/package.json b/package.json index d279eda..5d2e604 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "config.js", "contracts/*" ], + "types": "index.d.ts", "scripts": { "compile": "truffle compile", "coverage": "yarn compile && truffle run coverage", @@ -41,6 +42,7 @@ "@openzeppelin/contracts": "^3.1.0", "eth-sig-util": "^2.5.3", "ethereumjs-util": "^7.0.3", - "web3": "^1.2.11" + "web3": "^1.2.11", + "web3-utils": "^1.7.3" } } diff --git a/yarn.lock b/yarn.lock index 0f60ac3..f33e28c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -357,6 +357,13 @@ dependencies: "@types/node" "*" +"@types/bn.js@^5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-5.1.0.tgz#32c5d271503a12653c62cf4d2b45e6eab8cebc68" + integrity sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA== + dependencies: + "@types/node" "*" + "@types/color-name@^1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" @@ -1945,6 +1952,17 @@ ethereumjs-util@^7.0.3: ethjs-util "0.1.6" rlp "^2.2.4" +ethereumjs-util@^7.1.0: + version "7.1.4" + resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.4.tgz#a6885bcdd92045b06f596c7626c3e89ab3312458" + integrity sha512-p6KmuPCX4mZIqsQzXfmSx9Y0l2hqf+VkAiwSisW3UKUFdk8ZkAt+AYaor83z2nSi6CU2zSsXMlD80hAbNEGM0A== + dependencies: + "@types/bn.js" "^5.1.0" + bn.js "^5.1.2" + create-hash "^1.1.2" + ethereum-cryptography "^0.1.3" + rlp "^2.2.4" + ethers@4.0.0-beta.3: version "4.0.0-beta.3" resolved "https://registry.yarnpkg.com/ethers/-/ethers-4.0.0-beta.3.tgz#15bef14e57e94ecbeb7f9b39dd0a4bd435bc9066" @@ -5828,6 +5846,19 @@ web3-utils@1.2.6: underscore "1.9.1" utf8 "3.0.0" +web3-utils@^1.7.3: + version "1.7.3" + resolved "https://registry.yarnpkg.com/web3-utils/-/web3-utils-1.7.3.tgz#b214d05f124530d8694ad364509ac454d05f207c" + integrity sha512-g6nQgvb/bUpVUIxJE+ezVN+rYwYmlFyMvMIRSuqpi1dk6ApDD00YNArrk7sPcZnjvxOJ76813Xs2vIN2rgh4lg== + dependencies: + bn.js "^4.11.9" + ethereum-bloom-filters "^1.0.6" + ethereumjs-util "^7.1.0" + ethjs-unit "0.1.6" + number-to-bn "1.7.0" + randombytes "^2.1.0" + utf8 "3.0.0" + web3@1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.1.tgz#5d8158bcca47838ab8c2b784a2dee4c3ceb4179b" From 7bded955609a880fb29ba7dad8f1ac3b91ba5fc9 Mon Sep 17 00:00:00 2001 From: smart_ex Date: Wed, 22 Jun 2022 20:26:42 +1000 Subject: [PATCH 2/2] bump version 1.0.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5d2e604..2bfb688 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "torn-token", - "version": "1.0.6", + "version": "1.0.7", "main": "config.js", "repository": "https://github.com/tornadocash/torn-token.git", "author": "Tornadocash team ",