Skip to content

Commit

Permalink
chores: lint contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
cosinlink committed Aug 23, 2024
1 parent 80e9663 commit da2134b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 49 deletions.
12 changes: 9 additions & 3 deletions contracts/BSCGovernor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ contract BSCGovernor is
*@return `true` if the contract implements `interfaceID` and
*`interfaceID` is not 0xffffffff, `false` otherwise
*/
function supportsInterface(bytes4 interfaceId)
function supportsInterface(
bytes4 interfaceId
)
public
view
override(GovernorUpgradeable, IERC165Upgradeable, GovernorTimelockControlUpgradeable)
Expand All @@ -227,7 +229,9 @@ contract BSCGovernor is
* @notice module:core
* @dev Current state of a proposal, following Compound's convention
*/
function state(uint256 proposalId)
function state(
uint256 proposalId
)
public
view
override(GovernorUpgradeable, IGovernorUpgradeable, GovernorTimelockControlUpgradeable)
Expand All @@ -253,7 +257,9 @@ contract BSCGovernor is
* @dev Timepoint at which votes close. If using block number, votes close at the end of this block, so it is
* possible to cast a vote during this block.
*/
function proposalDeadline(uint256 proposalId)
function proposalDeadline(
uint256 proposalId
)
public
view
override(IGovernorUpgradeable, GovernorUpgradeable, GovernorPreventLateQuorumUpgradeable)
Expand Down
70 changes: 24 additions & 46 deletions contracts/StakeHub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
/**
* @param newConsensusAddress the new consensus address of the validator
*/
function editConsensusAddress(address newConsensusAddress)
external
whenNotPaused
notInBlackList
validatorExist(_bep410MsgSender())
{
function editConsensusAddress(
address newConsensusAddress
) external whenNotPaused notInBlackList validatorExist(_bep410MsgSender()) {
if (newConsensusAddress == address(0)) revert InvalidConsensusAddress();
if (consensusToOperator[newConsensusAddress] != address(0) || _legacyConsensusAddress[newConsensusAddress]) {
revert DuplicateConsensusAddress();
Expand All @@ -442,12 +439,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
/**
* @param commissionRate the new commission rate of the validator
*/
function editCommissionRate(uint64 commissionRate)
external
whenNotPaused
notInBlackList
validatorExist(_bep410MsgSender())
{
function editCommissionRate(
uint64 commissionRate
) external whenNotPaused notInBlackList validatorExist(_bep410MsgSender()) {
address operatorAddress = _bep410MsgSender();
Validator storage valInfo = _validators[operatorAddress];
if (valInfo.updateTime + BREATHE_BLOCK_INTERVAL > block.timestamp) revert UpdateTooFrequently();
Expand All @@ -468,12 +462,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
* @notice the moniker of the validator will be ignored as it is not editable
* @param description the new description of the validator
*/
function editDescription(Description memory description)
external
whenNotPaused
notInBlackList
validatorExist(_bep410MsgSender())
{
function editDescription(
Description memory description
) external whenNotPaused notInBlackList validatorExist(_bep410MsgSender()) {
address operatorAddress = _bep410MsgSender();
Validator storage valInfo = _validators[operatorAddress];
if (valInfo.updateTime + BREATHE_BLOCK_INTERVAL > block.timestamp) revert UpdateTooFrequently();
Expand Down Expand Up @@ -952,11 +943,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
* @return jailed whether the validator is jailed
* @return jailUntil the jail time of the validator
*/
function getValidatorBasicInfo(address operatorAddress)
external
view
returns (uint256 createdTime, bool jailed, uint256 jailUntil)
{
function getValidatorBasicInfo(
address operatorAddress
) external view returns (uint256 createdTime, bool jailed, uint256 jailUntil) {
Validator memory valInfo = _validators[operatorAddress];
createdTime = valInfo.createdTime;
jailed = valInfo.jailed;
Expand All @@ -968,12 +957,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
*
* @return the description of a validator
*/
function getValidatorDescription(address operatorAddress)
external
view
validatorExist(operatorAddress)
returns (Description memory)
{
function getValidatorDescription(
address operatorAddress
) external view validatorExist(operatorAddress) returns (Description memory) {
return _validators[operatorAddress].description;
}

Expand All @@ -982,12 +968,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
*
* @return the commission of a validator
*/
function getValidatorCommission(address operatorAddress)
external
view
validatorExist(operatorAddress)
returns (Commission memory)
{
function getValidatorCommission(
address operatorAddress
) external view validatorExist(operatorAddress) returns (Commission memory) {
return _validators[operatorAddress].commission;
}

Expand All @@ -996,12 +979,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
*
* @return the agent of a validator
*/
function getValidatorAgent(address operatorAddress)
external
view
validatorExist(operatorAddress)
returns (address)
{
function getValidatorAgent(
address operatorAddress
) external view validatorExist(operatorAddress) returns (address) {
return _validators[operatorAddress].agent;
}

Expand Down Expand Up @@ -1051,11 +1031,9 @@ contract StakeHub is SystemV2, Initializable, Protectable {
}

/*----------------- internal functions -----------------*/
function _decodeMigrationSynPackage(bytes memory msgBytes)
internal
pure
returns (StakeMigrationPackage memory, bool)
{
function _decodeMigrationSynPackage(
bytes memory msgBytes
) internal pure returns (StakeMigrationPackage memory, bool) {
StakeMigrationPackage memory migrationPackage;

RLPDecode.Iterator memory iter = msgBytes.toRLPItem().iterator();
Expand Down

0 comments on commit da2134b

Please sign in to comment.