Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Name:
AnkrETHRateProvider
Compiler Version
v0.8.14+commit.80d49f37
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./DefaultRateProvider.sol"; /** * ankrETH rate provider contract. */ contract AnkrETHRateProvider is DefaultRateProvider { // --- Init --- constructor(address _token) DefaultRateProvider(_token) {} function ankrETH() external view returns(address) { return s_token; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; /** * Balancer rate interface. */ interface IRateProvider { function getRate() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; /** * ankrMATIC interface. */ interface IAnkrRatio { function ratio() external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.14; import "./interfaces/IRateProvider.sol"; import "./interfaces/IAnkrRatio.sol"; import "@openzeppelin/contracts-upgradeable/utils/math/SafeMathUpgradeable.sol"; /** * Inheritable standard rate provider interface. */ abstract contract DefaultRateProvider is IRateProvider { // --- Wrapper --- using SafeMathUpgradeable for uint256; // --- Var --- address internal s_token; // --- Init --- constructor(address _token) { s_token = _token; } // --- View --- function getRate() external view override returns (uint256) { return safeFloorMultiplyAndDivide(1e18, 1e18, IAnkrRatio(s_token).ratio()); } function safeFloorMultiplyAndDivide(uint256 a, uint256 b, uint256 c) internal pure returns (uint256) { uint256 remainder = a.mod(c); uint256 result = a.div(c); bool safe; (safe, result) = result.tryMul(b); if (!safe) { return 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; } (safe, result) = result.tryAdd(remainder.mul(b).div(c)); if (!safe) { return 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff; } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMathUpgradeable { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // 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 (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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 a + b; } /** * @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 a - b; } /** * @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) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting 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 a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting 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) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * 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) { unchecked { require(b > 0, errorMessage); return a % b; } } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ankrETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5060405161035538038061035583398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b6102c2806100936000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063679aefce1461003b578063cc8e871a14610056575b600080fd5b610043610071565b6040519081526020015b60405180910390f35b6000546040516001600160a01b03909116815260200161004d565b60006100fa670de0b6b3a76400008060008054906101000a90046001600160a01b03166001600160a01b03166371ca337d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f59190610208565b6100ff565b905090565b60008061010c858461017e565b9050600061011a868561018a565b905060006101288287610196565b925090508061013e576000199350505050610177565b61015c6101558661014f868a6101e1565b9061018a565b83906101ed565b9250905080610172576000199350505050610177565b509150505b9392505050565b60006101778284610237565b6000610177828461024b565b600080836000036101ad57506001905060006101da565b838302838582816101c0576101c0610221565b04146101d35760008092509250506101da565b6001925090505b9250929050565b6000610177828461025f565b600080838301848110156101d35760008092509250506101da565b60006020828403121561021a57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b60008261024657610246610221565b500690565b60008261025a5761025a610221565b500490565b600081600019048311821515161561028757634e487b7160e01b600052601160045260246000fd5b50029056fea2646970667358221220f1588777b1d7f99e3a5d8d7b22c8deb7481d3bbcd166cbd75a78975afa95980d64736f6c634300080e003300000000000000000000000012d8ce035c5de3ce39b1fdd4c1d5a745eaba3b8c
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063679aefce1461003b578063cc8e871a14610056575b600080fd5b610043610071565b6040519081526020015b60405180910390f35b6000546040516001600160a01b03909116815260200161004d565b60006100fa670de0b6b3a76400008060008054906101000a90046001600160a01b03166001600160a01b03166371ca337d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100f59190610208565b6100ff565b905090565b60008061010c858461017e565b9050600061011a868561018a565b905060006101288287610196565b925090508061013e576000199350505050610177565b61015c6101558661014f868a6101e1565b9061018a565b83906101ed565b9250905080610172576000199350505050610177565b509150505b9392505050565b60006101778284610237565b6000610177828461024b565b600080836000036101ad57506001905060006101da565b838302838582816101c0576101c0610221565b04146101d35760008092509250506101da565b6001925090505b9250929050565b6000610177828461025f565b600080838301848110156101d35760008092509250506101da565b60006020828403121561021a57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b60008261024657610246610221565b500690565b60008261025a5761025a610221565b500490565b600081600019048311821515161561028757634e487b7160e01b600052601160045260246000fd5b50029056fea2646970667358221220f1588777b1d7f99e3a5d8d7b22c8deb7481d3bbcd166cbd75a78975afa95980d64736f6c634300080e0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000012d8ce035c5de3ce39b1fdd4c1d5a745eaba3b8c
-----Decoded View---------------
Arg [0] : _token (address): 0x12D8CE035c5DE3Ce39B1fDD4C1d5a745EAbA3b8C
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000012d8ce035c5de3ce39b1fdd4c1d5a745eaba3b8c
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.