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

Simple Delegation #34

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
8b8ef36
chore: add voting manager feature for holders
ujenjt Jan 25, 2024
c1fa2f1
chore: Prohibit managers from overwriting holder's votes, retain over…
ujenjt Jan 25, 2024
52a6524
fix: internal function types
katamarinaki Feb 1, 2024
7ed76a8
refactor: rename holder -> voter, manager -> delegate
katamarinaki Feb 1, 2024
740bb2b
refactor: update delegation related naming in tests
katamarinaki Feb 7, 2024
739ae34
refactor: extract vote phase check into separate fn
katamarinaki Feb 1, 2024
7392eb4
refactor: add CastVoteAsDelegate event
katamarinaki Feb 2, 2024
978b4eb
refactor: introduce Delegate struct and use it to simplify DelegatedA…
katamarinaki Feb 7, 2024
e8c7965
feat: add balance check to setDelegate
katamarinaki Feb 7, 2024
baa1a71
refactor: remove reverts from voteForMultiple and _vote, move revert …
katamarinaki Feb 7, 2024
1d98abf
fix: update voterIndex of swapped address during voter deletion
katamarinaki Feb 8, 2024
81a75b7
refactor: remove voterIndex from DelegateSet event
katamarinaki Feb 8, 2024
b040619
refactor: remove MAX_VOTERS_PER_DELEGATE limitation
katamarinaki Feb 8, 2024
337b031
refactor: add offset and count params to getDelegatedVoters
katamarinaki Feb 8, 2024
f98f68d
refactor: remove unused constant
katamarinaki Feb 8, 2024
4d6f150
refactor: add revert if error inside loop in voteForMultiple
katamarinaki Feb 13, 2024
7bf4014
refactor: add getter for delegated voters with their voting power and…
katamarinaki Feb 13, 2024
c3f8577
refactor: optimize delegated voter removal
katamarinaki Feb 13, 2024
5970417
refactor: add max uint96 check for delegated voters array length
katamarinaki Feb 14, 2024
3138944
refactor: remove unused variables from Voting contract
katamarinaki Feb 14, 2024
42bb8f3
refactor: rebuild invariant checks for voteForMultiple, refactor voteFor
katamarinaki Feb 14, 2024
569a600
refactor: update delegation getters and setters
katamarinaki Feb 16, 2024
8bacd24
refactor: remove _castVote argument from _newVote
katamarinaki Feb 16, 2024
d190e19
Merge pull request #4 from katamarinaki/refactor/delegation-remove-ca…
katamarinaki Feb 16, 2024
ae9ce25
feat: add getVoterStateMultiple
katamarinaki Feb 21, 2024
82aaaf4
refactor: rename _isDelegate fn to _isDelegateFor
katamarinaki Feb 21, 2024
2c248f1
feat: add length check to _removeDelegatedAddressFor
katamarinaki Feb 23, 2024
6de0d13
refactor: rename getVoterStateMultiple -> getVotersStateAtVote
katamarinaki Feb 23, 2024
02b11ee
refactor: read vote outside of the loop in getVotersStateAtVote
katamarinaki Feb 26, 2024
8476902
refactor: update contract structure, add functions docs
katamarinaki Feb 28, 2024
74ebc61
Merge pull request #7 from katamarinaki/refactor/delegation-update-st…
katamarinaki Feb 29, 2024
b8b1555
refactor: split DelegateSet into two events - SetDelegate and RemoveD…
katamarinaki Feb 29, 2024
5dd2bd0
refactor: update delegation related naming (#36)
katamarinaki Mar 1, 2024
01765d8
Merge branch 'voting-manager' of github.com:lidofinance/aragon-apps i…
katamarinaki Mar 1, 2024
8580ae7
Merge pull request #39 from katamarinaki/refactor/simple-delegation
katamarinaki Mar 1, 2024
f02be61
style: fix formatting
katamarinaki Mar 1, 2024
4d69635
style: fix errors code style
katamarinaki Mar 4, 2024
82e9a33
style: remove semicolons from errors file
katamarinaki Mar 4, 2024
678626b
refactor: address reviewers rfc
katamarinaki Mar 4, 2024
198e343
refactor: merge _isValidPhaseToVote and _canParticipateInVote functio…
katamarinaki Mar 4, 2024
243abe1
refactor: rename removeDelegate to resetDelegate; move Set/ResetDeleg…
katamarinaki Mar 4, 2024
208702c
refactor: rename _hasVoted to _hasVotedDirectly
katamarinaki Mar 4, 2024
997dd7e
refactor: no revert for `_canVoteFor` in `voteForMultiple`, rename `v…
katamarinaki Mar 4, 2024
08d43e3
fix: audit fixes
rkolpakov Mar 15, 2024
22fe318
fix: remove inconsistent balance check
katamarinaki Mar 22, 2024
e7faa43
feat: add holesky support for deployment
katamarinaki Mar 27, 2024
1096e16
refactor: rename _vote param to vote_
katamarinaki Mar 29, 2024
f2f1eed
refactor: comment out deprecated arguments names
katamarinaki Mar 31, 2024
e3cef8c
docs: add missing natspec comments
katamarinaki Apr 1, 2024
b303031
test: simple delegation tests (#41)
katamarinaki Apr 2, 2024
42f8dc2
test: remove outdated test
katamarinaki Apr 2, 2024
54caa64
test: move out tests for delegation to the diiferent test file & remo…
rkolpakov Apr 16, 2024
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
8 changes: 8 additions & 0 deletions apps/voting/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# IDE Settings
.vscode

# Local dev config
accounts.json

# Local artifacts
tx-deploy-voting_for_upgrade.json
15 changes: 14 additions & 1 deletion apps/voting/accounts.sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,23 @@
"projectId": "INFURA_PROJECT_ID"
},
"etherscan": {
"apiKey": "ETHERSCAN_API_KEY"
"apiKey": "ETHERSCAN_API_KEY",
"customChains": [
{
"network": "holesky",
"chainId": 17000,
"urls": {
"apiURL": "https://api-holesky.etherscan.io/api",
"browserURL": "https://holesky.etherscan.io"
}
}
]
},
"infura_ipfs": {
"projectId": "",
"projectSecret": ""
},
"drpc": {
"key": "DRPC_KEY"
}
}
348 changes: 312 additions & 36 deletions apps/voting/contracts/Voting.sol

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/voting/contracts/test/mocks/VotingMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ contract VotingMock is Voting, TimeHelpersMock {
token.generateTokens(_holder, _tokenAmount);

bytes memory noScript = new bytes(0);
voteId = _newVote(noScript, _metadata, false);
voteId = _newVote(noScript, _metadata);
emit StartVote(voteId, msg.sender, _metadata);
}
}
11 changes: 9 additions & 2 deletions apps/voting/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const ETH_ACCOUNT_NAME = process.env.ETH_ACCOUNT_NAME
const accounts = readJson(`./accounts.json`) || {
eth: { dev: 'remote' },
etherscan: { apiKey: undefined },
infura: { projectId: undefined }
infura: { projectId: undefined },
drpc: {key: undefined},
}

const getNetConfig = (networkName, ethAccountName) => {
Expand All @@ -41,7 +42,7 @@ const getNetConfig = (networkName, ethAccountName) => {
blockGasLimit: 20000000,
accounts: {
mnemonic: 'hardhat',
count: 20,
count: 500,
accountsBalance: '100000000000000000000000',
gasPrice: 0
}
Expand All @@ -64,6 +65,12 @@ const getNetConfig = (networkName, ethAccountName) => {
chainId: 1,
timeout: 60000 * 10
},
holesky: {
...base,
url: 'https://lb.drpc.org/ogrpc?network=holesky&dkey=' + accounts.drpc.key,
chainId: 17000,
timeout: 60000 * 10
}
}
const netConfig = byNetName[networkName]
return netConfig ? { [networkName]: netConfig } : {}
Expand Down
2 changes: 1 addition & 1 deletion apps/voting/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@nomiclabs/hardhat-truffle5": "^2.0.5",
"@nomiclabs/hardhat-web3": "^2.0.0",
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-etherscan": "^2.1.6",
"@nomiclabs/hardhat-etherscan": "^3.1.8",
"hardhat-abi-exporter": "^2.8.0",
"hardhat-gas-reporter": "^1.0.8",
"chai": "^4.2.0",
Expand Down
Loading
Loading