ETH Price: $3,526.41 (-1.36%)
Gas: 21 Gwei

Contract

0xCC33c2840B65c0a4AC4015c650Dd20dC3eb2081D
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x60a06040143065842022-03-02 8:50:08757 days ago1646211008IN
 Create: AssetsBooleanParameters
0 ETH0.0138138348.41505616

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AssetsBooleanParameters

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 4 : AssetsBooleanParameters.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2021 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;

import "../../Auth2.sol";
import "../../interfaces/vault-managers/parameters/IAssetsBooleanParameters.sol";


/**
 * @title AssetsBooleanParameters
 **/
contract AssetsBooleanParameters is Auth2, IAssetsBooleanParameters {

    mapping(address => uint256) internal values;

    constructor(address _vaultParameters, address[] memory _initialAssets, uint8[] memory _initialParams) Auth2(_vaultParameters) {
        require(_initialAssets.length == _initialParams.length, "Unit Protocol: ARGUMENTS_LENGTH_MISMATCH");

        for (uint i = 0; i < _initialAssets.length; i++) {
            _set(_initialAssets[i], _initialParams[i], true);
        }
    }

    /**
     * @notice Get value of _param for _asset
     * @dev see ParametersConstants
     **/
    function get(address _asset, uint8 _param) external override view returns (bool) {
        return values[_asset] & (1 << _param) != 0;
    }

    /**
     * @notice Get values of all params for _asset. The 0th bit of returned uint id the value of param=0, etc
     **/
    function getAll(address _asset) external override view returns (uint256) {
        return values[_asset];
    }

    /**
     * @notice Set value of _param for _asset
     * @dev see ParametersConstants
     **/
    function set(address _asset, uint8 _param, bool _value) public override onlyManager {
        _set(_asset, _param, _value);
    }

    function _set(address _asset, uint8 _param, bool _value) internal {
        require(_asset != address(0), "Unit Protocol: ZERO_ADDRESS");

        if (_value) {
            values[_asset] |= (1 << _param);
            emit ValueSet(_asset, _param, values[_asset]);
        } else {
            values[_asset] &= ~(1 << _param);
            emit ValueUnset(_asset, _param, values[_asset]);
        }
    }
}

File 3 of 4 : Auth2.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2021 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;

import "./VaultParameters.sol";


/**
 * @title Auth2
 * @dev Manages USDP's system access
 * @dev copy of Auth from VaultParameters.sol but with immutable vaultParameters for saving gas
 **/
contract Auth2 {

    // address of the the contract with vault parameters
    VaultParameters public immutable vaultParameters;

    constructor(address _parameters) {
        require(_parameters != address(0), "Unit Protocol: ZERO_ADDRESS");

        vaultParameters = VaultParameters(_parameters);
    }

    // ensures tx's sender is a manager
    modifier onlyManager() {
        require(vaultParameters.isManager(msg.sender), "Unit Protocol: AUTH_FAILED");
        _;
    }

    // ensures tx's sender is able to modify the Vault
    modifier hasVaultAccess() {
        require(vaultParameters.canModifyVault(msg.sender), "Unit Protocol: AUTH_FAILED");
        _;
    }

    // ensures tx's sender is the Vault
    modifier onlyVault() {
        require(msg.sender == vaultParameters.vault(), "Unit Protocol: AUTH_FAILED");
        _;
    }
}

File 4 of 4 : IAssetsBooleanParameters.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2021 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.6;

interface IAssetsBooleanParameters {

    event ValueSet(address indexed asset, uint8 param, uint256 valuesForAsset);
    event ValueUnset(address indexed asset, uint8 param, uint256 valuesForAsset);

    function get(address _asset, uint8 _param) external view returns (bool);
    function getAll(address _asset) external view returns (uint256);
    function set(address _asset, uint8 _param, bool _value) external;
}

File 5 of 4 : VaultParameters.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity 0.7.6;



/**
 * @title Auth
 * @dev Manages USDP's system access
 **/
contract Auth {

    // address of the the contract with vault parameters
    VaultParameters public vaultParameters;

    constructor(address _parameters) {
        vaultParameters = VaultParameters(_parameters);
    }

    // ensures tx's sender is a manager
    modifier onlyManager() {
        require(vaultParameters.isManager(msg.sender), "Unit Protocol: AUTH_FAILED");
        _;
    }

    // ensures tx's sender is able to modify the Vault
    modifier hasVaultAccess() {
        require(vaultParameters.canModifyVault(msg.sender), "Unit Protocol: AUTH_FAILED");
        _;
    }

    // ensures tx's sender is the Vault
    modifier onlyVault() {
        require(msg.sender == vaultParameters.vault(), "Unit Protocol: AUTH_FAILED");
        _;
    }
}



/**
 * @title VaultParameters
 **/
contract VaultParameters is Auth {

    // map token to stability fee percentage; 3 decimals
    mapping(address => uint) public stabilityFee;

    // map token to liquidation fee percentage, 0 decimals
    mapping(address => uint) public liquidationFee;

    // map token to USDP mint limit
    mapping(address => uint) public tokenDebtLimit;

    // permissions to modify the Vault
    mapping(address => bool) public canModifyVault;

    // managers
    mapping(address => bool) public isManager;

    // enabled oracle types
    mapping(uint => mapping (address => bool)) public isOracleTypeEnabled;

    // address of the Vault
    address payable public vault;

    // The foundation address
    address public foundation;

    /**
     * The address for an Ethereum contract is deterministically computed from the address of its creator (sender)
     * and how many transactions the creator has sent (nonce). The sender and nonce are RLP encoded and then
     * hashed with Keccak-256.
     * Therefore, the Vault address can be pre-computed and passed as an argument before deployment.
    **/
    constructor(address payable _vault, address _foundation) Auth(address(this)) {
        require(_vault != address(0), "Unit Protocol: ZERO_ADDRESS");
        require(_foundation != address(0), "Unit Protocol: ZERO_ADDRESS");

        isManager[msg.sender] = true;
        vault = _vault;
        foundation = _foundation;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Grants and revokes manager's status of any address
     * @param who The target address
     * @param permit The permission flag
     **/
    function setManager(address who, bool permit) external onlyManager {
        isManager[who] = permit;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets the foundation address
     * @param newFoundation The new foundation address
     **/
    function setFoundation(address newFoundation) external onlyManager {
        require(newFoundation != address(0), "Unit Protocol: ZERO_ADDRESS");
        foundation = newFoundation;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets ability to use token as the main collateral
     * @param asset The address of the main collateral token
     * @param stabilityFeeValue The percentage of the year stability fee (3 decimals)
     * @param liquidationFeeValue The liquidation fee percentage (0 decimals)
     * @param usdpLimit The USDP token issue limit
     * @param oracles The enables oracle types
     **/
    function setCollateral(
        address asset,
        uint stabilityFeeValue,
        uint liquidationFeeValue,
        uint usdpLimit,
        uint[] calldata oracles
    ) external onlyManager {
        setStabilityFee(asset, stabilityFeeValue);
        setLiquidationFee(asset, liquidationFeeValue);
        setTokenDebtLimit(asset, usdpLimit);
        for (uint i=0; i < oracles.length; i++) {
            setOracleType(oracles[i], asset, true);
        }
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets a permission for an address to modify the Vault
     * @param who The target address
     * @param permit The permission flag
     **/
    function setVaultAccess(address who, bool permit) external onlyManager {
        canModifyVault[who] = permit;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets the percentage of the year stability fee for a particular collateral
     * @param asset The address of the main collateral token
     * @param newValue The stability fee percentage (3 decimals)
     **/
    function setStabilityFee(address asset, uint newValue) public onlyManager {
        stabilityFee[asset] = newValue;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets the percentage of the liquidation fee for a particular collateral
     * @param asset The address of the main collateral token
     * @param newValue The liquidation fee percentage (0 decimals)
     **/
    function setLiquidationFee(address asset, uint newValue) public onlyManager {
        require(newValue <= 100, "Unit Protocol: VALUE_OUT_OF_RANGE");
        liquidationFee[asset] = newValue;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Enables/disables oracle types
     * @param _type The type of the oracle
     * @param asset The address of the main collateral token
     * @param enabled The control flag
     **/
    function setOracleType(uint _type, address asset, bool enabled) public onlyManager {
        isOracleTypeEnabled[_type][asset] = enabled;
    }

    /**
     * @notice Only manager is able to call this function
     * @dev Sets USDP limit for a specific collateral
     * @param asset The address of the main collateral token
     * @param limit The limit number
     **/
    function setTokenDebtLimit(address asset, uint limit) public onlyManager {
        tokenDebtLimit[asset] = limit;
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vaultParameters","type":"address"},{"internalType":"address[]","name":"_initialAssets","type":"address[]"},{"internalType":"uint8[]","name":"_initialParams","type":"uint8[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint8","name":"param","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"valuesForAsset","type":"uint256"}],"name":"ValueSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint8","name":"param","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"valuesForAsset","type":"uint256"}],"name":"ValueUnset","type":"event"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint8","name":"_param","type":"uint8"}],"name":"get","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"}],"name":"getAll","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_asset","type":"address"},{"internalType":"uint8","name":"_param","type":"uint8"},{"internalType":"bool","name":"_value","type":"bool"}],"name":"set","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultParameters","outputs":[{"internalType":"contract VaultParameters","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a060405234801561001057600080fd5b506040516107c13803806107c18339818101604052606081101561003357600080fd5b81516020830180516040519294929383019291908464010000000082111561005a57600080fd5b90830190602082018581111561006f57600080fd5b825186602082028301116401000000008211171561008c57600080fd5b82525081516020918201928201910280838360005b838110156100b95781810151838201526020016100a1565b50505050905001604052602001805160405193929190846401000000008211156100e257600080fd5b9083019060208201858111156100f757600080fd5b825186602082028301116401000000008211171561011457600080fd5b82525081516020918201928201910280838360005b83811015610141578181015183820152602001610129565b505050509050016040525050508260006001600160a01b0316816001600160a01b031614156101b7576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b60601b6001600160601b03191660805280518251146102075760405162461bcd60e51b81526004018080602001828103825260288152602001806107996028913960400191505060405180910390fd5b60005b82518110156102535761024b83828151811061022257fe5b602002602001015183838151811061023657fe5b6020026020010151600161025c60201b60201c565b60010161020a565b5050505061038d565b6001600160a01b0383166102b7576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b8015610324576001600160a01b038316600081815260208181526040918290208054600160ff881690811b9091179182905583519081529182015281517fe76889dca61072998a5f9679150b780d236b50d5325a9657324ad1f1f0747e96929181900390910190a2610388565b6001600160a01b038316600081815260208181526040918290208054600160ff881690811b199091169182905583519081529182015281517f24dff77206bfe0472d1ff28e51816d9b3a1d8e57bd66c4885d7d240b9f974008929181900390910190a25b505050565b60805160601c6103ea6103af6000398061012b528061016d52506103ea6000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c8063aca345ee14610051578063c15b70dd14610075578063eab84c4c146100ae578063eb077342146100f1575b600080fd5b610059610129565b604080516001600160a01b039092168252519081900360200190f35b6100ac6004803603606081101561008b57600080fd5b506001600160a01b038135169060ff6020820135169060400135151561014d565b005b6100dd600480360360408110156100c457600080fd5b5080356001600160a01b0316906020013560ff16610240565b604080519115158252519081900360200190f35b6101176004803603602081101561010757600080fd5b50356001600160a01b0316610269565b60408051918252519081900360200190f35b7f000000000000000000000000000000000000000000000000000000000000000081565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163f3ae2415916024808301926020929190829003018186803b1580156101b357600080fd5b505afa1580156101c7573d6000803e3d6000fd5b505050506040513d60208110156101dd57600080fd5b5051610230576040805162461bcd60e51b815260206004820152601a60248201527f556e69742050726f746f636f6c3a20415554485f4641494c4544000000000000604482015290519081900360640190fd5b61023b838383610284565b505050565b6001600160a01b038216600090815260208190526040902054600160ff83161b16151592915050565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0383166102df576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b801561034c576001600160a01b038316600081815260208181526040918290208054600160ff881690811b9091179182905583519081529182015281517fe76889dca61072998a5f9679150b780d236b50d5325a9657324ad1f1f0747e96929181900390910190a261023b565b6001600160a01b038316600081815260208181526040918290208054600160ff881690811b199091169182905583519081529182015281517f24dff77206bfe0472d1ff28e51816d9b3a1d8e57bd66c4885d7d240b9f974008929181900390910190a250505056fea2646970667358221220f78e01e862509431b9746fbd01c0513c8ed21495d25f9754cb3ec2fb17c6617764736f6c63430007060033556e69742050726f746f636f6c3a20415247554d454e54535f4c454e4754485f4d49534d41544348000000000000000000000000b46f8cf42e504efe8bef895f848741daa55e9f1d0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061004c5760003560e01c8063aca345ee14610051578063c15b70dd14610075578063eab84c4c146100ae578063eb077342146100f1575b600080fd5b610059610129565b604080516001600160a01b039092168252519081900360200190f35b6100ac6004803603606081101561008b57600080fd5b506001600160a01b038135169060ff6020820135169060400135151561014d565b005b6100dd600480360360408110156100c457600080fd5b5080356001600160a01b0316906020013560ff16610240565b604080519115158252519081900360200190f35b6101176004803603602081101561010757600080fd5b50356001600160a01b0316610269565b60408051918252519081900360200190f35b7f000000000000000000000000b46f8cf42e504efe8bef895f848741daa55e9f1d81565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f000000000000000000000000b46f8cf42e504efe8bef895f848741daa55e9f1d169163f3ae2415916024808301926020929190829003018186803b1580156101b357600080fd5b505afa1580156101c7573d6000803e3d6000fd5b505050506040513d60208110156101dd57600080fd5b5051610230576040805162461bcd60e51b815260206004820152601a60248201527f556e69742050726f746f636f6c3a20415554485f4641494c4544000000000000604482015290519081900360640190fd5b61023b838383610284565b505050565b6001600160a01b038216600090815260208190526040902054600160ff83161b16151592915050565b6001600160a01b031660009081526020819052604090205490565b6001600160a01b0383166102df576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b801561034c576001600160a01b038316600081815260208181526040918290208054600160ff881690811b9091179182905583519081529182015281517fe76889dca61072998a5f9679150b780d236b50d5325a9657324ad1f1f0747e96929181900390910190a261023b565b6001600160a01b038316600081815260208181526040918290208054600160ff881690811b199091169182905583519081529182015281517f24dff77206bfe0472d1ff28e51816d9b3a1d8e57bd66c4885d7d240b9f974008929181900390910190a250505056fea2646970667358221220f78e01e862509431b9746fbd01c0513c8ed21495d25f9754cb3ec2fb17c6617764736f6c63430007060033

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

000000000000000000000000b46f8cf42e504efe8bef895f848741daa55e9f1d0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _vaultParameters (address): 0xB46F8CF42e504Efe8BEf895f848741daA55e9f1D

-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000b46f8cf42e504efe8bef895f848741daa55e9f1d
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000060
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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