reviews addresses

This commit is contained in:
Richa-iitr 2022-09-01 00:09:55 +05:30
parent 912f46949b
commit 6c457ea60b
3 changed files with 22 additions and 27 deletions

View File

@ -36,7 +36,6 @@ abstract contract Helpers is DSMath, Basic {
address to,
uint256 amt
) internal {
bytes memory data;
if (from == address(0) && to == address(0)) {
CometInterface(market).withdraw(token, amt);
@ -53,7 +52,7 @@ abstract contract Helpers is DSMath, Basic {
address from,
address to,
uint256 amt
) public payable {
) internal {
bytes memory data;
if (from == address(0)) {

View File

@ -7,6 +7,11 @@ struct UserCollateral {
uint128 _reserved;
}
struct RewardOwed {
address token;
uint256 owed;
}
interface CometInterface {
function supply(address asset, uint256 amount) external virtual;
@ -124,6 +129,10 @@ interface CometRewards {
bool shouldAccrue
) external;
function getRewardOwed(address comet, address account)
external
returns (RewardOwed memory);
function rewardsClaimed(address cometProxy, address account)
external
view

View File

@ -455,7 +455,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(token_);
amt_ = amt_ == uint256(-1)
? CometInterface(market).borrowBalanceOf(address(this))
? TokenInterface(market).balanceOf(address(this))
: amt_;
if (isEth) {
@ -500,7 +500,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(token_);
amt_ = amt_ == uint256(-1)
? CometInterface(market).borrowBalanceOf(to)
? TokenInterface(market).balanceOf(to)
: amt_;
if (isEth) {
@ -548,7 +548,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
TokenInterface tokenContract = TokenInterface(token_);
amt_ = amt_ == uint256(-1)
? CometInterface(market).borrowBalanceOf(to)
? TokenInterface(market).balanceOf(to)
: amt_;
if (isEth) {
@ -634,23 +634,13 @@ abstract contract CompoundV3Resolver is Events, Helpers {
bool accrue,
uint256 setId
) public returns (string memory eventName_, bytes memory eventParam_) {
uint256 rewardsOwed = cometRewards.getRewardOwed(market, account).owed;
cometRewards.claim(market, account, accrue);
//in reward token decimals
uint256 totalRewardsClaimed = cometRewards.rewardsClaimed(
market,
account
);
setUint(setId, totalRewardsClaimed);
setUint(setId, rewardsOwed);
eventName_ = "LogRewardsClaimed(address,address,uint256,uint256,bool)";
eventParam_ = abi.encode(
market,
account,
totalRewardsClaimed,
setId,
accrue
);
eventParam_ = abi.encode(market, account, rewardsOwed, setId, accrue);
}
/**
@ -669,21 +659,18 @@ abstract contract CompoundV3Resolver is Events, Helpers {
bool accrue,
uint256 setId
) public returns (string memory eventName_, bytes memory eventParam_) {
//in reward token decimals
uint256 rewardsOwed = cometRewards.getRewardOwed(market, account).owed;
cometRewards.claimTo(market, account, dest, accrue);
//in reward token decimals
uint256 totalRewardsClaimed = cometRewards.rewardsClaimed(
market,
account
);
setUint(setId, totalRewardsClaimed);
setUint(setId, rewardsOwed);
eventName_ = "LogRewardsClaimedTo(address,address,address,uint256,uint256,bool)";
eventParam_ = abi.encode(
market,
account,
dest,
totalRewardsClaimed,
rewardsOwed,
setId,
accrue
);
@ -880,7 +867,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
* @param manager The address to be authorized.
* @param isAllowed Whether to allow or disallow the manager.
*/
function allow(
function toggleAccountManager(
address market,
address manager,
bool isAllowed
@ -903,7 +890,7 @@ abstract contract CompoundV3Resolver is Events, Helpers {
* @param r Half of the ECDSA signature pair.
* @param s Half of the ECDSA signature pair.
*/
function allowWithPermit(
function toggleAccountManagerWithPermit(
address market,
address owner,
address manager,