diff --git a/src/collator/CollatorSet.sol b/src/collator/CollatorSet.sol index ac8d006..821d9d5 100644 --- a/src/collator/CollatorSet.sol +++ b/src/collator/CollatorSet.sol @@ -17,6 +17,13 @@ abstract contract CollatorSet is Initializable, CollatorStakingHubStorage { votesOf[HEAD] = type(uint256).max; } + /// @dev Fetch top k collators in ordered collator set. + /// @param `k` Count of top collators. + /// @return The `k` top collators. + /// *Note* The result of top collators length is always be `k`. + /// If the length of collator set `len` is less than `k`, + /// the array result of first `len` is filled by nomal collators + /// and the rest of `len - k` collators is filled by address(0) function getTopCollators(uint256 k) public view returns (address[] memory) { address[] memory topCollators = new address[](k); uint256 len = count; diff --git a/src/collator/CollatorStakingHub.sol b/src/collator/CollatorStakingHub.sol index 5e01141..7e9aeb9 100644 --- a/src/collator/CollatorStakingHub.sol +++ b/src/collator/CollatorStakingHub.sol @@ -141,6 +141,10 @@ contract CollatorStakingHub is Initializable, ReentrancyGuardUpgradeable, Collat _addCollator(collator, _assetsToVotes(commission, stakedOf(collator)), newPrev); } + /// @dev Distribute collator reward from Staking Pallet Account. + /// The amount of the reward must be passed in via msg.value. + /// @notice Only Staking Pallet Account could call this function. + /// @param collator The collator address to distribute reward. function distributeReward(address collator) public payable onlySystem nonReentrant { address pool = poolOf[collator]; require(pool != address(0), "!collator"); diff --git a/src/deposit/Deposit.sol b/src/deposit/Deposit.sol index 46dcc30..fb932d2 100644 --- a/src/deposit/Deposit.sol +++ b/src/deposit/Deposit.sol @@ -105,6 +105,12 @@ contract Deposit is _disableInitializers(); } + /// @dev Migrate user's deposit from Deposit Pallet to Deposit smart contract. + /// The amount of the deposit value must be passed in via msg.value. + /// @notice Only Deposit Pallet Account could call this function. + /// @param account The user account address stored in Deposit Pallet. + /// @param months The user deposit months stored in Deposit Pallet. + /// @param startAt The user deposit start time stored in Deposit Pallet. function migrate(address account, uint64 months, uint64 startAt) external payable onlySystem nonReentrant { uint256 value = msg.value; require(value > 0 && value < type(uint128).max, "!value");