Source Code
Overview
S Balance
S Value
$0.00| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
Latest 25 internal transactions (View All)
Advanced mode:
Cross-Chain Transactions
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
PoolAccountantProxyDeployer
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import {RegistryBasedProxySingleContractDeployer} from "./RegistryBasedProxySingleContractDeployer.sol";
import {PoolAccountantProxy} from "../../../Lex/PoolAccountant/PoolAccountantProxy.sol";
import {IRegistryV1} from "../../../interfaces/IRegistryV1.sol";
contract PoolAccountantProxyDeployer is
RegistryBasedProxySingleContractDeployer
{
// ***** Constants (ILynxVersionedContract interface) *****
string public constant CONTRACT_NAME = "PoolAccountantProxyDeployer";
string public constant CONTRACT_VERSION = "1000"; // 1.0
// ***** Views (ILynxVersionedContract interface) *****
function getContractName() external pure override returns (string memory) {
return CONTRACT_NAME;
}
function getContractVersion() external pure override returns (string memory) {
return CONTRACT_VERSION;
}
// ***** Constructor *****
constructor(
address _registry
)
RegistryBasedProxySingleContractDeployer(
_registry,
"PoolAccountantProxy",
// 1.0
"1000"
)
{}
// ***** Public Override Views *****
function getFactoryRole() public override returns (address) {
return IRegistryV1(registry).lexProxiesFactory();
}
// ***** Internal Override Functions *****
function deployRegistryProxyInternal(
address _initialAdmin
) internal override returns (address) {
PoolAccountantProxy poolAccountantProxy = new PoolAccountantProxy(
registry,
_initialAdmin
);
address poolAccountantProxyAddress = address(poolAccountantProxy);
return poolAccountantProxyAddress;
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;
/**
* @dev Standard ERC20 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
*/
interface IERC20Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC20InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC20InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
* @param spender Address that may be allowed to operate on tokens without being their owner.
* @param allowance Amount of tokens a `spender` is allowed to operate with.
* @param needed Minimum amount required to perform a transfer.
*/
error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC20InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `spender` to be approved. Used in approvals.
* @param spender Address that may be allowed to operate on tokens without being their owner.
*/
error ERC20InvalidSpender(address spender);
}
/**
* @dev Standard ERC721 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
*/
interface IERC721Errors {
/**
* @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
* Used in balance queries.
* @param owner Address of the current owner of a token.
*/
error ERC721InvalidOwner(address owner);
/**
* @dev Indicates a `tokenId` whose `owner` is the zero address.
* @param tokenId Identifier number of a token.
*/
error ERC721NonexistentToken(uint256 tokenId);
/**
* @dev Indicates an error related to the ownership over a particular token. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param tokenId Identifier number of a token.
* @param owner Address of the current owner of a token.
*/
error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC721InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC721InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param tokenId Identifier number of a token.
*/
error ERC721InsufficientApproval(address operator, uint256 tokenId);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC721InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC721InvalidOperator(address operator);
}
/**
* @dev Standard ERC1155 Errors
* Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
*/
interface IERC1155Errors {
/**
* @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
* @param balance Current balance for the interacting account.
* @param needed Minimum amount required to perform a transfer.
* @param tokenId Identifier number of a token.
*/
error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);
/**
* @dev Indicates a failure with the token `sender`. Used in transfers.
* @param sender Address whose tokens are being transferred.
*/
error ERC1155InvalidSender(address sender);
/**
* @dev Indicates a failure with the token `receiver`. Used in transfers.
* @param receiver Address to which tokens are being transferred.
*/
error ERC1155InvalidReceiver(address receiver);
/**
* @dev Indicates a failure with the `operator`’s approval. Used in transfers.
* @param operator Address that may be allowed to operate on tokens without being their owner.
* @param owner Address of the current owner of a token.
*/
error ERC1155MissingApprovalForAll(address operator, address owner);
/**
* @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
* @param approver Address initiating an approval operation.
*/
error ERC1155InvalidApprover(address approver);
/**
* @dev Indicates a failure with the `operator` to be approved. Used in approvals.
* @param operator Address that may be allowed to operate on tokens without being their owner.
*/
error ERC1155InvalidOperator(address operator);
/**
* @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
* Used in batch transfers.
* @param idsLength Length of the array of token identifiers
* @param valuesLength Length of the array of token amounts
*/
error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*/
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
mapping(address account => uint256) private _balances;
mapping(address account => mapping(address spender => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the default value returned by this function, unless
* it's overridden.
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `value`.
*/
function transfer(address to, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_transfer(owner, to, value);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, value);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `value`.
* - the caller must have allowance for ``from``'s tokens of at least
* `value`.
*/
function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, value);
_transfer(from, to, value);
return true;
}
/**
* @dev Moves a `value` amount of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _transfer(address from, address to, uint256 value) internal {
if (from == address(0)) {
revert ERC20InvalidSender(address(0));
}
if (to == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(from, to, value);
}
/**
* @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
* (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
* this function.
*
* Emits a {Transfer} event.
*/
function _update(address from, address to, uint256 value) internal virtual {
if (from == address(0)) {
// Overflow check required: The rest of the code assumes that totalSupply never overflows
_totalSupply += value;
} else {
uint256 fromBalance = _balances[from];
if (fromBalance < value) {
revert ERC20InsufficientBalance(from, fromBalance, value);
}
unchecked {
// Overflow not possible: value <= fromBalance <= totalSupply.
_balances[from] = fromBalance - value;
}
}
if (to == address(0)) {
unchecked {
// Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
_totalSupply -= value;
}
} else {
unchecked {
// Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
_balances[to] += value;
}
}
emit Transfer(from, to, value);
}
/**
* @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
* Relies on the `_update` mechanism
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead.
*/
function _mint(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidReceiver(address(0));
}
_update(address(0), account, value);
}
/**
* @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
* Relies on the `_update` mechanism.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* NOTE: This function is not virtual, {_update} should be overridden instead
*/
function _burn(address account, uint256 value) internal {
if (account == address(0)) {
revert ERC20InvalidSender(address(0));
}
_update(account, address(0), value);
}
/**
* @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*
* Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
*/
function _approve(address owner, address spender, uint256 value) internal {
_approve(owner, spender, value, true);
}
/**
* @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
*
* By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
* `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
* `Approval` event during `transferFrom` operations.
*
* Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
* true using the following override:
* ```
* function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
* super._approve(owner, spender, value, true);
* }
* ```
*
* Requirements are the same as {_approve}.
*/
function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
if (owner == address(0)) {
revert ERC20InvalidApprover(address(0));
}
if (spender == address(0)) {
revert ERC20InvalidSpender(address(0));
}
_allowances[owner][spender] = value;
if (emitEvent) {
emit Approval(owner, spender, value);
}
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `value`.
*
* Does not update the allowance value in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Does not emit an {Approval} event.
*/
function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
if (currentAllowance < value) {
revert ERC20InsufficientAllowance(spender, currentAllowance, value);
}
unchecked {
_approve(owner, spender, currentAllowance - value, false);
}
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 value) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets a `value` amount of tokens as the allowance of `spender` over the
* caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 value) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "./AcceptableImplementationClaimableAdminStorage.sol";
/**
* @title SafeUpgradeableClaimableAdmin
* @dev based on Compound's Unitroller
* https://github.com/compound-finance/compound-protocol/blob/a3214f67b73310d547e00fc578e8355911c9d376/contracts/Unitroller.sol
*/
contract AcceptableImplementationClaimableAdmin is
AcceptableImplementationClaimableAdminStorage
{
/**
* @notice Emitted when pendingImplementation is changed
*/
event NewPendingImplementation(
address oldPendingImplementation,
address newPendingImplementation
);
/**
* @notice Emitted when pendingImplementation is accepted, which means delegation implementation is updated
*/
event NewImplementation(address oldImplementation, address newImplementation);
/**
* @notice Emitted when pendingAdmin is changed
*/
event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);
/**
* @notice Emitted when pendingAdmin is accepted, which means admin is updated
*/
event NewAdmin(address oldAdmin, address newAdmin);
/*** Admin Functions ***/
function _setPendingImplementation(address newPendingImplementation) public {
require(msg.sender == admin, "not admin");
require(
approvePendingImplementationInternal(newPendingImplementation),
"INVALID_IMPLEMENTATION"
);
address oldPendingImplementation = pendingImplementation;
pendingImplementation = newPendingImplementation;
emit NewPendingImplementation(
oldPendingImplementation,
pendingImplementation
);
}
/**
* @notice Accepts new implementation. msg.sender must be pendingImplementation
* @dev Admin function for new implementation to accept it's role as implementation
*/
function _acceptImplementation() public returns (uint) {
// Check caller is pendingImplementation and pendingImplementation ≠ address(0)
require(
msg.sender == pendingImplementation &&
pendingImplementation != address(0),
"Not the EXISTING pending implementation"
);
// Save current values for inclusion in log
address oldImplementation = implementation;
address oldPendingImplementation = pendingImplementation;
implementation = pendingImplementation;
pendingImplementation = address(0);
emit NewImplementation(oldImplementation, implementation);
emit NewPendingImplementation(
oldPendingImplementation,
pendingImplementation
);
return 0;
}
/**
* @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.
* @param newPendingAdmin New pending admin.
*/
function _setPendingAdmin(address newPendingAdmin) public {
// Check caller = admin
require(msg.sender == admin, "Not Admin");
// Save current value, if any, for inclusion in log
address oldPendingAdmin = pendingAdmin;
// Store pendingAdmin with value newPendingAdmin
pendingAdmin = newPendingAdmin;
// Emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin)
emit NewPendingAdmin(oldPendingAdmin, newPendingAdmin);
}
/**
* @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin
* @dev Admin function for pending admin to accept role and update admin
*/
function _acceptAdmin() public {
// Check caller is pendingAdmin and pendingAdmin ≠ address(0)
require(
msg.sender == pendingAdmin && pendingAdmin != address(0),
"Not the EXISTING pending admin"
);
// Save current values for inclusion in log
address oldAdmin = admin;
address oldPendingAdmin = pendingAdmin;
// Store admin with value pendingAdmin
admin = pendingAdmin;
// Clear the pending value
pendingAdmin = address(0);
emit NewAdmin(oldAdmin, admin);
emit NewPendingAdmin(oldPendingAdmin, pendingAdmin);
}
constructor(address _initialAdmin) {
admin = _initialAdmin;
emit NewAdmin(address(0), _initialAdmin);
}
/**
* @dev Delegates execution to an implementation contract.
* It returns to the external caller whatever the implementation returns
* or forwards reverts.
*/
fallback() external payable {
// delegate all other functions to current implementation
(bool success, ) = implementation.delegatecall(msg.data);
assembly {
let free_mem_ptr := mload(0x40)
returndatacopy(free_mem_ptr, 0, returndatasize())
switch success
case 0 {
revert(free_mem_ptr, returndatasize())
}
default {
return(free_mem_ptr, returndatasize())
}
}
}
receive() external payable {}
function approvePendingImplementationInternal(
address // _implementation
) internal virtual returns (bool) {
return true;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
contract ClaimableAdminStorage {
/**
* @notice Administrator for this contract
*/
address public admin;
/**
* @notice Pending administrator for this contract
*/
address public pendingAdmin;
/*** Modifiers ***/
modifier onlyAdmin() {
require(msg.sender == admin, "ONLY_ADMIN");
_;
}
/*** Constructor ***/
constructor() {
// Set admin to caller
admin = msg.sender;
}
}
contract AcceptableImplementationClaimableAdminStorage is
ClaimableAdminStorage
{
/**
* @notice Active logic
*/
address public implementation;
/**
* @notice Pending logic
*/
address public pendingImplementation;
}
contract AcceptableRegistryImplementationClaimableAdminStorage is
AcceptableImplementationClaimableAdminStorage
{
/**
* @notice System Registry
*/
address public registry;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "./AcceptableImplementationClaimableAdmin.sol";
import "./IContractRegistryBase.sol";
/**
* @title AcceptableRegistryImplementationClaimableAdmin
*/
contract AcceptableRegistryImplementationClaimableAdmin is
AcceptableImplementationClaimableAdmin,
AcceptableRegistryImplementationClaimableAdminStorage
{
bytes32 public immutable CONTRACT_NAME_HASH;
constructor(
address _registry,
string memory proxyName,
address _initialAdmin
) AcceptableImplementationClaimableAdmin(_initialAdmin) {
registry = _registry;
CONTRACT_NAME_HASH = keccak256(abi.encodePacked(proxyName));
}
function approvePendingImplementationInternal(
address _implementation
) internal view override returns (bool) {
return
IContractRegistryBase(registry).isImplementationValidForProxy(
CONTRACT_NAME_HASH,
_implementation
);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
interface IContractRegistryBase {
function isImplementationValidForProxy(
bytes32 proxyNameHash,
address _implementation
) external view returns (bool);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
/**
* @dev only use immutables and constants in this contract
*/
contract CommonScales {
uint256 public constant PRECISION = 1e18; // 18 decimals
uint256 public constant LEVERAGE_SCALE = 100; // 2 decimal points
uint256 public constant FRACTION_SCALE = 100000; // 5 decimal points
uint256 public constant ACCURACY_IMPROVEMENT_SCALE = 1e9;
function calculateLeveragedPosition(
uint256 collateral,
uint256 leverage
) internal pure returns (uint256) {
return (collateral * leverage) / LEVERAGE_SCALE;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
interface IFundingRateModel {
// return value is the "funding paid by heavier side" in PRECISION per OI (heavier side) per second
// e.g : (0.01 * PRECISION) = Paying (heavier) side (as a whole) pays 1% of funding per second for each OI unit
function getFundingRate(
uint256 pairId,
uint256 openInterestLong,
uint256 openInterestShort,
uint256 pairMaxOpenInterest
) external view returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
interface IGlobalLock {
function lock() external;
function freeLock() external;
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
interface IInterestRateModel {
// Returns asset/second of interest per borrowed unit
// e.g : (0.01 * PRECISION) = 1% of interest per second
function getBorrowRate(uint256 utilization) external view returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "./LexErrors.sol";
import "./LexPoolAdminEnums.sol";
import "./IPoolAccountantV1.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface LexPoolStructs {
struct PendingDeposit {
uint256 amount;
uint256 minAmountOut;
}
struct PendingRedeem {
uint256 amount;
uint256 minAmountOut;
uint256 maxAmountOut;
}
}
interface LexPoolEvents is LexPoolAdminEnums {
event NewEpoch(
uint256 epochId,
int256 reportedUnrealizedPricePnL,
uint256 exchangeRate,
uint256 virtualUnderlyingBalance,
uint256 totalSupply
);
event AddressUpdated(LexPoolAddressesEnum indexed enumCode, address a);
event NumberUpdated(LexPoolNumbersEnum indexed enumCode, uint value);
event DepositRequest(
address indexed user,
uint256 amount,
uint256 minAmountOut,
uint256 processingEpoch
);
event RedeemRequest(
address indexed user,
uint256 amount,
uint256 minAmountOut,
uint256 processingEpoch
);
event ProcessedDeposit(
address indexed user,
bool deposited,
uint256 depositedAmount
);
event ProcessedRedeem(
address indexed user,
bool redeemed,
uint256 withdrawnAmount // Underlying amount
);
event CanceledDeposit(
address indexed user,
uint256 epoch,
uint256 cancelledAmount
);
event CanceledRedeem(
address indexed user,
uint256 epoch,
uint256 cancelledAmount
);
event ImmediateDepositAllowedToggled(bool indexed value);
event ImmediateDeposit(
address indexed depositor,
uint256 depositAmount,
uint256 mintAmount
);
event ReservesWithdrawn(
address _to,
uint256 interestShare,
uint256 totalFundingShare
);
}
interface ILexPoolFunctionality is
IERC20,
LexPoolStructs,
LexPoolEvents,
LexErrors
{
function setPoolAccountant(
IPoolAccountantFunctionality _poolAccountant
) external;
function setPnlRole(address pnl) external;
function setMaxExtraWithdrawalAmountF(uint256 maxExtra) external;
function setEpochsDelayDeposit(uint256 delay) external;
function setEpochsDelayRedeem(uint256 delay) external;
function setEpochDuration(uint256 duration) external;
function setMinDepositAmount(uint256 amount) external;
function toggleImmediateDepositAllowed() external;
function reduceReserves(
address _to
) external returns (uint256 interestShare, uint256 totalFundingShare);
function requestDeposit(
uint256 amount,
uint256 minAmountOut,
bytes32 domain,
bytes32 referralCode
) external;
function requestDepositViaIntent(
address user,
uint256 amount,
uint256 minAmountOut,
bytes32 domain,
bytes32 referralCode
) external;
function requestRedeem(uint256 amount, uint256 minAmountOut) external;
function requestRedeemViaIntent(
address user,
uint256 amount,
uint256 minAmountOut
) external;
function processDeposit(
address[] memory users
)
external
returns (
uint256 amountDeposited,
uint256 amountCancelled,
uint256 counterDeposited,
uint256 counterCancelled
);
function cancelDeposits(
address[] memory users,
uint256[] memory epochs
) external;
function processRedeems(
address[] memory users
)
external
returns (
uint256 amountRedeemed,
uint256 amountCancelled,
uint256 counterDeposited,
uint256 counterCancelled
);
function cancelRedeems(
address[] memory users,
uint256[] memory epochs
) external;
function nextEpoch(
int256 totalUnrealizedPricePnL
) external returns (uint256 newExchangeRate);
function currentVirtualUtilization() external view returns (uint256);
function currentVirtualUtilization(
uint256 totalBorrows,
uint256 totalReserves,
int256 unrealizedFunding
) external view returns (uint256);
function virtualBalanceForUtilization() external view returns (uint256);
function virtualBalanceForUtilization(
uint256 extraAmount,
int256 unrealizedFunding
) external view returns (uint256);
function underlyingBalanceForExchangeRate() external view returns (uint256);
function sendAssetToTrader(address to, uint256 amount) external;
function isUtilizationForLPsValid() external view returns (bool);
}
interface ILexPoolV1 is ILexPoolFunctionality {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function SELF_UNIT_SCALE() external view returns (uint);
function underlyingDecimals() external view returns (uint256);
function poolAccountant() external view returns (address);
function underlying() external view returns (IERC20);
function tradingFloor() external view returns (address);
function currentEpoch() external view returns (uint256);
function currentExchangeRate() external view returns (uint256);
function nextEpochStartMin() external view returns (uint256);
function epochDuration() external view returns (uint256);
function minDepositAmount() external view returns (uint256);
function epochsDelayDeposit() external view returns (uint256);
function epochsDelayRedeem() external view returns (uint256);
function immediateDepositAllowed() external view returns (bool);
function pendingDeposits(
uint epoch,
address account
) external view returns (PendingDeposit memory);
function pendingRedeems(
uint epoch,
address account
) external view returns (PendingRedeem memory);
function pendingDepositAmount() external view returns (uint256);
function pendingWithdrawalAmount() external view returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
interface ILynxVersionedContract {
/**
* @notice Returns the name of the contract
*/
function getContractName() external view returns (string memory);
/**
* @notice Returns the version of the contract
* @dev units are scaled by 1000 (1,000 = 1.00, 1,120 = 1.12)
*/
function getContractVersion() external view returns (string memory);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "./LexErrors.sol";
import "./ILexPoolV1.sol";
import "./IInterestRateModel.sol";
import "./IFundingRateModel.sol";
import "./TradingEnumsV1.sol";
interface PoolAccountantStructs {
// @note To be used for passing information in function calls
struct PositionRegistrationParams {
uint256 collateral;
uint32 leverage;
bool long;
uint64 openPrice;
uint64 tp;
}
struct PairFunding {
// Slot 0
int256 accPerOiLong; // 32 bytes -- Underlying Decimals
// Slot 1
int256 accPerOiShort; // 32 bytes -- Underlying Decimals
// Slot 2
uint256 lastUpdateTimestamp; // 32 bytes
}
struct TradeInitialAccFees {
// Slot 0
uint256 borrowIndex; // 32 bytes
// Slot 1
int256 funding; // 32 bytes -- underlying units -- Underlying Decimals
}
struct PairOpenInterest {
// Slot 0
uint256 long; // 32 bytes -- underlying units -- Dynamic open interest for long positions
// Slot 1
uint256 short; // 32 bytes -- underlying units -- Dynamic open interest for short positions
}
// This struct is not kept in storage
struct PairFromTo {
string from;
string to;
}
struct Pair {
// Slot 0
uint16 id; // 02 bytes
uint16 groupId; // 02 bytes
uint16 feeId; // 02 bytes
uint32 minLeverage; // 04 bytes
uint32 maxLeverage; // 04 bytes
uint32 maxBorrowF; // 04 bytes -- FRACTION_SCALE (5)
// Slot 1
uint256 maxPositionSize; // 32 bytes -- underlying units
// Slot 2
uint256 maxGain; // 32 bytes -- underlying units
// Slot 3
uint256 maxOpenInterest; // 32 bytes -- Underlying units
// Slot 4
uint256 maxSkew; // 32 bytes -- underlying units
// Slot 5
uint256 minOpenFee; // 32 bytes -- underlying units. MAX_UINT means use the default group level value
// Slot 6
uint256 minPerformanceFee; // 32 bytes -- underlying units
}
struct Group {
// Slot 0
uint16 id; // 02 bytes
uint32 minLeverage; // 04 bytes
uint32 maxLeverage; // 04 bytes
uint32 maxBorrowF; // 04 bytes -- FRACTION_SCALE (5)
// Slot 1
uint256 maxPositionSize; // 32 bytes (Underlying units)
// Slot 2
uint256 minOpenFee; // 32 bytes (Underlying uints). MAX_UINT means use the default global level value
}
struct Fee {
// Slot 0
uint16 id; // 02 bytes
uint32 openFeeF; // 04 bytes -- FRACTION_SCALE (5) (Fraction of leveraged pos)
uint32 closeFeeF; // 04 bytes -- FRACTION_SCALE (5) (Fraction of leveraged pos)
uint32 performanceFeeF; // 04 bytes -- FRACTION_SCALE (5) (Fraction of performance)
}
}
interface PoolAccountantEvents is PoolAccountantStructs {
event PairAdded(
uint256 indexed id,
string indexed from,
string indexed to,
Pair pair
);
event PairUpdated(uint256 indexed id, Pair pair);
event GroupAdded(uint256 indexed id, string indexed groupName, Group group);
event GroupUpdated(uint256 indexed id, Group group);
event FeeAdded(uint256 indexed id, string indexed name, Fee fee);
event FeeUpdated(uint256 indexed id, Fee fee);
event TradeInitialAccFeesStored(
bytes32 indexed positionId,
uint256 borrowIndex,
// uint256 rollover,
int256 funding
);
event AccrueFunding(
uint256 indexed pairId,
int256 valueLong,
int256 valueShort
);
event ProtocolFundingShareAccrued(
uint16 indexed pairId,
uint256 protocolFundingShare
);
// event AccRolloverFeesStored(uint256 pairIndex, uint256 value);
event FeesCharged(
bytes32 indexed positionId,
address indexed trader,
uint16 indexed pairId,
PositionRegistrationParams positionRegistrationParams,
// bool long,
// uint256 collateral, // Underlying Decimals
// uint256 leverage,
int256 profitPrecision, // PRECISION
uint256 interest,
int256 funding, // Underlying Decimals
uint256 closingFee,
uint256 tradeValue
);
event PerformanceFeeCharging(
bytes32 indexed positionId,
uint256 performanceFee
);
event MaxOpenInterestUpdated(uint256 pairIndex, uint256 maxOpenInterest);
event AccrueInterest(
uint256 cash,
uint256 totalInterestNew,
uint256 borrowIndexNew,
uint256 interestShareNew
);
event Borrow(
uint256 indexed pairId,
uint256 borrowAmount,
uint256 newTotalBorrows
);
event Repay(
uint256 indexed pairId,
uint256 repayAmount,
uint256 newTotalBorrows
);
}
interface IPoolAccountantFunctionality is
PoolAccountantStructs,
PoolAccountantEvents,
LexErrors,
TradingEnumsV1
{
function setTradeIncentivizer(address _tradeIncentivizer) external;
function setMaxGainF(uint256 _maxGainF) external;
function setFrm(IFundingRateModel _frm) external;
function setMinOpenFee(uint256 min) external;
function setLexPartF(uint256 partF) external;
function setFundingRateMax(uint256 maxValue) external;
function setLiquidationThresholdF(uint256 threshold) external;
function setLiquidationFeeF(uint256 fee) external;
function setIrm(IInterestRateModel _irm) external;
function setIrmHard(IInterestRateModel _irm) external;
function setInterestShareFactor(uint256 factor) external;
function setFundingShareFactor(uint256 factor) external;
function setBorrowRateMax(uint256 rate) external;
function setMaxTotalBorrows(uint256 maxBorrows) external;
function setMaxVirtualUtilization(uint256 _maxVirtualUtilization) external;
function resetTradersPairGains(uint256 pairId) external;
function addGroup(Group calldata _group) external;
function updateGroup(Group calldata _group) external;
function addFee(Fee calldata _fee) external;
function updateFee(Fee calldata _fee) external;
function addPair(Pair calldata _pair) external;
function addPairs(Pair[] calldata _pairs) external;
function updatePair(Pair calldata _pair) external;
function readAndZeroReserves()
external
returns (uint256 accumulatedInterestShare,
uint256 accFundingShare);
function registerOpenTrade(
bytes32 positionId,
address trader,
uint16 pairId,
uint256 collateral,
uint32 leverage,
bool long,
uint256 tp,
uint256 openPrice
) external returns (uint256 fee, uint256 lexPartFee);
function registerCloseTrade(
bytes32 positionId,
address trader,
uint16 pairId,
PositionRegistrationParams calldata positionRegistrationParams,
uint256 closePrice,
PositionCloseType positionCloseType
)
external
returns (
uint256 closingFee,
uint256 tradeValue,
int256 profitPrecision,
uint finalClosePrice
);
function registerUpdateTp(
bytes32 positionId,
address trader,
uint16 pairId,
uint256 collateral,
uint32 leverage,
bool long,
uint256 openPrice,
uint256 oldTriggerPrice,
uint256 triggerPrice
) external;
// function registerUpdateSl(
// address trader,
// uint256 pairIndex,
// uint256 index,
// uint256 collateral,
// uint256 leverage,
// bool long,
// uint256 openPrice,
// uint256 triggerPrice
// ) external returns (uint256 fee);
function accrueInterest()
external
returns (
uint256 totalInterestNew,
uint256 interestShareNew,
uint256 borrowIndexNew
);
// Limited only for the LexPool
function accrueInterest(
uint256 availableCash
)
external
returns (
uint256 totalInterestNew,
uint256 interestShareNew,
uint256 borrowIndexNew
);
function getTradeClosingValues(
bytes32 positionId,
uint16 pairId,
PositionRegistrationParams calldata positionRegistrationParams,
uint256 closePrice,
bool isLiquidation
)
external
returns (
uint256 tradeValue, // Underlying Decimals
uint256 safeClosingFee,
int256 profitPrecision,
uint256 interest,
int256 funding
);
function getTradeLiquidationPrice(
bytes32 positionId,
uint16 pairId,
uint256 openPrice, // PRICE_SCALE (8)
uint256 tp,
bool long,
uint256 collateral, // Underlying Decimals
uint32 leverage
)
external
returns (
uint256 // PRICE_SCALE (8)
);
function calcTradeDynamicFees(
bytes32 positionId,
uint16 pairId,
bool long,
uint256 collateral,
uint32 leverage,
uint256 openPrice,
uint256 tp
) external returns (uint256 interest, int256 funding);
function unrealizedFunding() external view returns (int256);
function totalBorrows() external view returns (uint256);
function interestShare() external view returns (uint256);
function fundingShare() external view returns (uint256);
function totalReservesView() external view returns (uint256);
function borrowsAndInterestShare()
external
view
returns (uint256 totalBorrows, uint256 totalInterestShare);
function pairTotalOpenInterest(
uint256 pairIndex
) external view returns (int256);
function pricePnL(
uint256 pairId,
uint256 price
) external view returns (int256);
function getAllSupportedPairIds() external view returns (uint16[] memory);
function getAllSupportedGroupsIds() external view returns (uint16[] memory);
function getAllSupportedFeeIds() external view returns (uint16[] memory);
}
interface IPoolAccountantV1 is IPoolAccountantFunctionality {
function totalBorrows() external view returns (uint256);
function maxTotalBorrows() external view returns (uint256);
function pairBorrows(uint256 pairId) external view returns (uint256);
function groupBorrows(uint256 groupId) external view returns (uint256);
function pairMaxBorrow(uint16 pairId) external view returns (uint256);
function groupMaxBorrow(uint16 groupId) external view returns (uint256);
function lexPool() external view returns (ILexPoolV1);
function maxGainF() external view returns (uint256);
function interestShareFactor() external view returns (uint256);
function fundingShareFactor() external view returns (uint256);
function frm() external view returns (IFundingRateModel);
function irm() external view returns (IInterestRateModel);
function pairs(uint16 pairId) external view returns (Pair memory);
function groups(uint16 groupId) external view returns (Group memory);
function fees(uint16 feeId) external view returns (Fee memory);
function openInterestInPair(
uint pairId
) external view returns (PairOpenInterest memory);
function minOpenFee() external view returns (uint256);
function liquidationThresholdF() external view returns (uint256);
function liquidationFeeF() external view returns (uint256);
function lexPartF() external view returns (uint256);
function tradersPairGains(uint256 pairId) external view returns (int256);
function calcBorrowAmount(
uint256 collateral,
uint256 leverage,
bool long,
uint256 openPrice,
uint256 tp
) external pure returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "../../AdministrationContracts/IContractRegistryBase.sol";
import "./IGlobalLock.sol";
interface IRegistryV1Functionality is IContractRegistryBase, IGlobalLock {
// **** Locking mechanism ****
function isTradersPortalAndLocker(
address _address
) external view returns (bool);
function isTriggersAndLocker(address _address) external view returns (bool);
function isTradersPortalOrTriggersAndLocker(
address _address
) external view returns (bool);
}
interface IRegistryV1 is IRegistryV1Functionality {
// **** Public Storage params ****
function feesManagers(address asset) external view returns (address);
function orderBook() external view returns (address);
function tradersPortal() external view returns (address);
function triggers() external view returns (address);
function tradeIntentsVerifier() external view returns (address);
function liquidityIntentsVerifier() external view returns (address);
function chipsIntentsVerifier() external view returns (address);
function lexProxiesFactory() external view returns (address);
function chipsFactory() external view returns (address);
/**
* @return An array of all supported trading floors
*/
function getAllSupportedTradingFloors()
external
view
returns (address[] memory);
/**
* @return An array of all supported settlement assets
*/
function getSettlementAssetsForTradingFloor(
address _tradingFloor
) external view returns (address[] memory);
/**
* @return The spender role address that is set for this chip
*/
function getValidSpenderTargetForChipByRole(
address chip,
string calldata role
) external view returns (address);
/**
* @return the address of the valid 'burnHandler' for the chip
*/
function validBurnHandlerForChip(
address chip
) external view returns (address);
/**
* @return The address matching for the given role
*/
function getDynamicRoleAddress(
string calldata _role
) external view returns (address);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "./TradingFloorStructsV1.sol";
import "./IPoolAccountantV1.sol";
import "./ILexPoolV1.sol";
interface ITradingFloorV1Functionality is TradingFloorStructsV1 {
function supportNewSettlementAsset(
address _asset,
address _lexPool,
address _poolAccountant
) external;
function getPositionTriggerInfo(
bytes32 _positionId
)
external
view
returns (
PositionPhase positionPhase,
uint64 timestamp,
uint16 pairId,
bool long,
uint32 spreadReductionF
);
function getPositionPortalInfo(
bytes32 _positionId
)
external
view
returns (
PositionPhase positionPhase,
uint64 inPhaseSince,
address positionTrader
);
function storePendingPosition(
OpenOrderType _orderType,
PositionRequestIdentifiers memory _requestIdentifiers,
PositionRequestParams memory _requestParams,
uint32 _spreadReductionF
) external returns (bytes32 positionId);
function setOpenedPositionToMarketClose(
bytes32 _positionId,
uint64 _minPrice,
uint64 _maxPrice
) external;
function cancelPendingPosition(
bytes32 _positionId,
OpenOrderType _orderType,
uint feeFraction
) external;
function cancelMarketCloseForPosition(
bytes32 _positionId,
CloseOrderType _orderType,
uint feeFraction
) external;
function updatePendingPosition_openLimit(
bytes32 _positionId,
uint64 _minPrice,
uint64 _maxPrice,
uint64 _tp,
uint64 _sl
) external;
function openNewPosition_market(
bytes32 _positionId,
uint64 assetEffectivePrice,
uint256 feeForCancellation
) external;
function openNewPosition_limit(
bytes32 _positionId,
uint64 assetEffectivePrice,
uint256 feeForCancellation
) external;
function closeExistingPosition_Market(
bytes32 _positionId,
uint64 assetPrice,
uint64 effectivePrice
) external;
function closeExistingPosition_Limit(
bytes32 _positionId,
LimitTrigger limitTrigger,
uint64 assetPrice,
uint64 effectivePrice
) external;
// Manage open trade
function updateOpenedPosition(
bytes32 _positionId,
PositionField updateField,
uint64 fieldValue,
uint64 effectivePrice
) external;
// Fees
function collectFee(address _asset, FeeType _feeType, address _to) external;
}
interface ITradingFloorV1 is ITradingFloorV1Functionality {
function PRECISION() external pure returns (uint);
// *** Views ***
function pairTradersArray(
address _asset,
uint _pairIndex
) external view returns (address[] memory);
function generatePositionHashId(
address settlementAsset,
address trader,
uint16 pairId,
uint32 index
) external pure returns (bytes32 hashId);
// *** Public Storage addresses ***
function lexPoolForAsset(address asset) external view returns (ILexPoolV1);
function poolAccountantForAsset(
address asset
) external view returns (IPoolAccountantV1);
function registry() external view returns (address);
// *** Public Storage params ***
function positionsById(bytes32 id) external view returns (Position memory);
function positionIdentifiersById(
bytes32 id
) external view returns (PositionIdentifiers memory);
function positionLimitsInfoById(
bytes32 id
) external view returns (PositionLimitsInfo memory);
function triggerPricesById(
bytes32 id
) external view returns (PositionTriggerPrices memory);
function pairTradersInfo(
address settlementAsset,
address trader,
uint pairId
) external view returns (PairTraderInfo memory);
function spreadReductionsP(uint) external view returns (uint);
function maxSlF() external view returns (uint);
function maxTradesPerPair() external view returns (uint);
function maxSanityProfitF() external view returns (uint);
function feesMap(
address settlementAsset,
FeeType feeType
) external view returns (uint256);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
interface LexErrors {
enum CapType {
NONE, // 0
MIN_OPEN_FEE, // 1
MAX_POS_SIZE_PAIR, // 2
MAX_POS_SIZE_GROUP, // 3
MAX_LEVERAGE, // 4
MIN_LEVERAGE, // 5
MAX_VIRTUAL_UTILIZATION, // 6
MAX_OPEN_INTEREST, // 7
MAX_ABS_SKEW, // 8
MAX_BORROW_PAIR, // 9
MAX_BORROW_GROUP, // 10
MIN_DEPOSIT_AMOUNT, // 11
MAX_ACCUMULATED_GAINS, // 12
BORROW_RATE_MAX, // 13
FUNDING_RATE_MAX, // 14
MAX_POTENTIAL_GAIN, // 15
MAX_TOTAL_BORROW, // 16
MIN_PERFORMANCE_FEE // 17
//...
}
error CapError(CapType, uint256 value);
}// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;
interface LexPoolAdminEnums {
enum LexPoolAddressesEnum {
none,
poolAccountant,
pnlRole
}
enum LexPoolNumbersEnum {
none,
maxExtraWithdrawalAmountF,
epochsDelayDeposit,
epochsDelayRedeem,
epochDuration,
minDepositAmount
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
interface TradingEnumsV1 {
enum PositionPhase {
NONE,
OPEN_MARKET,
OPEN_LIMIT,
OPENED,
CLOSE_MARKET,
CLOSED
}
enum OpenOrderType {
NONE,
MARKET,
LIMIT
}
enum CloseOrderType {
NONE,
MARKET
}
enum FeeType {
NONE,
OPEN_FEE,
CLOSE_FEE,
TRIGGER_FEE
}
enum LimitTrigger {
NONE,
TP,
SL,
LIQ
}
enum PositionField {
NONE,
TP,
SL
}
enum PositionCloseType {
NONE,
TP,
SL,
LIQ,
MARKET
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "./TradingEnumsV1.sol";
interface TradingFloorStructsV1 is TradingEnumsV1 {
enum AdminNumericParam {
NONE,
MAX_TRADES_PER_PAIR,
MAX_SL_F,
MAX_SANITY_PROFIT_F
}
/**
* @dev Memory struct for identifiers
*/
struct PositionRequestIdentifiers {
address trader;
uint16 pairId;
address settlementAsset;
uint32 positionIndex;
}
struct PositionRequestParams {
bool long;
uint256 collateral; // Settlement Asset Decimals
uint32 leverage;
uint64 minPrice; // PRICE_SCALE
uint64 maxPrice; // PRICE_SCALE
uint64 tp; // PRICE_SCALE
uint64 sl; // PRICE_SCALE
uint64 tpByFraction; // FRACTION_SCALE
uint64 slByFraction; // FRACTION_SCALE
}
/**
* @dev Storage struct for identifiers
*/
struct PositionIdentifiers {
// Slot 0
address settlementAsset; // 20 bytes
uint16 pairId; // 02 bytes
uint32 index; // 04 bytes
// Slot 1
address trader; // 20 bytes
}
struct Position {
// Slot 0
uint collateral; // 32 bytes -- Settlement Asset Decimals
// Slot 1
PositionPhase phase; // 01 bytes
uint64 inPhaseSince; // 08 bytes
uint32 leverage; // 04 bytes
bool long; // 01 bytes
uint64 openPrice; // 08 bytes -- PRICE_SCALE (8)
uint32 spreadReductionF; // 04 bytes -- FRACTION_SCALE (5)
}
/**
* Holds the non liquidation limits for the position
*/
struct PositionLimitsInfo {
uint64 tpLastUpdated; // 08 bytes -- timestamp
uint64 slLastUpdated; // 08 bytes -- timestamp
uint64 tp; // 08 bytes -- PRICE_SCALE (8)
uint64 sl; // 08 bytes -- PRICE_SCALE (8)
}
/**
* Holds the prices for opening (and market closing) of a position
*/
struct PositionTriggerPrices {
uint64 minPrice; // 08 bytes -- PRICE_SCALE
uint64 maxPrice; // 08 bytes -- PRICE_SCALE
uint64 tpByFraction; // 04 bytes -- FRACTION_SCALE
uint64 slByFraction; // 04 bytes -- FRACTION_SCALE
}
/**
* @dev administration struct, used to keep tracks on the 'PairTraders' list and
* to limit the amount of positions a trader can have
*/
struct PairTraderInfo {
uint32 positionsCounter; // 04 bytes
uint32 positionInArray; // 04 bytes (the index + 1)
// Note : Can add more fields here
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "../../AdministrationContracts/AcceptableImplementationClaimableAdminStorage.sol";
import "../interfaces/ITradingFloorV1.sol";
import "../Common/CommonScales.sol";
/**
* @title LexCommon
* @dev For Lex contracts to inherit from, holding common variables and modifiers
*/
contract LexCommon is
CommonScales,
AcceptableRegistryImplementationClaimableAdminStorage
{
IERC20 public underlying;
ITradingFloorV1 public tradingFloor;
function initializeLexCommon(
ITradingFloorV1 _tradingFloor,
IERC20 _underlying
) public {
require(
address(tradingFloor) == address(0) && address(underlying) == address(0),
"Initialized"
);
tradingFloor = _tradingFloor;
underlying = _underlying;
}
modifier onlyTradingFloor() {
require(msg.sender == address(tradingFloor), "TRADING_FLOOR_ONLY");
_;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
/**
* @title LexERC20
* @dev simple erc20 contract.
* @notice This is the token that is issued against the deposited funds.
* The value of the token is represented by the exchange rate of the pool.
*/
contract LexERC20 is IERC20 {
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) internal _allowances;
uint256 public totalSupply;
string public name;
string public symbol;
function initializeLexERC20(
string memory _name,
string memory _symbol
) public {
require(
bytes(name).length == 0 && bytes(symbol).length == 0,
"Initialized"
);
name = _name;
symbol = _symbol;
}
function decimals() public pure returns (uint8) {
return 18;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(
address owner,
address spender
) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][msg.sender];
require(
currentAllowance >= amount,
"ERC20: transfer amount exceeds allowance"
);
unchecked {
_approve(sender, msg.sender, currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "../LexCommon.sol";
import "./LexERC20.sol";
/**
* @title LexPoolStorage
* @dev Storage contract for LexPool
*/
abstract contract LexPoolStorage is LexCommon, LexERC20, LexPoolStructs {
uint256 public underlyingDecimals;
// ***** Roles *****
IPoolAccountantFunctionality public poolAccountant;
address public pnlRole;
// ***** Depositing and Withdrawing *****
// epoch => user => PendingDeposit
mapping(uint256 => mapping(address => PendingDeposit)) public pendingDeposits;
// epoch => user => PendingRedeem
mapping(uint256 => mapping(address => PendingRedeem)) public pendingRedeems;
// epoch => users who deposits on this epoch
mapping(uint256 => address[]) public pendingDepositorsArr;
// epoch => users who redeems on this epoch
mapping(uint256 => address[]) public pendingRedeemersArr;
uint256 public pendingDepositAmount;
uint256 public pendingWithdrawalAmount;
// Extra fraction allowed to be withdrawn when redeem processes
uint256 public maxExtraWithdrawalAmountF;
uint256 public minDepositAmount;
// ***** Epochs *****
uint256 public currentEpoch;
uint256 public nextEpochStartMin; // Minimum timestamp that calling nextEpoch will be possible
uint256 public currentExchangeRate;
uint256 public epochsDelayDeposit;
uint256 public epochsDelayRedeem;
uint256 public epochDuration;
// ***** Flags *****
bool public immediateDepositAllowed;
function initializeLexPoolStorage(
ITradingFloorV1 _tradingFloor,
ERC20 _underlying,
uint _epochDuration
) internal {
initializeLexERC20(
string.concat("Lynx LP ", _underlying.symbol()),
string.concat("lx", _underlying.symbol())
);
initializeLexCommon(_tradingFloor, IERC20(_underlying));
underlyingDecimals = _underlying.decimals();
epochDuration = _epochDuration;
}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import "../../../AdministrationContracts/AcceptableRegistryImplementationClaimableAdmin.sol";
import "../LexPool/LexPoolStorage.sol";
/**
* @title LexPoolProxy
* @dev Used as the upgradable lex pool of the Lynx platform
*/
contract PoolAccountantProxy is AcceptableRegistryImplementationClaimableAdmin {
constructor(
address _registry,
address _initialAdmin
)
AcceptableRegistryImplementationClaimableAdmin(
_registry,
"PoolAccountant",
_initialAdmin
)
{}
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import {ILynxVersionedContract} from "../../../interfaces/ILynxVersionedContract.sol";
abstract contract SingleContractDeployerBase is ILynxVersionedContract {
// ***** Events *****
event FactoryRoleSet(
address indexed previousFactoryRole,
address indexed newFactoryRole
);
event ContractDeployed(address indexed newContract);
// ***** Immutable *****
// For readability only, should not use this value for on-chain logic
string public DEPLOYED_CONTRACT_NAME;
string public DEPLOYED_CONTRACT_VERSION;
// ***** Storage *****
address[] public allDeployedContracts;
// contract address => was deployed by this contract
mapping(address => bool) public wasDeployedFromHere;
// ***** Modifiers *****
modifier onlyFactoryRole() {
require(msg.sender == getFactoryRole(), "NOT_FACTORY_ROLE");
_;
}
// ***** Views *****
function getDeployedContractName() external view returns (string memory) {
return DEPLOYED_CONTRACT_NAME;
}
function getAllDeployedContractsAddresses()
external
view
returns (address[] memory)
{
return allDeployedContracts;
}
// ***** Public Virtual Views *****
function getFactoryRole() public virtual returns (address);
// ***** Constructor *****
constructor(
string memory _deployedContractName,
string memory _deployedContractVersion
) {
DEPLOYED_CONTRACT_NAME = _deployedContractName;
DEPLOYED_CONTRACT_VERSION = _deployedContractVersion;
}
// ***** Deployer Functions *****
function deploySingleContract(
bytes calldata payload
) public onlyFactoryRole returns (address) {
address deployedContract = deploySingleContractInternal(payload);
onContractDeployed(deployedContract);
return deployedContract;
}
// ***** Internal Functions *****
function onContractDeployed(address _deployedContract) internal {
// Sanity
require(!wasDeployedFromHere[_deployedContract], "HANDLER_ALREADY_CALLED");
// State
allDeployedContracts.push(_deployedContract);
wasDeployedFromHere[_deployedContract] = true;
// Events
emit ContractDeployed(_deployedContract);
}
// ***** Internal Virtual Functions *****
function deploySingleContractInternal(
bytes calldata payload
) internal virtual returns (address);
}// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
import {SingleContractDeployerBase} from "../baseContracts/SingleContractDeployerBase.sol";
abstract contract RegistryBasedProxySingleContractDeployer is
SingleContractDeployerBase
{
// ***** Storage *****
/**
* @notice System Registry
*/
address public immutable registry;
// ***** Constructor *****
constructor(
address _registry,
string memory _deployedContractName,
string memory _deployedContractVersion
)
SingleContractDeployerBase(_deployedContractName, _deployedContractVersion)
{
registry = _registry;
}
// ***** Deployment functions *****
/**
* @notice Specific deploy function
*/
function deployRegistryProxy(
address _initialAdmin
) external onlyFactoryRole returns (address) {
address deployedContract = deployRegistryProxyInternal(_initialAdmin);
// Call base hook
onContractDeployed(deployedContract);
return deployedContract;
}
// ***** Internal override functions *****
/**
* @notice Implements the 'SingleContractDeployerBase' generic deploy function
*/
function deploySingleContractInternal(
bytes calldata payload
) internal override returns (address) {
// Check payload length - address is exactly 32 bytes with encodePacked
require(payload.length == 32, "INVALID_PAYLOAD_LENGTH");
// Convert bytes to address
address initialAdminParam = abi.decode(payload, (address));
require(initialAdminParam != address(0), "INVALID_INITIAL_ADMIN");
// Continue in the specific deployment function
return deployRegistryProxyInternal(initialAdminParam);
}
// ***** Internal virtual functions *****
/**
* @notice Virtual function to allow deployment of a specific Registry Proxy
*/
function deployRegistryProxyInternal(
address _initialAdmin
) internal virtual returns (address);
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "paris",
"metadata": {
"useLiteralContent": true
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_registry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newContract","type":"address"}],"name":"ContractDeployed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousFactoryRole","type":"address"},{"indexed":true,"internalType":"address","name":"newFactoryRole","type":"address"}],"name":"FactoryRoleSet","type":"event"},{"inputs":[],"name":"CONTRACT_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"CONTRACT_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPLOYED_CONTRACT_NAME","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEPLOYED_CONTRACT_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allDeployedContracts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_initialAdmin","type":"address"}],"name":"deployRegistryProxy","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"payload","type":"bytes"}],"name":"deploySingleContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAllDeployedContractsAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getContractName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getContractVersion","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"getDeployedContractName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFactoryRole","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wasDeployedFromHere","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]Contract Creation Code
60a06040523480156200001157600080fd5b50604051620015ca380380620015ca8339810160408190526200003491620000c5565b806040518060400160405280601381526020017f506f6f6c4163636f756e74616e7450726f787900000000000000000000000000815250604051806040016040528060048152602001630313030360e41b815250818181600090816200009b91906200019e565b506001620000aa82826200019e565b5050506001600160a01b03909216608052506200026a915050565b600060208284031215620000d857600080fd5b81516001600160a01b0381168114620000f057600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200012257607f821691505b6020821081036200014357634e487b7160e01b600052602260045260246000fd5b50919050565b601f82111562000199576000816000526020600020601f850160051c81016020861015620001745750805b601f850160051c820191505b81811015620001955782815560010162000180565b5050505b505050565b81516001600160401b03811115620001ba57620001ba620000f7565b620001d281620001cb84546200010d565b8462000149565b602080601f8311600181146200020a5760008415620001f15750858301515b600019600386901b1c1916600185901b17855562000195565b600085815260208120601f198616915b828110156200023b578886015182559484019460019091019084016200021a565b50858210156200025a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805161133662000294600039600081816101da015281816103fc015261077f01526113366000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c806389b738b61161008c578063b04212c311610066578063b04212c31461024c578063b370b1eb14610254578063c6e9ad951461025c578063f5f5ba721461026457600080fd5b806389b738b6146102115780638aa1043514610219578063aa6d0a981461023957600080fd5b806362a75b61116100c857806362a75b6114610197578063704d543a146101c25780637b103999146101d55780638149fb7a146101fc57600080fd5b806338b90333146100ef578063598607ca14610128578063614d08f81461015b575b600080fd5b610112604051806040016040528060048152602001630313030360e41b81525081565b60405161011f91906107f3565b60405180910390f35b61014b61013636600461085a565b60036020526000908152604090205460ff1681565b604051901515815260200161011f565b6101126040518060400160405280601b81526020017f506f6f6c4163636f756e74616e7450726f78794465706c6f796572000000000081525081565b6101aa6101a5366004610877565b61029d565b6040516001600160a01b03909116815260200161011f565b6101aa6101d036600461085a565b61031d565b6101aa7f000000000000000000000000000000000000000000000000000000000000000081565b610204610396565b60405161011f91906108e9565b6101aa6103f8565b6040805180820190915260048152630313030360e41b6020820152610112565b6101aa610247366004610936565b610481565b6101126104ab565b610112610539565b610112610546565b60408051808201909152601b81527f506f6f6c4163636f756e74616e7450726f78794465706c6f79657200000000006020820152610112565b60006102a76103f8565b6001600160a01b0316336001600160a01b0316146102ff5760405162461bcd60e51b815260206004820152601060248201526f4e4f545f464143544f52595f524f4c4560801b60448201526064015b60405180910390fd5b600061030b84846105cf565b905061031681610689565b9392505050565b60006103276103f8565b6001600160a01b0316336001600160a01b03161461037a5760405162461bcd60e51b815260206004820152601060248201526f4e4f545f464143544f52595f524f4c4560801b60448201526064016102f6565b60006103858361077a565b905061039081610689565b92915050565b606060028054806020026020016040519081016040528092919081815260200182805480156103ee57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116103d0575b5050505050905090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663695660aa6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c919061094f565b905090565b6002818154811061049157600080fd5b6000918252602090912001546001600160a01b0316905081565b600080546104b89061096c565b80601f01602080910402602001604051908101604052809291908181526020018280546104e49061096c565b80156105315780601f1061050657610100808354040283529160200191610531565b820191906000526020600020905b81548152906001019060200180831161051457829003601f168201915b505050505081565b600180546104b89061096c565b6060600080546105559061096c565b80601f01602080910402602001604051908101604052809291908181526020018280546105819061096c565b80156103ee5780601f106105a3576101008083540402835291602001916103ee565b820191906000526020600020905b8154815290600101906020018083116105b157509395945050505050565b60006020821461061a5760405162461bcd60e51b81526020600482015260166024820152750929cac82989288bea082b2989e8288be988a9c8ea8960531b60448201526064016102f6565b60006106288385018561085a565b90506001600160a01b0381166106785760405162461bcd60e51b815260206004820152601560248201527424a72b20a624a22fa4a724aa24a0a62fa0a226a4a760591b60448201526064016102f6565b6106818161077a565b949350505050565b6001600160a01b03811660009081526003602052604090205460ff16156106eb5760405162461bcd60e51b81526020600482015260166024820152751210539113115497d053149150511657d0d05313115160521b60448201526064016102f6565b6002805460018082019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b038416908117909155600081815260036020526040808220805460ff1916909417909355915190917f8ffcdc15a283d706d38281f500270d8b5a656918f555de0913d7455e3e6bc1bf91a250565b6000807f0000000000000000000000000000000000000000000000000000000000000000836040516107ab906107e6565b6001600160a01b03928316815291166020820152604001604051809103906000f0801580156107de573d6000803e3d6000fd5b509392505050565b61095a806109a783390190565b60006020808352835180602085015260005b8181101561082157858101830151858201604001528201610805565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461085757600080fd5b50565b60006020828403121561086c57600080fd5b813561031681610842565b6000806020838503121561088a57600080fd5b823567ffffffffffffffff808211156108a257600080fd5b818501915085601f8301126108b657600080fd5b8135818111156108c557600080fd5b8660208285010111156108d757600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561092a5783516001600160a01b031683529284019291840191600101610905565b50909695505050505050565b60006020828403121561094857600080fd5b5035919050565b60006020828403121561096157600080fd5b815161031681610842565b600181811c9082168061098057607f821691505b6020821081036109a057634e487b7160e01b600052602260045260246000fd5b5091905056fe60a060405234801561001057600080fd5b5060405161095a38038061095a83398101604081905261002f91610127565b604080518082018252600e81526d141bdbdb1058d8dbdd5b9d185b9d60921b602080830191909152600080546001600160a01b031990811633909116176001600160a01b03861690811782558451918252918101919091528492849182917ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a150600480546001600160a01b0319166001600160a01b0385161790556040516100e590839060200161015a565b60408051601f198184030181529190528051602090910120608052506101899350505050565b80516001600160a01b038116811461012257600080fd5b919050565b6000806040838503121561013a57600080fd5b6101438361010b565b91506101516020840161010b565b90509250929050565b6000825160005b8181101561017b5760208186018101518583015201610161565b506000920191825250919050565b6080516107af6101ab600039600081816101a8015261068b01526107af6000f3fe6080604052600436106100955760003560e01c8063b71d1a0c11610059578063b71d1a0c146101f8578063c1e8033414610218578063e992a0411461022d578063e9c714f21461024d578063f851a440146102625761009c565b80632678224714610119578063396f7b23146101565780635c60da1b1461017657806368c63188146101965780637b103999146101d85761009c565b3661009c57005b6002546040516000916001600160a01b0316906100bc9083903690610717565b600060405180830381855af49150503d80600081146100f7576040519150601f19603f3d011682016040523d82523d6000602084013e6100fc565b606091505b505090506040513d6000823e818015610113573d82f35b3d82fd5b005b34801561012557600080fd5b50600154610139906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016257600080fd5b50600354610139906001600160a01b031681565b34801561018257600080fd5b50600254610139906001600160a01b031681565b3480156101a257600080fd5b506101ca7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161014d565b3480156101e457600080fd5b50600454610139906001600160a01b031681565b34801561020457600080fd5b50610117610213366004610727565b610282565b34801561022457600080fd5b506101ca61032f565b34801561023957600080fd5b50610117610248366004610727565b61046c565b34801561025957600080fd5b5061011761055a565b34801561026e57600080fd5b50600054610139906001600160a01b031681565b6000546001600160a01b031633146102cd5760405162461bcd60e51b81526020600482015260096024820152682737ba1020b236b4b760b91b60448201526064015b60405180910390fd5b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991015b60405180910390a15050565b6003546000906001600160a01b03163314801561035657506003546001600160a01b031615155b6103b25760405162461bcd60e51b815260206004820152602760248201527f4e6f7420746865204558495354494e472070656e64696e6720696d706c656d65604482015266373a30ba34b7b760c91b60648201526084016102c4565b60028054600380546001600160a01b038082166001600160a01b031980861682179096559490911690915560408051919092168082526020820184905292917fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a910160405180910390a1600354604080516001600160a01b03808516825290921660208301527fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d815910160405180910390a160009250505090565b6000546001600160a01b031633146104b25760405162461bcd60e51b81526020600482015260096024820152683737ba1030b236b4b760b91b60448201526064016102c4565b6104bb81610678565b6105005760405162461bcd60e51b815260206004820152601660248201527524a72b20a624a22fa4a6a82622a6a2a72a20aa24a7a760511b60448201526064016102c4565b600380546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d8159101610323565b6001546001600160a01b03163314801561057e57506001546001600160a01b031615155b6105ca5760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420746865204558495354494e472070656e64696e672061646d696e000060448201526064016102c4565b60008054600180546001600160a01b038082166001600160a01b031980861682179096559490911690915560408051919092168082526020820184905292917ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a1600154604080516001600160a01b03808516825290921660208301527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99101610323565b60048054604051631e58694360e01b81527f0000000000000000000000000000000000000000000000000000000000000000928101929092526001600160a01b038381166024840152600092911690631e58694390604401602060405180830381865afa1580156106ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107119190610757565b92915050565b8183823760009101908152919050565b60006020828403121561073957600080fd5b81356001600160a01b038116811461075057600080fd5b9392505050565b60006020828403121561076957600080fd5b8151801515811461075057600080fdfea2646970667358221220ff090923d6fad7a1709c851ec6daef5a103c5d35a1b8e408864eaaeb6e421b0d64736f6c63430008180033a2646970667358221220e810efac6a03e492f054c94ff744b41ec667d1e1877c53374b3bc907e8a46d9864736f6c634300081800330000000000000000000000004cf3d61165a6be8ff741320ad27cab57fae5c207
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806389b738b61161008c578063b04212c311610066578063b04212c31461024c578063b370b1eb14610254578063c6e9ad951461025c578063f5f5ba721461026457600080fd5b806389b738b6146102115780638aa1043514610219578063aa6d0a981461023957600080fd5b806362a75b61116100c857806362a75b6114610197578063704d543a146101c25780637b103999146101d55780638149fb7a146101fc57600080fd5b806338b90333146100ef578063598607ca14610128578063614d08f81461015b575b600080fd5b610112604051806040016040528060048152602001630313030360e41b81525081565b60405161011f91906107f3565b60405180910390f35b61014b61013636600461085a565b60036020526000908152604090205460ff1681565b604051901515815260200161011f565b6101126040518060400160405280601b81526020017f506f6f6c4163636f756e74616e7450726f78794465706c6f796572000000000081525081565b6101aa6101a5366004610877565b61029d565b6040516001600160a01b03909116815260200161011f565b6101aa6101d036600461085a565b61031d565b6101aa7f0000000000000000000000004cf3d61165a6be8ff741320ad27cab57fae5c20781565b610204610396565b60405161011f91906108e9565b6101aa6103f8565b6040805180820190915260048152630313030360e41b6020820152610112565b6101aa610247366004610936565b610481565b6101126104ab565b610112610539565b610112610546565b60408051808201909152601b81527f506f6f6c4163636f756e74616e7450726f78794465706c6f79657200000000006020820152610112565b60006102a76103f8565b6001600160a01b0316336001600160a01b0316146102ff5760405162461bcd60e51b815260206004820152601060248201526f4e4f545f464143544f52595f524f4c4560801b60448201526064015b60405180910390fd5b600061030b84846105cf565b905061031681610689565b9392505050565b60006103276103f8565b6001600160a01b0316336001600160a01b03161461037a5760405162461bcd60e51b815260206004820152601060248201526f4e4f545f464143544f52595f524f4c4560801b60448201526064016102f6565b60006103858361077a565b905061039081610689565b92915050565b606060028054806020026020016040519081016040528092919081815260200182805480156103ee57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116103d0575b5050505050905090565b60007f0000000000000000000000004cf3d61165a6be8ff741320ad27cab57fae5c2076001600160a01b031663695660aa6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c919061094f565b905090565b6002818154811061049157600080fd5b6000918252602090912001546001600160a01b0316905081565b600080546104b89061096c565b80601f01602080910402602001604051908101604052809291908181526020018280546104e49061096c565b80156105315780601f1061050657610100808354040283529160200191610531565b820191906000526020600020905b81548152906001019060200180831161051457829003601f168201915b505050505081565b600180546104b89061096c565b6060600080546105559061096c565b80601f01602080910402602001604051908101604052809291908181526020018280546105819061096c565b80156103ee5780601f106105a3576101008083540402835291602001916103ee565b820191906000526020600020905b8154815290600101906020018083116105b157509395945050505050565b60006020821461061a5760405162461bcd60e51b81526020600482015260166024820152750929cac82989288bea082b2989e8288be988a9c8ea8960531b60448201526064016102f6565b60006106288385018561085a565b90506001600160a01b0381166106785760405162461bcd60e51b815260206004820152601560248201527424a72b20a624a22fa4a724aa24a0a62fa0a226a4a760591b60448201526064016102f6565b6106818161077a565b949350505050565b6001600160a01b03811660009081526003602052604090205460ff16156106eb5760405162461bcd60e51b81526020600482015260166024820152751210539113115497d053149150511657d0d05313115160521b60448201526064016102f6565b6002805460018082019092557f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b038416908117909155600081815260036020526040808220805460ff1916909417909355915190917f8ffcdc15a283d706d38281f500270d8b5a656918f555de0913d7455e3e6bc1bf91a250565b6000807f0000000000000000000000004cf3d61165a6be8ff741320ad27cab57fae5c207836040516107ab906107e6565b6001600160a01b03928316815291166020820152604001604051809103906000f0801580156107de573d6000803e3d6000fd5b509392505050565b61095a806109a783390190565b60006020808352835180602085015260005b8181101561082157858101830151858201604001528201610805565b506000604082860101526040601f19601f8301168501019250505092915050565b6001600160a01b038116811461085757600080fd5b50565b60006020828403121561086c57600080fd5b813561031681610842565b6000806020838503121561088a57600080fd5b823567ffffffffffffffff808211156108a257600080fd5b818501915085601f8301126108b657600080fd5b8135818111156108c557600080fd5b8660208285010111156108d757600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561092a5783516001600160a01b031683529284019291840191600101610905565b50909695505050505050565b60006020828403121561094857600080fd5b5035919050565b60006020828403121561096157600080fd5b815161031681610842565b600181811c9082168061098057607f821691505b6020821081036109a057634e487b7160e01b600052602260045260246000fd5b5091905056fe60a060405234801561001057600080fd5b5060405161095a38038061095a83398101604081905261002f91610127565b604080518082018252600e81526d141bdbdb1058d8dbdd5b9d185b9d60921b602080830191909152600080546001600160a01b031990811633909116176001600160a01b03861690811782558451918252918101919091528492849182917ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a150600480546001600160a01b0319166001600160a01b0385161790556040516100e590839060200161015a565b60408051601f198184030181529190528051602090910120608052506101899350505050565b80516001600160a01b038116811461012257600080fd5b919050565b6000806040838503121561013a57600080fd5b6101438361010b565b91506101516020840161010b565b90509250929050565b6000825160005b8181101561017b5760208186018101518583015201610161565b506000920191825250919050565b6080516107af6101ab600039600081816101a8015261068b01526107af6000f3fe6080604052600436106100955760003560e01c8063b71d1a0c11610059578063b71d1a0c146101f8578063c1e8033414610218578063e992a0411461022d578063e9c714f21461024d578063f851a440146102625761009c565b80632678224714610119578063396f7b23146101565780635c60da1b1461017657806368c63188146101965780637b103999146101d85761009c565b3661009c57005b6002546040516000916001600160a01b0316906100bc9083903690610717565b600060405180830381855af49150503d80600081146100f7576040519150601f19603f3d011682016040523d82523d6000602084013e6100fc565b606091505b505090506040513d6000823e818015610113573d82f35b3d82fd5b005b34801561012557600080fd5b50600154610139906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561016257600080fd5b50600354610139906001600160a01b031681565b34801561018257600080fd5b50600254610139906001600160a01b031681565b3480156101a257600080fd5b506101ca7f000000000000000000000000000000000000000000000000000000000000000081565b60405190815260200161014d565b3480156101e457600080fd5b50600454610139906001600160a01b031681565b34801561020457600080fd5b50610117610213366004610727565b610282565b34801561022457600080fd5b506101ca61032f565b34801561023957600080fd5b50610117610248366004610727565b61046c565b34801561025957600080fd5b5061011761055a565b34801561026e57600080fd5b50600054610139906001600160a01b031681565b6000546001600160a01b031633146102cd5760405162461bcd60e51b81526020600482015260096024820152682737ba1020b236b4b760b91b60448201526064015b60405180910390fd5b600180546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a991015b60405180910390a15050565b6003546000906001600160a01b03163314801561035657506003546001600160a01b031615155b6103b25760405162461bcd60e51b815260206004820152602760248201527f4e6f7420746865204558495354494e472070656e64696e6720696d706c656d65604482015266373a30ba34b7b760c91b60648201526084016102c4565b60028054600380546001600160a01b038082166001600160a01b031980861682179096559490911690915560408051919092168082526020820184905292917fd604de94d45953f9138079ec1b82d533cb2160c906d1076d1f7ed54befbca97a910160405180910390a1600354604080516001600160a01b03808516825290921660208301527fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d815910160405180910390a160009250505090565b6000546001600160a01b031633146104b25760405162461bcd60e51b81526020600482015260096024820152683737ba1030b236b4b760b91b60448201526064016102c4565b6104bb81610678565b6105005760405162461bcd60e51b815260206004820152601660248201527524a72b20a624a22fa4a6a82622a6a2a72a20aa24a7a760511b60448201526064016102c4565b600380546001600160a01b038381166001600160a01b031983168117909355604080519190921680825260208201939093527fe945ccee5d701fc83f9b8aa8ca94ea4219ec1fcbd4f4cab4f0ea57c5c3e1d8159101610323565b6001546001600160a01b03163314801561057e57506001546001600160a01b031615155b6105ca5760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420746865204558495354494e472070656e64696e672061646d696e000060448201526064016102c4565b60008054600180546001600160a01b038082166001600160a01b031980861682179096559490911690915560408051919092168082526020820184905292917ff9ffabca9c8276e99321725bcb43fb076a6c66a54b7f21c4e8146d8519b417dc910160405180910390a1600154604080516001600160a01b03808516825290921660208301527fca4f2f25d0898edd99413412fb94012f9e54ec8142f9b093e7720646a95b16a99101610323565b60048054604051631e58694360e01b81527f0000000000000000000000000000000000000000000000000000000000000000928101929092526001600160a01b038381166024840152600092911690631e58694390604401602060405180830381865afa1580156106ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107119190610757565b92915050565b8183823760009101908152919050565b60006020828403121561073957600080fd5b81356001600160a01b038116811461075057600080fd5b9392505050565b60006020828403121561076957600080fd5b8151801515811461075057600080fdfea2646970667358221220ff090923d6fad7a1709c851ec6daef5a103c5d35a1b8e408864eaaeb6e421b0d64736f6c63430008180033a2646970667358221220e810efac6a03e492f054c94ff744b41ec667d1e1877c53374b3bc907e8a46d9864736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000004cf3d61165a6be8ff741320ad27cab57fae5c207
-----Decoded View---------------
Arg [0] : _registry (address): 0x4CF3d61165a6Be8FF741320ad27Cab57faE5c207
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000004cf3d61165a6be8ff741320ad27cab57fae5c207
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in S
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.