Contract 0x5BEf93a96DCc2cAEC92e8610bb2f5bf5EB4D89f4 1

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x93c1706c8407d5e1951405ca0f949112e25c414c8e03fd9bbbe2d10d73505b450x60a06040197369712021-10-22 5:43:5847 days 13 hrs ago0x55d56e1bb2fc8280a775ccfe9ececcecf1a01562 IN  Contract Creation0 FTM0.079689527474
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x93c1706c8407d5e1951405ca0f949112e25c414c8e03fd9bbbe2d10d73505b45197369712021-10-22 5:43:5847 days 13 hrs ago 0x55d56e1bb2fc8280a775ccfe9ececcecf1a01562  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
CollateralRegistry

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : CollateralRegistry.sol
// SPDX-License-Identifier: bsl-1.1

/*
  Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]).
*/
pragma solidity ^0.7.1;
pragma experimental ABIEncoderV2;


import "./VaultParameters.sol";


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

    event CollateralAdded(address indexed asset);
    event CollateralRemoved(address indexed asset);

    mapping(address => uint) public collateralId;

    address[] public collateralList;
    
    constructor(address _vaultParameters, address[] memory assets) Auth(_vaultParameters) {
        for (uint i = 0; i < assets.length; i++) {
            require(!isCollateral(assets[i]), "Unit Protocol: ALREADY_EXIST");
            collateralList.push(assets[i]);
            collateralId[assets[i]] = i;
            emit CollateralAdded(assets[i]);
        }
    }

    function addCollateral(address asset) public onlyManager {
        require(asset != address(0), "Unit Protocol: ZERO_ADDRESS");

        require(!isCollateral(asset), "Unit Protocol: ALREADY_EXIST");

        collateralId[asset] = collateralList.length;
        collateralList.push(asset);

        emit CollateralAdded(asset);
    }

    function removeCollateral(address asset) public onlyManager {
        require(asset != address(0), "Unit Protocol: ZERO_ADDRESS");

        require(isCollateral(asset), "Unit Protocol: DOES_NOT_EXIST");

        uint id = collateralId[asset];

        delete collateralId[asset];

        uint lastId = collateralList.length - 1;

        if (id != lastId) {
            address lastCollateral = collateralList[lastId];
            collateralList[id] = lastCollateral;
            collateralId[lastCollateral] = id;
        }

        collateralList.pop();

        emit CollateralRemoved(asset);
    }

    function isCollateral(address asset) public view returns(bool) {
        if (collateralList.length == 0) { return false; }
        return collateralId[asset] != 0 || collateralList[0] == asset;
    }

    function collaterals() external view returns (address[] memory) {
        return collateralList;
    }

    function collateralsCount() external view returns (uint) {
        return collateralList.length;
    }
}

File 2 of 2 : 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 immutable 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 immutable 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",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vaultParameters","type":"address"},{"internalType":"address[]","name":"assets","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"CollateralAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"asset","type":"address"}],"name":"CollateralRemoved","type":"event"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"addCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"collateralId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"collateralList","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collaterals","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"collateralsCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"isCollateral","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"removeCollateral","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultParameters","outputs":[{"internalType":"contract VaultParameters","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b5060405162000b3b38038062000b3b83398101604081905262000034916200020e565b6001600160601b0319606083901b1660805260005b81518110156200017f57620000788282815181106200006457fe5b60200260200101516200018860201b60201c565b15620000a15760405162461bcd60e51b81526004016200009890620002e3565b60405180910390fd5b6001828281518110620000b057fe5b6020908102919091018101518254600181018455600093845291832090910180546001600160a01b0319166001600160a01b03909216919091179055825182919081908590849081106200010057fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055508181815181106200013957fe5b60200260200101516001600160a01b03167f7db05e63d635a68c62fd7fd8f3107ae8ab584a383e102d1bd8a40f4c977e465f60405160405180910390a260010162000049565b5050506200031a565b6001546000906200019c57506000620001f1565b6001600160a01b038216600090815260208190526040902054151580620001ee5750816001600160a01b03166001600081548110620001d757fe5b6000918252602090912001546001600160a01b0316145b90505b919050565b80516001600160a01b0381168114620001f157600080fd5b6000806040838503121562000221578182fd5b6200022c83620001f6565b602084810151919350906001600160401b03808211156200024b578384fd5b818601915086601f8301126200025f578384fd5b8151818111156200026c57fe5b838102604051858282010181811085821117156200028657fe5b604052828152858101935084860182860187018b1015620002a5578788fd5b8795505b83861015620002d257620002bd81620001f6565b855260019590950194938601938601620002a9565b508096505050505050509250929050565b6020808252601c908201527f556e69742050726f746f636f6c3a20414c52454144595f455849535400000000604082015260600190565b60805160601c6107f96200034260003980610253528061029552806104cf52506107f96000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80634f7304551161005b5780634f73045514610100578063aca345ee14610113578063c99d3a061461011b578063f0d2d5a81461013057610088565b80630ee21e541461008d5780631bcff06c146100b65780633024a912146100cb5780634113e5ca146100eb575b600080fd5b6100a061009b366004610663565b610143565b6040516100ad919061070a565b60405180910390f35b6100be6101ad565b6040516100ad91906107ba565b6100de6100d9366004610691565b6101b3565b6040516100ad91906106a9565b6100f36101dd565b6040516100ad91906106bd565b6100be61010e366004610663565b61023f565b6100de610251565b61012e610129366004610663565b610275565b005b61012e61013e366004610663565b6104af565b600154600090610155575060006101a8565b6001600160a01b0382166000908152602081905260409020541515806101a55750816001600160a01b0316600160008154811061018e57fe5b6000918252602090912001546001600160a01b0316145b90505b919050565b60015490565b600181815481106101c357600080fd5b6000918252602090912001546001600160a01b0316905081565b6060600180548060200260200160405190810160405280929190818152602001828054801561023557602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610217575b5050505050905090565b60006020819052908152604090205481565b7f000000000000000000000000000000000000000000000000000000000000000081565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163f3ae2415916024808301926020929190829003018186803b1580156102db57600080fd5b505afa1580156102ef573d6000803e3d6000fd5b505050506040513d602081101561030557600080fd5b5051610358576040805162461bcd60e51b815260206004820152601a60248201527f556e69742050726f746f636f6c3a20415554485f4641494c4544000000000000604482015290519081900360640190fd5b6001600160a01b0381166103875760405162461bcd60e51b815260040161037e9061074c565b60405180910390fd5b61039081610143565b6103ac5760405162461bcd60e51b815260040161037e90610783565b6001600160a01b0381166000908152602081905260408120805491905560015460001901808214610449576000600182815481106103e657fe5b600091825260209091200154600180546001600160a01b03909216925082918590811061040f57fe5b600091825260208083209190910180546001600160a01b0319166001600160a01b0394851617905592909116815290819052604090208290555b600180548061045457fe5b600082815260208120820160001990810180546001600160a01b03191690559091019091556040516001600160a01b038516917fd89d2ee68ab04dca0193f48a4aff55e20fa5ec0429a8a8c1c51b8dad6178a59391a2505050565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163f3ae2415916024808301926020929190829003018186803b15801561051557600080fd5b505afa158015610529573d6000803e3d6000fd5b505050506040513d602081101561053f57600080fd5b5051610592576040805162461bcd60e51b815260206004820152601a60248201527f556e69742050726f746f636f6c3a20415554485f4641494c4544000000000000604482015290519081900360640190fd5b6001600160a01b0381166105b85760405162461bcd60e51b815260040161037e9061074c565b6105c181610143565b156105de5760405162461bcd60e51b815260040161037e90610715565b600180546001600160a01b03831660008181526020819052604080822084905583850185559381527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf690920180546001600160a01b0319168217905591517f7db05e63d635a68c62fd7fd8f3107ae8ab584a383e102d1bd8a40f4c977e465f9190a250565b600060208284031215610674578081fd5b81356001600160a01b038116811461068a578182fd5b9392505050565b6000602082840312156106a2578081fd5b5035919050565b6001600160a01b0391909116815260200190565b6020808252825182820181905260009190848201906040850190845b818110156106fe5783516001600160a01b0316835292840192918401916001016106d9565b50909695505050505050565b901515815260200190565b6020808252601c908201527f556e69742050726f746f636f6c3a20414c52454144595f455849535400000000604082015260600190565b6020808252601b908201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604082015260600190565b6020808252601d908201527f556e69742050726f746f636f6c3a20444f45535f4e4f545f4558495354000000604082015260600190565b9081526020019056fea26469706673582212202ce3d1b74ce14ed424104a82d3de5f8f06fab80372d4c75ac1dc9baabd74ba2664736f6c63430007060033000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000

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

000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000

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

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000040
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.