mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Add AAVE rewwards connector
This commit is contained in:
parent
a05b865b6d
commit
6ba85eba35
10
contracts/mainnet/connectors/aave/aave-rewards/events.sol
Normal file
10
contracts/mainnet/connectors/aave/aave-rewards/events.sol
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
contract Events {
|
||||||
|
event LogClaimed(
|
||||||
|
address[] assets,
|
||||||
|
uint256 amt,
|
||||||
|
uint256 getId,
|
||||||
|
uint256 setId
|
||||||
|
);
|
||||||
|
}
|
12
contracts/mainnet/connectors/aave/aave-rewards/helpers.sol
Normal file
12
contracts/mainnet/connectors/aave/aave-rewards/helpers.sol
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
import { DSMath } from "../../../common/math.sol";
|
||||||
|
import { Basic } from "../../../common/basic.sol";
|
||||||
|
import { AaveIncentivesInterface } from "./interface.sol";
|
||||||
|
|
||||||
|
abstract contract Helpers is DSMath, Basic {
|
||||||
|
/**
|
||||||
|
* @dev Aave Incentives
|
||||||
|
*/
|
||||||
|
AaveIncentivesInterface internal constant incentives = AaveIncentivesInterface(0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5);
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
interface AaveIncentivesInterface {
|
||||||
|
function claimRewards(
|
||||||
|
address[] calldata assets,
|
||||||
|
uint256 amount,
|
||||||
|
address to
|
||||||
|
) external returns (uint256);
|
||||||
|
}
|
39
contracts/mainnet/connectors/aave/aave-rewards/main.sol
Normal file
39
contracts/mainnet/connectors/aave/aave-rewards/main.sol
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
import { TokenInterface } from "../../../common/interfaces.sol";
|
||||||
|
import { Stores } from "../../../common/stores.sol";
|
||||||
|
import { Helpers } from "./helpers.sol";
|
||||||
|
import { Events } from "./events.sol";
|
||||||
|
|
||||||
|
abstract contract IncentivesResolver is Helpers, Events {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Claim Pending Rewards.
|
||||||
|
* @notice Claim Pending Rewards from Aave incentives contract.
|
||||||
|
* @param assets The list of assets supplied and borrowed.
|
||||||
|
* @param amt The amount of reward to claim. (uint(-1) for max)
|
||||||
|
* @param getId ID to retrieve amt.
|
||||||
|
* @param setId ID stores the amount of rewards claimed.
|
||||||
|
*/
|
||||||
|
function claim(
|
||||||
|
address[] calldata assets,
|
||||||
|
uint256 amt,
|
||||||
|
uint256 getId,
|
||||||
|
uint256 setId
|
||||||
|
) external payable returns (string memory _eventName, bytes memory _eventParam) {
|
||||||
|
uint _amt = getUint(getId, amt);
|
||||||
|
|
||||||
|
require(assets.length > 0, "invalid-assets");
|
||||||
|
|
||||||
|
_amt = incentives.claimRewards(assets, _amt, address(this));
|
||||||
|
|
||||||
|
setUint(setId, _amt);
|
||||||
|
|
||||||
|
_eventName = "LogClaimed(address[],uint256,uint256,uint256)";
|
||||||
|
_eventParam = abi.encode(assets, _amt, getId, setId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contract ConnectV2AaveIncentives is IncentivesResolver {
|
||||||
|
string public constant name = "Aave-Incentives-v1";
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user