Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 25 internal transactions (View All)
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xf3E4FdE0...2FE6EE461 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
BasePluginV1Factory
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 1000000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.20;
import '@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol';
import '@cryptoalgebra/integral-core/contracts/interfaces/IAlgebraFactory.sol';
import '@cryptoalgebra/integral-core/contracts/base/BlastGovernorSetup.sol';
import './interfaces/IBasePluginV1Factory.sol';
import './libraries/AdaptiveFee.sol';
import './interfaces/IAlgebraBasePluginV1.sol';
/// @title Algebra Integral 1.0 default plugin factory
/// @notice This contract creates Algebra default plugins for Algebra liquidity pools
contract BasePluginV1Factory is IBasePluginV1Factory, BlastGovernorSetup {
/// @inheritdoc IBasePluginV1Factory
bytes32 public constant override ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR = keccak256('ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR');
/// @inheritdoc IBasePluginV1Factory
address public immutable override algebraFactory;
/// @inheritdoc IBasePluginV1Factory
AlgebraFeeConfiguration public override defaultFeeConfiguration; // values of constants for sigmoids in fee calculation formula
/// @inheritdoc IBasePluginV1Factory
address public override farmingAddress;
/// @inheritdoc IBasePluginV1Factory
address public override defaultBlastGovernor;
/// @inheritdoc IBeacon
address public override implementation;
/// @inheritdoc IBasePluginV1Factory
mapping(address poolAddress => address pluginAddress) public override pluginByPool;
modifier onlyAdministrator() {
require(IAlgebraFactory(algebraFactory).hasRoleOrOwner(ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR, msg.sender), 'Only administrator');
_;
}
constructor(address _blastGovernor, address _algebraFactory, address _basePluginV1Implementation) {
__BlastGovernorSetup_init(_blastGovernor);
defaultBlastGovernor = _blastGovernor;
algebraFactory = _algebraFactory;
defaultFeeConfiguration = AdaptiveFee.initialFeeConfiguration();
_setImplementation(_basePluginV1Implementation);
emit DefaultFeeConfiguration(defaultFeeConfiguration);
}
/// @inheritdoc IAlgebraPluginFactory
function createPlugin(address pool, address, address) external override returns (address) {
require(msg.sender == algebraFactory);
return _createPlugin(pool);
}
/// @inheritdoc IBasePluginV1Factory
function createPluginForExistingPool(address token0, address token1) external override returns (address) {
IAlgebraFactory factory = IAlgebraFactory(algebraFactory);
require(factory.hasRoleOrOwner(factory.POOLS_ADMINISTRATOR_ROLE(), msg.sender));
address pool = factory.poolByPair(token0, token1);
require(pool != address(0), 'Pool not exist');
return _createPlugin(pool);
}
function _createPlugin(address pool) internal returns (address) {
require(pluginByPool[pool] == address(0), 'Already created');
IAlgebraBasePluginV1 volatilityOracle = IAlgebraBasePluginV1(address(new BeaconProxy(address(this), '')));
volatilityOracle.initialize(defaultBlastGovernor, pool, algebraFactory, address(this));
volatilityOracle.changeFeeConfiguration(defaultFeeConfiguration);
pluginByPool[pool] = address(volatilityOracle);
return address(volatilityOracle);
}
/// @inheritdoc IBasePluginV1Factory
function setDefaultBlastGovernor(address defaultBlastGovernor_) external override onlyAdministrator {
defaultBlastGovernor = defaultBlastGovernor_;
emit DefaultBlastGovernor(defaultBlastGovernor_);
}
/// @inheritdoc IBasePluginV1Factory
function setDefaultFeeConfiguration(AlgebraFeeConfiguration calldata newConfig) external override onlyAdministrator {
AdaptiveFee.validateFeeConfiguration(newConfig);
defaultFeeConfiguration = newConfig;
emit DefaultFeeConfiguration(newConfig);
}
/// @inheritdoc IBasePluginV1Factory
function setFarmingAddress(address newFarmingAddress) external override onlyAdministrator {
require(farmingAddress != newFarmingAddress);
farmingAddress = newFarmingAddress;
emit FarmingAddress(newFarmingAddress);
}
/**
* @dev Upgrades the beacon to a new implementation.
*
* Emits an {Upgraded} event.
*
* Requirements:
*
* - msg.sender must be the plugin adminisrator.
* - `newImplementation` must be a contract.
*/
function upgradeTo(address newImplementation) external onlyAdministrator {
_setImplementation(newImplementation);
}
/**
* @dev Sets the implementation contract address for this beacon
*
* Requirements:
*
* - `newImplementation` must be a contract.
*/
function _setImplementation(address newImplementation) private {
if (newImplementation.code.length == 0) {
revert BeaconInvalidImplementation(newImplementation);
}
implementation = newImplementation;
emit Upgraded(newImplementation);
}
}// SPDX-License-Identifier: MIT
pragma solidity =0.8.20;
import {IBlast} from '../interfaces/IBlast.sol';
/**
* @title Blast Governor Setup
* @dev Abstract contract for setting up a governor in the Blast ecosystem.
* This contract provides an initialization function to configure a governor address
* for the Blast protocol, utilizing the `IBlast` interface.
*/
abstract contract BlastGovernorSetup {
/// @dev Error thrown when an operation involves a zero address where a valid address is required.
error AddressZero();
/**
* @dev Initializes the governor configuration for the Blast protocol.
* This internal function is meant to be called in the initialization process
* of a derived contract that sets up governance.
*
* @param blastGovernor_ The address of the governor to be configured in the Blast protocol.
* Must be a non-zero address.
*/
function __BlastGovernorSetup_init(address blastGovernor_) internal {
if (blastGovernor_ == address(0)) {
revert AddressZero();
}
IBlast(0x4300000000000000000000000000000000000002).configureGovernor(blastGovernor_);
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma abicoder v2;
import './plugin/IAlgebraPluginFactory.sol';
import './vault/IAlgebraVaultFactory.sol';
/// @title The interface for the Algebra Factory
/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces
interface IAlgebraFactory {
/// @notice Emitted when a process of ownership renounce is started
/// @param timestamp The timestamp of event
/// @param finishTimestamp The timestamp when ownership renounce will be possible to finish
event RenounceOwnershipStart(uint256 timestamp, uint256 finishTimestamp);
/// @notice Emitted when a process of ownership renounce cancelled
/// @param timestamp The timestamp of event
event RenounceOwnershipStop(uint256 timestamp);
/// @notice Emitted when a process of ownership renounce finished
/// @param timestamp The timestamp of ownership renouncement
event RenounceOwnershipFinish(uint256 timestamp);
/// @notice Emitted when a pool is created
/// @param token0 The first token of the pool by address sort order
/// @param token1 The second token of the pool by address sort order
/// @param pool The address of the created pool
event Pool(address indexed token0, address indexed token1, address pool);
/// @notice Emitted when the default community fee is changed
/// @param newDefaultCommunityFee The new default community fee value
event DefaultCommunityFee(uint16 newDefaultCommunityFee);
/// @notice Emitted when the default tickspacing is changed
/// @param newDefaultTickspacing The new default tickspacing value
event DefaultTickspacing(int24 newDefaultTickspacing);
/// @notice Emitted when the default fee is changed
/// @param newDefaultFee The new default fee value
event DefaultFee(uint16 newDefaultFee);
/// @notice Emitted when the defaultPluginFactory address is changed
/// @param defaultPluginFactoryAddress The new defaultPluginFactory address
event DefaultPluginFactory(address defaultPluginFactoryAddress);
/// @notice Emitted when the vaultFactory address is changed
/// @param newVaultFactory The new vaultFactory address
event VaultFactory(address newVaultFactory);
/// @notice Emitted when the pools creation mode is changed
/// @param mode_ The new pools creation mode
event PublicPoolCreationMode(bool mode_);
/// @dev Emitted when set new default blast governor address is changed.
/// @param defaultBlastGovernor The new default blast governor address
event DefaultBlastGovernor(address indexed defaultBlastGovernor);
/// @notice role that can change communityFee and tickspacing in pools
/// @return The hash corresponding to this role
function POOLS_ADMINISTRATOR_ROLE() external view returns (bytes32);
/// @notice role that can create pools when public pool creation is disabled
/// @return The hash corresponding to this role
function POOLS_CREATOR_ROLE() external view returns (bytes32);
/// @notice Returns `true` if `account` has been granted `role` or `account` is owner.
/// @param role The hash corresponding to the role
/// @param account The address for which the role is checked
/// @return bool Whether the address has this role or the owner role or not
function hasRoleOrOwner(bytes32 role, address account) external view returns (bool);
/// @notice Returns the current owner of the factory
/// @dev Can be changed by the current owner via transferOwnership(address newOwner)
/// @return The address of the factory owner
function owner() external view returns (address);
/// @notice Returns the current default blast governor
/// @return The address of the default blast governor
function defaultBlastGovernor() external view returns (address);
/// @notice Returns the current poolDeployerAddress
/// @return The address of the poolDeployer
function poolDeployer() external view returns (address);
/// @notice Returns the status of enable public pool creation mode
/// @return bool Whether the public creation mode is enable or not
function isPublicPoolCreationMode() external view returns (bool);
/// @notice Returns the default community fee
/// @return Fee which will be set at the creation of the pool
function defaultCommunityFee() external view returns (uint16);
/// @notice Returns the default fee
/// @return Fee which will be set at the creation of the pool
function defaultFee() external view returns (uint16);
/// @notice Returns the default tickspacing
/// @return Tickspacing which will be set at the creation of the pool
function defaultTickspacing() external view returns (int24);
/// @notice Return the current pluginFactory address
/// @dev This contract is used to automatically set a plugin address in new liquidity pools
/// @return Algebra plugin factory
function defaultPluginFactory() external view returns (IAlgebraPluginFactory);
/// @notice Return the current vaultFactory address
/// @dev This contract is used to automatically set a vault address in new liquidity pools
/// @return Algebra vault factory
function vaultFactory() external view returns (IAlgebraVaultFactory);
/// @notice Returns the default communityFee, tickspacing, fee and communityFeeVault for pool
/// @param pool the address of liquidity pool
/// @return communityFee which will be set at the creation of the pool
/// @return tickSpacing which will be set at the creation of the pool
/// @return fee which will be set at the creation of the pool
/// @return communityFeeVault the address of communityFeeVault
function defaultConfigurationForPool(
address pool
) external view returns (uint16 communityFee, int24 tickSpacing, uint16 fee, address communityFeeVault);
/// @notice Deterministically computes the pool address given the token0 and token1
/// @dev The method does not check if such a pool has been created
/// @param token0 first token
/// @param token1 second token
/// @return pool The contract address of the Algebra pool
function computePoolAddress(address token0, address token1) external view returns (address pool);
/// @notice Returns the pool address for a given pair of tokens, or address 0 if it does not exist
/// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
/// @param tokenA The contract address of either token0 or token1
/// @param tokenB The contract address of the other token
/// @return pool The pool address
function poolByPair(address tokenA, address tokenB) external view returns (address pool);
/// @notice returns keccak256 of AlgebraPool init bytecode.
/// @dev the hash value changes with any change in the pool bytecode
/// @return Keccak256 hash of AlgebraPool contract init bytecode
function POOL_INIT_CODE_HASH() external view returns (bytes32);
/// @return timestamp The timestamp of the beginning of the renounceOwnership process
function renounceOwnershipStartTimestamp() external view returns (uint256 timestamp);
/// @notice Creates a pool for the given two tokens
/// @param tokenA One of the two tokens in the desired pool
/// @param tokenB The other of the two tokens in the desired pool
/// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0.
/// The call will revert if the pool already exists or the token arguments are invalid.
/// @return pool The address of the newly created pool
function createPool(address tokenA, address tokenB) external returns (address pool);
/// @dev updates pools creation mode
/// @param mode_ the new mode for pools creation proccess
function setIsPublicPoolCreationMode(bool mode_) external;
/// @dev updates default community fee for new pools
/// @param newDefaultCommunityFee The new community fee, _must_ be <= MAX_COMMUNITY_FEE
function setDefaultCommunityFee(uint16 newDefaultCommunityFee) external;
/// @dev updates default fee for new pools
/// @param newDefaultFee The new fee, _must_ be <= MAX_DEFAULT_FEE
function setDefaultFee(uint16 newDefaultFee) external;
/// @dev updates default tickspacing for new pools
/// @param newDefaultTickspacing The new tickspacing, _must_ be <= MAX_TICK_SPACING and >= MIN_TICK_SPACING
function setDefaultTickspacing(int24 newDefaultTickspacing) external;
/// @dev updates pluginFactory address
/// @param newDefaultPluginFactory address of new plugin factory
function setDefaultPluginFactory(address newDefaultPluginFactory) external;
/// @dev updates vaultFactory address
/// @param newVaultFactory address of new vault factory
function setVaultFactory(address newVaultFactory) external;
/// @notice Starts process of renounceOwnership. After that, a certain period
/// of time must pass before the ownership renounce can be completed.
function startRenounceOwnership() external;
/// @notice Stops process of renounceOwnership and removes timer.
function stopRenounceOwnership() external;
/// @dev updates default blast governor address on the factory
/// @param defaultBlastGovernor_ The new defautl blast governor address
function setDefaultBlastGovernor(address defaultBlastGovernor_) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
/**
* @title IBlast Interface
* @dev Interface for interacting with the Blast protocol, specifically for configuring
* governance settings. This interface abstracts the function to set up a governor
* within the Blast ecosystem.
*/
interface IBlast {
function configureGovernor(address _governor) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title The interface for the Algebra plugin with dynamic fee logic
/// @dev A plugin with a dynamic fee must implement this interface so that the current fee can be known through the pool
/// If the dynamic fee logic does not allow the fee to be calculated without additional data, the method should revert with the appropriate message
interface IAlgebraDynamicFeePlugin {
/// @notice Returns fee from plugin
/// @return fee The pool fee value in hundredths of a bip, i.e. 1e-6
function getCurrentFee() external view returns (uint16 fee);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title An interface for a contract that is capable of deploying Algebra plugins
/// @dev Such a factory is needed if the plugin should be automatically created and connected to each new pool
interface IAlgebraPluginFactory {
/// @notice Deploys new plugin contract for pool
/// @param pool The address of the pool for which the new plugin will be created
/// @param token0 First token of the pool
/// @param token1 Second token of the pool
/// @return New plugin address
function createPlugin(address pool, address token0, address token1) external returns (address);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title The interface for the Algebra Vault Factory
/// @notice This contract can be used for automatic vaults creation
/// @dev Version: Algebra Integral
interface IAlgebraVaultFactory {
/// @notice returns address of the community fee vault for the pool
/// @param pool the address of Algebra Integral pool
/// @return communityFeeVault the address of community fee vault
function getVaultForPool(address pool) external view returns (address communityFeeVault);
/// @notice creates the community fee vault for the pool if needed
/// @param pool the address of Algebra Integral pool
/// @return communityFeeVault the address of community fee vault
function createVaultForPool(address pool) external returns (address communityFeeVault);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0 <0.9.0;
/// @title Contains common constants for Algebra contracts
/// @dev Constants moved to the library, not the base contract, to further emphasize their constant nature
library Constants {
uint8 internal constant RESOLUTION = 96;
uint256 internal constant Q96 = 1 << 96;
uint256 internal constant Q128 = 1 << 128;
uint24 internal constant FEE_DENOMINATOR = 1e6;
uint16 internal constant FLASH_FEE = 0.01e4; // fee for flash loan in hundredths of a bip (0.01%)
uint16 internal constant INIT_DEFAULT_FEE = 0.05e4; // init default fee value in hundredths of a bip (0.05%)
uint16 internal constant MAX_DEFAULT_FEE = 5e4; // max default fee value in hundredths of a bip (5%)
int24 internal constant INIT_DEFAULT_TICK_SPACING = 60;
int24 internal constant MAX_TICK_SPACING = 500;
int24 internal constant MIN_TICK_SPACING = 1;
// the frequency with which the accumulated community fees are sent to the vault
uint32 internal constant COMMUNITY_FEE_TRANSFER_FREQUENCY = 1 hours;
// max(uint128) / (MAX_TICK - MIN_TICK)
uint128 internal constant MAX_LIQUIDITY_PER_TICK = 191757638537527648490752896198553;
uint16 internal constant MAX_COMMUNITY_FEE = 1e3; // 100%
uint256 internal constant COMMUNITY_FEE_DENOMINATOR = 1e3;
// role that can change settings in pools
bytes32 internal constant POOLS_ADMINISTRATOR_ROLE = keccak256('POOLS_ADMINISTRATOR');
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified
* proxy whose upgrades are fully controlled by the current implementation.
*/
interface IERC1822Proxiable {
/**
* @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation
* address.
*
* IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks
* bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this
* function revert if invoked through a proxy.
*/
function proxiableUUID() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC1967.sol)
pragma solidity ^0.8.0;
/**
* @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
*
* _Available since v4.8.3._
*/
interface IERC1967 {
/**
* @dev Emitted when the implementation is upgraded.
*/
event Upgraded(address indexed implementation);
/**
* @dev Emitted when the admin account has changed.
*/
event AdminChanged(address previousAdmin, address newAdmin);
/**
* @dev Emitted when the beacon is changed.
*/
event BeaconUpgraded(address indexed beacon);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (proxy/beacon/BeaconProxy.sol)
pragma solidity ^0.8.0;
import "./IBeacon.sol";
import "../Proxy.sol";
import "../ERC1967/ERC1967Upgrade.sol";
/**
* @dev This contract implements a proxy that gets the implementation address for each call from an {UpgradeableBeacon}.
*
* The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't
* conflict with the storage layout of the implementation behind the proxy.
*
* _Available since v3.4._
*/
contract BeaconProxy is Proxy, ERC1967Upgrade {
/**
* @dev Initializes the proxy with `beacon`.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
* will typically be an encoded function call, and allows initializing the storage of the proxy like a Solidity
* constructor.
*
* Requirements:
*
* - `beacon` must be a contract with the interface {IBeacon}.
*/
constructor(address beacon, bytes memory data) payable {
_upgradeBeaconToAndCall(beacon, data, false);
}
/**
* @dev Returns the current beacon address.
*/
function _beacon() internal view virtual returns (address) {
return _getBeacon();
}
/**
* @dev Returns the current implementation address of the associated beacon.
*/
function _implementation() internal view virtual override returns (address) {
return IBeacon(_getBeacon()).implementation();
}
/**
* @dev Changes the proxy to use a new beacon. Deprecated: see {_upgradeBeaconToAndCall}.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.
*
* Requirements:
*
* - `beacon` must be a contract.
* - The implementation returned by `beacon` must be a contract.
*/
function _setBeacon(address beacon, bytes memory data) internal virtual {
_upgradeBeaconToAndCall(beacon, data, false);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)
pragma solidity ^0.8.0;
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/ERC1967/ERC1967Upgrade.sol)
pragma solidity ^0.8.2;
import "../beacon/IBeacon.sol";
import "../../interfaces/IERC1967.sol";
import "../../interfaces/draft-IERC1822.sol";
import "../../utils/Address.sol";
import "../../utils/StorageSlot.sol";
/**
* @dev This abstract contract provides getters and event emitting update functions for
* https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.
*
* _Available since v4.1._
*/
abstract contract ERC1967Upgrade is IERC1967 {
// This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1
bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;
/**
* @dev Storage slot with the address of the current implementation.
* This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
/**
* @dev Returns the current implementation address.
*/
function _getImplementation() internal view returns (address) {
return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 implementation slot.
*/
function _setImplementation(address newImplementation) private {
require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
}
/**
* @dev Perform implementation upgrade
*
* Emits an {Upgraded} event.
*/
function _upgradeTo(address newImplementation) internal {
_setImplementation(newImplementation);
emit Upgraded(newImplementation);
}
/**
* @dev Perform implementation upgrade with additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCall(address newImplementation, bytes memory data, bool forceCall) internal {
_upgradeTo(newImplementation);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(newImplementation, data);
}
}
/**
* @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.
*
* Emits an {Upgraded} event.
*/
function _upgradeToAndCallUUPS(address newImplementation, bytes memory data, bool forceCall) internal {
// Upgrades from old implementations will perform a rollback test. This test requires the new
// implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing
// this special case will break upgrade paths from old UUPS implementation to new ones.
if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {
_setImplementation(newImplementation);
} else {
try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {
require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID");
} catch {
revert("ERC1967Upgrade: new implementation is not UUPS");
}
_upgradeToAndCall(newImplementation, data, forceCall);
}
}
/**
* @dev Storage slot with the admin of the contract.
* This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is
* validated in the constructor.
*/
bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;
/**
* @dev Returns the current admin.
*/
function _getAdmin() internal view returns (address) {
return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;
}
/**
* @dev Stores a new address in the EIP1967 admin slot.
*/
function _setAdmin(address newAdmin) private {
require(newAdmin != address(0), "ERC1967: new admin is the zero address");
StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;
}
/**
* @dev Changes the admin of the proxy.
*
* Emits an {AdminChanged} event.
*/
function _changeAdmin(address newAdmin) internal {
emit AdminChanged(_getAdmin(), newAdmin);
_setAdmin(newAdmin);
}
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Returns the current beacon.
*/
function _getBeacon() internal view returns (address) {
return StorageSlot.getAddressSlot(_BEACON_SLOT).value;
}
/**
* @dev Stores a new beacon in the EIP1967 beacon slot.
*/
function _setBeacon(address newBeacon) private {
require(Address.isContract(newBeacon), "ERC1967: new beacon is not a contract");
require(
Address.isContract(IBeacon(newBeacon).implementation()),
"ERC1967: beacon implementation is not a contract"
);
StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;
}
/**
* @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does
* not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).
*
* Emits a {BeaconUpgraded} event.
*/
function _upgradeBeaconToAndCall(address newBeacon, bytes memory data, bool forceCall) internal {
_setBeacon(newBeacon);
emit BeaconUpgraded(newBeacon);
if (data.length > 0 || forceCall) {
Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)
pragma solidity ^0.8.0;
/**
* @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
* instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
* be specified by overriding the virtual {_implementation} function.
*
* Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
* different contract through the {_delegate} function.
*
* The success and return data of the delegated call will be returned back to the caller of the proxy.
*/
abstract contract Proxy {
/**
* @dev Delegates the current call to `implementation`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _delegate(address implementation) internal virtual {
assembly {
// Copy msg.data. We take full control of memory in this inline assembly
// block because it will not return to Solidity code. We overwrite the
// Solidity scratch pad at memory position 0.
calldatacopy(0, 0, calldatasize())
// Call the implementation.
// out and outsize are 0 because we don't know the size yet.
let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)
// Copy the returned data.
returndatacopy(0, 0, returndatasize())
switch result
// delegatecall returns 0 on error.
case 0 {
revert(0, returndatasize())
}
default {
return(0, returndatasize())
}
}
}
/**
* @dev This is a virtual function that should be overridden so it returns the address to which the fallback function
* and {_fallback} should delegate.
*/
function _implementation() internal view virtual returns (address);
/**
* @dev Delegates the current call to the address returned by `_implementation()`.
*
* This function does not return to its internal call site, it will return directly to the external caller.
*/
function _fallback() internal virtual {
_beforeFallback();
_delegate(_implementation());
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
* function in the contract matches the call data.
*/
fallback() external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive() external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overridden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.0;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC1967 implementation slot:
* ```solidity
* contract ERC1967 {
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract");
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._
* _Available since v4.9 for `string`, `bytes`._
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
/**
* @dev Returns an `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
/// @solidity memory-safe-assembly
assembly {
r.slot := store.slot
}
}
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @notice coefficients for sigmoids: α / (1 + e^( (β-x) / γ))
/// @dev alpha1 + alpha2 + baseFee must be <= type(uint16).max
struct AlgebraFeeConfiguration {
uint16 alpha1; // max value of the first sigmoid
uint16 alpha2; // max value of the second sigmoid
uint32 beta1; // shift along the x-axis for the first sigmoid
uint32 beta2; // shift along the x-axis for the second sigmoid
uint16 gamma1; // horizontal stretch factor for the first sigmoid
uint16 gamma2; // horizontal stretch factor for the second sigmoid
uint16 baseFee; // minimum possible fee
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma abicoder v2;
import './plugins/IVolatilityOracle.sol';
import './plugins/IDynamicFeeManager.sol';
import './plugins/IFarmingPlugin.sol';
/// @title The interface for the AlgebraBasePluginV1
/// @notice This contract combines the standard implementations of the volatility oracle and the dynamic fee manager
/// @dev This contract stores timepoints and calculates adaptive fee and statistical averages
interface IAlgebraBasePluginV1 is IVolatilityOracle, IDynamicFeeManager, IFarmingPlugin {
/// @notice Initialize the plugin externally
/// @dev This function allows to initialize the plugin if it was created after the pool was created
function initialize() external;
/// @notice Initialize the plugin instead of the constructor flow, for proxy
/// @dev This function allows to initialize the plugin if it was created like proxy
function initialize(address _blastGovernor, address _pool, address _factory, address _pluginFactory) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma abicoder v2;
import '@cryptoalgebra/integral-core/contracts/interfaces/plugin/IAlgebraPluginFactory.sol';
import '@openzeppelin/contracts/proxy/beacon/IBeacon.sol';
import '../base/AlgebraFeeConfiguration.sol';
/// @title The interface for the BasePluginV1Factory
/// @notice This contract creates Algebra default plugins for Algebra liquidity pools
interface IBasePluginV1Factory is IAlgebraPluginFactory, IBeacon {
/// @notice Emitted when the default fee configuration is changed
/// @param newConfig The structure with dynamic fee parameters
/// @dev See the AdaptiveFee library for more details
event DefaultFeeConfiguration(AlgebraFeeConfiguration newConfig);
/// @notice Emitted when the farming address is changed
/// @param newFarmingAddress The farming address after the address was changed
event FarmingAddress(address newFarmingAddress);
/// @dev Emitted when the implementation returned by the beacon is changed.
/// @param implementation The new implementation address after changed
event Upgraded(address indexed implementation);
/// @dev Emitted when set new default blast governor address is changed.
/// @param defaultBlastGovernor The new default blast governor address
event DefaultBlastGovernor(address indexed defaultBlastGovernor);
/// @dev The `implementation` of the beacon is invalid.
error BeaconInvalidImplementation(address implementation);
/// @notice The hash of 'ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR' used as role
/// @dev allows to change settings of BasePluginV1Factory
function ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR() external pure returns (bytes32);
/// @notice Returns the address of AlgebraFactory
/// @return The AlgebraFactory contract address
function algebraFactory() external view returns (address);
/// @notice Current default dynamic fee configuration
/// @dev See the AdaptiveFee struct for more details about params.
/// This value is set by default in new plugins
function defaultFeeConfiguration()
external
view
returns (uint16 alpha1, uint16 alpha2, uint32 beta1, uint32 beta2, uint16 gamma1, uint16 gamma2, uint16 baseFee);
/// @notice Returns current farming address
/// @return The farming contract address
function farmingAddress() external view returns (address);
/// @notice Returns current default blast governor address
/// @return The default blast governor address for futurees pools
function defaultBlastGovernor() external view returns (address);
/// @notice Returns address of plugin created for given AlgebraPool
/// @param pool The address of AlgebraPool
/// @return The address of corresponding plugin
function pluginByPool(address pool) external view returns (address);
/// @notice Create plugin for already existing pool
/// @param token0 The address of first token in pool
/// @param token1 The address of second token in pool
/// @return The address of created plugin
function createPluginForExistingPool(address token0, address token1) external returns (address);
/// @notice Changes initial fee configuration for new pools
/// @dev changes coefficients for sigmoids: α / (1 + e^( (β-x) / γ))
/// alpha1 + alpha2 + baseFee (max possible fee) must be <= type(uint16).max and gammas must be > 0
/// @param newConfig new default fee configuration. See the #AdaptiveFee.sol library for details
function setDefaultFeeConfiguration(AlgebraFeeConfiguration calldata newConfig) external;
/// @dev updates farmings manager address on the factory
/// @param newFarmingAddress The new tokenomics contract address
function setFarmingAddress(address newFarmingAddress) external;
/// @dev updates default blast governor address on the factory
/// @param defaultBlastGovernor_ The new defautl blast governor address
function setDefaultBlastGovernor(address defaultBlastGovernor_) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma abicoder v2;
import '@cryptoalgebra/integral-core/contracts/interfaces/plugin/IAlgebraDynamicFeePlugin.sol';
import '../../base/AlgebraFeeConfiguration.sol';
/// @title The interface for the Algebra dynamic fee manager
/// @dev This contract calculates adaptive fee
interface IDynamicFeeManager is IAlgebraDynamicFeePlugin {
/// @notice Emitted when the fee configuration is changed
/// @param feeConfig The structure with dynamic fee parameters
/// @dev See the AdaptiveFee struct for more details
event FeeConfiguration(AlgebraFeeConfiguration feeConfig);
/// @notice Current dynamic fee configuration
/// @dev See the AdaptiveFee struct for more details
function feeConfig() external view returns (uint16 alpha1, uint16 alpha2, uint32 beta1, uint32 beta2, uint16 gamma1, uint16 gamma2, uint16 baseFee);
/// @notice Changes fee configuration for the pool
function changeFeeConfiguration(AlgebraFeeConfiguration calldata feeConfig) external;
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title The interface for the Algebra farming plugin
/// @dev This contract used for virtual pools in farms
interface IFarmingPlugin {
/// @notice Emitted when new activeIncentive is set
/// @param newIncentive The address of the new incentive
event Incentive(address newIncentive);
/// @notice Returns the address of the pool the plugin is created for
/// @return address of the pool
function pool() external view returns (address);
/// @notice Connects or disconnects an incentive.
/// @dev Only farming can connect incentives.
/// The one who connected it and the current farming has the right to disconnect the incentive.
/// @param newIncentive The address associated with the incentive or zero address
function setIncentive(address newIncentive) external;
/// @notice Checks if the incentive is connected to pool
/// @dev Returns false if the plugin has a different incentive set, the plugin is not connected to the pool,
/// or the plugin configuration is incorrect.
/// @param targetIncentive The address of the incentive to be checked
/// @return Indicates whether the target incentive is active
function isIncentiveConnected(address targetIncentive) external view returns (bool);
/// @notice Returns the address of active incentive
/// @dev if there is no active incentive at the moment, incentiveAddress would be equal to address(0)
/// @return The address associated with the current active incentive
function incentive() external view returns (address);
}// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
/// @title The interface for the Algebra volatility oracle
/// @dev This contract stores timepoints and calculates statistical averages
interface IVolatilityOracle {
/// @notice Returns data belonging to a certain timepoint
/// @param index The index of timepoint in the array
/// @dev There is more convenient function to fetch a timepoint: getTimepoints(). Which requires not an index but seconds
/// @return initialized Whether the timepoint has been initialized and the values are safe to use
/// @return blockTimestamp The timestamp of the timepoint
/// @return tickCumulative The tick multiplied by seconds elapsed for the life of the pool as of the timepoint timestamp
/// @return volatilityCumulative Cumulative standard deviation for the life of the pool as of the timepoint timestamp
/// @return tick The tick at blockTimestamp
/// @return averageTick Time-weighted average tick
/// @return windowStartIndex Index of closest timepoint >= WINDOW seconds ago
function timepoints(
uint256 index
)
external
view
returns (
bool initialized,
uint32 blockTimestamp,
int56 tickCumulative,
uint88 volatilityCumulative,
int24 tick,
int24 averageTick,
uint16 windowStartIndex
);
/// @notice Returns the index of the last timepoint that was written.
/// @return index of the last timepoint written
function timepointIndex() external view returns (uint16);
/// @notice Returns the timestamp of the last timepoint that was written.
/// @return timestamp of the last timepoint
function lastTimepointTimestamp() external view returns (uint32);
/// @notice Returns information about whether oracle is initialized
/// @return true if oracle is initialized, otherwise false
function isInitialized() external view returns (bool);
/// @dev Reverts if a timepoint at or before the desired timepoint timestamp does not exist.
/// 0 may be passed as `secondsAgo' to return the current cumulative values.
/// If called with a timestamp falling between two timepoints, returns the counterfactual accumulator values
/// at exactly the timestamp between the two timepoints.
/// @dev `volatilityCumulative` values for timestamps after the last timepoint _should not_ be compared because they may differ due to interpolation errors
/// @param secondsAgo The amount of time to look back, in seconds, at which point to return a timepoint
/// @return tickCumulative The cumulative tick since the pool was first initialized, as of `secondsAgo`
/// @return volatilityCumulative The cumulative volatility value since the pool was first initialized, as of `secondsAgo`
function getSingleTimepoint(uint32 secondsAgo) external view returns (int56 tickCumulative, uint88 volatilityCumulative);
/// @notice Returns the accumulator values as of each time seconds ago from the given time in the array of `secondsAgos`
/// @dev Reverts if `secondsAgos` > oldest timepoint
/// @dev `volatilityCumulative` values for timestamps after the last timepoint _should not_ be compared because they may differ due to interpolation errors
/// @param secondsAgos Each amount of time to look back, in seconds, at which point to return a timepoint
/// @return tickCumulatives The cumulative tick since the pool was first initialized, as of each `secondsAgo`
/// @return volatilityCumulatives The cumulative volatility values since the pool was first initialized, as of each `secondsAgo`
function getTimepoints(uint32[] memory secondsAgos) external view returns (int56[] memory tickCumulatives, uint88[] memory volatilityCumulatives);
/// @notice Fills uninitialized timepoints with nonzero value
/// @dev Can be used to reduce the gas cost of future swaps
/// @param startIndex The start index, must be not initialized
/// @param amount of slots to fill, startIndex + amount must be <= type(uint16).max
function prepayTimepointsStorageSlots(uint16 startIndex, uint16 amount) external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.20;
import '@cryptoalgebra/integral-core/contracts/libraries/Constants.sol';
import '../base/AlgebraFeeConfiguration.sol';
import '../types/AlgebraFeeConfigurationU144.sol';
/// @title AdaptiveFee
/// @notice Calculates fee based on combination of sigmoids
/// @dev Version for AlgebraBasePluginV1
library AdaptiveFee {
uint16 internal constant INITIAL_MIN_FEE = 0.01e4; // 0.01%
/// @notice Returns default initial fee configuration
function initialFeeConfiguration() internal pure returns (AlgebraFeeConfiguration memory) {
return
AlgebraFeeConfiguration({
alpha1: 3000 - INITIAL_MIN_FEE, // max value of the first sigmoid in hundredths of a bip, i.e. 1e-6
alpha2: 15000 - 3000, // max value of the second sigmoid in hundredths of a bip, i.e. 1e-6
beta1: 360, // shift along the x-axis (volatility) for the first sigmoid
beta2: 60000, // shift along the x-axis (volatility) for the second sigmoid
gamma1: 59, // horizontal stretch factor for the first sigmoid
gamma2: 8500, // horizontal stretch factor for the second sigmoid
baseFee: INITIAL_MIN_FEE // in hundredths of a bip, i.e. 1e-6
});
}
/// @notice Validates fee configuration.
/// @dev Maximum fee value capped by baseFee + alpha1 + alpha2 must be <= type(uint16).max
/// gammas must be > 0
function validateFeeConfiguration(AlgebraFeeConfiguration memory _config) internal pure {
require(uint256(_config.alpha1) + uint256(_config.alpha2) + uint256(_config.baseFee) <= type(uint16).max, 'Max fee exceeded');
require(_config.gamma1 != 0 && _config.gamma2 != 0, 'Gammas must be > 0');
}
/// @notice Calculates fee based on formula:
/// baseFee + sigmoid1(volatility) + sigmoid2(volatility)
/// maximum value capped by baseFee + alpha1 + alpha2
function getFee(uint88 volatility, AlgebraFeeConfigurationU144 config) internal pure returns (uint16 fee) {
unchecked {
volatility /= 15; // normalize for 15 sec interval
uint256 sumOfSigmoids = sigmoid(volatility, config.gamma1(), config.alpha1(), config.beta1()) +
sigmoid(volatility, config.gamma2(), config.alpha2(), config.beta2());
uint256 result = uint256(config.baseFee()) + sumOfSigmoids;
assert(result <= type(uint16).max); // should always be true
return uint16(result); // safe since alpha1 + alpha2 + baseFee _must_ be <= type(uint16).max
}
}
/// @notice calculates α / (1 + e^( (β-x) / γ))
/// that is a sigmoid with a maximum value of α, x-shifted by β, and stretched by γ
/// @dev returns uint256 for fuzzy testing. Guaranteed that the result is not greater than alpha
function sigmoid(uint256 x, uint16 g, uint16 alpha, uint256 beta) internal pure returns (uint256 res) {
unchecked {
if (x > beta) {
x = x - beta;
if (x >= 6 * uint256(g)) return alpha; // so x < 19 bits
uint256 g4 = uint256(g) ** 4; // < 64 bits (4*16)
uint256 ex = expXg4(x, g, g4); // < 155 bits
res = (alpha * ex) / (g4 + ex); // in worst case: (16 + 155 bits) / 155 bits
// so res <= alpha
} else {
x = beta - x;
if (x >= 6 * uint256(g)) return 0; // so x < 19 bits
uint256 g4 = uint256(g) ** 4; // < 64 bits (4*16)
uint256 ex = g4 + expXg4(x, g, g4); // < 156 bits
res = (alpha * g4) / ex; // in worst case: (16 + 128 bits) / 156 bits
// g8 <= ex, so res <= alpha
}
}
}
/// @notice calculates e^(x/g) * g^4 in a series, since (around zero):
/// e^x = 1 + x + x^2/2 + ... + x^n/n! + ...
/// e^(x/g) = 1 + x/g + x^2/(2*g^2) + ... + x^(n)/(g^n * n!) + ...
/// @dev has good accuracy only if x/g < 6
function expXg4(uint256 x, uint16 g, uint256 gHighestDegree) internal pure returns (uint256 res) {
uint256 closestValue; // nearest 'table' value of e^(x/g), multiplied by 10^20
assembly {
let xdg := div(x, g)
switch xdg
case 0 {
closestValue := 100000000000000000000 // 1
}
case 1 {
closestValue := 271828182845904523536 // ~= e
}
case 2 {
closestValue := 738905609893065022723 // ~= e^2
}
case 3 {
closestValue := 2008553692318766774092 // ~= e^3
}
case 4 {
closestValue := 5459815003314423907811 // ~= e^4
}
default {
closestValue := 14841315910257660342111 // ~= e^5
}
x := mod(x, g)
}
unchecked {
if (x >= g / 2) {
// (x - closestValue) >= 0.5, so closestValue := closestValue * e^0.5
x -= g / 2;
closestValue = (closestValue * 164872127070012814684) / 1e20;
}
// After calculating the closestValue x/g is <= 0.5, so that the series in the neighborhood of zero converges with sufficient speed
uint256 xLowestDegree = x;
res = gHighestDegree; // g**4, res < 64 bits
gHighestDegree /= g; // g**3
res += xLowestDegree * gHighestDegree; // g**4 + x*g**3, res < 68
gHighestDegree /= g; // g**2
xLowestDegree *= x; // x**2
// g**4 + x * g**3 + (x**2 * g**2) / 2, res < 71
res += (xLowestDegree * gHighestDegree) / 2;
gHighestDegree /= g; // g
xLowestDegree *= x; // x**3
// g^4 + x * g^3 + (x^2 * g^2)/2 + x^3(g*4 + x)/24, res < 73
res += (xLowestDegree * g * 4 + xLowestDegree * x) / 24;
// res = g^4 * (1 + x/g + x^2/(2*g^2) + x^3/(6*g^3) + x^4/(24*g^4)) * closestValue / 10^20, closestValue < 75 bits, res < 155
res = (res * closestValue) / (1e20);
}
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.20;
import '../base/AlgebraFeeConfiguration.sol';
type AlgebraFeeConfigurationU144 is uint144;
using AlgebraFeeConfigurationU144Lib for AlgebraFeeConfigurationU144 global;
/// @title AdaptiveFee packed configuration library
/// @notice Used to interact with uint144-packed fee config
/// @dev Structs are not packed in storage with neighboring values, but uint144 can be packed
library AlgebraFeeConfigurationU144Lib {
uint256 private constant UINT16_MASK = 0xFFFF;
uint256 private constant UINT32_MASK = 0xFFFFFFFF;
// alpha1 offset is 0
uint256 private constant ALPHA2_OFFSET = 16;
uint256 private constant BETA1_OFFSET = 32;
uint256 private constant BETA2_OFFSET = 64;
uint256 private constant GAMMA1_OFFSET = 96;
uint256 private constant GAMMA2_OFFSET = 112;
uint256 private constant BASE_FEE_OFFSET = 128;
function pack(AlgebraFeeConfiguration memory config) internal pure returns (AlgebraFeeConfigurationU144) {
uint144 _config = uint144(
(uint256(config.baseFee) << BASE_FEE_OFFSET) |
(uint256(config.gamma2) << GAMMA2_OFFSET) |
(uint256(config.gamma1) << GAMMA1_OFFSET) |
(uint256(config.beta2) << BETA2_OFFSET) |
(uint256(config.beta1) << BETA1_OFFSET) |
(uint256(config.alpha2) << ALPHA2_OFFSET) |
uint256(config.alpha1)
);
return AlgebraFeeConfigurationU144.wrap(_config);
}
function alpha1(AlgebraFeeConfigurationU144 config) internal pure returns (uint16 _alpha1) {
assembly {
_alpha1 := and(UINT16_MASK, config)
}
}
function alpha2(AlgebraFeeConfigurationU144 config) internal pure returns (uint16 _alpha2) {
assembly {
_alpha2 := and(UINT16_MASK, shr(ALPHA2_OFFSET, config))
}
}
function beta1(AlgebraFeeConfigurationU144 config) internal pure returns (uint32 _beta1) {
assembly {
_beta1 := and(UINT32_MASK, shr(BETA1_OFFSET, config))
}
}
function beta2(AlgebraFeeConfigurationU144 config) internal pure returns (uint32 _beta2) {
assembly {
_beta2 := and(UINT32_MASK, shr(BETA2_OFFSET, config))
}
}
function gamma1(AlgebraFeeConfigurationU144 config) internal pure returns (uint16 _gamma1) {
assembly {
_gamma1 := and(UINT16_MASK, shr(GAMMA1_OFFSET, config))
}
}
function gamma2(AlgebraFeeConfigurationU144 config) internal pure returns (uint16 _gamma2) {
assembly {
_gamma2 := and(UINT16_MASK, shr(GAMMA2_OFFSET, config))
}
}
function baseFee(AlgebraFeeConfigurationU144 config) internal pure returns (uint16 _baseFee) {
assembly {
_baseFee := and(UINT16_MASK, shr(BASE_FEE_OFFSET, config))
}
}
}{
"evmVersion": "paris",
"optimizer": {
"enabled": true,
"runs": 1000000
},
"metadata": {
"bytecodeHash": "none"
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_blastGovernor","type":"address"},{"internalType":"address","name":"_algebraFactory","type":"address"},{"internalType":"address","name":"_basePluginV1Implementation","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressZero","type":"error"},{"inputs":[{"internalType":"address","name":"implementation","type":"address"}],"name":"BeaconInvalidImplementation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"defaultBlastGovernor","type":"address"}],"name":"DefaultBlastGovernor","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint16","name":"alpha1","type":"uint16"},{"internalType":"uint16","name":"alpha2","type":"uint16"},{"internalType":"uint32","name":"beta1","type":"uint32"},{"internalType":"uint32","name":"beta2","type":"uint32"},{"internalType":"uint16","name":"gamma1","type":"uint16"},{"internalType":"uint16","name":"gamma2","type":"uint16"},{"internalType":"uint16","name":"baseFee","type":"uint16"}],"indexed":false,"internalType":"struct AlgebraFeeConfiguration","name":"newConfig","type":"tuple"}],"name":"DefaultFeeConfiguration","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newFarmingAddress","type":"address"}],"name":"FarmingAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"ALGEBRA_BASE_PLUGIN_FACTORY_ADMINISTRATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"algebraFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"createPlugin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"createPluginForExistingPool","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultBlastGovernor","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultFeeConfiguration","outputs":[{"internalType":"uint16","name":"alpha1","type":"uint16"},{"internalType":"uint16","name":"alpha2","type":"uint16"},{"internalType":"uint32","name":"beta1","type":"uint32"},{"internalType":"uint32","name":"beta2","type":"uint32"},{"internalType":"uint16","name":"gamma1","type":"uint16"},{"internalType":"uint16","name":"gamma2","type":"uint16"},{"internalType":"uint16","name":"baseFee","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"farmingAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"poolAddress","type":"address"}],"name":"pluginByPool","outputs":[{"internalType":"address","name":"pluginAddress","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"defaultBlastGovernor_","type":"address"}],"name":"setDefaultBlastGovernor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint16","name":"alpha1","type":"uint16"},{"internalType":"uint16","name":"alpha2","type":"uint16"},{"internalType":"uint32","name":"beta1","type":"uint32"},{"internalType":"uint32","name":"beta2","type":"uint32"},{"internalType":"uint16","name":"gamma1","type":"uint16"},{"internalType":"uint16","name":"gamma2","type":"uint16"},{"internalType":"uint16","name":"baseFee","type":"uint16"}],"internalType":"struct AlgebraFeeConfiguration","name":"newConfig","type":"tuple"}],"name":"setDefaultFeeConfiguration","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newFarmingAddress","type":"address"}],"name":"setFarmingAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
0x60a06040523480156200001157600080fd5b506040516200228d3803806200228d8339810160408190526200003491620003b2565b6200003f83620001ec565b600280546001600160a01b0319166001600160a01b038581169190911790915582166080526200006e62000286565b805160008054602084015160408501516060860151608087015160a088015160c09098015161ffff908116600160801b0261ffff60801b19998216600160701b0261ffff60701b199383166c01000000000000000000000000029390931663ffffffff60601b1963ffffffff958616680100000000000000000263ffffffff60401b19969097166401000000000295909516600160201b600160601b0319978416620100000263ffffffff1990991693909a169290921796909617949094169690961791909117161792909217929092161790556200014d8162000310565b7fe04232512a5cb82c08e0f9b1f51432930cd7a0b7ea9f9f916f080cb0b4ac644b6000604051620001db9190600060e082019050825461ffff8082168452808260101c16602085015263ffffffff808360201c166040860152808360401c16606086015250808260601c166080850152808260701c1660a0850152808260801c1660c0850152505092915050565b60405180910390a15050506200042d565b6001600160a01b0381166200021457604051639fabe1c160e01b815260040160405180910390fd5b604051631d70c8d360e31b81526001600160a01b03821660048201527343000000000000000000000000000000000000029063eb86469890602401600060405180830381600087803b1580156200026a57600080fd5b505af11580156200027f573d6000803e3d6000fd5b5050505050565b6040805160e08082018352600080835260208301819052828401819052606083018190526080830181905260a0830181905260c083015282519081019092529080620002d66064610bb8620003fc565b61ffff168152612ee06020820152610168604082015261ea606060820152603b608082015261213460a0820152606460c090910152919050565b806001600160a01b03163b6000036200034b5760405163211eb15960e21b81526001600160a01b038216600482015260240160405180910390fd5b600380546001600160a01b0319166001600160a01b0383169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b80516001600160a01b0381168114620003ad57600080fd5b919050565b600080600060608486031215620003c857600080fd5b620003d38462000395565b9250620003e36020850162000395565b9150620003f36040850162000395565b90509250925092565b61ffff8281168282160390808211156200042657634e487b7160e01b600052601160045260246000fd5b5092915050565b608051611e136200047a600039600081816102880152818161036e0152818161063601528181610749015281816107db0152818161098901528181610b6a0152610df10152611e136000f3fe60806040523480156200001157600080fd5b5060043610620000f15760003560e01c8063998709e01162000097578063cddff269116200006e578063cddff26914620002c1578063cdef16f614620002f8578063f718949a1462000331578063fb6cd276146200034857600080fd5b8063998709e0146200026b578063a7b64b041462000282578063b001f61814620002aa57600080fd5b80635c60da1b11620000cc5780635c60da1b14620002125780638a2ade5814620002335780639533ff10146200025457600080fd5b80632773302614620000f65780633659cfe614620001375780634e09a96a1462000150575b600080fd5b6200010d62000107366004620011ba565b62000369565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6200014e62000148366004620011f8565b620005e2565b005b600054620001c99061ffff8082169162010000810482169163ffffffff6401000000008304811692680100000000000000008104909116916c0100000000000000000000000082048116916e01000000000000000000000000000081048216917001000000000000000000000000000000009091041687565b6040805161ffff9889168152968816602088015263ffffffff9586169087015293909216606085015284166080840152831660a08301529190911660c082015260e0016200012e565b6003546200010d9073ffffffffffffffffffffffffffffffffffffffff1681565b6001546200010d9073ffffffffffffffffffffffffffffffffffffffff1681565b6200010d620002653660046200121f565b6200072f565b6200014e6200027c366004620011f8565b62000787565b6200010d7f000000000000000000000000000000000000000000000000000000000000000081565b6200014e620002bb366004620011f8565b62000935565b620002e97f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed681565b6040519081526020016200012e565b6200010d62000309366004620011f8565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6200014e6200034236600462001271565b62000b16565b6002546200010d9073ffffffffffffffffffffffffffffffffffffffff1681565b6000807f000000000000000000000000000000000000000000000000000000000000000090508073ffffffffffffffffffffffffffffffffffffffff1663e8ae2b698273ffffffffffffffffffffffffffffffffffffffff1663b500a48b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003f7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200041d91906200128a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526004810191909152336024820152604401602060405180830381865afa15801562000478573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200049e9190620012a4565b620004a857600080fd5b6040517fd9a641e100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015284811660248301526000919083169063d9a641e190604401602060405180830381865afa15801562000521573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005479190620012c8565b905073ffffffffffffffffffffffffffffffffffffffff8116620005cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f506f6f6c206e6f7420657869737400000000000000000000000000000000000060448201526064015b60405180910390fd5b620005d78162000cb3565b925050505b92915050565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa15801562000693573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006b99190620012a4565b62000721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b6200072c8162000f8e565b50565b60003373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146200077457600080fd5b6200077f8462000cb3565b949350505050565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa15801562000838573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200085e9190620012a4565b620008c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f7abdc4975133587e2e798bf8ada0f6b11ae12688d0dac360555ca2e931ba9ced90600090a250565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa158015620009e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a0c9190620012a4565b62000a74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b60015473ffffffffffffffffffffffffffffffffffffffff80831691160362000a9c57600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f56b9e8342f530796ceed0d5529abdcdeae6e4f2ac1dc456ceb73bbda898e0cd3906020015b60405180910390a150565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa15801562000bc7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bed9190620012a4565b62000c55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b62000c7062000c6a368390038301836200132b565b62001068565b80600062000c7f828262001430565b9050507fe04232512a5cb82c08e0f9b1f51432930cd7a0b7ea9f9f916f080cb0b4ac644b8160405162000b0b91906200164a565b73ffffffffffffffffffffffffffffffffffffffff8181166000908152600460205260408120549091161562000d46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c7265616479206372656174656400000000000000000000000000000000006044820152606401620005c3565b60003060405162000d579062001189565b73ffffffffffffffffffffffffffffffffffffffff9091168152604060208201819052600090820152606001604051809103906000f08015801562000da0573d6000803e3d6000fd5b506002546040517ff8c8765e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015285821660248201527f00000000000000000000000000000000000000000000000000000000000000008216604482015230606482015291925082169063f8c8765e90608401600060405180830381600087803b15801562000e4757600080fd5b505af115801562000e5c573d6000803e3d6000fd5b5050604080517f1d39215e00000000000000000000000000000000000000000000000000000000815260005461ffff8082166004840152601082901c8116602484015263ffffffff602083901c811660448501529382901c9093166064830152606081901c83166084830152607081901c831660a483015260801c90911660c482015273ffffffffffffffffffffffffffffffffffffffff84169250631d39215e915060e401600060405180830381600087803b15801562000f1d57600080fd5b505af115801562000f32573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff928316600090815260046020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016938216939093179092555090565b8073ffffffffffffffffffffffffffffffffffffffff163b60000362000ff9576040517f847ac56400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401620005c3565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60c08101516020820151825161ffff928316916200108c9190841690841662001701565b62001098919062001701565b111562001102576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4d617820666565206578636565646564000000000000000000000000000000006044820152606401620005c3565b608081015161ffff161580159062001121575060a081015161ffff1615155b6200072c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f47616d6d6173206d757374206265203e203000000000000000000000000000006044820152606401620005c3565b6106ca806200173d83390190565b73ffffffffffffffffffffffffffffffffffffffff811681146200072c57600080fd5b60008060408385031215620011ce57600080fd5b8235620011db8162001197565b91506020830135620011ed8162001197565b809150509250929050565b6000602082840312156200120b57600080fd5b8135620012188162001197565b9392505050565b6000806000606084860312156200123557600080fd5b8335620012428162001197565b92506020840135620012548162001197565b91506040840135620012668162001197565b809150509250925092565b600060e082840312156200128457600080fd5b50919050565b6000602082840312156200129d57600080fd5b5051919050565b600060208284031215620012b757600080fd5b815180151581146200121857600080fd5b600060208284031215620012db57600080fd5b8151620012188162001197565b61ffff811681146200072c57600080fd5b80356200130681620012e8565b919050565b63ffffffff811681146200072c57600080fd5b803562001306816200130b565b600060e082840312156200133e57600080fd5b60405160e0810181811067ffffffffffffffff8211171562001389577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040526200139783620012f9565b8152620013a760208401620012f9565b6020820152620013ba604084016200131e565b6040820152620013cd606084016200131e565b6060820152620013e060808401620012f9565b6080820152620013f360a08401620012f9565b60a08201526200140660c08401620012f9565b60c08201529392505050565b60008135620005dc81620012e8565b60008135620005dc816200130b565b81356200143d81620012e8565b61ffff811690508154817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000821617835560208401356200147d81620012e8565b63ffff00008160101b16905080837fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000008416171784556040850135620014c2816200130b565b67ffffffff000000008160201b16847fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008516178317178555505050506200154d620015106060840162001421565b82547fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff1660409190911b6bffffffff000000000000000016178255565b6200159e6200155f6080840162001412565b82547fffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffff1660609190911b6dffff00000000000000000000000016178255565b620015f1620015b060a0840162001412565b82547fffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffff1660709190911b6fffff000000000000000000000000000016178255565b620016466200160360c0840162001412565b82547fffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffff1660809190911b71ffff0000000000000000000000000000000016178255565b5050565b60e0810182356200165b81620012e8565b61ffff90811683526020840135906200167482620012e8565b90811660208401526040840135906200168d826200130b565b63ffffffff9182166040850152606085013591620016ab836200130b565b919091166060840152608084013590620016c582620012e8565b166080830152620016d960a08401620012f9565b61ffff1660a0830152620016f060c08401620012f9565b61ffff811660c08401525092915050565b80820180821115620005dc577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfe60806040526040516106ca3803806106ca83398101604081905261002291610420565b61002e82826000610035565b505061054a565b61003e836100f6565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100f1576100ef836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e991906104e0565b8361027a565b505b505050565b6001600160a01b0381163b6101605760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101d4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c591906104e0565b6001600160a01b03163b151590565b6102395760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610157565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392909216919091179055565b606061029f83836040518060600160405280602781526020016106a3602791396102a6565b9392505050565b6060600080856001600160a01b0316856040516102c391906104fb565b600060405180830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b5090925090506103158683838761031f565b9695505050505050565b6060831561038e578251600003610387576001600160a01b0385163b6103875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610157565b5081610398565b61039883836103a0565b949350505050565b8151156103b05781518083602001fd5b8060405162461bcd60e51b81526004016101579190610517565b80516001600160a01b03811681146103e157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156104175781810151838201526020016103ff565b50506000910152565b6000806040838503121561043357600080fd5b61043c836103ca565b60208401519092506001600160401b038082111561045957600080fd5b818501915085601f83011261046d57600080fd5b81518181111561047f5761047f6103e6565b604051601f8201601f19908116603f011681019083821181831017156104a7576104a76103e6565b816040528281528860208487010111156104c057600080fd5b6104d18360208301602088016103fc565b80955050505050509250929050565b6000602082840312156104f257600080fd5b61029f826103ca565b6000825161050d8184602087016103fc565b9190910192915050565b60208152600082518060208401526105368160408501602087016103fc565b601f01601f19169190910160400192915050565b61014a806105596000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b6100dc565b565b60006100697fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100d79190610100565b905090565b3660008037600080366000845af43d6000803e8080156100fb573d6000f35b3d6000fd5b60006020828403121561011257600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461013657600080fd5b939250505056fea164736f6c6343000814000a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000814000a0000000000000000000000004867664baafe5926b3ca338e96c88fb5a5feab300000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df00000000000000000000000087f6af89ab8f6e11f06cf76b17f2208255247013
Deployed Bytecode
0x60806040523480156200001157600080fd5b5060043610620000f15760003560e01c8063998709e01162000097578063cddff269116200006e578063cddff26914620002c1578063cdef16f614620002f8578063f718949a1462000331578063fb6cd276146200034857600080fd5b8063998709e0146200026b578063a7b64b041462000282578063b001f61814620002aa57600080fd5b80635c60da1b11620000cc5780635c60da1b14620002125780638a2ade5814620002335780639533ff10146200025457600080fd5b80632773302614620000f65780633659cfe614620001375780634e09a96a1462000150575b600080fd5b6200010d62000107366004620011ba565b62000369565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6200014e62000148366004620011f8565b620005e2565b005b600054620001c99061ffff8082169162010000810482169163ffffffff6401000000008304811692680100000000000000008104909116916c0100000000000000000000000082048116916e01000000000000000000000000000081048216917001000000000000000000000000000000009091041687565b6040805161ffff9889168152968816602088015263ffffffff9586169087015293909216606085015284166080840152831660a08301529190911660c082015260e0016200012e565b6003546200010d9073ffffffffffffffffffffffffffffffffffffffff1681565b6001546200010d9073ffffffffffffffffffffffffffffffffffffffff1681565b6200010d620002653660046200121f565b6200072f565b6200014e6200027c366004620011f8565b62000787565b6200010d7f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df81565b6200014e620002bb366004620011f8565b62000935565b620002e97f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed681565b6040519081526020016200012e565b6200010d62000309366004620011f8565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b6200014e6200034236600462001271565b62000b16565b6002546200010d9073ffffffffffffffffffffffffffffffffffffffff1681565b6000807f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df90508073ffffffffffffffffffffffffffffffffffffffff1663e8ae2b698273ffffffffffffffffffffffffffffffffffffffff1663b500a48b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003f7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200041d91906200128a565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526004810191909152336024820152604401602060405180830381865afa15801562000478573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200049e9190620012a4565b620004a857600080fd5b6040517fd9a641e100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff858116600483015284811660248301526000919083169063d9a641e190604401602060405180830381865afa15801562000521573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005479190620012c8565b905073ffffffffffffffffffffffffffffffffffffffff8116620005cc576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f506f6f6c206e6f7420657869737400000000000000000000000000000000000060448201526064015b60405180910390fd5b620005d78162000cb3565b925050505b92915050565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df73ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa15801562000693573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006b99190620012a4565b62000721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b6200072c8162000f8e565b50565b60003373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df16146200077457600080fd5b6200077f8462000cb3565b949350505050565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df73ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa15801562000838573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200085e9190620012a4565b620008c6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f7abdc4975133587e2e798bf8ada0f6b11ae12688d0dac360555ca2e931ba9ced90600090a250565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df73ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa158015620009e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000a0c9190620012a4565b62000a74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b60015473ffffffffffffffffffffffffffffffffffffffff80831691160362000a9c57600080fd5b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f56b9e8342f530796ceed0d5529abdcdeae6e4f2ac1dc456ceb73bbda898e0cd3906020015b60405180910390a150565b6040517fe8ae2b690000000000000000000000000000000000000000000000000000000081527f267da724c255813ae00f4522fe843cb70148a4b8099cbc5af64f9a4151e55ed660048201523360248201527f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df73ffffffffffffffffffffffffffffffffffffffff169063e8ae2b6990604401602060405180830381865afa15801562000bc7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000bed9190620012a4565b62000c55576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f4f6e6c792061646d696e6973747261746f7200000000000000000000000000006044820152606401620005c3565b62000c7062000c6a368390038301836200132b565b62001068565b80600062000c7f828262001430565b9050507fe04232512a5cb82c08e0f9b1f51432930cd7a0b7ea9f9f916f080cb0b4ac644b8160405162000b0b91906200164a565b73ffffffffffffffffffffffffffffffffffffffff8181166000908152600460205260408120549091161562000d46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c7265616479206372656174656400000000000000000000000000000000006044820152606401620005c3565b60003060405162000d579062001189565b73ffffffffffffffffffffffffffffffffffffffff9091168152604060208201819052600090820152606001604051809103906000f08015801562000da0573d6000803e3d6000fd5b506002546040517ff8c8765e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015285821660248201527f0000000000000000000000007a44cd060afc1b6f4c80a2b9b37f4473e74e25df8216604482015230606482015291925082169063f8c8765e90608401600060405180830381600087803b15801562000e4757600080fd5b505af115801562000e5c573d6000803e3d6000fd5b5050604080517f1d39215e00000000000000000000000000000000000000000000000000000000815260005461ffff8082166004840152601082901c8116602484015263ffffffff602083901c811660448501529382901c9093166064830152606081901c83166084830152607081901c831660a483015260801c90911660c482015273ffffffffffffffffffffffffffffffffffffffff84169250631d39215e915060e401600060405180830381600087803b15801562000f1d57600080fd5b505af115801562000f32573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff928316600090815260046020526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016938216939093179092555090565b8073ffffffffffffffffffffffffffffffffffffffff163b60000362000ff9576040517f847ac56400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82166004820152602401620005c3565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60c08101516020820151825161ffff928316916200108c9190841690841662001701565b62001098919062001701565b111562001102576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4d617820666565206578636565646564000000000000000000000000000000006044820152606401620005c3565b608081015161ffff161580159062001121575060a081015161ffff1615155b6200072c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f47616d6d6173206d757374206265203e203000000000000000000000000000006044820152606401620005c3565b6106ca806200173d83390190565b73ffffffffffffffffffffffffffffffffffffffff811681146200072c57600080fd5b60008060408385031215620011ce57600080fd5b8235620011db8162001197565b91506020830135620011ed8162001197565b809150509250929050565b6000602082840312156200120b57600080fd5b8135620012188162001197565b9392505050565b6000806000606084860312156200123557600080fd5b8335620012428162001197565b92506020840135620012548162001197565b91506040840135620012668162001197565b809150509250925092565b600060e082840312156200128457600080fd5b50919050565b6000602082840312156200129d57600080fd5b5051919050565b600060208284031215620012b757600080fd5b815180151581146200121857600080fd5b600060208284031215620012db57600080fd5b8151620012188162001197565b61ffff811681146200072c57600080fd5b80356200130681620012e8565b919050565b63ffffffff811681146200072c57600080fd5b803562001306816200130b565b600060e082840312156200133e57600080fd5b60405160e0810181811067ffffffffffffffff8211171562001389577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040526200139783620012f9565b8152620013a760208401620012f9565b6020820152620013ba604084016200131e565b6040820152620013cd606084016200131e565b6060820152620013e060808401620012f9565b6080820152620013f360a08401620012f9565b60a08201526200140660c08401620012f9565b60c08201529392505050565b60008135620005dc81620012e8565b60008135620005dc816200130b565b81356200143d81620012e8565b61ffff811690508154817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000821617835560208401356200147d81620012e8565b63ffff00008160101b16905080837fffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000008416171784556040850135620014c2816200130b565b67ffffffff000000008160201b16847fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008516178317178555505050506200154d620015106060840162001421565b82547fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff1660409190911b6bffffffff000000000000000016178255565b6200159e6200155f6080840162001412565b82547fffffffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffff1660609190911b6dffff00000000000000000000000016178255565b620015f1620015b060a0840162001412565b82547fffffffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffff1660709190911b6fffff000000000000000000000000000016178255565b620016466200160360c0840162001412565b82547fffffffffffffffffffffffffffff0000ffffffffffffffffffffffffffffffff1660809190911b71ffff0000000000000000000000000000000016178255565b5050565b60e0810182356200165b81620012e8565b61ffff90811683526020840135906200167482620012e8565b90811660208401526040840135906200168d826200130b565b63ffffffff9182166040850152606085013591620016ab836200130b565b919091166060840152608084013590620016c582620012e8565b166080830152620016d960a08401620012f9565b61ffff1660a0830152620016f060c08401620012f9565b61ffff811660c08401525092915050565b80820180821115620005dc577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fdfe60806040526040516106ca3803806106ca83398101604081905261002291610420565b61002e82826000610035565b505061054a565b61003e836100f6565b6040516001600160a01b038416907f1cf3b03a6cf19fa2baba4df148e9dcabedea7f8a5c07840e207e5c089be95d3e90600090a260008251118061007f5750805b156100f1576100ef836001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100e991906104e0565b8361027a565b505b505050565b6001600160a01b0381163b6101605760405162461bcd60e51b815260206004820152602560248201527f455243313936373a206e657720626561636f6e206973206e6f74206120636f6e6044820152641d1c9858dd60da1b60648201526084015b60405180910390fd5b6101d4816001600160a01b0316635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c591906104e0565b6001600160a01b03163b151590565b6102395760405162461bcd60e51b815260206004820152603060248201527f455243313936373a20626561636f6e20696d706c656d656e746174696f6e206960448201526f1cc81b9bdd08184818dbdb9d1c9858dd60821b6064820152608401610157565b7fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d5080546001600160a01b0319166001600160a01b0392909216919091179055565b606061029f83836040518060600160405280602781526020016106a3602791396102a6565b9392505050565b6060600080856001600160a01b0316856040516102c391906104fb565b600060405180830381855af49150503d80600081146102fe576040519150601f19603f3d011682016040523d82523d6000602084013e610303565b606091505b5090925090506103158683838761031f565b9695505050505050565b6060831561038e578251600003610387576001600160a01b0385163b6103875760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610157565b5081610398565b61039883836103a0565b949350505050565b8151156103b05781518083602001fd5b8060405162461bcd60e51b81526004016101579190610517565b80516001600160a01b03811681146103e157600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156104175781810151838201526020016103ff565b50506000910152565b6000806040838503121561043357600080fd5b61043c836103ca565b60208401519092506001600160401b038082111561045957600080fd5b818501915085601f83011261046d57600080fd5b81518181111561047f5761047f6103e6565b604051601f8201601f19908116603f011681019083821181831017156104a7576104a76103e6565b816040528281528860208487010111156104c057600080fd5b6104d18360208301602088016103fc565b80955050505050509250929050565b6000602082840312156104f257600080fd5b61029f826103ca565b6000825161050d8184602087016103fc565b9190910192915050565b60208152600082518060208401526105368160408501602087016103fc565b601f01601f19169190910160400192915050565b61014a806105596000396000f3fe60806040523661001357610011610017565b005b6100115b610027610022610029565b6100dc565b565b60006100697fa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d505473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff16635c60da1b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100d79190610100565b905090565b3660008037600080366000845af43d6000803e8080156100fb573d6000f35b3d6000fd5b60006020828403121561011257600080fd5b815173ffffffffffffffffffffffffffffffffffffffff8116811461013657600080fd5b939250505056fea164736f6c6343000814000a416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a164736f6c6343000814000a
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in ETH
0
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
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.