Skip to content

Commit

Permalink
fix: minor staking variables renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
gabririgo committed Oct 26, 2022
1 parent c322a26 commit 3ed91f5
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 32 deletions.
39 changes: 20 additions & 19 deletions contracts/staking/GrgVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import "./interfaces/IGrgVault.sol";

contract GrgVault is Authorizable, IGrgVault {
// Address of staking proxy contract
address public stakingProxyAddress;
address public stakingProxy;

// True iff vault has been set to Catastrophic Failure Mode
bool public isInCatastrophicFailure;
Expand Down Expand Up @@ -65,24 +65,25 @@ contract GrgVault is Authorizable, IGrgVault {
}

/// @dev Constructor.
/// @param _grgProxyAddress Address of the RigoBlock Grg Proxy.
/// @param _grgTokenAddress Address of the Grg Token.
/// @param grgProxyAddress Address of the RigoBlock Grg Proxy.
/// @param grgTokenAddress Address of the Grg Token.
/// @param newOwner Address of the Grg vault owner.
constructor(
address _grgProxyAddress,
address _grgTokenAddress,
address _owner
) Authorizable(_owner) {
grgAssetProxy = IAssetProxy(_grgProxyAddress);
_grgToken = IERC20Token(_grgTokenAddress);
_grgAssetData = abi.encodeWithSelector(IAssetData(address(0)).ERC20Token.selector, _grgTokenAddress);
address grgProxyAddress,
address grgTokenAddress,
address newOwner
) Authorizable(newOwner) {
grgAssetProxy = IAssetProxy(grgProxyAddress);
_grgToken = IERC20Token(grgTokenAddress);
_grgAssetData = abi.encodeWithSelector(IAssetData(address(0)).ERC20Token.selector, grgTokenAddress);
}

/// @dev Sets the address of the StakingProxy contract.
/// Note that only the contract owner can call this function.
/// @param _stakingProxyAddress Address of Staking proxy contract.
function setStakingProxy(address _stakingProxyAddress) external override onlyAuthorized {
stakingProxyAddress = _stakingProxyAddress;
emit StakingProxySet(_stakingProxyAddress);
/// @param stakingProxyAddress Address of Staking proxy contract.
function setStakingProxy(address stakingProxyAddress) external override onlyAuthorized {
stakingProxy = stakingProxyAddress;
emit StakingProxySet(stakingProxyAddress);
}

/// @dev Vault enters into Catastrophic Failure Mode.
Expand All @@ -96,10 +97,10 @@ contract GrgVault is Authorizable, IGrgVault {
/// @dev Sets the Grg proxy.
/// Note that only an authorized address can call this function.
/// Note that this can only be called when *not* in Catastrophic Failure mode.
/// @param _grgProxyAddress Address of the RigoBlock Grg Proxy.
function setGrgProxy(address _grgProxyAddress) external override onlyAuthorized onlyNotInCatastrophicFailure {
grgAssetProxy = IAssetProxy(_grgProxyAddress);
emit GrgProxySet(_grgProxyAddress);
/// @param grgProxyAddress Address of the RigoBlock Grg Proxy.
function setGrgProxy(address grgProxyAddress) external override onlyAuthorized onlyNotInCatastrophicFailure {
grgAssetProxy = IAssetProxy(grgProxyAddress);
emit GrgProxySet(grgProxyAddress);
}

/// @dev Deposit an `amount` of Grg Tokens from `staker` into the vault.
Expand Down Expand Up @@ -178,7 +179,7 @@ contract GrgVault is Authorizable, IGrgVault {

/// @dev Asserts that sender is stakingProxy contract.
function _assertSenderIsStakingProxy() private view {
require(msg.sender == stakingProxyAddress, "GRG_VAULT_ONLY_CALLABLE_BY_STAKING_PROXY_ERROR");
require(msg.sender == stakingProxy, "GRG_VAULT_ONLY_CALLABLE_BY_STAKING_PROXY_ERROR");
}

/// @dev Asserts that vault is in catastrophic failure mode.
Expand Down
3 changes: 3 additions & 0 deletions contracts/staking/Staking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ contract Staking is IStaking, MixinParams, MixinStake, MixinPopRewards {
/// @notice Setting owner to null address prevents admin direct calls to implementation.
/// @dev Initializing immutable implementation address is used to allow delegatecalls only.
/// @dev Direct calls to the implementation contract are effectively locked.
/// @param grgVault Address of the Grg vault.
/// @param poolRegistry Address of the RigoBlock pool registry.
/// @param rigoToken Address of the Grg token.
constructor(
address grgVault,
address poolRegistry,
Expand Down
21 changes: 11 additions & 10 deletions contracts/staking/StakingProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ contract StakingProxy is IStakingProxy, MixinStorage, MixinConstants {
using LibSafeDowncast for uint256;

/// @notice Constructor.
/// @param _stakingContract Staking contract to delegate calls to.
constructor(address _stakingContract, address _owner) Authorizable(_owner) MixinStorage() {
/// @param stakingImplementation Address of the staking contract to delegate calls to.
/// @param newOwner Address of the staking proxy owner.
constructor(address stakingImplementation, address newOwner) Authorizable(newOwner) MixinStorage() {
// Deployer address must be authorized in order to call `init`
// in the context of deterministic deployment, the deployer factory must be authorized.
// in the context of deterministic deployment, the deployer factory (msg.sender) must be authorized.
_addAuthorizedAddress(msg.sender);

// Attach the staking contract and initialize state
_attachStakingContract(_stakingContract);
_attachStakingContract(stakingImplementation);

// Remove the sender as an authorized address
_removeAuthorizedAddressAtIndex(msg.sender, 0);
Expand Down Expand Up @@ -70,8 +71,8 @@ contract StakingProxy is IStakingProxy, MixinStorage, MixinConstants {
/* solhint-enable payable-fallback, no-complex-fallback */

/// @inheritdoc IStakingProxy
function attachStakingContract(address _stakingContract) external override onlyAuthorized {
_attachStakingContract(_stakingContract);
function attachStakingContract(address stakingImplementation) external override onlyAuthorized {
_attachStakingContract(stakingImplementation);
}

/// @inheritdoc IStakingProxy
Expand Down Expand Up @@ -135,11 +136,11 @@ contract StakingProxy is IStakingProxy, MixinStorage, MixinConstants {
}

/// @dev Attach a staking contract; future calls will be delegated to the staking contract.
/// @param _stakingContract Address of staking contract.
function _attachStakingContract(address _stakingContract) internal {
/// @param stakingImplementation Address of staking contract.
function _attachStakingContract(address stakingImplementation) internal {
// Attach the staking contract
stakingContract = _stakingContract;
emit StakingContractAttachedToProxy(_stakingContract);
stakingContract = stakingImplementation;
emit StakingContractAttachedToProxy(stakingImplementation);

// Call `init()` on the staking contract to initialize storage.
(bool didInitSucceed, bytes memory initReturnData) = stakingContract.delegatecall(
Expand Down
2 changes: 1 addition & 1 deletion contracts/utils/0xUtils/Authorizable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ abstract contract Authorizable is Ownable, IAuthorizable {
address[] public authorities;

/// @dev Initializes the `owner` address.
constructor(address _owner) Ownable(_owner) {}
constructor(address newOwner) Ownable(newOwner) {}

/// @dev Authorizes an address.
/// @param target Address to authorize.
Expand Down
4 changes: 2 additions & 2 deletions contracts/utils/0xUtils/Ownable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ abstract contract Ownable is IOwnable {
/// @return 0 The owner address.
address public owner;

constructor(address _owner) {
owner = _owner;
constructor(address newOwner) {
owner = newOwner;
}

modifier onlyOwner() {
Expand Down

0 comments on commit 3ed91f5

Please sign in to comment.