Contract 0x94Bc2a1C732BcAd7343B25af48385Fe76E08734f 7

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x171a30244ba035b51f0eceec46a48fc200725adc9bf779cc02322c07910963720x60806040227746552022-11-24 8:10:514 days 6 hrs ago0x11799622f4d98a24514011e8527b969f7488ef47 IN  Create: TraderJoeHelper0 AVAX0.0099796525
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
TraderJoeHelper

Compiler Version
v0.8.15+commit.e14f2714

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : TraderJoeHelper.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

import "./interfaces/IJoePair.sol";

contract TraderJoeHelper {
    struct BinData {
        uint256 id;
        uint256 reserveX;
        uint256 reserveY;
    }

    function getBins(IJoePair pair, uint24 offset, uint24 size)
        external
        view
        returns (BinData[] memory data, uint24 i)
    {
        uint256 counter = 0;
        data = new BinData[](size);
        uint24 lastBin = pair.findFirstNonEmptyBinId(type(uint24).max, true);
        for (
            i = offset;
            i < lastBin && counter < size;
            i = pair.findFirstNonEmptyBinId(i, false)
        ) {
            (uint256 x, uint256 y) = pair.getBin(i);
            if (x > 0 || y > 0) {
                (data[counter].reserveX, data[counter].reserveY) = (x, y);
                data[counter].id = i;
                unchecked{ ++counter; }
            }
        }
        if (i == lastBin && counter < size) {
            (data[counter].reserveX, data[counter].reserveY) = pair.getBin(i);
            data[counter].id = i;
            unchecked{ ++counter; }
            i = 0;
        }
        // cut array size down
        assembly {  // solhint-disable-line no-inline-assembly
            mstore(data, counter)
        }
    }
}

File 2 of 2 : IJoePair.sol
// SPDX-License-Identifier: MIT

pragma solidity 0.8.15;

interface IJoePair {
	function findFirstNonEmptyBinId(uint24 _id, bool _swapForY) external view returns (uint24);
    function getBin(uint24 _id) external view returns (uint256 reserveX, uint256 reserveY);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"contract IJoePair","name":"pair","type":"address"},{"internalType":"uint24","name":"offset","type":"uint24"},{"internalType":"uint24","name":"size","type":"uint24"}],"name":"getBins","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"reserveX","type":"uint256"},{"internalType":"uint256","name":"reserveY","type":"uint256"}],"internalType":"struct TraderJoeHelper.BinData[]","name":"data","type":"tuple[]"},{"internalType":"uint24","name":"i","type":"uint24"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5061064b806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c806336d9ec1914610030575b600080fd5b61004361003e3660046104a4565b61005a565b604051610051929190610508565b60405180910390f35b606060008062ffffff841667ffffffffffffffff81111561007d5761007d61056f565b6040519080825280602002602001820160405280156100d257816020015b6100bf60405180606001604052806000815260200160008152602001600081525090565b81526020019060019003908161009b5790505b506040517f8f919a8300000000000000000000000000000000000000000000000000000000815262ffffff60048201526001602482015290935060009073ffffffffffffffffffffffffffffffffffffffff881690638f919a8390604401602060405180830381865afa15801561014d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610171919061059e565b90508592505b8062ffffff168362ffffff1610801561019457508462ffffff1682105b1561035c576040517f0abe968800000000000000000000000000000000000000000000000000000000815262ffffff84166004820152600090819073ffffffffffffffffffffffffffffffffffffffff8a1690630abe9688906024016040805180830381865afa15801561020c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061023091906105c2565b9150915060008211806102435750600081115b156102b957818187868151811061025c5761025c6105e6565b6020026020010151602001888781518110610279576102796105e6565b6020026020010151604001828152508281525050508462ffffff168685815181106102a6576102a66105e6565b6020908102919091010151526001909301925b50506040517f8f919a8300000000000000000000000000000000000000000000000000000000815262ffffff841660048201526000602482015273ffffffffffffffffffffffffffffffffffffffff881690638f919a8390604401602060405180830381865afa158015610331573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610355919061059e565b9250610177565b8062ffffff168362ffffff1614801561037957508462ffffff1682105b15610483576040517f0abe968800000000000000000000000000000000000000000000000000000000815262ffffff8416600482015273ffffffffffffffffffffffffffffffffffffffff881690630abe9688906024016040805180830381865afa1580156103ec573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061041091906105c2565b858481518110610422576104226105e6565b602002602001015160200186858151811061043f5761043f6105e6565b6020026020010151604001828152508281525050508262ffffff1684838151811061046c5761046c6105e6565b602090810291909101015152600092506001909101905b8184525050935093915050565b62ffffff811681146104a157600080fd5b50565b6000806000606084860312156104b957600080fd5b833573ffffffffffffffffffffffffffffffffffffffff811681146104dd57600080fd5b925060208401356104ed81610490565b915060408401356104fd81610490565b809150509250925092565b6040808252835182820181905260009190606090818501906020808901865b83811015610554578151805186528381015184870152870151878601529385019390820190600101610527565b505082955062ffffff88168188015250505050509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000602082840312156105b057600080fd5b81516105bb81610490565b9392505050565b600080604083850312156105d557600080fd5b505080516020909101519092909150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fdfea264697066735822122008287f345ee8ae62cd906bc412e57f8fcf3d773b890477f638f8fbd07207728664736f6c634300080f0033

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.