Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stake slashing implementation #2

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5f85047
Added exchange rate, initial tests
Jan 26, 2021
6cc4689
Added cooldown admin, modifiers
Jan 26, 2021
436c7fe
Updated StakedTokenV3 implementation, added StakedAaveV3
Jan 27, 2021
2e961ea
Updated tests
Jan 28, 2021
951d09a
Added more tests
Jan 28, 2021
3f22cd2
Added more slashing tests
Jan 29, 2021
47e6eb4
Refactored StakeTokenV3, added more tests
Jan 29, 2021
5917b9d
Added claim admins pattern
The-3D Feb 1, 2021
138ec5c
Merge branch 'master' into feat/slashing-implementation
The-3D Feb 9, 2021
fdc8cf2
Added missing events
The-3D Feb 9, 2021
8c1403f
Added stakeWithPermit function, tests
The-3D Feb 11, 2021
b8d366a
Added features and tests (1/2)
dhadrien Feb 15, 2021
baf9f32
added redeemOnBehalf claimRewardsOnBehalf claimRewardsAndStake claimR…
dhadrien Feb 16, 2021
5bd671a
Change on StakedTokenV2
eboadom Feb 19, 2021
586d02f
removed useless transfers in claimAndStake
dhadrien Feb 16, 2021
57bd352
updated behavior on claimAndStake
The-3D Feb 16, 2021
1bb2173
Updated tests, added gas reporter
The-3D Feb 16, 2021
769e1d3
Merge pull request #5 from aave/feat/other-features
eboadom Feb 19, 2021
eee3207
adding return type to claimOnBehalf
dhadrien Mar 15, 2021
6522d51
Swap arguments at handleAction to match aToken implementation: user, …
kartojal Mar 22, 2021
869902d
Merge pull request #8 from aave/feat/swap-handleAction-params
The-3D Mar 22, 2021
ce0be83
Moved AaveEcosystemReserve.sol to the repository. Create hardhat scri…
kartojal Mar 22, 2021
782798e
Remove unused helper.
kartojal Mar 22, 2021
2672c64
Add distribution and reward vault setters. Add new rewards role to Aa…
kartojal Mar 24, 2021
5f0d34f
Keep old interface compatibility at AaveDistributionManager
kartojal Mar 25, 2021
a42ea49
Merge pull request #11 from aave/feat/rewards-role
kartojal Mar 26, 2021
740440c
Solve conflicts. Update scripts to latest AaveIncentivesController.
kartojal Mar 26, 2021
d315278
Upload fixed package-lock
kartojal Mar 26, 2021
206a886
Import typings and polygon verifier from protocol-v2
kartojal Mar 26, 2021
c909437
Fixed getters of AaveEcosystemReserve, AaveIncentivesController and p…
kartojal Mar 31, 2021
cb8e5e8
Added config script
dhadrien Apr 12, 2021
231a589
new addresses mumbai
dhadrien Apr 12, 2021
d39a684
updated to new mumbai addresses
dhadrien Apr 12, 2021
b81c1a3
Added fork test matic
dhadrien Apr 13, 2021
1dbb853
Updated the AaveIncentivesController interface
The-3D Apr 14, 2021
0fb481c
Merge branch 'feat/incentives/mumbai-config' of github.com:aave/aave-…
The-3D Apr 14, 2021
ad1afde
refactor: Updated IAaveIncentivesController interface
The-3D Apr 17, 2021
d3c4208
Merge pull request #13 from aave/feat/incentives/mumbai-config
kartojal Apr 28, 2021
da4bad6
Merge pull request #9 from aave/feat/deployment-scripts
kartojal Apr 28, 2021
759258e
feat: merge master and fix conflicts
kartojal Aug 9, 2021
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
281 changes: 281 additions & 0 deletions asset-addresses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
{
"matic": {
"lendingPool": "0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf",
"assets": [
{
"aTokenAddress": "0x27F8D03b3a2196956ED754baDc28D73be8830A6e",
"aTokenSymbol": "amDAI",
"stableDebtTokenAddress": "0x2238101B7014C279aaF6b408A284E49cDBd5DB55",
"variableDebtTokenAddress": "0x75c4d1Fb84429023170086f06E682DcbBF537b7d",
"symbol": "DAI",
"address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",
"decimals": 18
},
{
"aTokenAddress": "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F",
"aTokenSymbol": "amUSDC",
"stableDebtTokenAddress": "0xdeb05676dB0DB85cecafE8933c903466Bf20C572",
"variableDebtTokenAddress": "0x248960A9d75EdFa3de94F7193eae3161Eb349a12",
"symbol": "USDC",
"address": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
"decimals": 6
},
{
"aTokenAddress": "0x60D55F02A771d515e077c9C2403a1ef324885CeC",
"aTokenSymbol": "amUSDT",
"stableDebtTokenAddress": "0xe590cfca10e81FeD9B0e4496381f02256f5d2f61",
"variableDebtTokenAddress": "0x8038857FD47108A07d1f6Bf652ef1cBeC279A2f3",
"symbol": "USDT",
"address": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
"decimals": 6
},
{
"aTokenAddress": "0x5c2ed810328349100A66B82b78a1791B101C9D61",
"aTokenSymbol": "amWBTC",
"stableDebtTokenAddress": "0x2551B15dB740dB8348bFaDFe06830210eC2c2F13",
"variableDebtTokenAddress": "0xF664F50631A6f0D72ecdaa0e49b0c019Fa72a8dC",
"symbol": "WBTC",
"address": "0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",
"decimals": 8
},
{
"aTokenAddress": "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390",
"aTokenSymbol": "amWETH",
"stableDebtTokenAddress": "0xc478cBbeB590C76b01ce658f8C4dda04f30e2C6f",
"variableDebtTokenAddress": "0xeDe17e9d79fc6f9fF9250D9EEfbdB88Cc18038b5",
"symbol": "WETH",
"address": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",
"decimals": 18
},
{
"aTokenAddress": "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4",
"aTokenSymbol": "amWMATIC",
"stableDebtTokenAddress": "0xb9A6E29fB540C5F1243ef643EB39b0AcbC2e68E3",
"variableDebtTokenAddress": "0x59e8E9100cbfCBCBAdf86b9279fa61526bBB8765",
"symbol": "WMATIC",
"address": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",
"decimals": 18
},
{
"aTokenAddress": "0x1d2a0E5EC8E5bBDCA5CB219e649B565d8e5c3360",
"aTokenSymbol": "amAAVE",
"stableDebtTokenAddress": "0x17912140e780B29Ba01381F088f21E8d75F954F9",
"variableDebtTokenAddress": "0x1c313e9d0d826662F5CE692134D938656F681350",
"symbol": "AAVE",
"address": "0xD6DF932A45C0f255f85145f286eA0b292B21C90B",
"decimals": 18
}
],
"incentivesController": "0x357D51124f59836DeD84c8a1730D72B749d8BC23",
"incentives": [
{
"symbol": "DAI",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "DAI",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDC",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDC",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDT",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDT",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WMATIC",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WMATIC",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WBTC",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WBTC",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},{
"symbol": "WETH",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WETH",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "AAVE",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "AAVE",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
}
]
},
"mumbai": {
"incentivesController": "0xd41aE58e803Edf4304334acCE4DC4Ec34a63C644",
"incentives": [
{
"symbol": "DAI",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "DAI",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDC",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDC",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDT",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "USDT",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WMATIC",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WMATIC",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WBTC",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WBTC",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},{
"symbol": "WETH",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "WETH",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "AAVE",
"type": "aToken",
"emissionPerSecond": "10000000000000"
},
{
"symbol": "AAVE",
"type": "variableDebtToken",
"emissionPerSecond": "10000000000000"
}
],
"assets": [
{
"aTokenAddress": "0x639cB7b21ee2161DF9c882483C9D55c90c20Ca3e",
"aTokenSymbol": "amDAI",
"stableDebtTokenAddress": "0x10dec6dF64d0ebD271c8AdD492Af4F5594358919",
"variableDebtTokenAddress": "0x6D29322ba6549B95e98E9B08033F5ffb857f19c5",
"symbol": "DAI",
"address": "0x001B3B4d0F3714Ca98ba10F6042DaEbF0B1B7b6F",
"decimals": 18
},
{
"aTokenAddress": "0x2271e3Fef9e15046d09E1d78a8FF038c691E9Cf9",
"aTokenSymbol": "amUSDC",
"stableDebtTokenAddress": "0x83A7bC369cFd55D9F00267318b6D221fb9Fa739F",
"variableDebtTokenAddress": "0x05771A896327ee702F965FB6E4A35A9A57C84a2a",
"symbol": "USDC",
"address": "0x2058A9D7613eEE744279e3856Ef0eAda5FCbaA7e",
"decimals": 6
},
{
"aTokenAddress": "0xF8744C0bD8C7adeA522d6DDE2298b17284A79D1b",
"aTokenSymbol": "amUSDT",
"stableDebtTokenAddress": "0xdD250d4e7ff5f7414F3EBe8fcBbB13583191BDaC",
"variableDebtTokenAddress": "0x6C0a86573a63672D8a66C037036e441A59086d68",
"symbol": "USDT",
"address": "0xBD21A10F619BE90d6066c941b04e340841F1F989",
"decimals": 6
},
{
"aTokenAddress": "0xc9276ECa6798A14f64eC33a526b547DAd50bDa2F",
"aTokenSymbol": "amWBTC",
"stableDebtTokenAddress": "0x29A36d45e8d9f446EC9529b28907bc850B398154",
"variableDebtTokenAddress": "0xc156967272b7177DcE40E3b3E7c4269f750F3160",
"symbol": "WBTC",
"address": "0x0d787a4a1548f673ed375445535a6c7A1EE56180",
"decimals": 8
},
{
"aTokenAddress": "0x7aE20397Ca327721F013BB9e140C707F82871b56",
"aTokenSymbol": "amWETH",
"stableDebtTokenAddress": "0x35D88812d32b966da90db9F546fbf43553C4F35b",
"variableDebtTokenAddress": "0x0F2656e068b77cdA65213Ef25705B728d5C73340",
"symbol": "WETH",
"address": "0x3C68CE8504087f89c640D02d133646d98e64ddd9",
"decimals": 18
},
{
"aTokenAddress": "0xF45444171435d0aCB08a8af493837eF18e86EE27",
"aTokenSymbol": "amWMATIC",
"stableDebtTokenAddress": "0xfeedbD76ac61616f270911CCaBb43a36380f40ae",
"variableDebtTokenAddress": "0x11b884339E453E3d66A8E22246782D40E62cB5F2",
"symbol": "WMATIC",
"address": "0x9c3C9283D3e44854697Cd22D3Faa240Cfb032889",
"decimals": 18
},
{
"aTokenAddress": "0x7ec62b6fC19174255335C8f4346E0C2fcf870a6B",
"aTokenSymbol": "amAAVE",
"stableDebtTokenAddress": "0x14bD9790e15294608Df4160dcF45B64adBFdCBaA",
"variableDebtTokenAddress": "0x5A6659794E3Fe10eee90833B36a4819953AaB9A1",
"symbol": "AAVE",
"address": "0x341d1f30e77D3FBfbD43D17183E2acb9dF25574E",
"decimals": 18
}
]
}
}
88 changes: 86 additions & 2 deletions contracts/interfaces/IAaveIncentivesController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,105 @@ pragma solidity 0.7.5;
pragma experimental ABIEncoderV2;

interface IAaveIncentivesController {

event RewardsAccrued(address indexed user, uint256 amount);

event RewardsClaimed(
address indexed user,
address indexed to,
uint256 amount
);

event RewardsClaimed(
address indexed user,
address indexed to,
address indexed claimer,
uint256 amount
);

event ClaimerSet(address indexed user, address indexed claimer);

/**
* @dev Whitelists an address to claim the rewards on behalf of another address
* @param user The address of the user
* @param claimer The address of the claimer
*/
function setClaimer(address user, address claimer) external;

/**
* @dev Returns the whitelisted claimer for a certain address (0x0 if not set)
* @param user The address of the user
* @return The claimer address
*/
function getClaimer(address user) external view returns (address);

/**
* @dev Configure assets for a certain rewards emission
* @param assets The assets to incentivize
* @param emissionsPerSecond The emission for each asset
*/
function configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond)
external;


/**
* @dev Called by the corresponding asset on any update that affects the rewards distribution
* @param asset The address of the user
* @param userBalance The balance of the user of the asset in the lending pool
* @param totalSupply The total supply of the asset in the lending pool
**/
function handleAction(
address asset,
uint256 userBalance,
uint256 totalSupply
) external;

/**
* @dev Returns the total of rewards of an user, already accrued + not yet accrued
* @param user The address of the user
* @return The rewards
**/
function getRewardsBalance(address[] calldata assets, address user)
external
view
returns (uint256);

/**
* @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
* @param amount Amount of rewards to claim
* @param to Address that will be receiving the rewards
* @return Rewards claimed
**/
function claimRewards(
address[] calldata assets,
uint256 amount,
address to,
bool stake
address to
) external returns (uint256);

/**
* @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must
* be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
* @param amount Amount of rewards to claim
* @param user Address to check and claim rewards
* @param to Address that will be receiving the rewards
* @return Rewards claimed
**/
function claimRewardsOnBehalf(
address[] calldata assets,
uint256 amount,
address user,
address to
) external returns (uint256);

/**
* @dev returns the unclaimed rewards of the user
* @param user the address of the user
* @return the unclaimed user rewards
*/
function getUserUnclaimedRewards(address user) external view returns (uint256);

/**
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
function REWARD_TOKEN() external view returns (address);
}
Loading