dsa-connectors/contracts/polygon/connectors/aave/aave-rewards/main.sol

51 lines
1.5 KiB
Solidity
Raw Normal View History

2021-04-13 06:01:53 +00:00
pragma solidity ^0.7.0;
/**
* @title Aave Rewards.
* @dev Claim Aave rewards.
*/
2021-05-11 13:52:01 +00:00
import { TokenInterface } from "../../../common/interfaces.sol";
import { Stores } from "../../../common/stores.sol";
2021-04-13 06:01:53 +00:00
import { Helpers } from "./helpers.sol";
import { Events } from "./events.sol";
abstract contract IncentivesResolver is Helpers, Events {
2021-04-14 12:41:47 +00:00
/**
* @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.
*/
2021-04-13 06:01:53 +00:00
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");
2021-04-14 14:53:26 +00:00
_amt = incentives.claimRewards(assets, _amt, address(this));
2021-04-13 06:01:53 +00:00
2021-06-02 00:11:26 +00:00
TokenInterface wmatic = TokenInterface(wmaticAddr);
uint256 wmaticAmount = wmatic.balanceOf(address(this));
convertWmaticToMatic(wmaticAmount > 0, wmatic, wmaticAmount);
2021-04-13 06:01:53 +00:00
setUint(setId, _amt);
2021-04-14 14:53:26 +00:00
_eventName = "LogClaimed(address[],uint256,uint256,uint256)";
_eventParam = abi.encode(assets, _amt, getId, setId);
2021-04-13 06:01:53 +00:00
}
}
2021-05-11 13:52:01 +00:00
contract ConnectV2AaveIncentivesPolygon is IncentivesResolver {
string public constant name = "Aave-Incentives-v1";
2021-04-14 12:41:47 +00:00
}