Sonic Blaze Testnet

Contract

0x4532Ecb5b6879B1F4Cf44d7927b79C267Adcf71c

Overview

S Balance

Sonic Blaze LogoSonic Blaze LogoSonic Blaze Logo0 S

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

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

Contract Source Code Verified (Exact Match)

Contract Name:
RightsManager

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 20 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 1 : RightsManager.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.6.12;

// Needed to handle structures externally
pragma experimental ABIEncoderV2;

/**
 * @author Desyn Labs
 * @title Manage Configurable Rights for the smart pool
 *                         by default, it is off on initialization and can only be turned on
 *      canWhitelistLPs - can limit liquidity providers to a given set of addresses
 *      canChangeCap - can change the BSP cap (max # of pool tokens)
 *      canChangeFloor - can change the BSP floor for Closure ETF (min # of pool tokens)
 */
library RightsManager {
    // Type declarations

    enum Permissions {
        WHITELIST_LPS,
        TOKEN_WHITELISTS
    }

    struct Rights {
        bool canWhitelistLPs;
        bool canTokenWhiteLists;
    }

    // State variables (can only be constants in a library)
    bool public constant DEFAULT_CAN_WHITELIST_LPS = false;
    bool public constant DEFAULT_CAN_TOKEN_WHITELISTS = false;

    // bool public constant DEFAULT_CAN_CHANGE_CAP = false;
    // bool public constant DEFAULT_CAN_CHANGE_FLOOR = false;

    // Functions

    /**
     * @notice create a struct from an array (or return defaults)
     * @dev If you pass an empty array, it will construct it using the defaults
     * @param a - array input
     * @return Rights struct
     */
    function constructRights(bool[] calldata a) external pure returns (Rights memory) {
        if (a.length < 2) {
            return
                Rights(
                    DEFAULT_CAN_WHITELIST_LPS,
                    DEFAULT_CAN_TOKEN_WHITELISTS
                );
        } else {
            // return Rights(a[0], a[1], a[2], a[3], a[4], a[5], a[6]);
            return Rights(a[0], a[1]);
        }
    }

    /**
     * @notice Convert rights struct to an array (e.g., for events, GUI)
     * @dev avoids multiple calls to hasPermission
     * @param rights - the rights struct to convert
     * @return boolean array containing the rights settings
     */
    function convertRights(Rights calldata rights) external pure returns (bool[] memory) {
        bool[] memory result = new bool[](2);

        result[0] = rights.canWhitelistLPs;
        result[1] = rights.canTokenWhiteLists;

        return result;
    }

    // Though it is actually simple, the number of branches triggers code-complexity
    /* solhint-disable code-complexity */

    /**
     * @notice Externally check permissions using the Enum
     * @param self - Rights struct containing the permissions
     * @param permission - The permission to check
     * @return Boolean true if it has the permission
     */
    function hasPermission(Rights calldata self, Permissions permission) external pure returns (bool) {
        if (Permissions.WHITELIST_LPS == permission) {
            return self.canWhitelistLPs;
        } else if (Permissions.TOKEN_WHITELISTS == permission) {
            return self.canTokenWhiteLists;
        }
    }

    /* solhint-enable code-complexity */
}

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

Contract ABI

[{"inputs":[],"name":"DEFAULT_CAN_TOKEN_WHITELISTS","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_CAN_WHITELIST_LPS","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool[]","name":"a","type":"bool[]"}],"name":"constructRights","outputs":[{"components":[{"internalType":"bool","name":"canWhitelistLPs","type":"bool"},{"internalType":"bool","name":"canTokenWhiteLists","type":"bool"}],"internalType":"struct RightsManager.Rights","name":"","type":"tuple"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"canWhitelistLPs","type":"bool"},{"internalType":"bool","name":"canTokenWhiteLists","type":"bool"}],"internalType":"struct RightsManager.Rights","name":"rights","type":"tuple"}],"name":"convertRights","outputs":[{"internalType":"bool[]","name":"","type":"bool[]"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"bool","name":"canWhitelistLPs","type":"bool"},{"internalType":"bool","name":"canTokenWhiteLists","type":"bool"}],"internalType":"struct RightsManager.Rights","name":"self","type":"tuple"},{"internalType":"enum RightsManager.Permissions","name":"permission","type":"RightsManager.Permissions"}],"name":"hasPermission","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"}]

6103f3610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100615760003560e01c80634583544a14610066578063710a51c21461008f578063c08473fc146100af578063dccf54e7146100cf578063fe7f62d1146100cf575b600080fd5b610079610074366004610317565b6100d7565b6040516100869190610397565b60405180910390f35b6100a261009d3660046102fc565b610127565b6040516100869190610351565b6100c26100bd366004610266565b6101a7565b60405161008691906103a2565b610079610233565b60008160018111156100e557fe5b6100fd576100f660208401846102d5565b9050610121565b81600181111561010957fe5b60011415610121576100f660408401602085016102d5565b92915050565b60408051600280825260608083018452928392919060208301908036833701905050905061015860208401846102d5565b8160008151811061016557fe5b91151560209283029190910182015261018490604085019085016102d5565b8160018151811061019157fe5b9115156020928302919091019091015292915050565b6101af610238565b60028210156101d257506040805180820190915260008082526020820152610121565b6040518060400160405280848460008181106101ea57fe5b90506020020160208101906101ff91906102d5565b151581526020018484600181811061021357fe5b905060200201602081019061022891906102d5565b151590529050610121565b600081565b604080518082019091526000808252602082015290565b600060408284031215610260578081fd5b50919050565b60008060208385031215610278578182fd5b823567ffffffffffffffff8082111561028f578384fd5b818501915085601f8301126102a2578384fd5b8135818111156102b0578485fd5b86602080830285010111156102c3578485fd5b60209290920196919550909350505050565b6000602082840312156102e6578081fd5b813580151581146102f5578182fd5b9392505050565b60006040828403121561030d578081fd5b6102f5838361024f565b60008060608385031215610329578182fd5b610333848461024f565b9150604083013560028110610346578182fd5b809150509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561038b57835115158352928401929184019160010161036d565b50909695505050505050565b901515815260200190565b8151151581526020918201511515918101919091526040019056fea2646970667358221220ab7b728cc5043410929a0a33025da24a9ae79392404d295c954e0307251bd66064736f6c634300060c0033

Deployed Bytecode

0x734532ecb5b6879b1f4cf44d7927b79c267adcf71c30146080604052600436106100615760003560e01c80634583544a14610066578063710a51c21461008f578063c08473fc146100af578063dccf54e7146100cf578063fe7f62d1146100cf575b600080fd5b610079610074366004610317565b6100d7565b6040516100869190610397565b60405180910390f35b6100a261009d3660046102fc565b610127565b6040516100869190610351565b6100c26100bd366004610266565b6101a7565b60405161008691906103a2565b610079610233565b60008160018111156100e557fe5b6100fd576100f660208401846102d5565b9050610121565b81600181111561010957fe5b60011415610121576100f660408401602085016102d5565b92915050565b60408051600280825260608083018452928392919060208301908036833701905050905061015860208401846102d5565b8160008151811061016557fe5b91151560209283029190910182015261018490604085019085016102d5565b8160018151811061019157fe5b9115156020928302919091019091015292915050565b6101af610238565b60028210156101d257506040805180820190915260008082526020820152610121565b6040518060400160405280848460008181106101ea57fe5b90506020020160208101906101ff91906102d5565b151581526020018484600181811061021357fe5b905060200201602081019061022891906102d5565b151590529050610121565b600081565b604080518082019091526000808252602082015290565b600060408284031215610260578081fd5b50919050565b60008060208385031215610278578182fd5b823567ffffffffffffffff8082111561028f578384fd5b818501915085601f8301126102a2578384fd5b8135818111156102b0578485fd5b86602080830285010111156102c3578485fd5b60209290920196919550909350505050565b6000602082840312156102e6578081fd5b813580151581146102f5578182fd5b9392505050565b60006040828403121561030d578081fd5b6102f5838361024f565b60008060608385031215610329578182fd5b610333848461024f565b9150604083013560028110610346578182fd5b809150509250929050565b6020808252825182820181905260009190848201906040850190845b8181101561038b57835115158352928401929184019160010161036d565b50909695505050505050565b901515815260200190565b8151151581526020918201511515918101919091526040019056fea2646970667358221220ab7b728cc5043410929a0a33025da24a9ae79392404d295c954e0307251bd66064736f6c634300060c0033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.