diff --git a/contracts/Core/BlockManager.sol b/contracts/Core/BlockManager.sol index ddaf0d31..89fcf667 100644 --- a/contracts/Core/BlockManager.sol +++ b/contracts/Core/BlockManager.sol @@ -301,7 +301,6 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager ); // TIR : total influence revealed require(disputes[epoch][msg.sender].accWeight != 0, "Invalid dispute"); // Would revert if no block is proposed, or the asset specifed was not revealed - require(disputes[epoch][msg.sender].median > 0, "median can not be zero"); uint32 blockId = sortedProposedBlockIds[epoch][blockIndex]; require(proposedBlocks[epoch][blockId].valid, "Block already has been disputed"); uint16 medianIndex = disputes[epoch][msg.sender].medianIndex; diff --git a/docs/BlockStorage.md b/docs/BlockStorage.md index 823e24cd..207b61ab 100644 --- a/docs/BlockStorage.md +++ b/docs/BlockStorage.md @@ -16,7 +16,7 @@ function blockIndexToBeConfirmed() external view returns (int8) ``` - +block index that is to be confirmed if not disputed @@ -33,7 +33,7 @@ function blockIndexToBeConfirmed() external view returns (int8) function blocks(uint32) external view returns (bool valid, uint32 proposerId, uint256 iteration, uint256 biggestStake) ``` - +mapping of epoch -> blocks @@ -58,7 +58,7 @@ function blocks(uint32) external view returns (bool valid, uint32 proposerId, ui function disputes(uint32, address) external view returns (uint16 medianIndex, uint32 median, uint32 lastVisitedValue, uint256 accWeight) ``` - +mapping of epoch -> address -> dispute @@ -84,7 +84,7 @@ function disputes(uint32, address) external view returns (uint16 medianIndex, ui function epochLastProposed(uint32) external view returns (uint32) ``` - +mapping of stakerId->epoch @@ -106,7 +106,7 @@ function epochLastProposed(uint32) external view returns (uint32) function numProposedBlocks() external view returns (uint32) ``` - +total number of proposed blocks in an epoch @@ -123,7 +123,7 @@ function numProposedBlocks() external view returns (uint32) function proposedBlocks(uint32, uint32) external view returns (bool valid, uint32 proposerId, uint256 iteration, uint256 biggestStake) ``` - +mapping of epoch -> blockId -> block @@ -149,7 +149,7 @@ function proposedBlocks(uint32, uint32) external view returns (bool valid, uint3 function sortedProposedBlockIds(uint32, uint256) external view returns (uint32) ``` - +mapping of epoch->blockId diff --git a/docs/Delegator.md b/docs/Delegator.md index d6601ed3..9fc72084 100644 --- a/docs/Delegator.md +++ b/docs/Delegator.md @@ -2,9 +2,9 @@ +> Delegator - - +Delegator acts as a bridge between the client and the protocol @@ -392,7 +392,7 @@ function getCollectionID(bytes32 _hname) external view returns (uint16) - +*using the hash of collection name, clients can query collection id with respect to its hash* #### Parameters @@ -404,7 +404,7 @@ function getCollectionID(bytes32 _hname) external view returns (uint16) | Name | Type | Description | |---|---|---| -| _0 | uint16 | undefined +| _0 | uint16 | collection ID ### getNumActiveCollections @@ -421,7 +421,7 @@ function getNumActiveCollections() external view returns (uint256) | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | number of active collections in the oracle ### getResult @@ -431,19 +431,19 @@ function getResult(bytes32 _name) external view returns (uint32, int8) - +*using the hash of collection name, clients can query the result of that collection* #### Parameters | Name | Type | Description | |---|---|---| -| _name | bytes32 | undefined +| _name | bytes32 | bytes32 hash of the collection name #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | result of the collection and its power | _1 | int8 | undefined ### getResultFromID @@ -454,19 +454,19 @@ function getResultFromID(uint16 _id) external view returns (uint32, int8) - +*using the collection id, clients can query the result of the collection* #### Parameters | Name | Type | Description | |---|---|---| -| _id | uint16 | undefined +| _id | uint16 | collection ID #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | result of the collection and its power | _1 | int8 | undefined ### getRoleAdmin @@ -595,13 +595,13 @@ function updateAddress(address newDelegateAddress) external nonpayable - +*updates the address of the Collection Manager contract from where the delegator will fetch results of the oracle* #### Parameters | Name | Type | Description | |---|---|---| -| newDelegateAddress | address | undefined +| newDelegateAddress | address | address of the Collection Manager diff --git a/docs/IBlockManager.md b/docs/IBlockManager.md index 66ec822f..e159fb70 100644 --- a/docs/IBlockManager.md +++ b/docs/IBlockManager.md @@ -16,7 +16,7 @@ function confirmPreviousEpochBlock(uint32 stakerId) external nonpayable ``` - +if the proposed staker, whose block is valid and has the lowest iteration, does not call claimBlockReward() then in commit state, the staker who commits first will confirm this block and will receive the block reward inturn @@ -24,7 +24,7 @@ function confirmPreviousEpochBlock(uint32 stakerId) external nonpayable | Name | Type | Description | |---|---|---| -| stakerId | uint32 | undefined +| stakerId | uint32 | id of the staker that is confirming the block ### getBlock @@ -32,7 +32,7 @@ function confirmPreviousEpochBlock(uint32 stakerId) external nonpayable function getBlock(uint32 epoch) external view returns (struct Structs.Block _block) ``` - +return the struct of the confirmed block @@ -40,13 +40,13 @@ function getBlock(uint32 epoch) external view returns (struct Structs.Block _blo | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined +| epoch | uint32 | in which this block was confirmed #### Returns | Name | Type | Description | |---|---|---| -| _block | Structs.Block | undefined +| _block | Structs.Block | : struct of the confirmed block ### isBlockConfirmed @@ -54,7 +54,7 @@ function getBlock(uint32 epoch) external view returns (struct Structs.Block _blo function isBlockConfirmed(uint32 epoch) external view returns (bool) ``` - +this is to check whether a block was confirmed in a particular epoch or not @@ -62,13 +62,13 @@ function isBlockConfirmed(uint32 epoch) external view returns (bool) | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined +| epoch | uint32 | for which this check is being done #### Returns | Name | Type | Description | |---|---|---| -| _0 | bool | undefined +| _0 | bool | true or false. true if a block has been confirmed, else false diff --git a/docs/IDelegator.md b/docs/IDelegator.md index 48076dc7..133ca65c 100644 --- a/docs/IDelegator.md +++ b/docs/IDelegator.md @@ -18,19 +18,19 @@ function getCollectionID(bytes32 _name) external view returns (uint16) - +*using the hash of collection name, clients can query collection id with respect to its hash* #### Parameters | Name | Type | Description | |---|---|---| -| _name | bytes32 | undefined +| _name | bytes32 | bytes32 hash of the collection name #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint16 | undefined +| _0 | uint16 | collection ID ### getNumActiveCollections @@ -47,7 +47,7 @@ function getNumActiveCollections() external view returns (uint256) | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | number of active collections in the oracle ### getResult @@ -57,19 +57,19 @@ function getResult(bytes32 _name) external view returns (uint32, int8) - +*using the hash of collection name, clients can query the result of that collection* #### Parameters | Name | Type | Description | |---|---|---| -| _name | bytes32 | undefined +| _name | bytes32 | bytes32 hash of the collection name #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | result of the collection and its power | _1 | int8 | undefined ### getResultFromID @@ -80,19 +80,19 @@ function getResultFromID(uint16 _id) external view returns (uint32, int8) - +*using the collection id, clients can query the result of the collection* #### Parameters | Name | Type | Description | |---|---|---| -| _id | uint16 | undefined +| _id | uint16 | collection ID #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | result of the collection and its power | _1 | int8 | undefined ### updateAddress @@ -103,13 +103,13 @@ function updateAddress(address newDelegateAddress) external nonpayable - +*updates the address of the Collection Manager contract from where the delegator will fetch results of the oracle* #### Parameters | Name | Type | Description | |---|---|---| -| newDelegateAddress | address | undefined +| newDelegateAddress | address | address of the Collection Manager diff --git a/docs/IStakedToken.md b/docs/IStakedToken.md index 9ffc953f..eb12c435 100644 --- a/docs/IStakedToken.md +++ b/docs/IStakedToken.md @@ -107,7 +107,7 @@ function burn(address account, uint256 amount) external nonpayable returns (bool function getRZRDeposited(address delegator, uint256 sAmount) external view returns (uint256) ``` - +Used in withdraw diff --git a/docs/IStakedTokenFactory.md b/docs/IStakedTokenFactory.md index 1f78f065..93ddf81e 100644 --- a/docs/IStakedTokenFactory.md +++ b/docs/IStakedTokenFactory.md @@ -18,14 +18,14 @@ function createStakedToken(address stakeManagerAddress, uint32 stakedID) externa - +*a factory contract where the sRZR for a new staker is being deployed* #### Parameters | Name | Type | Description | |---|---|---| -| stakeManagerAddress | address | undefined -| stakedID | uint32 | undefined +| stakeManagerAddress | address | address of the stake Manager contract +| stakedID | uint32 | id of the staker whom the sRZR is being deployed #### Returns diff --git a/docs/IVoteManager.md b/docs/IVoteManager.md index a3aa8df5..a62afb82 100644 --- a/docs/IVoteManager.md +++ b/docs/IVoteManager.md @@ -16,7 +16,7 @@ function getEpochLastCommitted(uint32 stakerId) external view returns (uint32) ``` - +returns the epoch a staker last committed their votes @@ -24,13 +24,13 @@ function getEpochLastCommitted(uint32 stakerId) external view returns (uint32) | Name | Type | Description | |---|---|---| -| stakerId | uint32 | undefined +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | epoch last committed ### getEpochLastRevealed @@ -38,7 +38,7 @@ function getEpochLastCommitted(uint32 stakerId) external view returns (uint32) function getEpochLastRevealed(uint32 stakerId) external view returns (uint32) ``` - +returns the epoch a staker last revealed their votes @@ -46,13 +46,13 @@ function getEpochLastRevealed(uint32 stakerId) external view returns (uint32) | Name | Type | Description | |---|---|---| -| stakerId | uint32 | undefined +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | epoch last revealed ### getInfluenceSnapshot @@ -60,7 +60,7 @@ function getEpochLastRevealed(uint32 stakerId) external view returns (uint32) function getInfluenceSnapshot(uint32 epoch, uint32 stakerId) external view returns (uint256) ``` - +returns snapshot of influence of the staker when they revealed @@ -68,14 +68,14 @@ function getInfluenceSnapshot(uint32 epoch, uint32 stakerId) external view retur | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| stakerId | uint32 | undefined +| epoch | uint32 | when the snapshot was taken +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | influence of the staker ### getSalt @@ -92,7 +92,7 @@ function getSalt() external view returns (bytes32) | Name | Type | Description | |---|---|---| -| _0 | bytes32 | undefined +| _0 | bytes32 | the salt ### getStakeSnapshot @@ -100,7 +100,7 @@ function getSalt() external view returns (bytes32) function getStakeSnapshot(uint32 epoch, uint32 stakerId) external view returns (uint256) ``` - +returns snapshot of stake of the staker when they revealed @@ -108,22 +108,22 @@ function getStakeSnapshot(uint32 epoch, uint32 stakerId) external view returns ( | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| stakerId | uint32 | undefined +| epoch | uint32 | when the snapshot was taken +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | stake of the staker ### getTotalInfluenceRevealed ```solidity -function getTotalInfluenceRevealed(uint32 epoch, uint16 assetId) external view returns (uint256) +function getTotalInfluenceRevealed(uint32 epoch, uint16 medianIndex) external view returns (uint256) ``` - +returns the total influence revealed of the collection @@ -131,22 +131,22 @@ function getTotalInfluenceRevealed(uint32 epoch, uint16 assetId) external view r | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| assetId | uint16 | undefined +| epoch | uint32 | when asset was being revealed +| medianIndex | uint16 | index of the collection #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | total influence revealed of the collection ### getVoteValue ```solidity -function getVoteValue(uint32 epoch, uint32 stakerId, uint16 assetId) external view returns (uint32) +function getVoteValue(uint32 epoch, uint32 stakerId, uint16 medianIndex) external view returns (uint32) ``` - +returns vote value of a collection reported by a particular staker @@ -154,23 +154,23 @@ function getVoteValue(uint32 epoch, uint32 stakerId, uint16 assetId) external vi | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| stakerId | uint32 | undefined -| assetId | uint16 | undefined +| epoch | uint32 | in which the staker reveal this value +| stakerId | uint32 | id of the staker +| medianIndex | uint16 | index of the collection #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | vote value ### getVoteWeight ```solidity -function getVoteWeight(uint32 epoch, uint16 assetId, uint32 voteValue) external view returns (uint256) +function getVoteWeight(uint32 epoch, uint16 medianIndex, uint32 voteValue) external view returns (uint256) ``` - +returns vote weight of the value of the collection reported @@ -178,15 +178,15 @@ function getVoteWeight(uint32 epoch, uint16 assetId, uint32 voteValue) external | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| assetId | uint16 | undefined -| voteValue | uint32 | undefined +| epoch | uint32 | in which the staker reveal this value +| medianIndex | uint16 | index of the collection +| voteValue | uint32 | one of the values of the collection being reported #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | vote weight of the vote ### storeDepth @@ -194,7 +194,7 @@ function getVoteWeight(uint32 epoch, uint16 assetId, uint32 voteValue) external function storeDepth(uint256 _depth) external nonpayable ``` - +stores the depth of a valid merkle tree. Depth of the merkle tree sent by the stakers should match with this for a valid commit/reveal @@ -202,7 +202,7 @@ function storeDepth(uint256 _depth) external nonpayable | Name | Type | Description | |---|---|---| -| _depth | uint256 | undefined +| _depth | uint256 | depth of the merkle tree ### storeSalt @@ -210,7 +210,7 @@ function storeDepth(uint256 _depth) external nonpayable function storeSalt(bytes32 _salt) external nonpayable ``` - +stores the salt calculated in block manager @@ -218,7 +218,7 @@ function storeSalt(bytes32 _salt) external nonpayable | Name | Type | Description | |---|---|---| -| _salt | bytes32 | undefined +| _salt | bytes32 | the hash of the last epoch and medians of the block diff --git a/docs/StakeManager.md b/docs/StakeManager.md index 20a94bb2..9e4a487e 100644 --- a/docs/StakeManager.md +++ b/docs/StakeManager.md @@ -414,7 +414,7 @@ mapping of bounty id -> bounty lock info function delegate(uint32 stakerId, uint256 amount) external nonpayable ``` -Delegation +delegators can delegate their funds to staker if they do not have the adequate resources to start a node *the delegator receives the sRZR for the stakerID to which he/she delegates. The amount of sRZR minted depends on depends on sRZR:(RAZOR staked) valuation at the time of delegation* diff --git a/docs/StakedToken.md b/docs/StakedToken.md index b557ed7f..5b12a980 100644 --- a/docs/StakedToken.md +++ b/docs/StakedToken.md @@ -195,7 +195,7 @@ function mint(address account, uint256 amount, uint256 _razorDeposited) external - +*Creates `amount` tokens and assigns them to `account`, increasing the total supply. Emits a {Transfer} event with `from` set to the zero address. Requirements: - `account` cannot be the zero address.* #### Parameters @@ -234,7 +234,7 @@ function name() external view returns (string) function razorDeposited(address) external view returns (uint256) ``` - +Mapping to store the amount of RZR delegated or staked by user hence at any time we can calculate gain = (current Rel * sRZRamount) - ((razorDeposited/balOfsRZR()) * sRZRamount) razorDeposited/balOfsRZR() indicates, for 1 sRZR, how much you had put in diff --git a/docs/StakedTokenFactory.md b/docs/StakedTokenFactory.md index 56409161..773781c1 100644 --- a/docs/StakedTokenFactory.md +++ b/docs/StakedTokenFactory.md @@ -18,13 +18,13 @@ function createStakedToken(address stakeManagerAddress, uint32 stakerID) externa - +*a factory contract where the sRZR for a new staker is being deployed* #### Parameters | Name | Type | Description | |---|---|---| -| stakeManagerAddress | address | undefined +| stakeManagerAddress | address | address of the stake Manager contract | stakerID | uint32 | undefined #### Returns diff --git a/docs/VoteManager.md b/docs/VoteManager.md index 51b3a163..09c59f7a 100644 --- a/docs/VoteManager.md +++ b/docs/VoteManager.md @@ -2,9 +2,9 @@ +> VoteManager - - +VoteManager manages the commitments of votes of the stakers @@ -407,16 +407,16 @@ function collectionManager() external view returns (contract ICollectionManager) function commit(uint32 epoch, bytes32 commitment) external nonpayable ``` +stakers query the jobs in collection, aggregate and instead of revealing them instantly, they need to submit a hash of their results which becomes their commitment and send it to the protocol - - +*After query and aggregation is done, the staker would have to construct a merkle tree of their votes. The commitment sent by the staker is hash of root of the merkle tree and seed, which is the hash of the salt and the staker's secret. Collection allocation of each staker is done using seed and the staker would know in commit itself their allocations but wouldn't know other staker's allocation unless they have their seed. Hence, it is advisable to fetch results for only those collections that they have been assigned and set rest to 0 and construct a merkle tree accordingly Before the staker's commitment is registered, the staker confirms the block of the previous epoch incase the initial proposer had not confirmed the block. The staker then gets the block reward if confirmed by the staker and is then given out penalties based on their votes in the previous epoch or incase of inactivity.* #### Parameters | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| commitment | bytes32 | undefined +| epoch | uint32 | epoch when the commitment was sent +| commitment | bytes32 | the commitment ### commitments @@ -424,7 +424,7 @@ function commit(uint32 epoch, bytes32 commitment) external nonpayable function commitments(uint32) external view returns (uint32 epoch, bytes32 commitmentHash) ``` - +mapping of stakerid -> commitment @@ -447,7 +447,7 @@ function commitments(uint32) external view returns (uint32 epoch, bytes32 commit function depth() external view returns (uint256) ``` - +depth of a valid merkle tree @@ -464,7 +464,7 @@ function depth() external view returns (uint256) function epochLastRevealed(uint32) external view returns (uint32) ``` - +mapping of stakerid=> epochLastRevealed @@ -508,7 +508,7 @@ function getCommitment(uint32 stakerId) external view returns (struct Structs.Co function getEpochLastCommitted(uint32 stakerId) external view returns (uint32) ``` - +returns the epoch a staker last committed their votes @@ -516,13 +516,13 @@ function getEpochLastCommitted(uint32 stakerId) external view returns (uint32) | Name | Type | Description | |---|---|---| -| stakerId | uint32 | undefined +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | epoch last committed ### getEpochLastRevealed @@ -530,7 +530,7 @@ function getEpochLastCommitted(uint32 stakerId) external view returns (uint32) function getEpochLastRevealed(uint32 stakerId) external view returns (uint32) ``` - +returns the epoch a staker last revealed their votes @@ -538,13 +538,13 @@ function getEpochLastRevealed(uint32 stakerId) external view returns (uint32) | Name | Type | Description | |---|---|---| -| stakerId | uint32 | undefined +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | epoch last revealed ### getInfluenceSnapshot @@ -552,7 +552,7 @@ function getEpochLastRevealed(uint32 stakerId) external view returns (uint32) function getInfluenceSnapshot(uint32 epoch, uint32 stakerId) external view returns (uint256) ``` - +returns snapshot of influence of the staker when they revealed @@ -560,14 +560,14 @@ function getInfluenceSnapshot(uint32 epoch, uint32 stakerId) external view retur | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| stakerId | uint32 | undefined +| epoch | uint32 | when the snapshot was taken +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | influence of the staker ### getRoleAdmin @@ -606,7 +606,7 @@ function getSalt() external view returns (bytes32) | Name | Type | Description | |---|---|---| -| _0 | bytes32 | undefined +| _0 | bytes32 | the salt ### getStakeSnapshot @@ -614,7 +614,7 @@ function getSalt() external view returns (bytes32) function getStakeSnapshot(uint32 epoch, uint32 stakerId) external view returns (uint256) ``` - +returns snapshot of stake of the staker when they revealed @@ -622,14 +622,14 @@ function getStakeSnapshot(uint32 epoch, uint32 stakerId) external view returns ( | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| stakerId | uint32 | undefined +| epoch | uint32 | when the snapshot was taken +| stakerId | uint32 | id of the staker #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | stake of the staker ### getTotalInfluenceRevealed @@ -637,7 +637,7 @@ function getStakeSnapshot(uint32 epoch, uint32 stakerId) external view returns ( function getTotalInfluenceRevealed(uint32 epoch, uint16 medianIndex) external view returns (uint256) ``` - +returns the total influence revealed of the collection @@ -645,14 +645,14 @@ function getTotalInfluenceRevealed(uint32 epoch, uint16 medianIndex) external vi | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| medianIndex | uint16 | undefined +| epoch | uint32 | when asset was being revealed +| medianIndex | uint16 | index of the collection #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | total influence revealed of the collection ### getVoteValue @@ -660,7 +660,7 @@ function getTotalInfluenceRevealed(uint32 epoch, uint16 medianIndex) external vi function getVoteValue(uint32 epoch, uint32 stakerId, uint16 medianIndex) external view returns (uint32) ``` - +returns vote value of a collection reported by a particular staker @@ -668,15 +668,15 @@ function getVoteValue(uint32 epoch, uint32 stakerId, uint16 medianIndex) externa | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| stakerId | uint32 | undefined -| medianIndex | uint16 | undefined +| epoch | uint32 | in which the staker reveal this value +| stakerId | uint32 | id of the staker +| medianIndex | uint16 | index of the collection #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint32 | undefined +| _0 | uint32 | vote value ### getVoteWeight @@ -684,7 +684,7 @@ function getVoteValue(uint32 epoch, uint32 stakerId, uint16 medianIndex) externa function getVoteWeight(uint32 epoch, uint16 medianIndex, uint32 voteValue) external view returns (uint256) ``` - +returns vote weight of the value of the collection reported @@ -692,15 +692,15 @@ function getVoteWeight(uint32 epoch, uint16 medianIndex, uint32 voteValue) exter | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| medianIndex | uint16 | undefined -| voteValue | uint32 | undefined +| epoch | uint32 | in which the staker reveal this value +| medianIndex | uint16 | index of the collection +| voteValue | uint32 | one of the values of the collection being reported #### Returns | Name | Type | Description | |---|---|---| -| _0 | uint256 | undefined +| _0 | uint256 | vote weight of the vote ### grantRole @@ -748,7 +748,7 @@ function hasRole(bytes32 role, address account) external view returns (bool) function influenceSnapshot(uint32, uint32) external view returns (uint256) ``` - +mapping of epoch-> stakerid->influence @@ -779,10 +779,10 @@ function initialize(address stakeManagerAddress, address rewardManagerAddress, a | Name | Type | Description | |---|---|---| -| stakeManagerAddress | address | undefined -| rewardManagerAddress | address | undefined -| blockManagerAddress | address | undefined -| collectionManagerAddress | address | undefined +| stakeManagerAddress | address | The address of the StakeManager contract +| rewardManagerAddress | address | The address of the RewardManager contract +| blockManagerAddress | address | The address of the BlockManager contract +| collectionManagerAddress | address | The address of the CollectionManager contract ### minStake @@ -824,17 +824,17 @@ function renounceRole(bytes32 role, address account) external nonpayable function reveal(uint32 epoch, Structs.MerkleTree tree, bytes32 secret) external nonpayable ``` +staker reveal the votes that they had committed to the protocol in the commit state. Stakers would only reveal the collections they have been allocated, the rest of their votes wont matter - - +*stakers would need to submit their votes in accordance of how they were assigned to the staker. for example, if they are assigned the following ids: [2,5,4], they would to send their votes in the following order only The votes of other ids dont matter but they should not be passed in the values. So staker would have to pass the proof path of the assigned values of the merkle tree, root of the merkle tree and the values being revealed into a struct in the Structs.MerkleTree format.* #### Parameters | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| tree | Structs.MerkleTree | undefined -| secret | bytes32 | undefined +| epoch | uint32 | epoch when the revealed their votes +| tree | Structs.MerkleTree | the merkle tree struct of the staker +| secret | bytes32 | staker's secret using which seed would be calculated and thereby checking for collection allocation ### revokeRole @@ -876,7 +876,7 @@ function rewardManager() external view returns (contract IRewardManager) function salt() external view returns (bytes32) ``` - +hash of last epoch and its block medians @@ -925,18 +925,18 @@ changing maximum number of collections that can be assigned to the staker function snitch(uint32 epoch, bytes32 root, bytes32 secret, address stakerAddress) external nonpayable ``` +incase the staker's secret and root of the merkle tree is leaked before the staker reveals, a bounty hunter can snitch on the staker and reveal the root and secret to the protocol - - +*when the staker is correctly snitched, their stake is slashed and the bounty hunter receives a part of their stake based on the Slash Nums parameters. A staker can be snitched only in the commit state* #### Parameters | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined -| root | bytes32 | undefined -| secret | bytes32 | undefined -| stakerAddress | address | undefined +| epoch | uint32 | epoch when the bounty hunter snitched. +| root | bytes32 | of the staker's merkle tree +| secret | bytes32 | secret of the staker being snitched +| stakerAddress | address | the address of the staker ### stakeManager @@ -961,7 +961,7 @@ function stakeManager() external view returns (contract IStakeManager) function stakeSnapshot(uint32, uint32) external view returns (uint256) ``` - +mapping of epoch-> stakerid->stake @@ -984,7 +984,7 @@ function stakeSnapshot(uint32, uint32) external view returns (uint256) function storeDepth(uint256 _depth) external nonpayable ``` - +stores the depth of a valid merkle tree. Depth of the merkle tree sent by the stakers should match with this for a valid commit/reveal @@ -992,7 +992,7 @@ function storeDepth(uint256 _depth) external nonpayable | Name | Type | Description | |---|---|---| -| _depth | uint256 | undefined +| _depth | uint256 | depth of the merkle tree ### storeSalt @@ -1000,7 +1000,7 @@ function storeDepth(uint256 _depth) external nonpayable function storeSalt(bytes32 _salt) external nonpayable ``` - +stores the salt calculated in block manager @@ -1008,7 +1008,7 @@ function storeSalt(bytes32 _salt) external nonpayable | Name | Type | Description | |---|---|---| -| _salt | bytes32 | undefined +| _salt | bytes32 | the hash of the last epoch and medians of the block ### supportsInterface @@ -1055,7 +1055,7 @@ maximum number of collections that can be assigned to the staker function totalInfluenceRevealed(uint32, uint16) external view returns (uint256) ``` - +mapping of epoch -> assetid -> weight @@ -1078,7 +1078,7 @@ function totalInfluenceRevealed(uint32, uint16) external view returns (uint256) function voteWeights(uint32, uint16, uint32) external view returns (uint256) ``` - +mapping of epoch -> assetid -> voteValue -> weight @@ -1102,7 +1102,7 @@ function voteWeights(uint32, uint16, uint32) external view returns (uint256) function votes(uint32, uint32, uint16) external view returns (uint32) ``` - +mapping of epoch -> stakerid -> assetid -> vote @@ -1132,16 +1132,16 @@ event Committed(uint32 epoch, uint32 stakerId, bytes32 commitment, uint256 times - +*Emitted when a staker commits* #### Parameters | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined | -| stakerId | uint32 | undefined | -| commitment | bytes32 | undefined | -| timestamp | uint256 | undefined | +| epoch | uint32 | epoch when the commitment was sent | +| stakerId | uint32 | id of the staker that committed | +| commitment | bytes32 | the staker's commitment | +| timestamp | uint256 | time when the commitment was set for the staker | ### Revealed @@ -1151,16 +1151,16 @@ event Revealed(uint32 epoch, uint32 stakerId, Structs.AssignedAsset[] values, ui - +*Emitted when a staker reveals* #### Parameters | Name | Type | Description | |---|---|---| -| epoch | uint32 | undefined | -| stakerId | uint32 | undefined | -| values | Structs.AssignedAsset[] | undefined | -| timestamp | uint256 | undefined | +| epoch | uint32 | epoch when the staker revealed | +| stakerId | uint32 | id of the staker that reveals | +| values | Structs.AssignedAsset[] | of the collections assigned to the staker | +| timestamp | uint256 | time when the staker revealed | ### RoleAdminChanged diff --git a/docs/VoteStorage.md b/docs/VoteStorage.md index 61d172f2..a792c66b 100644 --- a/docs/VoteStorage.md +++ b/docs/VoteStorage.md @@ -16,7 +16,7 @@ function commitments(uint32) external view returns (uint32 epoch, bytes32 commitmentHash) ``` - +mapping of stakerid -> commitment @@ -39,7 +39,7 @@ function commitments(uint32) external view returns (uint32 epoch, bytes32 commit function depth() external view returns (uint256) ``` - +depth of a valid merkle tree @@ -56,7 +56,7 @@ function depth() external view returns (uint256) function epochLastRevealed(uint32) external view returns (uint32) ``` - +mapping of stakerid=> epochLastRevealed @@ -78,7 +78,7 @@ function epochLastRevealed(uint32) external view returns (uint32) function influenceSnapshot(uint32, uint32) external view returns (uint256) ``` - +mapping of epoch-> stakerid->influence @@ -101,7 +101,7 @@ function influenceSnapshot(uint32, uint32) external view returns (uint256) function salt() external view returns (bytes32) ``` - +hash of last epoch and its block medians @@ -118,7 +118,7 @@ function salt() external view returns (bytes32) function stakeSnapshot(uint32, uint32) external view returns (uint256) ``` - +mapping of epoch-> stakerid->stake @@ -141,7 +141,7 @@ function stakeSnapshot(uint32, uint32) external view returns (uint256) function totalInfluenceRevealed(uint32, uint16) external view returns (uint256) ``` - +mapping of epoch -> assetid -> weight @@ -164,7 +164,7 @@ function totalInfluenceRevealed(uint32, uint16) external view returns (uint256) function voteWeights(uint32, uint16, uint32) external view returns (uint256) ``` - +mapping of epoch -> assetid -> voteValue -> weight @@ -188,7 +188,7 @@ function voteWeights(uint32, uint16, uint32) external view returns (uint256) function votes(uint32, uint32, uint16) external view returns (uint32) ``` - +mapping of epoch -> stakerid -> assetid -> vote