require statements format

This commit is contained in:
Richa-iitr 2022-09-02 19:51:56 +05:30
parent 28ef1ae2bb
commit 5571cf187e
2 changed files with 34 additions and 17 deletions

View File

@ -58,8 +58,10 @@ abstract contract Helpers is DSMath, Basic {
uint256 amt_ = getUint(params.getId, params.amt); uint256 amt_ = getUint(params.getId, params.amt);
require( require(
params.market != address(0) && params.token != address(0), params.market != address(0) &&
"invalid market/token address" params.token != address(0) &&
params.to != address(0),
"invalid market/token/to address"
); );
bool isEth = params.token == ethAddr; bool isEth = params.token == ethAddr;
address token_ = isEth ? wethAddr : params.token; address token_ = isEth ? wethAddr : params.token;
@ -99,8 +101,10 @@ abstract contract Helpers is DSMath, Basic {
uint256 amt_ = getUint(params.getId, params.amt); uint256 amt_ = getUint(params.getId, params.amt);
require( require(
params.market != address(0) && params.token != address(0), params.market != address(0) &&
"invalid market/token address" params.token != address(0) &&
params.to != address(0),
"invalid market/token/to address"
); );
bool isEth = params.token == ethAddr; bool isEth = params.token == ethAddr;

View File

@ -93,10 +93,9 @@ abstract contract CompoundV3Resolver is Events, Helpers {
uint256 amt_ = getUint(getId, amt); uint256 amt_ = getUint(getId, amt);
require( require(
market != address(0) && token != address(0), market != address(0) && token != address(0) && to != address(0),
"invalid market/token address" "invalid market/token/to address"
); );
require(to != address(0), "invalid to address");
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
address token_ = isEth ? wethAddr : token; address token_ = isEth ? wethAddr : token;
@ -154,10 +153,9 @@ abstract contract CompoundV3Resolver is Events, Helpers {
uint256 amt_ = getUint(getId, amt); uint256 amt_ = getUint(getId, amt);
require( require(
market != address(0) && token != address(0), market != address(0) && token != address(0) && to != address(0),
"invalid market/token address" "invalid market/token/to address"
); );
require(to != address(0), "invalid to address");
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
address token_ = isEth ? wethAddr : token; address token_ = isEth ? wethAddr : token;
@ -482,7 +480,10 @@ abstract contract CompoundV3Resolver is Events, Helpers {
returns (string memory eventName_, bytes memory eventParam_) returns (string memory eventName_, bytes memory eventParam_)
{ {
uint256 amt_ = getUint(getId, amt); uint256 amt_ = getUint(getId, amt);
require(market != address(0), "invalid market address"); require(
market != address(0) && token != address(0),
"invalid market/token address"
);
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
address token_ = getBaseToken(market); address token_ = getBaseToken(market);
@ -534,7 +535,10 @@ abstract contract CompoundV3Resolver is Events, Helpers {
returns (string memory eventName_, bytes memory eventParam_) returns (string memory eventName_, bytes memory eventParam_)
{ {
uint256 amt_ = getUint(getId, amt); uint256 amt_ = getUint(getId, amt);
require(market != address(0), "invalid market address"); require(
market != address(0) && token != address(0) && to != address(0),
"invalid market/token/to address"
);
address token_ = getBaseToken(market); address token_ = getBaseToken(market);
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
@ -587,7 +591,10 @@ abstract contract CompoundV3Resolver is Events, Helpers {
returns (string memory eventName_, bytes memory eventParam_) returns (string memory eventName_, bytes memory eventParam_)
{ {
uint256 amt_ = getUint(getId, amt); uint256 amt_ = getUint(getId, amt);
require(market != address(0), "invalid market address"); require(
market != address(0) && token != address(0) && to != address(0),
"invalid market/token/to address"
);
address token_ = getBaseToken(market); address token_ = getBaseToken(market);
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
@ -637,6 +644,10 @@ abstract contract CompoundV3Resolver is Events, Helpers {
returns (string memory eventName_, bytes memory eventParam_) returns (string memory eventName_, bytes memory eventParam_)
{ {
uint256 amt_ = getUint(getId, baseAmt); uint256 amt_ = getUint(getId, baseAmt);
require(
market != address(0) && asset != address(0) && dest != address(0),
"invalid market/token/to address"
);
bool isEth = asset == ethAddr; bool isEth = asset == ethAddr;
address token_ = isEth ? wethAddr : asset; address token_ = isEth ? wethAddr : asset;
@ -691,8 +702,8 @@ abstract contract CompoundV3Resolver is Events, Helpers {
{ {
uint256 amt_ = getUint(getId, amount); uint256 amt_ = getUint(getId, amount);
require( require(
market != address(0) && token != address(0), market != address(0) && token != address(0) && dest != address(0),
"invalid market address" "invalid market/token/to address"
); );
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
@ -744,8 +755,10 @@ abstract contract CompoundV3Resolver is Events, Helpers {
returns (string memory eventName_, bytes memory eventParam_) returns (string memory eventName_, bytes memory eventParam_)
{ {
uint256 amt_ = getUint(getId, amount); uint256 amt_ = getUint(getId, amount);
require(market != address(0), "invalid market address"); require(
require(dest != address(0), "invalid destination address"); market != address(0) && token != address(0) && dest != address(0),
"invalid market/token/to address"
);
bool isEth = token == ethAddr; bool isEth = token == ethAddr;
address token_ = isEth ? wethAddr : token; address token_ = isEth ? wethAddr : token;