ETH Price: $1,879.92 (-1.53%)

Contract

0xa77b57445FA262CaE325DeD434Df89302c93f59A
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BtrflyOhmBondingCalculator

Compiler Version
v0.7.5+commit.eb77ed08

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU AGPLv3 license
/**
 *Submitted for verification at Etherscan.io on 2021-12-21
*/

// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;

library SafeMath {
  function add(uint256 a, uint256 b) internal pure returns (uint256) {
    uint256 c = a + b;
    require(c >= a, "SafeMath: addition overflow");

    return c;
  }

  function sub(uint256 a, uint256 b) internal pure returns (uint256) {
    return sub(a, b, "SafeMath: subtraction overflow");
  }

  function sub(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b <= a, errorMessage);
    uint256 c = a - b;

    return c;
  }

  function mul(uint256 a, uint256 b) internal pure returns (uint256) {
    if (a == 0) {
      return 0;
    }

    uint256 c = a * b;
    require(c / a == b, "SafeMath: multiplication overflow");

    return c;
  }

  function div(uint256 a, uint256 b) internal pure returns (uint256) {
    return div(a, b, "SafeMath: division by zero");
  }

  function div(
    uint256 a,
    uint256 b,
    string memory errorMessage
  ) internal pure returns (uint256) {
    require(b > 0, errorMessage);
    uint256 c = a / b;
    return c;
  }
}

interface IUniswapV2ERC20 {
  function totalSupply() external view returns (uint256);
}

interface IUniswapV2Pair is IUniswapV2ERC20 {
  function getReserves()
    external
    view
    returns (
      uint112 reserve0,
      uint112 reserve1,
      uint32 blockTimestampLast
    );

  function token0() external view returns (address);

  function token1() external view returns (address);
}

contract BtrflyOhmBondingCalculator{

    using SafeMath for uint256;

    address immutable public BTRFLY;

    constructor( address _BTRFLY ){
      BTRFLY = _BTRFLY;
    }
    
    function valuation(address _token, uint256 _amount) external view returns (uint256 value_){

      address token0 = IUniswapV2Pair(_token).token0();

      (uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(_token).getReserves();

      uint256 totalSupply = IUniswapV2Pair(_token).totalSupply();
      uint256 reserve = token0 == BTRFLY ? reserve1 : reserve0;

      return _amount.mul(reserve).div(totalSupply);

    }

  }

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_BTRFLY","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BTRFLY","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"valuation","outputs":[{"internalType":"uint256","name":"value_","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b506040516104903803806104908339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b031661042561006b60003980609f528061023152506104256000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806322443c101461003b5780634249719f1461005f575b600080fd5b61004361009d565b604080516001600160a01b039092168252519081900360200190f35b61008b6004803603604081101561007557600080fd5b506001600160a01b0381351690602001356100c1565b60408051918252519081900360200190f35b7f000000000000000000000000000000000000000000000000000000000000000081565b600080836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156100fd57600080fd5b505afa158015610111573d6000803e3d6000fd5b505050506040513d602081101561012757600080fd5b505160408051630240bc6b60e21b8152905191925060009182916001600160a01b03881691630902f1ac91600480820192606092909190829003018186803b15801561017257600080fd5b505afa158015610186573d6000803e3d6000fd5b505050506040513d606081101561019c57600080fd5b508051602091820151604080516318160ddd60e01b815290516dffffffffffffffffffffffffffff93841696509290911693506000926001600160a01b038a16926318160ddd926004808201939291829003018186803b1580156101ff57600080fd5b505afa158015610213573d6000803e3d6000fd5b505050506040513d602081101561022957600080fd5b5051905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811690861614610269578361026b565b825b90506102818261027b898461028f565b906102ef565b955050505050505b92915050565b60008261029e57506000610289565b828202828482816102ab57fe5b04146102e85760405162461bcd60e51b81526004018080602001828103825260218152602001806103cf6021913960400191505060405180910390fd5b9392505050565b60006102e883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836103b85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561037d578181015183820152602001610365565b50505050905090810190601f1680156103aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816103c457fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212206fbdfc3bf3ba255556a1a3956045f81bcb2a03c48e97f533309c601f9f5f495764736f6c63430007050033000000000000000000000000c0d4ceb216b3ba9c3701b291766fdcba977cec3a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100365760003560e01c806322443c101461003b5780634249719f1461005f575b600080fd5b61004361009d565b604080516001600160a01b039092168252519081900360200190f35b61008b6004803603604081101561007557600080fd5b506001600160a01b0381351690602001356100c1565b60408051918252519081900360200190f35b7f000000000000000000000000c0d4ceb216b3ba9c3701b291766fdcba977cec3a81565b600080836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156100fd57600080fd5b505afa158015610111573d6000803e3d6000fd5b505050506040513d602081101561012757600080fd5b505160408051630240bc6b60e21b8152905191925060009182916001600160a01b03881691630902f1ac91600480820192606092909190829003018186803b15801561017257600080fd5b505afa158015610186573d6000803e3d6000fd5b505050506040513d606081101561019c57600080fd5b508051602091820151604080516318160ddd60e01b815290516dffffffffffffffffffffffffffff93841696509290911693506000926001600160a01b038a16926318160ddd926004808201939291829003018186803b1580156101ff57600080fd5b505afa158015610213573d6000803e3d6000fd5b505050506040513d602081101561022957600080fd5b5051905060007f000000000000000000000000c0d4ceb216b3ba9c3701b291766fdcba977cec3a6001600160a01b0390811690861614610269578361026b565b825b90506102818261027b898461028f565b906102ef565b955050505050505b92915050565b60008261029e57506000610289565b828202828482816102ab57fe5b04146102e85760405162461bcd60e51b81526004018080602001828103825260218152602001806103cf6021913960400191505060405180910390fd5b9392505050565b60006102e883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836103b85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561037d578181015183820152602001610365565b50505050905090810190601f1680156103aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816103c457fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212206fbdfc3bf3ba255556a1a3956045f81bcb2a03c48e97f533309c601f9f5f495764736f6c63430007050033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000c0d4ceb216b3ba9c3701b291766fdcba977cec3a

-----Decoded View---------------
Arg [0] : _BTRFLY (address): 0xC0d4Ceb216B3BA9C3701B291766fDCbA977ceC3A

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c0d4ceb216b3ba9c3701b291766fdcba977cec3a


Deployed Bytecode Sourcemap

1583:637:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1662:31;;;:::i;:::-;;;;-1:-1:-1;;;;;1662:31:0;;;;;;;;;;;;;;1777:436;;;;;;;;;;;;;;;;-1:-1:-1;;;;;;1777:436:0;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;1662:31;;;:::o;1777:436::-;1852:14;1878;1910:6;-1:-1:-1;;;;;1895:29:0;;:31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1895:31:0;1978:36;;;-1:-1:-1;;;1978:36:0;;;;1895:31;;-1:-1:-1;1938:16:0;;;;-1:-1:-1;;;;;1978:34:0;;;;;:36;;;;;;;;;;;;;;;:34;:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1978:36:0;;;;;;;;2047;;-1:-1:-1;;;2047:36:0;;;;1937:77;;;;;-1:-1:-1;1937:77:0;;;;;-1:-1:-1;2025:19:0;;-1:-1:-1;;;;;2047:34:0;;;;;:36;;;;;1978;2047;;;;;;:34;:36;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;2047:36:0;;-1:-1:-1;2092:15:0;2120:6;-1:-1:-1;;;;;2110:16:0;;;;;;;:38;;2140:8;2110:38;;;2129:8;2110:38;2092:56;-1:-1:-1;2166:37:0;2191:11;2166:20;:7;2092:56;2166:11;:20::i;:::-;:24;;:37::i;:::-;2159:44;;;;;;;1777:436;;;;;:::o;608:222::-;666:7;686:6;682:37;;-1:-1:-1;710:1:0;703:8;;682:37;739:5;;;743:1;739;:5;:1;759:5;;;;;:10;751:56;;;;-1:-1:-1;;;751:56:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;823:1;608:222;-1:-1:-1;;;608:222:0:o;836:126::-;894:7;917:39;921:1;924;917:39;;;;;;;;;;;;;;;;;1074:7;1105:12;1098:5;1090:28;;;;-1:-1:-1;;;1090:28:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1125:9;1141:1;1137;:5;;;;;;;968:195;-1:-1:-1;;;;;968:195:0:o

Swarm Source

ipfs://6fbdfc3bf3ba255556a1a3956045f81bcb2a03c48e97f533309c601f9f5f4957

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.