Source Code
Overview
DEV Balance
More Info
ContractCreator
Multichain Info
N/A
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
2349285 | 1006 days ago | 0 DEV |
Loading...
Loading
Contract Name:
CRM
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "./interfaces/ICRM.sol"; import "./CRMStorage.sol"; contract CRM is ICRM, CRMStorage { modifier onlyAdmin() { require(msg.sender == admin, "Unauthorized use of function"); _; } constructor () { admin = msg.sender; } function initialize( address _primeOracle, address[] memory _assets, uint256[] memory _absMaxLtvRatios, uint256 _pusdPriceCeiling, uint256 _pusdPriceFloor ) external onlyAdmin() { ICRM[] memory _collateralRatioModels = new ICRM[](_assets.length); for (uint256 i = 0; i < _assets.length; i++) { _collateralRatioModels[i] = ICRM(this); } _setCollateralRatioModels(_assets, _collateralRatioModels); _setAbsMaxLtvRatios(_assets, _absMaxLtvRatios); primeOracle = IPrimeOracle(_primeOracle); pusdPriceCeiling = _pusdPriceCeiling; pusdPriceFloor = _pusdPriceFloor; } /* external getters */ function getCollateralRatioModel(address asset) external view override returns (address){ return address(collateralRatioModels[asset]); } function getCurrentMaxLtvRatios(address[] calldata assets) external override returns (uint256[] memory){ uint256[] memory ltvRequirements = new uint256[](assets.length); for (uint256 i = 0; i < assets.length; i++) { ICRM crm = collateralRatioModels[assets[i]]; ltvRequirements[i] = crm.getCurrentMaxLtvRatio(assets[i]); } return ltvRequirements; } function getCurrentMaxLtvRatio( address asset ) external view override returns (uint256) { uint256 _pusdPrice = _getPusdPrice(); //price >= 1.00 if (_pusdPrice >= pusdPriceCeiling) { return absMaxLtvRatios[asset]; } //price <= 0.99 else if (_pusdPrice <= pusdPriceFloor) { return 0; } else { uint256 priceDelta = _pusdPrice - pusdPriceFloor; return (priceDelta * absMaxLtvRatios[asset]) / 1e4; } } /* external setters */ function setPusdPriceCeiling(uint256 price) external override onlyAdmin returns (uint256) { return _setPusdPriceCeiling(price); } function setPusdPriceFloor(uint256 price) external override onlyAdmin returns (uint256) { return _setPusdPriceFloor(price); } function setAbsMaxLtvRatios( address[] memory _assets, uint256[] memory _absMaxLtvRatios ) external override onlyAdmin { _setAbsMaxLtvRatios(_assets, _absMaxLtvRatios); } /* internal getters */ function _getPusdPrice() internal view returns (uint256) { return primeOracle.getPusdPrice(); } /* internal setters */ function _setPusdPriceCeiling(uint256 price) internal returns (uint256) { pusdPriceCeiling = price; return pusdPriceCeiling; } function _setPusdPriceFloor(uint256 price) internal returns (uint256) { pusdPriceFloor = price; return pusdPriceFloor; } function _setAbsMaxLtvRatios( address[] memory _assets, uint256[] memory _absMaxLtvRatios ) internal { require( _assets.length == _absMaxLtvRatios.length, "ERROR: Length mismatch between 'assets' and 'assetLtvRatios'" ); for (uint256 i = 0; i < _assets.length; i++) { absMaxLtvRatios[_assets[i]] = _absMaxLtvRatios[i]; emit AssetLtvRatioUpdated(_assets[i], _absMaxLtvRatios[i]); } } function _setCollateralRatioModels( address[] memory _assets, ICRM[] memory _collateralRatioModels ) internal { require( _assets.length == _collateralRatioModels.length, "ERROR: Length mismatch between 'assets' and 'assetLtvRatios'" ); for (uint256 i = 0; i < _assets.length; i++) { collateralRatioModels[_assets[i]] = _collateralRatioModels[i]; emit CollateralRatioModelUpdated(_assets[i], address(_collateralRatioModels[i])); } } }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; interface ICRM { event CollateralRatioModelUpdated(address asset, address collateralRatioModel); event AssetLtvRatioUpdated(address asset, uint256 ltvRatio); function getCollateralRatioModel(address asset) external returns (address model); function getCurrentMaxLtvRatios(address[] calldata assets) external returns (uint256[] memory ratios); function getCurrentMaxLtvRatio(address asset) external returns (uint256 ratio); function setPusdPriceCeiling(uint256 price) external returns (uint256 ceiling); function setPusdPriceFloor(uint256 price) external returns (uint256 floor); function setAbsMaxLtvRatios(address[] memory assets, uint256[] memory _maxLtvRatios) external; }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "../oracle/interfaces/IPrimeOracle.sol"; import "./interfaces/ICRM.sol"; abstract contract CRMStorage { /// @notice future consideration to have custom max LTV ratios bool public constant IS_CRM = true; address public admin; IPrimeOracle public primeOracle; uint256 public pusdPriceCeiling; uint256 public pusdPriceFloor; // slither-disable-next-line unused-state mapping(address => ICRM) internal collateralRatioModels; // slither-disable-next-line unused-state mapping(address => uint256) internal absMaxLtvRatios; }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "./IPrimeOracleGetter.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** * @title IPrimeOracle * @author Prime * @notice The core interface for the Prime Oracle */ interface IPrimeOracle { /** * @dev Emitted after the price data feed of an asset is updated * @param asset The address of the asset * @param feed The price feed of the asset */ event PrimaryFeedUpdated(IERC20 indexed asset, address indexed feed); /** * @dev Emitted after the price data feed of an asset is updated * @param asset The address of the asset * @param feed The price feed of the asset */ event SecondaryFeedUpdated(IERC20 indexed asset, address indexed feed); /** * @notice Sets or replaces price feeds of assets * @param assets The addresses of the assets * @param feeds The addresses of the price feeds */ function setPrimaryFeeds(IERC20[] calldata assets, IPrimeOracleGetter[] calldata feeds) external; /** * @notice Sets or replaces price feeds of assets * @param assets The addresses of the assets * @param feeds The addresses of the price feeds */ function setSecondaryFeeds(IERC20[] calldata assets, IPrimeOracleGetter[] calldata feeds) external; /** * @notice Returns a list of prices from a list of assets addresses * @param assets The list of assets addresses * @return The prices of the given assets */ function getAssetPrices(IERC20[] calldata assets) external view returns (uint256[] memory); /** * @notice Returns the address of the primary price feed for an asset address * @param asset The address of the asset * @return The address of the price feed */ function getPrimaryFeedOfAsset(IERC20 asset) external view returns (address); /** * @notice Returns the address of the secondary price feed for an asset address * @param asset The address of the asset * @return The address of the price feed */ function getSecondaryFeedOfAsset(IERC20 asset) external view returns (address); /** * @notice Returns the address for the denomination currency * @dev For USD, the address should be set to 0x0. * @return Returns the denomination currency address. **/ function getDenomCurrency() external view returns (address); /** * @notice Returns the denom currency unit * @dev 1e8 for USD, 1 ether for ETH. * @return Returns the denom currency unit. **/ function getDenomCurrencyUnit() external view returns (uint256); /** * @return Returns the price of PUSD **/ function getPusdPrice() external view returns (uint256); }
//SPDX-License-Identifier: Unlicense pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; /** * @title IPrimeOracleGetter * @author Prime * @notice Interface for the Prime price oracle. **/ interface IPrimeOracleGetter { /** * @dev Emitted after the denom currency is set * @param denomCurrency The denom currency used for price quotes * @param denomCurrencyUnit The unit of the denom currency (1e8 for USD) */ event DenomCurrencySet(address indexed denomCurrency, uint256 denomCurrencyUnit); /** * @dev Emitted after the price data feed of an asset is updated * @param asset The address of the asset * @param feed The price feed of the asset */ event AssetFeedUpdated(IERC20 indexed asset, address indexed feed); /** * @notice Gets the price feed of an asset * @param asset The addresses of the asset * @return address of asset feed */ function getAssetFeed(IERC20 asset) external view returns (address); /** * @notice Sets or replaces price feeds of assets * @param assets The addresses of the assets * @param feeds The addresses of the price feeds */ function setAssetFeeds(IERC20[] calldata assets, address[] calldata feeds) external; /** * @notice Returns the price data in the denom currency * @param quoteToken A token to return price data for * @param denomToken A token to price quoteToken against * @return return price of the asset from the oracle **/ function getAssetPrice(IERC20 quoteToken, IERC20 denomToken) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.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}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * 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. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * 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 override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override 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 value {ERC20} uses, unless this function is * 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 override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override 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 `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` 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 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); 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 `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * 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. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); 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); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` 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. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { 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); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @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 amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` 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 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ 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 v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract ABI
API[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"uint256","name":"ltvRatio","type":"uint256"}],"name":"AssetLtvRatioUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"asset","type":"address"},{"indexed":false,"internalType":"address","name":"collateralRatioModel","type":"address"}],"name":"CollateralRatioModelUpdated","type":"event"},{"inputs":[],"name":"IS_CRM","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"admin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getCollateralRatioModel","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"asset","type":"address"}],"name":"getCurrentMaxLtvRatio","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"assets","type":"address[]"}],"name":"getCurrentMaxLtvRatios","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_primeOracle","type":"address"},{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"uint256[]","name":"_absMaxLtvRatios","type":"uint256[]"},{"internalType":"uint256","name":"_pusdPriceCeiling","type":"uint256"},{"internalType":"uint256","name":"_pusdPriceFloor","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"primeOracle","outputs":[{"internalType":"contract IPrimeOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pusdPriceCeiling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pusdPriceFloor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_assets","type":"address[]"},{"internalType":"uint256[]","name":"_absMaxLtvRatios","type":"uint256[]"}],"name":"setAbsMaxLtvRatios","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPusdPriceCeiling","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"price","type":"uint256"}],"name":"setPusdPriceFloor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50600080546001600160a01b03191633179055610d08806100326000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063f025069811610071578063f02506981461013b578063f0abc9ff1461015b578063f1b7a50d1461016e578063f781f22614610199578063f851a440146101a2578063fcb9f367146101b557600080fd5b80632933e2d6146100b95780632e8481d8146100d65780633d3b90ed146100ed5780634fd72283146101005780636cf99d47146101155780639a50f99814610128575b600080fd5b6100c1600181565b60405190151581526020015b60405180910390f35b6100df60035481565b6040519081526020016100cd565b6100df6100fb36600461085b565b6101e1565b61011361010e3660046109c3565b610224565b005b6100df610123366004610a27565b61025c565b6100df61013636600461085b565b6102ed565b61014e610149366004610a49565b610323565b6040516100cd9190610abe565b610113610169366004610b02565b610492565b600154610181906001600160a01b031681565b6040516001600160a01b0390911681526020016100cd565b6100df60025481565b600054610181906001600160a01b031681565b6101816101c3366004610a27565b6001600160a01b039081166000908152600460205260409020541690565b600080546001600160a01b031633146102155760405162461bcd60e51b815260040161020c90610b88565b60405180910390fd5b6003829055815b90505b919050565b6000546001600160a01b0316331461024e5760405162461bcd60e51b815260040161020c90610b88565b610258828261058e565b5050565b6000806102676106ad565b9050600254811061028f5750506001600160a01b031660009081526005602052604090205490565b60035481116102a15750600092915050565b6000600354826102b19190610bd5565b6001600160a01b038516600090815260056020526040902054909150612710906102db9083610bec565b6102e59190610c0b565b949350505050565b600080546001600160a01b031633146103185760405162461bcd60e51b815260040161020c90610b88565b60028290558161021c565b606060008267ffffffffffffffff81111561034057610340610874565b604051908082528060200260200182016040528015610369578160200160208202803683370190505b50905060005b8381101561048a5760006004600087878581811061038f5761038f610c2d565b90506020020160208101906103a49190610a27565b6001600160a01b03908116825260208201929092526040016000205416905080636cf99d478787858181106103db576103db610c2d565b90506020020160208101906103f09190610a27565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024016020604051808303816000875af1158015610436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045a9190610c43565b83838151811061046c5761046c610c2d565b6020908102919091010152508061048281610c5c565b91505061036f565b509392505050565b6000546001600160a01b031633146104bc5760405162461bcd60e51b815260040161020c90610b88565b6000845167ffffffffffffffff8111156104d8576104d8610874565b604051908082528060200260200182016040528015610501578160200160208202803683370190505b50905060005b855181101561054d573082828151811061052357610523610c2d565b6001600160a01b03909216602092830291909101909101528061054581610c5c565b915050610507565b506105588582610720565b610562858561058e565b50600180546001600160a01b0319166001600160a01b0396909616959095179094556002555050600355565b80518251146105af5760405162461bcd60e51b815260040161020c90610c75565b60005b82518110156106a8578181815181106105cd576105cd610c2d565b6020026020010151600560008584815181106105eb576105eb610c2d565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f9173608cfaee1eaad1f1809858bd93f171f9d34004d2133ab4ffa052d0d4d6e283828151811061064a5761064a610c2d565b602002602001015183838151811061066457610664610c2d565b602002602001015160405161068e9291906001600160a01b03929092168252602082015260400190565b60405180910390a1806106a081610c5c565b9150506105b2565b505050565b60015460408051638389c08f60e01b815290516000926001600160a01b031691638389c08f9160048083019260209291908290030181865afa1580156106f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071b9190610c43565b905090565b80518251146107415760405162461bcd60e51b815260040161020c90610c75565b60005b82518110156106a85781818151811061075f5761075f610c2d565b60200260200101516004600085848151811061077d5761077d610c2d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f2cd065d9254245a152e6f825892f614d61d4a70c997145a9420982230698e8878382815181106107fc576107fc610c2d565b602002602001015183838151811061081657610816610c2d565b60200260200101516040516108419291906001600160a01b0392831681529116602082015260400190565b60405180910390a18061085381610c5c565b915050610744565b60006020828403121561086d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156108b3576108b3610874565b604052919050565b600067ffffffffffffffff8211156108d5576108d5610874565b5060051b60200190565b80356001600160a01b038116811461021f57600080fd5b600082601f83011261090757600080fd5b8135602061091c610917836108bb565b61088a565b82815260059290921b8401810191818101908684111561093b57600080fd5b8286015b8481101561095d57610950816108df565b835291830191830161093f565b509695505050505050565b600082601f83011261097957600080fd5b81356020610989610917836108bb565b82815260059290921b840181019181810190868411156109a857600080fd5b8286015b8481101561095d57803583529183019183016109ac565b600080604083850312156109d657600080fd5b823567ffffffffffffffff808211156109ee57600080fd5b6109fa868387016108f6565b93506020850135915080821115610a1057600080fd5b50610a1d85828601610968565b9150509250929050565b600060208284031215610a3957600080fd5b610a42826108df565b9392505050565b60008060208385031215610a5c57600080fd5b823567ffffffffffffffff80821115610a7457600080fd5b818501915085601f830112610a8857600080fd5b813581811115610a9757600080fd5b8660208260051b8501011115610aac57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015610af657835183529284019291840191600101610ada565b50909695505050505050565b600080600080600060a08688031215610b1a57600080fd5b610b23866108df565b9450602086013567ffffffffffffffff80821115610b4057600080fd5b610b4c89838a016108f6565b95506040880135915080821115610b6257600080fd5b50610b6f88828901610968565b9598949750949560608101359550608001359392505050565b6020808252601c908201527f556e617574686f72697a656420757365206f662066756e6374696f6e00000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015610be757610be7610bbf565b500390565b6000816000190483118215151615610c0657610c06610bbf565b500290565b600082610c2857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610c5557600080fd5b5051919050565b600060018201610c6e57610c6e610bbf565b5060010190565b6020808252603c908201527f4552524f523a204c656e677468206d69736d61746368206265747765656e202760408201527f6173736574732720616e64202761737365744c7476526174696f73270000000060608201526080019056fea2646970667358221220527e0f315806d0792097ddff3bf111338dc6af9312b64755827a0691aaeffe8764736f6c634300080d0033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063f025069811610071578063f02506981461013b578063f0abc9ff1461015b578063f1b7a50d1461016e578063f781f22614610199578063f851a440146101a2578063fcb9f367146101b557600080fd5b80632933e2d6146100b95780632e8481d8146100d65780633d3b90ed146100ed5780634fd72283146101005780636cf99d47146101155780639a50f99814610128575b600080fd5b6100c1600181565b60405190151581526020015b60405180910390f35b6100df60035481565b6040519081526020016100cd565b6100df6100fb36600461085b565b6101e1565b61011361010e3660046109c3565b610224565b005b6100df610123366004610a27565b61025c565b6100df61013636600461085b565b6102ed565b61014e610149366004610a49565b610323565b6040516100cd9190610abe565b610113610169366004610b02565b610492565b600154610181906001600160a01b031681565b6040516001600160a01b0390911681526020016100cd565b6100df60025481565b600054610181906001600160a01b031681565b6101816101c3366004610a27565b6001600160a01b039081166000908152600460205260409020541690565b600080546001600160a01b031633146102155760405162461bcd60e51b815260040161020c90610b88565b60405180910390fd5b6003829055815b90505b919050565b6000546001600160a01b0316331461024e5760405162461bcd60e51b815260040161020c90610b88565b610258828261058e565b5050565b6000806102676106ad565b9050600254811061028f5750506001600160a01b031660009081526005602052604090205490565b60035481116102a15750600092915050565b6000600354826102b19190610bd5565b6001600160a01b038516600090815260056020526040902054909150612710906102db9083610bec565b6102e59190610c0b565b949350505050565b600080546001600160a01b031633146103185760405162461bcd60e51b815260040161020c90610b88565b60028290558161021c565b606060008267ffffffffffffffff81111561034057610340610874565b604051908082528060200260200182016040528015610369578160200160208202803683370190505b50905060005b8381101561048a5760006004600087878581811061038f5761038f610c2d565b90506020020160208101906103a49190610a27565b6001600160a01b03908116825260208201929092526040016000205416905080636cf99d478787858181106103db576103db610c2d565b90506020020160208101906103f09190610a27565b6040516001600160e01b031960e084901b1681526001600160a01b0390911660048201526024016020604051808303816000875af1158015610436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045a9190610c43565b83838151811061046c5761046c610c2d565b6020908102919091010152508061048281610c5c565b91505061036f565b509392505050565b6000546001600160a01b031633146104bc5760405162461bcd60e51b815260040161020c90610b88565b6000845167ffffffffffffffff8111156104d8576104d8610874565b604051908082528060200260200182016040528015610501578160200160208202803683370190505b50905060005b855181101561054d573082828151811061052357610523610c2d565b6001600160a01b03909216602092830291909101909101528061054581610c5c565b915050610507565b506105588582610720565b610562858561058e565b50600180546001600160a01b0319166001600160a01b0396909616959095179094556002555050600355565b80518251146105af5760405162461bcd60e51b815260040161020c90610c75565b60005b82518110156106a8578181815181106105cd576105cd610c2d565b6020026020010151600560008584815181106105eb576105eb610c2d565b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020819055507f9173608cfaee1eaad1f1809858bd93f171f9d34004d2133ab4ffa052d0d4d6e283828151811061064a5761064a610c2d565b602002602001015183838151811061066457610664610c2d565b602002602001015160405161068e9291906001600160a01b03929092168252602082015260400190565b60405180910390a1806106a081610c5c565b9150506105b2565b505050565b60015460408051638389c08f60e01b815290516000926001600160a01b031691638389c08f9160048083019260209291908290030181865afa1580156106f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071b9190610c43565b905090565b80518251146107415760405162461bcd60e51b815260040161020c90610c75565b60005b82518110156106a85781818151811061075f5761075f610c2d565b60200260200101516004600085848151811061077d5761077d610c2d565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a8154816001600160a01b0302191690836001600160a01b031602179055507f2cd065d9254245a152e6f825892f614d61d4a70c997145a9420982230698e8878382815181106107fc576107fc610c2d565b602002602001015183838151811061081657610816610c2d565b60200260200101516040516108419291906001600160a01b0392831681529116602082015260400190565b60405180910390a18061085381610c5c565b915050610744565b60006020828403121561086d57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156108b3576108b3610874565b604052919050565b600067ffffffffffffffff8211156108d5576108d5610874565b5060051b60200190565b80356001600160a01b038116811461021f57600080fd5b600082601f83011261090757600080fd5b8135602061091c610917836108bb565b61088a565b82815260059290921b8401810191818101908684111561093b57600080fd5b8286015b8481101561095d57610950816108df565b835291830191830161093f565b509695505050505050565b600082601f83011261097957600080fd5b81356020610989610917836108bb565b82815260059290921b840181019181810190868411156109a857600080fd5b8286015b8481101561095d57803583529183019183016109ac565b600080604083850312156109d657600080fd5b823567ffffffffffffffff808211156109ee57600080fd5b6109fa868387016108f6565b93506020850135915080821115610a1057600080fd5b50610a1d85828601610968565b9150509250929050565b600060208284031215610a3957600080fd5b610a42826108df565b9392505050565b60008060208385031215610a5c57600080fd5b823567ffffffffffffffff80821115610a7457600080fd5b818501915085601f830112610a8857600080fd5b813581811115610a9757600080fd5b8660208260051b8501011115610aac57600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015610af657835183529284019291840191600101610ada565b50909695505050505050565b600080600080600060a08688031215610b1a57600080fd5b610b23866108df565b9450602086013567ffffffffffffffff80821115610b4057600080fd5b610b4c89838a016108f6565b95506040880135915080821115610b6257600080fd5b50610b6f88828901610968565b9598949750949560608101359550608001359392505050565b6020808252601c908201527f556e617574686f72697a656420757365206f662066756e6374696f6e00000000604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015610be757610be7610bbf565b500390565b6000816000190483118215151615610c0657610c06610bbf565b500290565b600082610c2857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610c5557600080fd5b5051919050565b600060018201610c6e57610c6e610bbf565b5060010190565b6020808252603c908201527f4552524f523a204c656e677468206d69736d61746368206265747765656e202760408201527f6173736574732720616e64202761737365744c7476526174696f73270000000060608201526080019056fea2646970667358221220527e0f315806d0792097ddff3bf111338dc6af9312b64755827a0691aaeffe8764736f6c634300080d0033
Loading...
Loading
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.