Skip to content

Commit

Permalink
Add mappings params names
Browse files Browse the repository at this point in the history
  • Loading branch information
thaarok committed Nov 1, 2024
1 parent 19ab6e1 commit 0fd4973
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions contracts/sfc/SFC.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ contract SFC is Initializable, Ownable, Version {

// last sealed epoch (currentEpoch - 1)
uint256 public currentSealedEpoch;
mapping(uint256 => Validator) public getValidator;
mapping(address => uint256) public getValidatorID;
mapping(uint256 => bytes) public getValidatorPubkey;
mapping(uint256 validatorID => Validator) public getValidator;
mapping(address auth => uint256 validatorID) public getValidatorID;
mapping(uint256 validatorID => bytes pubkey) public getValidatorPubkey;

uint256 public lastValidatorID;

Expand All @@ -49,10 +49,10 @@ contract SFC is Initializable, Ownable, Version {
uint256 public totalActiveStake;

// delegator => validator ID => stashed rewards (to be claimed/restaked)
mapping(address => mapping(uint256 => uint256)) internal _rewardsStash;
mapping(address delegator => mapping(uint256 validatorID => uint256 stashedRewards)) internal _rewardsStash;

// delegator => validator ID => last epoch number for which were rewards stashed
mapping(address => mapping(uint256 => uint256)) public stashedRewardsUntilEpoch;
mapping(address delegator => mapping(uint256 validatorID => uint256 epoch)) public stashedRewardsUntilEpoch;

struct WithdrawalRequest {
uint256 epoch; // epoch where undelegated
Expand All @@ -61,10 +61,10 @@ contract SFC is Initializable, Ownable, Version {
}

// delegator => validator ID => withdrawal ID => withdrawal request
mapping(address => mapping(uint256 => mapping(uint256 => WithdrawalRequest))) public getWithdrawalRequest;
mapping(address delegator => mapping(uint256 validatorID => mapping(uint256 wrID => WithdrawalRequest))) public getWithdrawalRequest;

// delegator => validator ID => current stake (locked+unlocked)
mapping(address => mapping(uint256 => uint256)) public getStake;
// delegator => validator ID => current stake
mapping(address delegator => mapping(uint256 validatorID => uint256 stake)) public getStake;

struct EpochSnapshot {
// validator ID => validator weight in the epoch
Expand All @@ -90,10 +90,10 @@ contract SFC is Initializable, Ownable, Version {
uint256 public totalSupply;

// epoch id => epoch snapshot
mapping(uint256 => EpochSnapshot) public getEpochSnapshot;
mapping(uint256 epoch => EpochSnapshot) public getEpochSnapshot;

// validator ID -> slashing refund ratio (allows to withdraw slashed stake)
mapping(uint256 => uint256) public slashingRefundRatio;
mapping(uint256 validatorID => uint256 refundRatio) public slashingRefundRatio;

// the minimal gas price calculated for the current epoch
uint256 public minGasPrice;
Expand All @@ -106,20 +106,20 @@ contract SFC is Initializable, Ownable, Version {
// the governance contract (to recalculate votes when the stake changes)
address public voteBookAddress;

// validator ID => amount of pubkey updates
mapping(uint256 => uint256) internal validatorPubkeyChanges;
// validator ID => amount of pubkey changes
mapping(uint256 validatorID => uint256 changes) internal validatorPubkeyChanges;

// keccak256(pubkey bytes) => validator ID (prevents using the same key by multiple validators)
mapping(bytes32 => uint256) internal pubkeyHashToValidatorID;
mapping(bytes32 pubkeyHash => uint256 validatorID) internal pubkeyHashToValidatorID;

// address authorized to initiate redirection
address public redirectionAuthorizer;

// delegator => withdrawals receiver
mapping(address => address) public getRedirectionRequest;
mapping(address delegator => address receiver) public getRedirectionRequest;

// delegator => withdrawals receiver
mapping(address => address) public getRedirection;
mapping(address delegator => address receiver) public getRedirection;

struct SealEpochRewardsCtx {
uint256[] baseRewardWeights;
Expand Down Expand Up @@ -158,7 +158,7 @@ contract SFC is Initializable, Ownable, Version {
error ValidatorExists();
error ValidatorNotActive();
error ValidatorDelegationLimitExceeded();
error WrongValidatorStatus();
error NotDeactivatedStatus();

// requests
error RequestExists();
Expand Down Expand Up @@ -405,7 +405,7 @@ contract SFC is Initializable, Ownable, Version {

function deactivateValidator(uint256 validatorID, uint256 status) external onlyDriver {
if (status == OK_STATUS) {
revert WrongValidatorStatus();
revert NotDeactivatedStatus();
}

_setValidatorDeactivated(validatorID, status);
Expand Down

0 comments on commit 0fd4973

Please sign in to comment.