Source Code
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Cross-Chain Transactions
Loading...
Loading
Contract Name:
BalancerPoolBalanceChecker
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 100000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
// ====================================================================
// | ______ _______ |
// | / _____________ __ __ / ____(_____ ____ _____ ________ |
// | / /_ / ___/ __ `| |/_/ / /_ / / __ \/ __ `/ __ \/ ___/ _ \ |
// | / __/ / / / /_/ _> < / __/ / / / / / /_/ / / / / /__/ __/ |
// | /_/ /_/ \__,_/_/|_| /_/ /_/_/ /_/\__,_/_/ /_/\___/\___/ |
// | |
// ====================================================================
// =================== BalancerPoolBalanceChecker =====================
// ====================================================================
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IBalancerPool } from "./interfaces/IBalancerPool.sol";
/**
* @title BalancerPoolBalanceChecker
* @author Frax Finance
* @notice The BalancerPoolBalanceChecker contract is used to retrieve the balances of collateral and LP tokens of pools.
*/
contract BalancerPoolBalanceChecker {
constructor() {}
/**
* @notice Used to get the structure of a pool.
* @dev Passing `0x0` address as the token address gets the native token balance.
* @param poolAddress Address of the pool to check the structure of
* @param tokens An array of tokens to check the balance of
* @return result An array of the balances of the tokens in the pool
* @return totalLpSupply The total supply of the LP token
*/
function poolStructure(
address poolAddress,
address[] memory tokens
) external view returns (uint256[] memory result, uint256 totalLpSupply) {
result = new uint256[](tokens.length);
for (uint256 i; i < tokens.length; ) {
if (tokens[i] == address(0)) result[i] = poolAddress.balance;
else result[i] = IERC20(tokens[i]).balanceOf(poolAddress);
unchecked {
++i;
}
}
totalLpSupply = IBalancerPool(poolAddress).getActualSupply();
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IBalancerPool {
function getActualSupply() external view returns (uint256);
}{
"remappings": [
"frax-std/=lib/frax-standard-solidity/src/",
"@eth-optimism/=lib/optimism/packages/",
"lib/optimism/packages/contracts-bedrock:src/=lib/optimism/packages/contracts-bedrock/src/",
"src/=src/",
"@openzeppelin-4/=node_modules/@openzeppelin-4/",
"@openzeppelin-5/=node_modules/@openzeppelin-5/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@rari-capital/=node_modules/@rari-capital/",
"clones-with-immutable-args/=lib/optimism/packages/contracts-bedrock/lib/clones-with-immutable-args/src/",
"ds-test/=lib/frax-standard-solidity/lib/forge-std/lib/ds-test/src/",
"forge-std/=lib/frax-standard-solidity/lib/forge-std/src/",
"frax-standard-solidity/=lib/frax-standard-solidity/src/",
"kontrol-cheatcodes/=lib/optimism/packages/contracts-bedrock/lib/kontrol-cheatcodes/src/",
"lib-keccak/=lib/optimism/packages/contracts-bedrock/lib/lib-keccak/contracts/",
"openzeppelin-contracts-upgradeable/=lib/optimism/packages/contracts-bedrock/lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/optimism/packages/contracts-bedrock/lib/openzeppelin-contracts/",
"optimism/=lib/optimism/",
"safe-contracts/=lib/optimism/packages/contracts-bedrock/lib/safe-contracts/contracts/",
"solady/=lib/optimism/packages/contracts-bedrock/lib/solady/",
"solidity-bytes-utils/=lib/frax-standard-solidity/lib/solidity-bytes-utils/",
"solmate/=lib/optimism/packages/contracts-bedrock/lib/solmate/src/"
],
"optimizer": {
"enabled": true,
"runs": 100000
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"poolAddress","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"name":"poolStructure","outputs":[{"internalType":"uint256[]","name":"result","type":"uint256[]"},{"internalType":"uint256","name":"totalLpSupply","type":"uint256"}],"stateMutability":"view","type":"function"}]Contract Creation Code
608060405234801561001057600080fd5b5061049f806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063839041d214610030575b600080fd5b61004361003e3660046102de565b61005a565b6040516100519291906103d4565b60405180910390f35b60606000825167ffffffffffffffff811115610078576100786102af565b6040519080825280602002602001820160405280156100a1578160200160208202803683370190505b50915060005b835181101561020d57600073ffffffffffffffffffffffffffffffffffffffff168482815181106100da576100da610421565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1603610138578473ffffffffffffffffffffffffffffffffffffffff163183828151811061012757610127610421565b602002602001018181525050610205565b83818151811061014a5761014a610421565b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152909116906370a0823190602401602060405180830381865afa1580156101c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e69190610450565b8382815181106101f8576101f8610421565b6020026020010181815250505b6001016100a7565b508373ffffffffffffffffffffffffffffffffffffffff1663876f303b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610259573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027d9190610450565b90509250929050565b803573ffffffffffffffffffffffffffffffffffffffff811681146102aa57600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156102f157600080fd5b6102fa83610286565b915060208084013567ffffffffffffffff8082111561031857600080fd5b818601915086601f83011261032c57600080fd5b81358181111561033e5761033e6102af565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715610381576103816102af565b60405291825284820192508381018501918983111561039f57600080fd5b938501935b828510156103c4576103b585610286565b845293850193928501926103a4565b8096505050505050509250929050565b604080825283519082018190526000906020906060840190828701845b8281101561040d578151845292840192908401906001016103f1565b505050602093909301939093525092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561046257600080fd5b505191905056fea2646970667358221220809f4938683b6d1e8ec7bed0f163e4f6abc095e4e24eda6777219a43e475ee7764736f6c63430008170033
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063839041d214610030575b600080fd5b61004361003e3660046102de565b61005a565b6040516100519291906103d4565b60405180910390f35b60606000825167ffffffffffffffff811115610078576100786102af565b6040519080825280602002602001820160405280156100a1578160200160208202803683370190505b50915060005b835181101561020d57600073ffffffffffffffffffffffffffffffffffffffff168482815181106100da576100da610421565b602002602001015173ffffffffffffffffffffffffffffffffffffffff1603610138578473ffffffffffffffffffffffffffffffffffffffff163183828151811061012757610127610421565b602002602001018181525050610205565b83818151811061014a5761014a610421565b60209081029190910101516040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152909116906370a0823190602401602060405180830381865afa1580156101c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101e69190610450565b8382815181106101f8576101f8610421565b6020026020010181815250505b6001016100a7565b508373ffffffffffffffffffffffffffffffffffffffff1663876f303b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610259573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061027d9190610450565b90509250929050565b803573ffffffffffffffffffffffffffffffffffffffff811681146102aa57600080fd5b919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080604083850312156102f157600080fd5b6102fa83610286565b915060208084013567ffffffffffffffff8082111561031857600080fd5b818601915086601f83011261032c57600080fd5b81358181111561033e5761033e6102af565b8060051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108582111715610381576103816102af565b60405291825284820192508381018501918983111561039f57600080fd5b938501935b828510156103c4576103b585610286565b845293850193928501926103a4565b8096505050505050509250929050565b604080825283519082018190526000906020906060840190828701845b8281101561040d578151845292840192908401906001016103f1565b505050602093909301939093525092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561046257600080fd5b505191905056fea2646970667358221220809f4938683b6d1e8ec7bed0f163e4f6abc095e4e24eda6777219a43e475ee7764736f6c63430008170033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in FRAX
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.