S Price: $0.53707 (-0.05%)

Contract

0xbf5DF0FE9DF04b50dB68125991F0610546d6f7C1

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x1765f078...bB84e5073
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Uniswap3Data

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion
File 1 of 1 : Uniswap3Data.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface Uniswap3SC{
    function liquidity() external view returns (uint128);
	function tickSpacing() external view returns (int24);
	function slot0() external view returns (
        uint160 sqrtPriceX96,
        int24 tick,
        uint16 observationIndex,
        uint16 observationCardinality,
        uint16 observationCardinalityNext,
        uint8 feeProtocol,
        bool unlocked
    );
	function ticks(int24 tick) external view returns (
        uint128 liquidityGross,
        int128 liquidityNet,
        uint256 feeGrowthOutside0X128,
        uint256 feeGrowthOutside1X128,
        int56 tickCumulativeOutside,
        uint160 secondsPerLiquidityOutsideX128,
        uint32 secondsOutside,
        bool initialized
    );
	function token0() external view returns (address);
	function token1() external view returns (address);
}

contract Uniswap3Data{
	
	struct TickRange {
        int24 lower;
        int24 upper;
    }
	function calculateTickRange(int24 tick, int24 tickSpace) internal pure returns (TickRange memory range) {

        if(tick >= 0){
		
            range.lower = int24(int256(tick / tickSpace) * tickSpace);
            range.upper = range.lower + tickSpace;
			
        }else{
			
			if(tick % tickSpace != 0){
			
				range.upper = int24(int256(tick / tickSpace) * tickSpace);
				range.lower = range.upper - tickSpace;
			
			}else{
			
				range.lower = tick;
				range.upper = tick + tickSpace;
			
			}
			
		}
        
        return range;
	}
	
	struct LiquidityNetData{
		int24 tick;
		int128 liquidityNet;
	}
	struct LiquidityNets {
		LiquidityNetData[] lower;
		LiquidityNetData[] upper;
	}
	function getLiquidityNets(Uniswap3SC poolSC, TickRange memory tickRange, int24 tickSpacing, uint16 numTicks) internal view returns (LiquidityNets memory liquidityNets){

		LiquidityNetData[] memory liquidityNetsUp = new LiquidityNetData[](numTicks);
		LiquidityNetData[] memory liquidityNetsDown = new LiquidityNetData[](numTicks);
		
		for (uint16 i = 0; i < numTicks; i++) {

			int24 tickStep = (tickSpacing * int24(int16(i)));

            //up
            int24 tickUp = tickRange.upper + tickStep;
            (, int128 lqNetUp, , , , , , ) = poolSC.ticks(tickUp);
            liquidityNetsUp[i].tick = tickUp;
			liquidityNetsUp[i].liquidityNet = lqNetUp;

            //down
            int24 tickDown = tickRange.lower - tickStep;
            (, int128 lqNetDown, , , , , , ) = poolSC.ticks(tickDown);
            liquidityNetsDown[i].tick = tickDown;
			liquidityNetsDown[i].liquidityNet = lqNetDown;

        }
		
		liquidityNets.upper = liquidityNetsUp;
		liquidityNets.lower = liquidityNetsDown;
		
	}
    
    function getCurrentTickData(address pool) external view returns (uint128 liquidity, int24 tick, int24 tickSpacing) {

		Uniswap3SC poolSC = Uniswap3SC(pool);
        
		liquidity = poolSC.liquidity();
		(, tick, , , , , ) = poolSC.slot0();
		tickSpacing = poolSC.tickSpacing();
		
	}

    function getTicksData(address pool, uint16 numTicks) external view returns (
			uint128 liquidity, 
			int24 tick, int24 tickSpacing, int24[] memory tickRange, 
			LiquidityNetData[] memory liquidityNetsUpper, LiquidityNetData[] memory liquidityNetsLower,
			address[] memory tokens
		){

		//create SC
        Uniswap3SC poolSC = Uniswap3SC(pool);
		
		//get liquidity, tick and tick space
        liquidity = poolSC.liquidity();
        (, tick, , , , , ) = poolSC.slot0();
		tickSpacing = poolSC.tickSpacing();
		
		//calculate the range for tick
        TickRange memory tickRangeObj = calculateTickRange(tick, tickSpacing);
		
		//put it in return variable
		tickRange = new int24[](2);
		tickRange[0] = tickRangeObj.lower;
		tickRange[1] = tickRangeObj.upper;

		//get liquidity nets for numTicks tickere
        LiquidityNets memory liquidityNets = getLiquidityNets(poolSC, tickRangeObj, tickSpacing, numTicks);
		
		//split them
		liquidityNetsUpper = liquidityNets.upper;
		liquidityNetsLower = liquidityNets.lower;
		
		//get the tokens
		tokens = new address[](2);
		tokens[0] = poolSC.token0();
		tokens[1] = poolSC.token1();

    }

    function getTickRange(int24 tick, int24 tickSpace) external pure returns (int24 lower, int24 upper) {
        TickRange memory range = calculateTickRange(tick, tickSpace);
        return (range.lower, range.upper);
    }

}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"getCurrentTickData","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"int24","name":"tickSpace","type":"int24"}],"name":"getTickRange","outputs":[{"internalType":"int24","name":"lower","type":"int24"},{"internalType":"int24","name":"upper","type":"int24"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint16","name":"numTicks","type":"uint16"}],"name":"getTicksData","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"int24","name":"tickSpacing","type":"int24"},{"internalType":"int24[]","name":"tickRange","type":"int24[]"},{"components":[{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"int128","name":"liquidityNet","type":"int128"}],"internalType":"struct Uniswap3Data.LiquidityNetData[]","name":"liquidityNetsUpper","type":"tuple[]"},{"components":[{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"int128","name":"liquidityNet","type":"int128"}],"internalType":"struct Uniswap3Data.LiquidityNetData[]","name":"liquidityNetsLower","type":"tuple[]"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636e1e389a14610046578063ce93059514610078578063fe1f0744146100ae575b600080fd5b610060600480360381019061005b9190610b78565b6100df565b60405161006f93929190610bec565b60405180910390f35b610092600480360381019061008d9190610c5d565b61025b565b6040516100a59796959493929190610f13565b60405180910390f35b6100c860048036038101906100c39190610fca565b61067d565b6040516100d692919061100a565b60405180910390f35b6000806000808490508073ffffffffffffffffffffffffffffffffffffffff16631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa158015610133573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610157919061105f565b93508073ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156101a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c89190611153565b90919293949550909192935090919250909150905050809350508073ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561022d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025191906111f5565b9150509193909250565b600080600060608060608060008990508073ffffffffffffffffffffffffffffffffffffffff16631a6865026040518163ffffffff1660e01b8152600401602060405180830381865afa1580156102b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102da919061105f565b97508073ffffffffffffffffffffffffffffffffffffffff16633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061034b9190611153565b90919293949550909192935090919250909150905050809750508073ffffffffffffffffffffffffffffffffffffffff1663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103d491906111f5565b955060006103e288886106a4565b9050600267ffffffffffffffff8111156103ff576103fe611222565b5b60405190808252806020026020018201604052801561042d5781602001602082028036833780820191505090505b50955080600001518660008151811061044957610448611251565b5b602002602001019060020b908160020b8152505080602001518660018151811061047657610475611251565b5b602002602001019060020b908160020b81525050600061049883838a8e6107ac565b90508060200151955080600001519450600267ffffffffffffffff8111156104c3576104c2611222565b5b6040519080825280602002602001820160405280156104f15781602001602082028036833780820191505090505b5093508273ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561053f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105639190611295565b8460008151811061057757610576611251565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508273ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106209190611295565b8460018151811061063457610633611251565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505050505092959891949750929550565b600080600061068c85856106a4565b90508060000151816020015192509250509250929050565b6106ac610abb565b60008360020b1261070b578160020b82846106c79190611320565b60020b6106d49190611394565b816000019060020b908160020b815250508181600001516106f5919061140c565b816020019060020b908160020b815250506107a6565b600082846107199190611467565b60020b14610775578160020b82846107319190611320565b60020b61073e9190611394565b816020019060020b908160020b8152505081816020015161075f9190611498565b816000019060020b908160020b815250506107a5565b82816000019060020b908160020b815250508183610793919061140c565b816020019060020b908160020b815250505b5b92915050565b6107b4610adb565b60008261ffff1667ffffffffffffffff8111156107d4576107d3611222565b5b60405190808252806020026020018201604052801561080d57816020015b6107fa610af5565b8152602001906001900390816107f25790505b50905060008361ffff1667ffffffffffffffff8111156108305761082f611222565b5b60405190808252806020026020018201604052801561086957816020015b610856610af5565b81526020019060019003908161084e5790505b50905060005b8461ffff168161ffff161015610a9e5760008160010b8761089091906114f3565b905060008189602001516108a4919061140c565b905060008a73ffffffffffffffffffffffffffffffffffffffff1663f30dba93836040518263ffffffff1660e01b81526004016108e19190611530565b61010060405180830381865afa1580156108ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109239190611622565b50505050505091505081868561ffff168151811061094457610943611251565b5b60200260200101516000019060020b908160020b8152505080868561ffff168151811061097457610973611251565b5b602002602001015160200190600f0b9081600f0b815250506000838b6000015161099e9190611498565b905060008c73ffffffffffffffffffffffffffffffffffffffff1663f30dba93836040518263ffffffff1660e01b81526004016109db9190611530565b61010060405180830381865afa1580156109f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1d9190611622565b50505050505091505081878761ffff1681518110610a3e57610a3d611251565b5b60200260200101516000019060020b908160020b8152505080878761ffff1681518110610a6e57610a6d611251565b5b602002602001015160200190600f0b9081600f0b8152505050505050508080610a96906116d8565b91505061086f565b508183602001819052508083600001819052505050949350505050565b6040518060400160405280600060020b8152602001600060020b81525090565b604051806040016040528060608152602001606081525090565b6040518060400160405280600060020b81526020016000600f0b81525090565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610b4582610b1a565b9050919050565b610b5581610b3a565b8114610b6057600080fd5b50565b600081359050610b7281610b4c565b92915050565b600060208284031215610b8e57610b8d610b15565b5b6000610b9c84828501610b63565b91505092915050565b60006fffffffffffffffffffffffffffffffff82169050919050565b610bca81610ba5565b82525050565b60008160020b9050919050565b610be681610bd0565b82525050565b6000606082019050610c016000830186610bc1565b610c0e6020830185610bdd565b610c1b6040830184610bdd565b949350505050565b600061ffff82169050919050565b610c3a81610c23565b8114610c4557600080fd5b50565b600081359050610c5781610c31565b92915050565b60008060408385031215610c7457610c73610b15565b5b6000610c8285828601610b63565b9250506020610c9385828601610c48565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610cd281610bd0565b82525050565b6000610ce48383610cc9565b60208301905092915050565b6000602082019050919050565b6000610d0882610c9d565b610d128185610ca8565b9350610d1d83610cb9565b8060005b83811015610d4e578151610d358882610cd8565b9750610d4083610cf0565b925050600181019050610d21565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081600f0b9050919050565b610d9d81610d87565b82525050565b604082016000820151610db96000850182610cc9565b506020820151610dcc6020850182610d94565b50505050565b6000610dde8383610da3565b60408301905092915050565b6000602082019050919050565b6000610e0282610d5b565b610e0c8185610d66565b9350610e1783610d77565b8060005b83811015610e48578151610e2f8882610dd2565b9750610e3a83610dea565b925050600181019050610e1b565b5085935050505092915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b610e8a81610b3a565b82525050565b6000610e9c8383610e81565b60208301905092915050565b6000602082019050919050565b6000610ec082610e55565b610eca8185610e60565b9350610ed583610e71565b8060005b83811015610f06578151610eed8882610e90565b9750610ef883610ea8565b925050600181019050610ed9565b5085935050505092915050565b600060e082019050610f28600083018a610bc1565b610f356020830189610bdd565b610f426040830188610bdd565b8181036060830152610f548187610cfd565b90508181036080830152610f688186610df7565b905081810360a0830152610f7c8185610df7565b905081810360c0830152610f908184610eb5565b905098975050505050505050565b610fa781610bd0565b8114610fb257600080fd5b50565b600081359050610fc481610f9e565b92915050565b60008060408385031215610fe157610fe0610b15565b5b6000610fef85828601610fb5565b925050602061100085828601610fb5565b9150509250929050565b600060408201905061101f6000830185610bdd565b61102c6020830184610bdd565b9392505050565b61103c81610ba5565b811461104757600080fd5b50565b60008151905061105981611033565b92915050565b60006020828403121561107557611074610b15565b5b60006110838482850161104a565b91505092915050565b61109581610b1a565b81146110a057600080fd5b50565b6000815190506110b28161108c565b92915050565b6000815190506110c781610f9e565b92915050565b6000815190506110dc81610c31565b92915050565b600060ff82169050919050565b6110f8816110e2565b811461110357600080fd5b50565b600081519050611115816110ef565b92915050565b60008115159050919050565b6111308161111b565b811461113b57600080fd5b50565b60008151905061114d81611127565b92915050565b600080600080600080600060e0888a03121561117257611171610b15565b5b60006111808a828b016110a3565b97505060206111918a828b016110b8565b96505060406111a28a828b016110cd565b95505060606111b38a828b016110cd565b94505060806111c48a828b016110cd565b93505060a06111d58a828b01611106565b92505060c06111e68a828b0161113e565b91505092959891949750929550565b60006020828403121561120b5761120a610b15565b5b6000611219848285016110b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008151905061128f81610b4c565b92915050565b6000602082840312156112ab576112aa610b15565b5b60006112b984828501611280565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061132b82610bd0565b915061133683610bd0565b925082611346576113456112c2565b5b600160000383147fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000008314161561137f5761137e6112f1565b5b828205905092915050565b6000819050919050565b600061139f8261138a565b91506113aa8361138a565b92508282026113b88161138a565b91507f800000000000000000000000000000000000000000000000000000000000000084146000841216156113f0576113ef6112f1565b5b8282058414831517611405576114046112f1565b5b5092915050565b600061141782610bd0565b915061142283610bd0565b925082820190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8000008112627fffff82131715611461576114606112f1565b5b92915050565b600061147282610bd0565b915061147d83610bd0565b92508261148d5761148c6112c2565b5b828207905092915050565b60006114a382610bd0565b91506114ae83610bd0565b92508282039050627fffff81137fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff800000821217156114ed576114ec6112f1565b5b92915050565b60006114fe82610bd0565b915061150983610bd0565b925082820261151781610bd0565b9150808214611529576115286112f1565b5b5092915050565b60006020820190506115456000830184610bdd565b92915050565b61155481610d87565b811461155f57600080fd5b50565b6000815190506115718161154b565b92915050565b6000819050919050565b61158a81611577565b811461159557600080fd5b50565b6000815190506115a781611581565b92915050565b60008160060b9050919050565b6115c3816115ad565b81146115ce57600080fd5b50565b6000815190506115e0816115ba565b92915050565b600063ffffffff82169050919050565b6115ff816115e6565b811461160a57600080fd5b50565b60008151905061161c816115f6565b92915050565b600080600080600080600080610100898b03121561164357611642610b15565b5b60006116518b828c0161104a565b98505060206116628b828c01611562565b97505060406116738b828c01611598565b96505060606116848b828c01611598565b95505060806116958b828c016115d1565b94505060a06116a68b828c016110a3565b93505060c06116b78b828c0161160d565b92505060e06116c88b828c0161113e565b9150509295985092959890939650565b60006116e382610c23565b915061ffff82036116f7576116f66112f1565b5b60018201905091905056fea26469706673582212203efdd1100024d784f9e1a2b89228833494211f820d90882d9b641397a56dc8f864736f6c63430008130033

Block Transaction 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

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.