Contract Overview
Balance:
0 FTM
FTM Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | ||
---|---|---|---|---|---|---|---|---|
0x7397cedb0fc51bcd8b0fab8f25b9a8abca9e1f0d7a2db65edbce2206ae257577 | 0x60c06040 | 19737265 | 472 days 17 hrs ago | 0x55d56e1bb2fc8280a775ccfe9ececcecf1a01562 | IN | Create: WrappedToUnderlyingOracle | 0 FTM | 0.057415142263 |
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0x7397cedb0fc51bcd8b0fab8f25b9a8abca9e1f0d7a2db65edbce2206ae257577 | 19737265 | 472 days 17 hrs ago | 0x55d56e1bb2fc8280a775ccfe9ececcecf1a01562 | Contract Creation | 0 FTM |
[ Download CSV Export ]
Contract Name:
WrappedToUnderlyingOracle
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)
// SPDX-License-Identifier: bsl-1.1 /* Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]). */ pragma solidity 0.7.6; import "../helpers/ERC20Like.sol"; import "../VaultParameters.sol"; import "../interfaces/IOracleUsd.sol"; import "../interfaces/IOracleEth.sol"; import "../interfaces/IOracleRegistry.sol"; /** * @title WrappedToUnderlyingOracle * @dev Oracle to quote wrapped tokens to underlying **/ contract WrappedToUnderlyingOracle is IOracleUsd, Auth { IOracleRegistry public immutable oracleRegistry; mapping (address => address) public assetToUnderlying; event NewUnderlying(address indexed wrapped, address indexed underlying); constructor(address _vaultParameters, address _oracleRegistry) Auth(_vaultParameters) { require(_vaultParameters != address(0) && _oracleRegistry != address(0), "Unit Protocol: ZERO_ADDRESS"); oracleRegistry = IOracleRegistry(_oracleRegistry); } function setUnderlying(address wrapped, address underlying) external onlyManager { assetToUnderlying[wrapped] = underlying; emit NewUnderlying(wrapped, underlying); } // returns Q112-encoded value function assetToUsd(address asset, uint amount) public override view returns (uint) { if (amount == 0) return 0; (address oracle, address underlying) = _getOracleAndUnderlying(asset); return IOracleUsd(oracle).assetToUsd(underlying, amount); } function _getOracleAndUnderlying(address asset) internal view returns (address oracle, address underlying) { underlying = assetToUnderlying[asset]; require(underlying != address(0), "Unit Protocol: UNDEFINED_UNDERLYING"); oracle = oracleRegistry.oracleByAsset(underlying); require(oracle != address(0), "Unit Protocol: NO_ORACLE_FOUND"); } }
// SPDX-License-Identifier: bsl-1.1 /* Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]). */ pragma solidity 0.7.6; interface ERC20Like { function balanceOf(address) external view returns (uint); function decimals() external view returns (uint8); function transfer(address, uint256) external returns (bool); function transferFrom(address, address, uint256) external returns (bool); function totalSupply() external view returns (uint256); }
// 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; } }
// SPDX-License-Identifier: bsl-1.1 /* Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]). */ pragma solidity ^0.7.6; interface IOracleUsd { // returns Q112-encoded value // returned value 10**18 * 2**112 is $1 function assetToUsd(address asset, uint amount) external view returns (uint); }
// SPDX-License-Identifier: bsl-1.1 /* Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]). */ pragma solidity ^0.7.6; interface IOracleEth { // returns Q112-encoded value // returned value 10**18 * 2**112 is 1 Ether function assetToEth(address asset, uint amount) external view returns (uint); // returns the value "as is" function ethToUsd(uint amount) external view returns (uint); // returns the value "as is" function usdToEth(uint amount) external view returns (uint); }
// SPDX-License-Identifier: bsl-1.1 /* Copyright 2020 Unit Protocol: Artem Zakharov ([email protected]). */ pragma solidity ^0.7.6; pragma abicoder v2; interface IOracleRegistry { struct Oracle { uint oracleType; address oracleAddress; } function WETH ( ) external view returns ( address ); function getKeydonixOracleTypes ( ) external view returns ( uint256[] memory ); function getOracles ( ) external view returns ( Oracle[] memory foundOracles ); function keydonixOracleTypes ( uint256 ) external view returns ( uint256 ); function maxOracleType ( ) external view returns ( uint256 ); function oracleByAsset ( address asset ) external view returns ( address ); function oracleByType ( uint256 ) external view returns ( address ); function oracleTypeByAsset ( address ) external view returns ( uint256 ); function oracleTypeByOracle ( address ) external view returns ( uint256 ); function setKeydonixOracleTypes ( uint256[] memory _keydonixOracleTypes ) external; function setOracle ( uint256 oracleType, address oracle ) external; function setOracleTypeForAsset ( address asset, uint256 oracleType ) external; function setOracleTypeForAssets ( address[] memory assets, uint256 oracleType ) external; function unsetOracle ( uint256 oracleType ) external; function unsetOracleForAsset ( address asset ) external; function unsetOracleForAssets ( address[] memory assets ) external; function vaultParameters ( ) external view returns ( address ); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_vaultParameters","type":"address"},{"internalType":"address","name":"_oracleRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wrapped","type":"address"},{"indexed":true,"internalType":"address","name":"underlying","type":"address"}],"name":"NewUnderlying","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"assetToUnderlying","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"assetToUsd","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oracleRegistry","outputs":[{"internalType":"contract IOracleRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wrapped","type":"address"},{"internalType":"address","name":"underlying","type":"address"}],"name":"setUnderlying","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"vaultParameters","outputs":[{"internalType":"contract VaultParameters","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60c060405234801561001057600080fd5b506040516106193803806106198339818101604052604081101561003357600080fd5b5080516020909101516001600160601b0319606083901b166080526001600160a01b0382161580159061006e57506001600160a01b03811615155b6100bf576040805162461bcd60e51b815260206004820152601b60248201527f556e69742050726f746f636f6c3a205a45524f5f414444524553530000000000604482015290519081900360640190fd5b606081811b6001600160601b03191660a052608051901c91506001600160a01b03166105116101086000398061030352806103bf5250806101e7528061034252506105116000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806310e556981461005c57806311b04cfa1461009a5780634bb93ab1146100ca5780635bff6117146100ee578063aca345ee14610114575b600080fd5b6100886004803603604081101561007257600080fd5b506001600160a01b03813516906020013561011c565b60408051918252519081900360200190f35b6100c8600480360360408110156100b057600080fd5b506001600160a01b03813581169160200135166101c7565b005b6100d2610301565b604080516001600160a01b039092168252519081900360200190f35b6100d26004803603602081101561010457600080fd5b50356001600160a01b0316610325565b6100d2610340565b60008161012b575060006101c1565b60008061013785610364565b91509150816001600160a01b03166310e5569882866040518363ffffffff1660e01b815260040180836001600160a01b031681526020018281526020019250505060206040518083038186803b15801561019057600080fd5b505afa1580156101a4573d6000803e3d6000fd5b505050506040513d60208110156101ba57600080fd5b5051925050505b92915050565b6040805163f3ae241560e01b815233600482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163f3ae2415916024808301926020929190829003018186803b15801561022d57600080fd5b505afa158015610241573d6000803e3d6000fd5b505050506040513d602081101561025757600080fd5b50516102aa576040805162461bcd60e51b815260206004820152601a60248201527f556e69742050726f746f636f6c3a20415554485f4641494c4544000000000000604482015290519081900360640190fd5b6001600160a01b0382811660008181526020819052604080822080546001600160a01b0319169486169485179055517f42160901260b189ed537d6f70d0c0b5c991b36c2bd0f1cd2353c14cd76cc15479190a35050565b7f000000000000000000000000000000000000000000000000000000000000000081565b6000602081905290815260409020546001600160a01b031681565b7f000000000000000000000000000000000000000000000000000000000000000081565b6001600160a01b03808216600090815260208190526040812054909116806103bd5760405162461bcd60e51b81526004018080602001828103825260238152602001806104b96023913960400191505060405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166338163032826040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561042a57600080fd5b505afa15801561043e573d6000803e3d6000fd5b505050506040513d602081101561045457600080fd5b505191506001600160a01b0382166104b3576040805162461bcd60e51b815260206004820152601e60248201527f556e69742050726f746f636f6c3a204e4f5f4f5241434c455f464f554e440000604482015290519081900360640190fd5b91509156fe556e69742050726f746f636f6c3a20554e444546494e45445f554e4445524c59494e47a264697066735822122031de258762f99724d1bc04d6b5b2a7ce251e7038d80202db7e6f1557563e40e164736f6c63430007060033000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c0000000000000000000000000058ab54d4405d8084e8d71b8ab36b3091b21c7d
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c0000000000000000000000000058ab54d4405d8084e8d71b8ab36b3091b21c7d
-----Decoded View---------------
Arg [0] : _vaultParameters (address): 0xa8f0b5758041158cf0375b7adc8ac175ff031b6c
Arg [1] : _oracleRegistry (address): 0x0058ab54d4405d8084e8d71b8ab36b3091b21c7d
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000a8f0b5758041158cf0375b7adc8ac175ff031b6c
Arg [1] : 0000000000000000000000000058ab54d4405d8084e8d71b8ab36b3091b21c7d
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 |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.