sambacha / isdx

Introspection / Observability smart contracts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

isdx

Introspection / Observability smart contracts

examples

  • AllowancesHelper
 // Fetch allowances
        Allowance[] memory _allowances = new Allowance[](numberOfAllowances);
        uint256 allowanceIdx;
        for (tokenIdx = 0; tokenIdx < tokensAddresses.length; tokenIdx++) {
            for (spenderIdx = 0; spenderIdx < spenderAddresses.length; spenderIdx++) {
                address spenderAddress = spenderAddresses[spenderIdx];
                address tokenAddress = tokensAddresses[tokenIdx];
                IERC20 token = IERC20(tokenAddress);
                uint256 amount = token.allowance(ownerAddress, spenderAddress);
                if (amount > 0) {
                    Allowance memory allowance = Allowance({
                        owner: ownerAddress,
                        spender: spenderAddress,
                        amount: amount,
                        token: tokenAddress
                    });
                    _allowances[allowanceIdx] = allowance;
                    allowanceIdx++;
                }
            }
        }
        return _allowances;

About

Introspection / Observability smart contracts

License:Apache License 2.0


Languages

Language:Solidity 90.6%Language:Shell 8.3%Language:JavaScript 0.8%Language:Makefile 0.3%