mirror of
https://github.com/Instadapp/dsa-resolvers-deprecated.git
synced 2024-07-29 22:38:16 +00:00
03c0cb5c68
This reverts commit 20e74a5bcd
.
38 lines
1.2 KiB
Solidity
38 lines
1.2 KiB
Solidity
pragma solidity ^0.6.0;
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
interface TokenInterface {
|
|
function balanceOf(address) external view returns (uint);
|
|
}
|
|
|
|
|
|
contract Resolver {
|
|
struct Balances {
|
|
address owner;
|
|
uint[] balance;
|
|
}
|
|
function getBalances(address[] memory owners, address[] memory tknAddress) public view returns (Balances[] memory) {
|
|
Balances[] memory tokensBal = new Balances[](owners.length);
|
|
for (uint i = 0; i < owners.length; i++) {
|
|
uint[] memory bals = new uint[](tknAddress.length);
|
|
for (uint j = 0; j < tknAddress.length; j++) {
|
|
if (tknAddress[j] == 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) {
|
|
bals[j] = owners[i].balance;
|
|
} else {
|
|
TokenInterface token = TokenInterface(tknAddress[i]);
|
|
bals[j] = token.balanceOf(owners[i]);
|
|
}
|
|
}
|
|
tokensBal[i] = Balances({
|
|
owner: owners[i],
|
|
balance: bals
|
|
});
|
|
}
|
|
return tokensBal;
|
|
}
|
|
}
|
|
|
|
|
|
contract InstaPowerERC20Resolver is Resolver {
|
|
string public constant name = "ERC20-Power-Resolver-v1";
|
|
} |