Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial setup for testnet-delegation contract #427

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5662008
Initial setup for testnet-delegation contract
Malak67 Mar 27, 2023
ee1391f
cleanup: add checks to constructor
VargaElod23 Mar 28, 2023
1a9a76a
implements initial regisration flow
VargaElod23 Apr 5, 2023
6cb3445
set up config and deployment
VargaElod23 Apr 6, 2023
4a15eff
implement orchestrator and mocks for tests
VargaElod23 Apr 6, 2023
75ee92c
implements addInternalValidator logic
VargaElod23 Apr 6, 2023
0495d59
finishes testnet dpos orchestrator tests and impl
VargaElod23 Apr 6, 2023
674c68b
adds reentrancyGuard to additions, fixes logic for own stake additions
VargaElod23 Apr 13, 2023
2c2c398
adds slither to analysis pipeline
VargaElod23 Apr 17, 2023
2d3839d
change sol v to 0.8.19
VargaElod23 Apr 17, 2023
42ee34e
adds small improvements
VargaElod23 Apr 17, 2023
8e634fb
reset sol version for analysis
VargaElod23 Apr 17, 2023
af979e0
implements V2 of contract
VargaElod23 Apr 19, 2023
57f046b
adds comments to V2
VargaElod23 Apr 19, 2023
d49d191
rename parameters
VargaElod23 Apr 19, 2023
e67f05e
Implements proxy func for DPOS
VargaElod23 Apr 21, 2023
650c18d
add zero address check in proxy constructor
VargaElod23 Apr 21, 2023
79e623e
add release step
VargaElod23 Apr 24, 2023
f5e9c56
adds event tests
VargaElod23 Apr 24, 2023
2e53ad4
adds some view functionality
VargaElod23 Apr 26, 2023
8f3a071
finalize version1
VargaElod23 Apr 27, 2023
9095a5c
implements shadowing of view methods and registerValidator
VargaElod23 Apr 28, 2023
82d6ae3
Merge branch 'develop' into feat/testnet-delegation
VargaElod23 Aug 17, 2023
25ad5f0
bumps deps
VargaElod23 Aug 17, 2023
f4fffa3
updates tests
VargaElod23 Aug 17, 2023
bebc1fd
refactor: simplify contract
VargaElod23 Aug 28, 2023
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
23 changes: 23 additions & 0 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Solidity Analysis
on: [push]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install packages
run: yarn install
- name: Run slither
uses: crytic/[email protected]
id: slither
with:
solc-version: 0.8.18
node-version: 16
sarif: results.sarif
fail-on: none
target: 'packages/testnet-delegation/contracts/DelegationOrchestrator.sol'
slither-config: 'packages/testnet-delegation/slither.config.json'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.slither.outputs.sarif }}
19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"private": true,
"workspaces": [
"services/*",
"packages/*"
],
"workspaces": {
"services": [
"services/*"
],
"packages": [
"packages/*"
],
"nohoist": [
"**/typechain",
"**/@typechain/*"
]
},
"scripts": {
"build-storybook": "cross-env SKIP_PREFLIGHT_CHECK=true yarn workspace @taraxa_project/taraxa-ui build-storybook",
"claim-build": "cross-env SKIP_PREFLIGHT_CHECK=true yarn workspace @taraxa_project/taraxa-claim-backend build",
Expand Down Expand Up @@ -49,7 +57,8 @@
"watch:ui": "nodemon -w \"packages/taraxa-ui/src/*\" -x \"yarn ui-build && yarn community-build \"",
"economics:start": "cross-env SKIP_PREFLIGHT_CHECK=true yarn workspace @taraxa_project/economics-rewards start",
"economics:generate:csv": "cross-env SKIP_PREFLIGHT_CHECK=true yarn workspace @taraxa_project/economics-rewards generate:csv",
"economics:run": "nodemon \"services/economics-rewards/src/*\" -x \"yarn economics:start || touch index.ts \""
"economics:run": "nodemon \"services/economics-rewards/src/*\" -x \"yarn economics:start || touch index.ts \"",
"dpos-build": "yarn workspace @taraxa_project/taraxa-testnet-dpos compile"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down
13 changes: 13 additions & 0 deletions packages/testnet-delegation/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
PRIVATE_KEY=570a4ff197369cf0e63f36ade0df12934903c291b2a69c0b1accfdcd069be9ae
TARA_TESTNET_URL=https://rpc.testnet.taraxa.io/
MAINNET_PRIV_KEY=570a4ff197369cf0e63f36ade0df12934903c291b2a69c0b1accfdcd069be9ae

# --- TESTING --- #
TEST_KEY_1=4c8e71073821e1029fb5b9cca3c93fbdac265e8af6d08c434776b82b3b377941
TEST_KEY_2=570a4ff197369cf0e63f36ade0df12934903c291b2a69c0b1accfdcd069be9ae
TEST_KEY_3=0f5fc5b4cdeefc64f867fd69eed697f70f146367eeee78d073b19b24c5039aee
TEST_KEY_4=9f29fceec65f699209d187478c4d7e293e32bd8a6bfb7e467063973524888167
TEST_KEY_5=472a3f59fe3d81cda76dbb2a64825e46c4b067ae559cd4dfc784869da80bd05e

DPOS_ADDRESS=
5 changes: 5 additions & 0 deletions packages/testnet-delegation/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
artifacts
cache
coverage
docs
27 changes: 27 additions & 0 deletions packages/testnet-delegation/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
root: true,
env: {
browser: false,
es2021: true,
mocha: true,
node: true,
},
plugins: ["@typescript-eslint"],
extends: ["standard", "plugin:prettier/recommended", "plugin:node/recommended"],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 12,
},
rules: {
"node/no-unsupported-features/es-syntax": ["error", { ignores: ["modules"] }],
},
overrides: [
{
files: ["*.test.ts", "*.spec.ts"],
rules: {
"no-unused-expressions": "off",
"node/no-missing-import": "off",
},
},
],
};
14 changes: 14 additions & 0 deletions packages/testnet-delegation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node_modules
.env
coverage
coverage.json
types
.openzeppelin

#Hardhat files
cache
artifacts/**/*.dbg.json
artifacts/@openzeppelin/
artifacts/build-info/
artifacts/hardhat/

3 changes: 3 additions & 0 deletions packages/testnet-delegation/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
hardhat.config.ts
scripts
test
5 changes: 5 additions & 0 deletions packages/testnet-delegation/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
artifacts
cache
coverage*
gasReporterOutput.json
1 change: 1 addition & 0 deletions packages/testnet-delegation/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "printWidth": 120 }
7 changes: 7 additions & 0 deletions packages/testnet-delegation/.solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "solhint:recommended",
"rules": {
"compiler-version": ["error", "^0.8.4"],
"func-visibility": ["warn", { "ignoreConstructors": true }]
}
}
1 change: 1 addition & 0 deletions packages/testnet-delegation/.solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"_format": "hh-sol-artifact-1",
"contractName": "CallProxy",
"sourceName": "contracts/CallProxy.sol",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "implementation",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"stateMutability": "payable",
"type": "fallback"
},
{
"stateMutability": "payable",
"type": "receive"
}
],
"bytecode": "0x60a060405234801561001057600080fd5b5060405161019438038061019483398101604081905261002f916100b2565b6001600160a01b0381166100a15760405162461bcd60e51b815260206004820152602f60248201527f5a65726f2061646472657373206e6f7420612076616c696420696d706c656d6560448201526e6e746174696f6e206164647265737360881b606482015260840160405180910390fd5b6001600160a01b03166080526100e2565b6000602082840312156100c457600080fd5b81516001600160a01b03811681146100db57600080fd5b9392505050565b608051609a6100fa600039600060170152609a6000f3fe608060405236601057600e6013565b005b600e5b603a7f0000000000000000000000000000000000000000000000000000000000000000603c565b565b366000803760008036600034855af1806059573d6000803e3d6000fd5b503d6000803e3d6000f3fea2646970667358221220bcde2f56823cd50fa90df2b0225b82733c5e52284713e9378309b82c4b8d993664736f6c63430008120033",
"deployedBytecode": "0x608060405236601057600e6013565b005b600e5b603a7f0000000000000000000000000000000000000000000000000000000000000000603c565b565b366000803760008036600034855af1806059573d6000803e3d6000fd5b503d6000803e3d6000f3fea2646970667358221220bcde2f56823cd50fa90df2b0225b82733c5e52284713e9378309b82c4b8d993664736f6c63430008120033",
"linkReferences": {},
"deployedLinkReferences": {}
}
Loading