Basic types definition for torn-token package

This commit is contained in:
smart_ex 2022-05-11 23:21:48 +10:00 committed by Serg
parent 456beaafca
commit b531347384
5 changed files with 146 additions and 2 deletions

View File

@ -22,5 +22,6 @@
"object-curly-spacing": ["error", "always"], "object-curly-spacing": ["error", "always"],
"comma-dangle": ["error", "always-multiline"], "comma-dangle": ["error", "always-multiline"],
"require-await": "error" "require-await": "error"
} },
"ignorePatterns": ["*.d.ts"]
} }

View File

@ -2,3 +2,4 @@
build build
scripts scripts
contracts/ECDSA.sol contracts/ECDSA.sol
*.d.ts

109
index.d.ts vendored Normal file
View File

@ -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
}

View File

@ -9,6 +9,7 @@
"config.js", "config.js",
"contracts/*" "contracts/*"
], ],
"types": "index.d.ts",
"scripts": { "scripts": {
"compile": "truffle compile", "compile": "truffle compile",
"coverage": "yarn compile && truffle run coverage", "coverage": "yarn compile && truffle run coverage",
@ -41,6 +42,7 @@
"@openzeppelin/contracts": "^3.1.0", "@openzeppelin/contracts": "^3.1.0",
"eth-sig-util": "^2.5.3", "eth-sig-util": "^2.5.3",
"ethereumjs-util": "^7.0.3", "ethereumjs-util": "^7.0.3",
"web3": "^1.2.11" "web3": "^1.2.11",
"web3-utils": "^1.7.3"
} }
} }

View File

@ -357,6 +357,13 @@
dependencies: dependencies:
"@types/node" "*" "@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": "@types/color-name@^1.1.1":
version "1.1.1" version "1.1.1"
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" 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" ethjs-util "0.1.6"
rlp "^2.2.4" 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: ethers@4.0.0-beta.3:
version "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" 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" underscore "1.9.1"
utf8 "3.0.0" 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: web3@1.2.1:
version "1.2.1" version "1.2.1"
resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.1.tgz#5d8158bcca47838ab8c2b784a2dee4c3ceb4179b" resolved "https://registry.yarnpkg.com/web3/-/web3-1.2.1.tgz#5d8158bcca47838ab8c2b784a2dee4c3ceb4179b"