Address Contract Verified
Address
0x613272cb97cbC8BEc0AA864612c1411b26ba5b5D
Balance
0 ETH
Nonce
1
Code Size
5563 bytes
Creator
0xF563B49f...EFB2 at tx 0x235eae57...0762f3
Indexed Transactions
0
Contract Bytecode
5563 bytes
0x608060405234801561000f575f5ffd5b5060043610610086575f3560e01c806384c8a3db1161005957806384c8a3db146101275780638da5cb5b14610143578063bfc579a214610161578063f2fde38b1461019157610086565b80632fba4aa91461008a578063714407f5146100bd578063715018a6146100ed57806379b99e00146100f7575b5f5ffd5b6100a4600480360381019061009f9190610e7e565b6101ad565b6040516100b49493929190610f37565b60405180910390f35b6100d760048036038101906100d29190610e7e565b610210565b6040516100e49190610f7a565b60405180910390f35b6100f5610221565b005b610111600480360381019061010c9190610fbd565b610234565b60405161011e9190610f7a565b60405180910390f35b610141600480360381019061013c9190610fbd565b6103e5565b005b61014b6103fd565b604051610158919061101c565b60405180910390f35b61017b60048036038101906101769190611035565b610424565b6040516101889190610f7a565b60405180910390f35b6101ab60048036038101906101a69190610e7e565b6105c6565b005b6001602052805f5260405f205f91509050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690805f0160149054906101000a900460ff1690805f0160159054906101000a900460ff16908060010154905084565b5f61021a8261064a565b9050919050565b61022961098d565b6102325f610a14565b565b5f5f8203610244575f90506103de565b5f61024f8584610424565b90505f60015f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206040518060800160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020015f820160149054906101000a900460ff1660ff1660ff1681526020015f820160159054906101000a900460ff1660ff1660ff16815260200160018201548152505090505f73ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff16036103a557846040517f7e83f8ca00000000000000000000000000000000000000000000000000000000815260040161039c919061101c565b60405180910390fd5b5f6103af8661064a565b9050808260400151600a6103c391906111cf565b846103ce9190611219565b6103d89190611287565b93505050505b9392505050565b6103ed61098d565b6103f8838383610ad5565b505050565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b5f5f8203610434575f90506105c0565b5f60015f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206040518060800160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020015f820160149054906101000a900460ff1660ff1660ff1681526020015f820160159054906101000a900460ff1660ff1660ff16815260200160018201548152505090505f73ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff160361058857836040517f7e83f8ca00000000000000000000000000000000000000000000000000000000815260040161057f919061101c565b60405180910390fd5b5f6105928561064a565b90508160400151600a6105a591906111cf565b81856105b19190611219565b6105bb9190611287565b925050505b92915050565b6105ce61098d565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361063e575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610635919061101c565b60405180910390fd5b61064781610a14565b50565b5f5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f206040518060800160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020015f820160149054906101000a900460ff1660ff1660ff1681526020015f820160159054906101000a900460ff1660ff1660ff16815260200160018201548152505090505f73ffffffffffffffffffffffffffffffffffffffff16815f015173ffffffffffffffffffffffffffffffffffffffff160361079f57826040517f7e83f8ca000000000000000000000000000000000000000000000000000000008152600401610796919061101c565b60405180910390fd5b5f5f5f5f845f015173ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156107ef573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610813919061133d565b9450945050935093505f831361086057866040517f73899cb4000000000000000000000000000000000000000000000000000000008152600401610857919061101c565b60405180910390fd5b8369ffffffffffffffffffff168169ffffffffffffffffffff1610156108bd57866040517f73899cb40000000000000000000000000000000000000000000000000000000081526004016108b4919061101c565b60405180910390fd5b846060015182426108ce91906113b4565b111561091157866040517f81927929000000000000000000000000000000000000000000000000000000008152600401610908919061101c565b60405180910390fd5b5f8390505f8660200151905060128160ff161061095a5760128161093591906113e7565b600a61094191906111cf565b8261094c9190611287565b975050505050505050610988565b80601261096791906113e7565b600a61097391906111cf565b8261097e9190611219565b9750505050505050505b919050565b610995610e19565b73ffffffffffffffffffffffffffffffffffffffff166109b36103fd565b73ffffffffffffffffffffffffffffffffffffffff1614610a12576109d6610e19565b6040517f118cdaa7000000000000000000000000000000000000000000000000000000008152600401610a09919061101c565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015610b3d57505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b610b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b7390611475565b60405180910390fd5b5f8111610bbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb5906114dd565b60405180910390fd5b5f8373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c08573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c2c9190611525565b90505f8373ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c78573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c9c9190611525565b905060405180608001604052808573ffffffffffffffffffffffffffffffffffffffff1681526020018260ff1681526020018360ff1681526020018481525060015f8773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151815f0160146101000a81548160ff021916908360ff1602179055506040820151815f0160156101000a81548160ff021916908360ff160217905550606082015181600101559050508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167f1703b8b5433a02c6bdde8d7fbe95169ad9c36ac3758f767d1bc9e7458237db1e838587604051610e0a93929190611550565b60405180910390a35050505050565b5f33905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f610e4d82610e24565b9050919050565b610e5d81610e43565b8114610e67575f5ffd5b50565b5f81359050610e7881610e54565b92915050565b5f60208284031215610e9357610e92610e20565b5b5f610ea084828501610e6a565b91505092915050565b5f819050919050565b5f610ecc610ec7610ec284610e24565b610ea9565b610e24565b9050919050565b5f610edd82610eb2565b9050919050565b5f610eee82610ed3565b9050919050565b610efe81610ee4565b82525050565b5f60ff82169050919050565b610f1981610f04565b82525050565b5f819050919050565b610f3181610f1f565b82525050565b5f608082019050610f4a5f830187610ef5565b610f576020830186610f10565b610f646040830185610f10565b610f716060830184610f28565b95945050505050565b5f602082019050610f8d5f830184610f28565b92915050565b610f9c81610f1f565b8114610fa6575f5ffd5b50565b5f81359050610fb781610f93565b92915050565b5f5f5f60608486031215610fd457610fd3610e20565b5b5f610fe186828701610e6a565b9350506020610ff286828701610e6a565b925050604061100386828701610fa9565b9150509250925092565b61101681610e43565b82525050565b5f60208201905061102f5f83018461100d565b92915050565b5f5f6040838503121561104b5761104a610e20565b5b5f61105885828601610e6a565b925050602061106985828601610fa9565b9150509250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8160011c9050919050565b5f5f8291508390505b60018511156110f5578086048111156110d1576110d0611073565b5b60018516156110e05780820291505b80810290506110ee856110a0565b94506110b5565b94509492505050565b5f8261110d57600190506111c8565b8161111a575f90506111c8565b8160018114611130576002811461113a57611169565b60019150506111c8565b60ff84111561114c5761114b611073565b5b8360020a91508482111561116357611162611073565b5b506111c8565b5060208310610133831016604e8410600b841016171561119e5782820a90508381111561119957611198611073565b5b6111c8565b6111ab84848460016110ac565b925090508184048111156111c2576111c1611073565b5b81810290505b9392505050565b5f6111d982610f1f565b91506111e483610f04565b92506112117fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846110fe565b905092915050565b5f61122382610f1f565b915061122e83610f1f565b925082820261123c81610f1f565b9150828204841483151761125357611252611073565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61129182610f1f565b915061129c83610f1f565b9250826112ac576112ab61125a565b5b828204905092915050565b5f69ffffffffffffffffffff82169050919050565b6112d5816112b7565b81146112df575f5ffd5b50565b5f815190506112f0816112cc565b92915050565b5f819050919050565b611308816112f6565b8114611312575f5ffd5b50565b5f81519050611323816112ff565b92915050565b5f8151905061133781610f93565b92915050565b5f5f5f5f5f60a0868803121561135657611355610e20565b5b5f611363888289016112e2565b955050602061137488828901611315565b945050604061138588828901611329565b935050606061139688828901611329565b92505060806113a7888289016112e2565b9150509295509295909350565b5f6113be82610f1f565b91506113c983610f1f565b92508282039050818111156113e1576113e0611073565b5b92915050565b5f6113f182610f04565b91506113fc83610f04565b9250828203905060ff81111561141557611414611073565b5b92915050565b5f82825260208201905092915050565b7f7a65726f5f6164647265737300000000000000000000000000000000000000005f82015250565b5f61145f600c8361141b565b915061146a8261142b565b602082019050919050565b5f6020820190508181035f83015261148c81611453565b9050919050565b7f7374616c65506572696f643d30000000000000000000000000000000000000005f82015250565b5f6114c7600d8361141b565b91506114d282611493565b602082019050919050565b5f6020820190508181035f8301526114f4816114bb565b9050919050565b61150481610f04565b811461150e575f5ffd5b50565b5f8151905061151f816114fb565b92915050565b5f6020828403121561153a57611539610e20565b5b5f61154784828501611511565b91505092915050565b5f6060820190506115635f830186610f10565b6115706020830185610f10565b61157d6040830184610f28565b94935050505056fea2646970667358221220e15d39cf2a4426df65ca5f5e1db5d6a4d4fb6fef1fd8a6ec197cbaf62c44049a64736f6c634300081e0033
Verified Source Code Full Match
Compiler: v0.8.30+commit.73712a01
EVM: prague
Optimization: No
ChainlinkUsdPriceOracle.sol 148 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IVaultPriceOracle, AggregatorV3Interface} from "../interfaces/VaultExternalInterfaces.sol";
contract ChainlinkUsdPriceOracle is IVaultPriceOracle, Ownable {
struct FeedConfig {
AggregatorV3Interface agg;
uint8 aggDecimals;
uint8 tokenDecimals;
uint256 stalePeriod; // per-asset max age in seconds
}
mapping(address => FeedConfig) public feeds;
error NoFeedConfigured(address asset);
error BadAnswer(address asset);
error StalePrice(address asset);
event FeedSet(
address indexed asset,
address indexed aggregator,
uint8 aggDecimals,
uint8 tokenDecimals,
uint256 stalePeriod
);
constructor(
address initialOwner,
address[] memory assets,
address[] memory aggregators,
uint256[] memory stalePeriods
) Ownable(initialOwner) {
require(
assets.length == aggregators.length &&
assets.length == stalePeriods.length,
"length_mismatch"
);
for (uint256 i = 0; i < assets.length; ++i) {
_setFeedInternal(assets[i], aggregators[i], stalePeriods[i]);
}
}
/// @notice Add or update a feed config. Restricted to owner.
function setFeed(
address asset,
address aggregator,
uint256 stalePeriodSeconds
) external onlyOwner {
_setFeedInternal(asset, aggregator, stalePeriodSeconds);
}
function _setFeedInternal(
address asset,
address aggregator,
uint256 stalePeriodSeconds
) internal {
require(asset != address(0) && aggregator != address(0), "zero_address");
require(stalePeriodSeconds > 0, "stalePeriod=0");
uint8 tokenDec = IERC20Metadata(asset).decimals();
uint8 aggDec = AggregatorV3Interface(aggregator).decimals();
feeds[asset] = FeedConfig({
agg: AggregatorV3Interface(aggregator),
aggDecimals: aggDec,
tokenDecimals: tokenDec,
stalePeriod: stalePeriodSeconds
});
emit FeedSet(asset, aggregator, aggDec, tokenDec, stalePeriodSeconds);
}
function _latestPrice1e18(address asset) internal view returns (uint256) {
FeedConfig memory cfg = feeds[asset];
if (address(cfg.agg) == address(0)) revert NoFeedConfigured(asset);
(
uint80 roundId,
int256 answer,
,
uint256 updatedAt,
uint80 answeredInRound
) = cfg.agg.latestRoundData();
if (answer <= 0) revert BadAnswer(asset);
if (answeredInRound < roundId) revert BadAnswer(asset);
if (block.timestamp - updatedAt > cfg.stalePeriod) revert StalePrice(asset);
uint256 raw = uint256(answer);
uint8 d = cfg.aggDecimals;
// Normalize to 1e18
if (d >= 18) {
return raw / 10 ** (d - 18);
} else {
return raw * 10 ** (18 - d);
}
}
/// @inheritdoc IVaultPriceOracle
function priceInUsd(address asset) public view override returns (uint256) {
return _latestPrice1e18(asset); // USD 1e18 per 1 full token
}
/// @inheritdoc IVaultPriceOracle
function valueInUsd(address asset, uint256 amount)
public
view
override
returns (uint256)
{
if (amount == 0) return 0;
FeedConfig memory cfg = feeds[asset];
if (address(cfg.agg) == address(0)) revert NoFeedConfigured(asset);
uint256 price = _latestPrice1e18(asset); // 1e18 per 1 token
// amount [tokenDecimals], price [1e18 per 1 token] =>
// valueUsd = amount * price / 10^tokenDecimals
return (amount * price) / 10 ** cfg.tokenDecimals;
}
/// @inheritdoc IVaultPriceOracle
function valueInCollateral(
address asset,
address collateralAsset,
uint256 amount
) public view override returns (uint256) {
if (amount == 0) return 0;
uint256 valueUsd = valueInUsd(asset, amount); // 1e18
FeedConfig memory collCfg = feeds[collateralAsset];
if (address(collCfg.agg) == address(0)) revert NoFeedConfigured(collateralAsset);
uint256 collPrice = _latestPrice1e18(collateralAsset); // 1e18
// valueUsd [1e18] = amountCollat * collPrice / 10^collDecimals
// => amountCollat = valueUsd * 10^collDecimals / collPrice
return (valueUsd * 10 ** collCfg.tokenDecimals) / collPrice;
}
}
VaultExternalInterfaces.sol 105 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
// ==========================================================
// Core external interfaces shared across contracts
// ==========================================================
/// @dev Minimal Aave V3 Pool interface (supply + withdraw + borrow + repay).
interface IAavePool {
function supply(
address asset,
uint256 amount,
address onBehalfOf,
uint16 referralCode
) external;
function withdraw(
address asset,
uint256 amount,
address to
) external returns (uint256);
function borrow(
address asset,
uint256 amount,
uint256 interestRateMode, // 1 = stable, 2 = variable (Aave v3)
uint16 referralCode,
address onBehalfOf
) external;
function repay(
address asset,
uint256 amount,
uint256 interestRateMode,
address onBehalfOf
) external returns (uint256);
}
/// @dev Minimal aToken interface (just ERC20).
interface IAToken is IERC20 {}
/// @dev Aave variable debt token (tracks principal + interest).
interface IVariableDebtToken is IERC20 {}
/// @dev Minimal Uniswap V3-style router interface.
interface ISwapRouter {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
function exactInputSingle(ExactInputSingleParams calldata params)
external
payable
returns (uint256 amountOut);
}
// ==========================================================
// Oracle interface used by vault
// ==========================================================
/// @dev Price oracle interface used by the vault.
interface IVaultPriceOracle {
/// @notice Value of `amount` of `asset` in USD, scaled by 1e18.
function valueInUsd(address asset, uint256 amount) external view returns (uint256);
/// @notice Value of `amount` of `asset` expressed in `collateralAsset` units.
/// Must return a value in the exact decimals of `collateralAsset`.
function valueInCollateral(
address asset,
address collateralAsset,
uint256 amount
) external view returns (uint256);
/// @notice Price of 1 full token of `asset` in USD, scaled by 1e18.
function priceInUsd(address asset) external view returns (uint256);
}
// ==========================================================
// Chainlink aggregator interface
// ==========================================================
interface AggregatorV3Interface {
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
function decimals() external view returns (uint8);
}
Ownable.sol 100 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* The initial owner is set to the address provided by the deployer. This can
* later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
IERC20Metadata.sol 26 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity >=0.6.2;
import {IERC20} from "../IERC20.sol";
/**
* @dev Interface for the optional metadata functions from the ERC-20 standard.
*/
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);
}
IERC20.sol 79 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-20 standard as defined in the ERC.
*/
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 value of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the value of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);
/**
* @dev Moves a `value` amount of tokens from `from` to `to` using the
* allowance mechanism. `value` 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 value) external returns (bool);
}
Context.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
Read Contract
feeds 0x2fba4aa9 → address, uint8, uint8, uint256
owner 0x8da5cb5b → address
priceInUsd 0x714407f5 → uint256
valueInCollateral 0x79b99e00 → uint256
valueInUsd 0xbfc579a2 → uint256
Write Contract 3 functions
These functions modify contract state and require a wallet transaction to execute.
renounceOwnership 0x715018a6
No parameters
setFeed 0x84c8a3db
address asset
address aggregator
uint256 stalePeriodSeconds
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address