Contract
0x515695578eECd92d7747897df7756967912E678a
2
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] | |||
---|---|---|---|---|---|---|---|---|---|
0x54b74e3a2e2b4b5283d16cd751ab40842c330373a79fa74c8b0af4dbe9722648 | 0x60806040 | 41084676 | 275 days 11 hrs ago | 0xcbd4e556fc24c83159defd1d1bbad66fd7d2c75c | IN | Create: Converter | 0 FTM | 0.140695714835 |
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0x54b74e3a2e2b4b5283d16cd751ab40842c330373a79fa74c8b0af4dbe9722648 | 41084676 | 275 days 11 hrs ago | 0xcbd4e556fc24c83159defd1d1bbad66fd7d2c75c | Contract Creation | 0 FTM |
[ Download CSV Export ]
Contract Name:
Converter
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.0; import "./libraries/SafeMath.sol"; import "./interfaces/ERC20Interface.sol"; import "./interfaces/PriceOracle.sol"; contract Converter { using SafeMath for uint256; function convertUsdAmountToAssetAmount( uint256 usdAmount, address assetAddress ) public view returns (uint256) { ERC20Interface token = ERC20Interface(assetAddress); uint256 tokenDecimal = uint256(token.decimals()); uint256 defaultDecimal = 18; if (defaultDecimal == tokenDecimal) { return usdAmount; } else if (defaultDecimal > tokenDecimal) { return usdAmount.div(10**(defaultDecimal.sub(tokenDecimal))); } else { return usdAmount.mul(10**(tokenDecimal.sub(defaultDecimal))); } } function convertAssetAmountToUsdAmount( uint256 assetAmount, address assetAddress ) public view returns (uint256) { ERC20Interface token = ERC20Interface(assetAddress); uint256 tokenDecimal = uint256(token.decimals()); uint256 defaultDecimal = 18; if (defaultDecimal == tokenDecimal) { return assetAmount; } else if (defaultDecimal > tokenDecimal) { return assetAmount.mul(10**(defaultDecimal.sub(tokenDecimal))); } else { return assetAmount.div(10**(tokenDecimal.sub(defaultDecimal))); } } function getUsdAmount( address market, uint256 assetAmount, address priceOracle ) public view returns (uint256 usdAmount) { uint256 usdPrice = PriceOracle(priceOracle).getUnderlyingPrice(market); require(usdPrice > 0, "upe"); usdAmount = (assetAmount.mul(usdPrice)).div(10**8); } // verified not function getAssetAmount( address market, uint256 usdAmount, address priceOracle ) public view returns (uint256 assetAmount) { uint256 usdPrice = PriceOracle(priceOracle).getUnderlyingPrice(market); require(usdPrice > 0, "usd price error"); assetAmount = (usdAmount.mul(10**8)).div(usdPrice); } }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return add(a, b, "SafeMath: addition overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function add(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, errorMessage); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.0; interface ERC20Interface { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the token name. */ function name() external view returns (string memory); /** * @dev Returns the bep token owner. */ function getOwner() external view returns (address); /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.0; abstract contract PriceOracle { /// @notice Indicator that this is a PriceOracle contract (for inspection) bool public constant isPriceOracle = true; /** * @notice Get the underlying price of a cToken asset * @param market The cToken to get the underlying price of * @return The underlying asset price mantissa (scaled by 1e18). * Zero means the price is unavailable. */ function getUnderlyingPrice(address market) external virtual view returns (uint); }
{ "optimizer": { "enabled": true, "runs": 100 }, "metadata": { "bytecodeHash": "none", "useLiteralContent": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"address","name":"assetAddress","type":"address"}],"name":"convertAssetAmountToUsdAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdAmount","type":"uint256"},{"internalType":"address","name":"assetAddress","type":"address"}],"name":"convertUsdAmountToAssetAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"usdAmount","type":"uint256"},{"internalType":"address","name":"priceOracle","type":"address"}],"name":"getAssetAmount","outputs":[{"internalType":"uint256","name":"assetAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"market","type":"address"},{"internalType":"uint256","name":"assetAmount","type":"uint256"},{"internalType":"address","name":"priceOracle","type":"address"}],"name":"getUsdAmount","outputs":[{"internalType":"uint256","name":"usdAmount","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50610656806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806348a2508414610051578063788e10b814610099578063791f99a5146100cf5780639b4863d2146100fb575b600080fd5b6100876004803603606081101561006757600080fd5b506001600160a01b03813581169160208101359160409091013516610127565b60408051918252519081900360200190f35b610087600480360360608110156100af57600080fd5b506001600160a01b0381358116916020810135916040909101351661020a565b610087600480360360408110156100e557600080fd5b50803590602001356001600160a01b03166102d2565b6100876004803603604081101561011157600080fd5b50803590602001356001600160a01b031661039f565b600080826001600160a01b031663fc57d4df866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561017757600080fd5b505afa15801561018b573d6000803e3d6000fd5b505050506040513d60208110156101a157600080fd5b50519050806101e9576040805162461bcd60e51b815260206004820152600f60248201526e3ab9b210383934b1b29032b93937b960891b604482015290519081900360640190fd5b610201816101fb866305f5e100610448565b906104a8565b95945050505050565b600080826001600160a01b031663fc57d4df866040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561025a57600080fd5b505afa15801561026e573d6000803e3d6000fd5b505050506040513d602081101561028457600080fd5b50519050806102c0576040805162461bcd60e51b815260206004820152600360248201526275706560e81b604482015290519081900360640190fd5b6102016305f5e1006101fb8684610448565b6000808290506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b15801561031357600080fd5b505afa158015610327573d6000803e3d6000fd5b505050506040513d602081101561033d57600080fd5b505160ff16905060128082141561035957859350505050610399565b818111156103825761037861036e82846104ea565b8790600a0a610448565b9350505050610399565b61037861038f83836104ea565b8790600a0a6104a8565b92915050565b6000808290506000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156103e057600080fd5b505afa1580156103f4573d6000803e3d6000fd5b505050506040513d602081101561040a57600080fd5b505160ff16905060128082141561042657859350505050610399565b8181111561043b5761037861038f82846104ea565b61037861036e83836104ea565b60008261045757506000610399565b8282028284828161046457fe5b04146104a15760405162461bcd60e51b81526004018080602001828103825260218152602001806106296021913960400191505060405180910390fd5b9392505050565b60006104a183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061052c565b60006104a183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506105ce565b600081836105b85760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561057d578181015183820152602001610565565b50505050905090810190601f1680156105aa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816105c457fe5b0495945050505050565b600081848411156106205760405162461bcd60e51b815260206004820181815283516024840152835190928392604490910191908501908083836000831561057d578181015183820152602001610565565b50505090039056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a164736f6c6343000706000a
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.