mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
Merge pull request #23 from Instadapp/aave-rewards
Add Aave rewards connector
This commit is contained in:
commit
e85a489b10
11
contracts/polygon/connectors/aave-rewards/events.sol
Normal file
11
contracts/polygon/connectors/aave-rewards/events.sol
Normal file
|
@ -0,0 +1,11 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
contract Events {
|
||||
event LogClaimed(
|
||||
address[] assets,
|
||||
uint256 amt,
|
||||
bool stake,
|
||||
uint256 getId,
|
||||
uint256 setId
|
||||
);
|
||||
}
|
12
contracts/polygon/connectors/aave-rewards/helpers.sol
Normal file
12
contracts/polygon/connectors/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(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
|
||||
}
|
10
contracts/polygon/connectors/aave-rewards/interface.sol
Normal file
10
contracts/polygon/connectors/aave-rewards/interface.sol
Normal file
|
@ -0,0 +1,10 @@
|
|||
pragma solidity ^0.7.0;
|
||||
|
||||
interface AaveIncentivesInterface {
|
||||
function claimRewards(
|
||||
address[] calldata assets,
|
||||
uint256 amount,
|
||||
address to,
|
||||
bool stake
|
||||
) external returns (uint256);
|
||||
}
|
28
contracts/polygon/connectors/aave-rewards/main.sol
Normal file
28
contracts/polygon/connectors/aave-rewards/main.sol
Normal file
|
@ -0,0 +1,28 @@
|
|||
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 {
|
||||
|
||||
function claim(
|
||||
address[] calldata assets,
|
||||
uint256 amt,
|
||||
bool stake,
|
||||
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), stake);
|
||||
|
||||
setUint(setId, _amt);
|
||||
|
||||
_eventName = "LogClaimed(address[],uint256,bool,uint256,uint256)";
|
||||
_eventParam = abi.encode(assets, _amt, stake, getId, setId);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user