Skip to content

Commit

Permalink
fix: added gov v3 interfaces. solved conflicts with main
Browse files Browse the repository at this point in the history
  • Loading branch information
sendra committed Aug 18, 2023
2 parents 7469962 + 4dba081 commit 06ed846
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 44 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.33.0](https://github.com/bgd-labs/aave-address-book/compare/v1.32.0...v1.33.0) (2023-08-18)


### Features

* Add IMigrationHelper interface ([#185](https://github.com/bgd-labs/aave-address-book/issues/185)) ([b87a51d](https://github.com/bgd-labs/aave-address-book/commit/b87a51d014167effaaa7f6f7e33562b223b3d6b2))


### Bug Fixes

* add weth gateway address to base ([#207](https://github.com/bgd-labs/aave-address-book/issues/207)) ([b37eb99](https://github.com/bgd-labs/aave-address-book/commit/b37eb991c690cf19dae7945baf139ce1fba5c36b))

## [1.32.0](https://github.com/bgd-labs/aave-address-book/compare/v1.31.7...v1.32.0) (2023-08-14)


Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bgd-labs/aave-address-book",
"version": "1.32.0",
"version": "1.33.0",
"description": "This repository contains an up-to-date registry of all addresses of the Aave ecosystem's smart contracts, for its usage in Solidity codebases.",
"private": false,
"files": [
Expand Down
1 change: 1 addition & 0 deletions scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,7 @@ export const pools = [
UI_INCENTIVE_DATA_PROVIDER: '0xEdD3b4737C1a0011626631a977b91Cf3E944982d',
UI_POOL_DATA_PROVIDER: '0x174446a6741300cD2E7C1b1A636Fee99c8F83502',
WALLET_BALANCE_PROVIDER: '0x5779b29B0a34577d927E8D511B595ef9abbFAE82',
WETH_GATEWAY: '0x18CD499E3d7ed42FEbA981ac9236A278E4Cdc2ee',
},
initial: {
COLLECTOR: '0xBA9424d650A4F5c80a0dA641254d1AcCE2A37057',
Expand Down
2 changes: 2 additions & 0 deletions src/AaveV3Base.sol
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ library AaveV3Base {
address internal constant UI_POOL_DATA_PROVIDER = 0x174446a6741300cD2E7C1b1A636Fee99c8F83502;

address internal constant WALLET_BALANCE_PROVIDER = 0x5779b29B0a34577d927E8D511B595ef9abbFAE82;

address internal constant WETH_GATEWAY = 0x18CD499E3d7ed42FEbA981ac9236A278E4Cdc2ee;
}

library AaveV3BaseGovV3 {
Expand Down
52 changes: 11 additions & 41 deletions src/GovernanceV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,9 @@ interface IGovernancePowerStrategy {
* @param user address where we want to get the power from
* @return full proposition power of a user
*/
function getFullPropositionPower(
address user
) external view returns (uint256);
function getFullPropositionPower(address user) external view returns (uint256);
}


interface IPayloadsControllerCore {
/// @notice Enum indicating the possible payload states
enum PayloadState {
Expand Down Expand Up @@ -214,18 +211,14 @@ interface IPayloadsControllerCore {
* @param payloadId id of the payload to retrieve
* @return payload information
*/
function getPayloadById(
uint40 payloadId
) external view returns (Payload memory);
function getPayloadById(uint40 payloadId) external view returns (Payload memory);

/**
* @notice get the current state of a payload
* @param payloadId id of the payload to retrieve the state from
* @return payload state
*/
function getPayloadState(
uint40 payloadId
) external view returns (PayloadState);
function getPayloadState(uint40 payloadId) external view returns (PayloadState);

/**
* @notice get the total count of payloads created
Expand All @@ -238,9 +231,7 @@ interface IPayloadsControllerCore {
* @param actions array of actions which this proposal payload will contain
* @return id of the created payload
*/
function createPayload(
ExecutionAction[] calldata actions
) external returns (uint40);
function createPayload(ExecutionAction[] calldata actions) external returns (uint40);

/**
* @notice method to execute a payload
Expand Down Expand Up @@ -431,11 +422,7 @@ interface IGovernanceCore {
* @param votesFor votes for proposal
* @param votesAgainst votes against proposal
*/
event ProposalQueued(
uint256 indexed proposalId,
uint128 votesFor,
uint128 votesAgainst
);
event ProposalQueued(uint256 indexed proposalId, uint128 votesFor, uint128 votesAgainst);

/**
* @notice emitted when proposal change state to Executed
Expand All @@ -455,21 +442,14 @@ interface IGovernanceCore {
* @param votesFor votes for proposal
* @param votesAgainst votes against proposal
*/
event ProposalFailed(
uint256 indexed proposalId,
uint128 votesFor,
uint128 votesAgainst
);
event ProposalFailed(uint256 indexed proposalId, uint128 votesFor, uint128 votesAgainst);

/**
* @notice emitted when a voting machine gets updated
* @param votingPortal address of the voting portal updated
* @param approved boolean indicating if a voting portal has been added or removed
*/
event VotingPortalUpdated(
address indexed votingPortal,
bool indexed approved
);
event VotingPortalUpdated(address indexed votingPortal, bool indexed approved);

/**
* @notice emitted when a payload is successfully sent to the execution chain
Expand Down Expand Up @@ -579,9 +559,7 @@ interface IGovernanceCore {
* @notice method to set the voting configuration for a determined access level
* @param votingConfigs object containing configuration for an access level
*/
function setVotingConfigs(
SetVotingConfigInput[] calldata votingConfigs
) external;
function setVotingConfigs(SetVotingConfigInput[] calldata votingConfigs) external;

/**
* @notice method to get the voting configuration from an access level
Expand Down Expand Up @@ -641,9 +619,7 @@ interface IGovernanceCore {
* @param proposalId id of the proposal to get the information of
* @return proposal object containing all the information
*/
function getProposal(
uint256 proposalId
) external view returns (Proposal memory);
function getProposal(uint256 proposalId) external view returns (Proposal memory);

/**
* @notice address of the current voting strategy to use on the governance
Expand All @@ -662,21 +638,15 @@ interface IGovernanceCore {
* @param votingPortal address of the voting portal to check if approved
* @return flag indicating the approval status of the voting portal
*/
function isVotingPortalApproved(
address votingPortal
) external view returns (bool);
function isVotingPortalApproved(address votingPortal) external view returns (bool);

/**
* @notice method to queue a proposal for execution
* @param proposalId the id of the proposal to queue
* @param forVotes number of votes in favor of the proposal
* @param againstVotes number of votes against of the proposal
*/
function queueProposal(
uint256 proposalId,
uint128 forVotes,
uint128 againstVotes
) external;
function queueProposal(uint256 proposalId, uint128 forVotes, uint128 againstVotes) external;

/**
* @notice method to send proposal to votingMachine
Expand Down
113 changes: 113 additions & 0 deletions src/common/IMigrationHelper.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {IPool as IV3Pool} from '../AaveV3.sol';
import {ILendingPool as IV2Pool} from '../AaveV2.sol';
import {ICreditDelegationToken} from 'aave-v3-core/contracts/interfaces/ICreditDelegationToken.sol';
import {IERC20WithPermit} from 'aave-v3-core/contracts/interfaces/IERC20WithPermit.sol';

interface IMigrationHelper {
struct PermitInput {
IERC20WithPermit aToken;
uint256 value;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}

struct CreditDelegationInput {
ICreditDelegationToken debtToken;
uint256 value;
uint256 deadline;
uint8 v;
bytes32 r;
bytes32 s;
}

struct RepayInput {
address asset;
uint256 amount;
uint256 rateMode;
}

struct RepaySimpleInput {
address asset;
uint256 rateMode;
}

struct EmergencyTransferInput {
IERC20WithPermit asset;
uint256 amount;
address to;
}

/**
* @notice Method to do migration of any types of positions. Migrating whole amount of specified assets
* @param assetsToMigrate - list of assets to migrate
* @param positionsToRepay - list of assets to be repayed
* @param permits - list of EIP712 permits, can be empty, if approvals provided in advance
* @param creditDelegationPermits - list of EIP712 signatures (credit delegations) for v3 variable debt token
* @dev check more details about permit at PermitInput and /solidity-utils/contracts/oz-common/interfaces/draft-IERC20Permit.sol
**/
function migrate(
address[] memory assetsToMigrate,
RepaySimpleInput[] memory positionsToRepay,
PermitInput[] memory permits,
CreditDelegationInput[] memory creditDelegationPermits
) external;

/**
* @notice Executes an operation after receiving the flash-borrowed assets
* @dev Ensure that the contract can return the debt + premium, e.g., has
* enough funds to repay and has approved the Pool to pull the total amount
* @param assets The addresses of the flash-borrowed assets
* @param amounts The amounts of the flash-borrowed assets
* @param premiums The fee of each flash-borrowed asset
* @param initiator The address of the flashloan initiator
* @param params The byte-encoded params passed when initiating the flashloan
* @return True if the execution of the operation succeeds, false otherwise
*/
function executeOperation(
address[] calldata assets,
uint256[] calldata amounts,
uint256[] calldata premiums,
address initiator,
bytes calldata params
) external returns (bool);

/**
* @notice Public method to optimize the gas costs, to avoid having getReserveData calls on every execution
**/
function cacheATokens() external;

/**
* @notice Method to get asset and amount to be supplied to V3
* @param asset the v2 pool asset
* @param amount origin amount
* @return address asset to be supplied to the v3 pool
* @return uint256 amount to be supplied to the v3 pool
*/
function getMigrationSupply(
address asset,
uint256 amount
) external view returns (address, uint256);

/// @notice The source pool
function V2_POOL() external returns (IV2Pool);

/// @notice The destination pool
function V3_POOL() external returns (IV3Pool);

/**
* @notice Public method for rescue funds in case of a wrong transfer
* @param emergencyInput - array of parameters to transfer out funds
**/
function rescueFunds(EmergencyTransferInput[] calldata emergencyInput) external;

function aTokens(address underlying) external returns (address);

function vTokens(address underlying) external returns (address);

function sTokens(address underlying) external returns (address);
}
1 change: 1 addition & 0 deletions src/ts/AaveV3Base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ export const POOL_ADDRESSES_PROVIDER_REGISTRY = '0x2f6571d3Eb9a4e350C68C36bCD2af
export const UI_INCENTIVE_DATA_PROVIDER = '0xEdD3b4737C1a0011626631a977b91Cf3E944982d';
export const UI_POOL_DATA_PROVIDER = '0x174446a6741300cD2E7C1b1A636Fee99c8F83502';
export const WALLET_BALANCE_PROVIDER = '0x5779b29B0a34577d927E8D511B595ef9abbFAE82';
export const WETH_GATEWAY = '0x18CD499E3d7ed42FEbA981ac9236A278E4Cdc2ee';
export const EXECUTOR_LVL_1 = '0x0000000000000000000000000000000000000000';
export const EXECUTOR_LVL_2 = '0x0000000000000000000000000000000000000000';

0 comments on commit 06ed846

Please sign in to comment.