Update addresses, Fixed Qi reward claim

This commit is contained in:
babkendev01 2021-09-30 11:17:17 +04:00
parent a057263b3f
commit 5ff2546efe
6 changed files with 25 additions and 19 deletions

View File

@ -13,7 +13,7 @@ abstract contract Stores {
/**
* @dev Return Wrapped AVAX address
*/
address constant internal wavaxAddr = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
address constant internal wavaxAddr = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7;
/**
* @dev Return memory variable address

View File

@ -9,18 +9,24 @@ abstract contract Helpers is DSMath, Basic {
/**
* @dev Benqi Comptroller
*/
ComptrollerInterface internal constant troller = ComptrollerInterface(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B);
ComptrollerInterface internal constant troller = ComptrollerInterface(0x486Af39519B4Dc9a7fCcd318217352830E8AD9b4);
/**
* @dev Reward Token
*/
QiInterface internal constant benqiToken = QiInterface(0xc00e94Cb662C3520282E6f5717214004A7f26888);
QiInterface internal constant benqiToken = QiInterface(0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5);
/**
* @dev Benqi Mapping
*/
BenqiMappingInterface internal constant qiMapping = BenqiMappingInterface(0xe7a85d0adDB972A4f0A4e57B698B37f171519e88);
/**
* @dev Benqi reward token type to show BENQI or AVAX
*/
uint8 internal constant rewardQi = 0;
uint8 internal constant rewardAvax = 1;
function getMergedQiTokens(
string[] calldata supplyIds,
string[] calldata borrowIds

View File

@ -1,9 +1,9 @@
pragma solidity ^0.7.0;
interface ComptrollerInterface {
function claimReward(address holder) external;
function claimReward(address holder, address[] calldata) external;
function claimReward(address[] calldata holders, address[] calldata qiTokens, bool borrowers, bool suppliers) external;
function claimReward(uint8 rewardType, address holder) external;
function claimReward(uint8 rewardType, address holder, address[] calldata) external;
function claimReward(uint8 rewardType, address[] calldata holders, address[] calldata qiTokens, bool borrowers, bool suppliers) external;
}
interface QiInterface {

View File

@ -13,14 +13,14 @@ import { Events } from "./events.sol";
abstract contract BenqiResolver is Events, Helpers {
/**
* @dev Claim Accrued Reward Token.
* @notice Claim Accrued Reward Token.
* @dev Claim Accrued Qi Token.
* @notice Claim Accrued Qi Token.
* @param setId ID stores the amount of Reward claimed.
*/
function ClaimReward(uint256 setId) external payable returns (string memory _eventName, bytes memory _eventParam) {
TokenInterface _benqiToken = TokenInterface(address(benqiToken));
uint intialBal = _benqiToken.balanceOf(address(this));
troller.claimReward(address(this));
troller.claimReward(rewardQi, address(this));
uint finalBal = _benqiToken.balanceOf(address(this));
uint amt = sub(finalBal, intialBal);
@ -31,8 +31,8 @@ abstract contract BenqiResolver is Events, Helpers {
}
/**
* @dev Claim Accrued Reward Token.
* @notice Claim Accrued Reward Token.
* @dev Claim Accrued Qi Token.
* @notice Claim Accrued Qi Token.
* @param tokenIds Array of supplied and borrowed token IDs.
* @param setId ID stores the amount of Reward claimed.
*/
@ -48,7 +48,7 @@ abstract contract BenqiResolver is Events, Helpers {
TokenInterface _benqiToken = TokenInterface(address(benqiToken));
uint intialBal = _benqiToken.balanceOf(address(this));
troller.claimReward(address(this), qitokens);
troller.claimReward(rewardQi, address(this), qitokens);
uint finalBal = _benqiToken.balanceOf(address(this));
uint amt = sub(finalBal, intialBal);
@ -59,8 +59,8 @@ abstract contract BenqiResolver is Events, Helpers {
}
/**
* @dev Claim Accrued Reward Token.
* @notice Claim Accrued Reward Token.
* @dev Claim Accrued Qi Token.
* @notice Claim Accrued Qi Token.
* @param supplyTokenIds Array of supplied tokenIds.
* @param borrowTokenIds Array of borrowed tokenIds.
* @param setId ID stores the amount of Reward claimed.
@ -73,7 +73,7 @@ abstract contract BenqiResolver is Events, Helpers {
TokenInterface _benqiToken = TokenInterface(address(benqiToken));
uint intialBal = _benqiToken.balanceOf(address(this));
troller.claimReward(holders, qitokens, isBorrow, isSupply);
troller.claimReward(rewardQi, holders, qitokens, isBorrow, isSupply);
uint finalBal = _benqiToken.balanceOf(address(this));
uint amt = sub(finalBal, intialBal);
@ -98,6 +98,6 @@ abstract contract BenqiResolver is Events, Helpers {
}
}
contract ConnectBenqi is BenqiResolver {
string public constant name = "Benqi-v1.0";
contract ConnectV2Benqi is BenqiResolver {
string public constant name = "Benqi-v1";
}

View File

@ -27,7 +27,7 @@ interface ComptrollerInterface {
function exitMarket(address qiTokenAddress) external returns (uint);
function getAssetsIn(address account) external view returns (address[] memory);
function getAccountLiquidity(address account) external view returns (uint, uint, uint);
function claimReward(address) external;
function claimReward(uint8 rewardType, address) external;
}
interface BenqiMappingInterface {

View File

@ -437,5 +437,5 @@ abstract contract BenqiResolver is Events, Helpers {
}
contract ConnectV2Benqi is BenqiResolver {
string public name = "Benqi-v1.1";
string public name = "Benqi-v1";
}