mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
Merge branch 'new-updates' into new-tests
This commit is contained in:
commit
bd72d17bc5
|
@ -19,6 +19,10 @@ contract MigrateResolver is Helpers, Events {
|
||||||
|
|
||||||
function addTokenSupport(address[] memory _tokens) public {
|
function addTokenSupport(address[] memory _tokens) public {
|
||||||
require(msg.sender == instaIndex.master(), "not-master");
|
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++) {
|
for (uint i = 0; i < _tokens.length; i++) {
|
||||||
require(!isSupportedToken[_tokens[i]], "already-added");
|
require(!isSupportedToken[_tokens[i]], "already-added");
|
||||||
isSupportedToken[_tokens[i]] = true;
|
isSupportedToken[_tokens[i]] = true;
|
||||||
|
|
|
@ -36,6 +36,6 @@ contract Variables {
|
||||||
|
|
||||||
// TODO: Set by construtor?
|
// TODO: Set by construtor?
|
||||||
mapping(address => bool) public isSupportedToken;
|
mapping(address => bool) public isSupportedToken;
|
||||||
address[] public supportedTokens;
|
address[] public supportedTokens; // don't add ethAddr. Only add wethAddr
|
||||||
|
|
||||||
}
|
}
|
|
@ -20,6 +20,10 @@ contract LiquidityResolver is Helpers, Events {
|
||||||
|
|
||||||
function addTokenSupport(address[] memory _tokens) public {
|
function addTokenSupport(address[] memory _tokens) public {
|
||||||
require(msg.sender == instaIndex.master(), "not-master");
|
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++) {
|
for (uint i = 0; i < _tokens.length; i++) {
|
||||||
require(!isSupportedToken[_tokens[i]], "already-added");
|
require(!isSupportedToken[_tokens[i]], "already-added");
|
||||||
isSupportedToken[_tokens[i]] = true;
|
isSupportedToken[_tokens[i]] = true;
|
||||||
|
@ -53,8 +57,7 @@ contract LiquidityResolver is Helpers, Events {
|
||||||
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
|
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
|
||||||
for (uint i = 0; i < supportedTokens.length; i++) {
|
for (uint i = 0; i < supportedTokens.length; i++) {
|
||||||
address _token = supportedTokens[i];
|
address _token = supportedTokens[i];
|
||||||
if (_token == ethAddr) {
|
if (_token == wethAddr) {
|
||||||
_token = wethAddr;
|
|
||||||
if (address(this).balance > 0) {
|
if (address(this).balance > 0) {
|
||||||
TokenInterface(wethAddr).deposit{value: address(this).balance}();
|
TokenInterface(wethAddr).deposit{value: address(this).balance}();
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ contract Variables {
|
||||||
uint public fee = 998000000000000000; // 0.2% (99.8%) on collateral? TODO: Is this right?
|
uint public fee = 998000000000000000; // 0.2% (99.8%) on collateral? TODO: Is this right?
|
||||||
// TODO: Set by construtor?
|
// TODO: Set by construtor?
|
||||||
mapping(address => bool) public isSupportedToken;
|
mapping(address => bool) public isSupportedToken;
|
||||||
address[] public supportedTokens;
|
address[] public supportedTokens; // don't add ethAddr. Only add wethAddr
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dev Aave Provider
|
* @dev Aave Provider
|
||||||
|
|
Loading…
Reference in New Issue
Block a user