Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions contracts/gov/Executor.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import '@aave/governance-v2/contracts/governance/Executor.sol';
106 changes: 1 addition & 105 deletions contracts/interfaces/IAaveGovernanceV2.sol
Original file line number Diff line number Diff line change
@@ -1,105 +1 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;

// simplified interface to expose functions added events for tests
interface IAaveGovernanceV2 {
struct Vote {
bool support;
uint248 votingPower;
}

/**
Added for test purposes
**/
event ReserveInitialized(
address indexed asset,
address indexed aToken,
address stableDebtToken,
address variableDebtToken,
address interestRateStrategyAddress
);
enum ProposalState {Pending, Canceled, Active, Failed, Succeeded, Queued, Expired, Executed}

/**
* @dev Creates a Proposal (needs Proposition Power of creator > Threshold)
* @param executor The ExecutorWithTimelock contract that will execute the proposal
* @param targets list of contracts called by proposal's associated transactions
* @param values list of value in wei for each propoposal's associated transaction
* @param signatures list of function signatures (can be empty) to be used when created the callData
* @param calldatas list of calldatas: if associated signature empty, calldata ready, else calldata is arguments
* @param withDelegatecalls if true, transaction delegatecalls the taget, else calls the target
* @param ipfsHash IPFS hash of the proposal
**/
function create(
address executor,
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas,
bool[] memory withDelegatecalls,
bytes32 ipfsHash
) external returns (uint256);

/**
* @dev Cancels a Proposal,
* either at anytime by guardian
* or when proposal is Pending/Active and threshold no longer reached
* @param proposalId id of the proposal
**/
function cancel(uint256 proposalId) external;

/**
* @dev Queue the proposal (If Proposal Succeeded)
* @param proposalId id of the proposal to queue
**/
function queue(uint256 proposalId) external;

/**
* @dev Execute the proposal (If Proposal Queued)
* @param proposalId id of the proposal to execute
**/
function execute(uint256 proposalId) external payable;

/**
* @dev Function allowing msg.sender to vote for/against a proposal
* @param proposalId id of the proposal
* @param support boolean, true = vote for, false = vote against
**/
function submitVote(uint256 proposalId, bool support) external;

/**
* @dev Function to register the vote of user that has voted offchain via signature
* @param proposalId id of the proposal
* @param support boolean, true = vote for, false = vote against
* @param v v part of the voter signature
* @param r r part of the voter signature
* @param s s part of the voter signature
**/
function submitVoteBySignature(
uint256 proposalId,
bool support,
uint8 v,
bytes32 r,
bytes32 s
) external;

/**
* @dev Getter of the proposal count (the current number of proposals ever created)
* @return the proposal count
**/
function getProposalsCount() external view returns (uint256);

function getProposalState(uint256 proposalId) external view returns (ProposalState);

function getGuardian() external view returns (address);

/**
* @dev Getter of the Vote of a voter about a proposal
* Note: Vote is a struct: ({bool support, uint248 votingPower})
* @param proposalId id of the proposal
* @param voter address of the voter
* @return The associated Vote memory object
**/
function getVoteOnProposal(uint256 proposalId, address voter) external view returns (Vote memory);
}
import '@aave/governance-v2/contracts/interfaces/IAaveGovernanceV2.sol';
13 changes: 13 additions & 0 deletions contracts/interfaces/IBaseAdminUpgradabilityProxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pragma solidity ^0.7.5;

interface IBaseAdminUpgradabilityProxy {
function upgradeTo(address newImplementation) external;

function upgradeToAndCall(address newImplementation, bytes calldata data) external;

function implementation() external returns (address);

function admin() external returns (address);

function changeAdmin(address newAdmin) external;
}
4 changes: 4 additions & 0 deletions contracts/interfaces/IStakedTokenV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ interface IStakedTokenV3 is IStakedToken {

function setCooldownPause(bool paused) external;

function getEmergencyShutdown() external view returns (bool);

function setEmergencyShutdown(bool emergencyShutdown) external;

function slash(address destination, uint256 amount) external;

function getMaxSlashablePercentage() external view returns (uint256);
Expand Down
58 changes: 58 additions & 0 deletions contracts/proposals/StakeTokenUpgradeProposal.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.7.5;
pragma abicoder v2;

import {IBaseAdminUpgradabilityProxy} from './../interfaces/IBaseAdminUpgradabilityProxy.sol';

contract StakeTokenUpgradeProposalExecutor {
address constant SHORT_EXECUTOR = address(0xEE56e2B3D491590B5b31738cC34d5232F378a8D5);

// TODO: Replace immutable with constant address when implementations are deployed
// TODO: replace claimhelper for the real address when decided decided
address immutable NEW_STAKED_AAVE_TOKEN_IMPLEMENTATION;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems clearer to fix the address here directly (instead of using the constructor)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be fixed when we have an implementation that is deployed.
Using the constructor for passing freshly deployed implementation made testing easier.

address immutable NEW_STAKED_ABP_TOKEN_IMPLEMENTATION;
address constant CLAIM_HELPER = SHORT_EXECUTOR;

address constant SLASHING_ADMIN = SHORT_EXECUTOR;
address constant COOLDOWN_PAUSE_ADMIN = SHORT_EXECUTOR;
uint256 constant MAX_SLASHABLE_PERCENTAGE = 3000;

IBaseAdminUpgradabilityProxy constant STAKED_AAVE_TOKEN_PROXY =
IBaseAdminUpgradabilityProxy(0x4da27a545c0c5B758a6BA100e3a049001de870f5);
IBaseAdminUpgradabilityProxy constant STAKED_ABP_TOKEN_PROXY =
IBaseAdminUpgradabilityProxy(0xa1116930326D21fB917d5A27F1E9943A9595fb47);

constructor(address newStakedAaveTokenImplementation, address newStakedAbpTokenImplementation) {
NEW_STAKED_AAVE_TOKEN_IMPLEMENTATION = newStakedAaveTokenImplementation;
NEW_STAKED_ABP_TOKEN_IMPLEMENTATION = newStakedAbpTokenImplementation;
}

function execute() external {
_upgradeStakedAave();
_upgradeStakedAbpt();
}

function _upgradeStakedAave() internal {
bytes memory params = abi.encodeWithSignature(
'initialize(address,address,address,uint256)',
SLASHING_ADMIN,
COOLDOWN_PAUSE_ADMIN,
CLAIM_HELPER,
MAX_SLASHABLE_PERCENTAGE
);

STAKED_AAVE_TOKEN_PROXY.upgradeToAndCall(NEW_STAKED_AAVE_TOKEN_IMPLEMENTATION, params);
}

function _upgradeStakedAbpt() internal {
bytes memory params = abi.encodeWithSignature(
'initialize(address,address,address,uint256)',
SLASHING_ADMIN,
COOLDOWN_PAUSE_ADMIN,
CLAIM_HELPER,
MAX_SLASHABLE_PERCENTAGE
);

STAKED_ABP_TOKEN_PROXY.upgradeToAndCall(NEW_STAKED_ABP_TOKEN_IMPLEMENTATION, params);
}
}
43 changes: 43 additions & 0 deletions contracts/stake/StakedAbptV3.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// SPDX-License-Identifier: agpl-3.0
pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;

import {IERC20} from '../interfaces/IERC20.sol';
import {StakedTokenV3} from './StakedTokenV3.sol';

/**
* @title StakedAbptV3
* @notice StakedTokenV3 with Aave Balance Pool token as staked token
* @author Aave
**/
contract StakedAbptV3 is StakedTokenV3 {
string internal constant NAME = 'Staked Aave Balance Pool Token';
string internal constant SYMBOL = 'stkABPT';
uint8 internal constant DECIMALS = 18;

constructor(
IERC20 stakedToken,
IERC20 rewardToken,
uint256 cooldownSeconds,
uint256 unstakeWindow,
address rewardsVault,
address emissionManager,
uint128 distributionDuration,
address governance
)
public
StakedTokenV3(
stakedToken,
rewardToken,
cooldownSeconds,
unstakeWindow,
rewardsVault,
emissionManager,
distributionDuration,
NAME,
SYMBOL,
DECIMALS,
governance
)
{}
}
Loading