Merge branch 'new-updates' into new-tests

This commit is contained in:
Samyak Jain 2021-04-16 02:39:00 +05:30
commit bd72d17bc5
4 changed files with 11 additions and 4 deletions

View File

@ -19,6 +19,10 @@ contract MigrateResolver is Helpers, Events {
function addTokenSupport(address[] memory _tokens) public {
require(msg.sender == instaIndex.master(), "not-master");
for (uint i = 0; i < supportedTokens.length; i++) {
delete isSupportedToken[supportedTokens[i]];
}
delete supportedTokens;
for (uint i = 0; i < _tokens.length; i++) {
require(!isSupportedToken[_tokens[i]], "already-added");
isSupportedToken[_tokens[i]] = true;

View File

@ -36,6 +36,6 @@ contract Variables {
// TODO: Set by construtor?
mapping(address => bool) public isSupportedToken;
address[] public supportedTokens;
address[] public supportedTokens; // don't add ethAddr. Only add wethAddr
}

View File

@ -20,6 +20,10 @@ contract LiquidityResolver is Helpers, Events {
function addTokenSupport(address[] memory _tokens) public {
require(msg.sender == instaIndex.master(), "not-master");
for (uint i = 0; i < supportedTokens.length; i++) {
delete isSupportedToken[supportedTokens[i]];
}
delete supportedTokens;
for (uint i = 0; i < _tokens.length; i++) {
require(!isSupportedToken[_tokens[i]], "already-added");
isSupportedToken[_tokens[i]] = true;
@ -53,8 +57,7 @@ contract LiquidityResolver is Helpers, Events {
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
for (uint i = 0; i < supportedTokens.length; i++) {
address _token = supportedTokens[i];
if (_token == ethAddr) {
_token = wethAddr;
if (_token == wethAddr) {
if (address(this).balance > 0) {
TokenInterface(wethAddr).deposit{value: address(this).balance}();
}

View File

@ -49,7 +49,7 @@ contract Variables {
uint public fee = 998000000000000000; // 0.2% (99.8%) on collateral? TODO: Is this right?
// TODO: Set by construtor?
mapping(address => bool) public isSupportedToken;
address[] public supportedTokens;
address[] public supportedTokens; // don't add ethAddr. Only add wethAddr
/**
* @dev Aave Provider