Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Latest 1 from a total of 1 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Set Market Id | 20108802 | 9 days ago | IN | 0 ETH | 0.00000138 |
Cross-Chain Transactions
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
YechoMorphoCollatHelper
Compiler Version
v0.8.33+commit.64118f21
Optimization Enabled:
No with 200 runs
Other Settings:
prague EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BSL 1.1
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
/*
██ ██ ███████ ██████ ██ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██
████ █████ ██ ███████ ██ ██
██ ██ ██ ██ ██ ██ ██
██ ███████ ██████ ██ ██ ██████
Yecho - Know Your Yield
Morpho Collateral Helper Smartcontract
https://www.yecho.app | https://x.com/YechoApp
By Lasalad
*/
struct Position {
uint256 supplyShares;
uint128 borrowShares;
uint128 collateral;
}
struct Market {
uint128 totalSupplyAssets;
uint128 totalSupplyShares;
uint128 totalBorrowAssets;
uint128 totalBorrowShares;
uint128 lastUpdate;
uint128 fee;
}
interface IMorpho {
function position(bytes32 marketId, address user) external view returns (Position memory);
function market(bytes32 marketId) external view returns (Market memory);
}
contract YechoMorphoCollatHelper is Ownable {
IMorpho public morpho;
bytes32 public marketId;
event MorphoAddressUpdated(address newAddress);
event MarketIdUpdated(bytes32 newMarketId);
constructor(address _morphoAddress, bytes32 _marketId) Ownable(msg.sender) {
require(_morphoAddress != address(0), "Invalid Morpho address");
morpho = IMorpho(_morphoAddress);
marketId = _marketId;
}
function setMorphoAddress(address _newMorphoAddress) external onlyOwner {
require(_newMorphoAddress != address(0), "Invalid Morpho address");
morpho = IMorpho(_newMorphoAddress);
emit MorphoAddressUpdated(_newMorphoAddress);
}
function setMarketId(bytes32 _newMarketId) external onlyOwner {
marketId = _newMarketId;
emit MarketIdUpdated(_newMarketId);
}
function getHelper(address user) external view returns (uint256 collateral) {
Position memory position = morpho.position(marketId, user);
return position.collateral;
}
}// 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);
}
}// 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;
}
}{
"remappings": [
"@openzeppelin/=lib/openzeppelin-contracts/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/"
],
"optimizer": {
"enabled": false,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": false
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_morphoAddress","type":"address"},{"internalType":"bytes32","name":"_marketId","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"newMarketId","type":"bytes32"}],"name":"MarketIdUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newAddress","type":"address"}],"name":"MorphoAddressUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getHelper","outputs":[{"internalType":"uint256","name":"collateral","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"marketId","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"morpho","outputs":[{"internalType":"contract IMorpho","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_newMarketId","type":"bytes32"}],"name":"setMarketId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newMorphoAddress","type":"address"}],"name":"setMorphoAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]Contract Creation Code
608060405234801561000f575f5ffd5b50604051610d8f380380610d8f833981810160405281019061003191906102c0565b335f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036100a2575f6040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600401610099919061030d565b60405180910390fd5b6100b18161016e60201b60201c565b505f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610120576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161011790610380565b60405180910390fd5b8160015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600281905550505061039e565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61025c82610233565b9050919050565b61026c81610252565b8114610276575f5ffd5b50565b5f8151905061028781610263565b92915050565b5f819050919050565b61029f8161028d565b81146102a9575f5ffd5b50565b5f815190506102ba81610296565b92915050565b5f5f604083850312156102d6576102d561022f565b5b5f6102e385828601610279565b92505060206102f4858286016102ac565b9150509250929050565b61030781610252565b82525050565b5f6020820190506103205f8301846102fe565b92915050565b5f82825260208201905092915050565b7f496e76616c6964204d6f7270686f2061646472657373000000000000000000005f82015250565b5f61036a601683610326565b915061037582610336565b602082019050919050565b5f6020820190508181035f8301526103978161035e565b9050919050565b6109e4806103ab5f395ff3fe608060405234801561000f575f5ffd5b5060043610610086575f3560e01c80638da5cb5b116100595780638da5cb5b146100fe578063c9f00d571461011c578063d8fbc83314610138578063f2fde38b1461015657610086565b80636ed71ede1461008a578063715018a6146100a857806375d39356146100b25780638937e6ce146100e2575b5f5ffd5b610092610172565b60405161009f91906105bb565b60405180910390f35b6100b0610178565b005b6100cc60048036038101906100c7919061063b565b61018b565b6040516100d9919061067e565b60405180910390f35b6100fc60048036038101906100f791906106c1565b61024b565b005b610106610294565b60405161011391906106fb565b60405180910390f35b6101366004803603810190610131919061063b565b6102bb565b005b6101406103ab565b60405161014d919061076f565b60405180910390f35b610170600480360381019061016b919061063b565b6103d0565b005b60025481565b610180610454565b6101895f6104db565b565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166393c52062600254856040518363ffffffff1660e01b81526004016101eb929190610788565b606060405180830381865afa158015610206573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061022a919061090b565b905080604001516fffffffffffffffffffffffffffffffff16915050919050565b610253610454565b806002819055507fc04740e081dca61cc37383dbf40b10a83336f91ea2e64fc439246375f5b2c2e68160405161028991906105bb565b60405180910390a150565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6102c3610454565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610331576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032890610990565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fe551a727ce84fcce18e75bb608983de9ef9cd63273a22c80c5d2b3eee9500056816040516103a091906106fb565b60405180910390a150565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6103d8610454565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610448575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161043f91906106fb565b60405180910390fd5b610451816104db565b50565b61045c61059c565b73ffffffffffffffffffffffffffffffffffffffff1661047a610294565b73ffffffffffffffffffffffffffffffffffffffff16146104d95761049d61059c565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016104d091906106fb565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f819050919050565b6105b5816105a3565b82525050565b5f6020820190506105ce5f8301846105ac565b92915050565b5f604051905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61060a826105e1565b9050919050565b61061a81610600565b8114610624575f5ffd5b50565b5f8135905061063581610611565b92915050565b5f602082840312156106505761064f6105dd565b5b5f61065d84828501610627565b91505092915050565b5f819050919050565b61067881610666565b82525050565b5f6020820190506106915f83018461066f565b92915050565b6106a0816105a3565b81146106aa575f5ffd5b50565b5f813590506106bb81610697565b92915050565b5f602082840312156106d6576106d56105dd565b5b5f6106e3848285016106ad565b91505092915050565b6106f581610600565b82525050565b5f60208201905061070e5f8301846106ec565b92915050565b5f819050919050565b5f61073761073261072d846105e1565b610714565b6105e1565b9050919050565b5f6107488261071d565b9050919050565b5f6107598261073e565b9050919050565b6107698161074f565b82525050565b5f6020820190506107825f830184610760565b92915050565b5f60408201905061079b5f8301856105ac565b6107a860208301846106ec565b9392505050565b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6107f9826107b3565b810181811067ffffffffffffffff82111715610818576108176107c3565b5b80604052505050565b5f61082a6105d4565b905061083682826107f0565b919050565b61084481610666565b811461084e575f5ffd5b50565b5f8151905061085f8161083b565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b61088981610865565b8114610893575f5ffd5b50565b5f815190506108a481610880565b92915050565b5f606082840312156108bf576108be6107af565b5b6108c96060610821565b90505f6108d884828501610851565b5f8301525060206108eb84828501610896565b60208301525060406108ff84828501610896565b60408301525092915050565b5f606082840312156109205761091f6105dd565b5b5f61092d848285016108aa565b91505092915050565b5f82825260208201905092915050565b7f496e76616c6964204d6f7270686f2061646472657373000000000000000000005f82015250565b5f61097a601683610936565b915061098582610946565b602082019050919050565b5f6020820190508181035f8301526109a78161096e565b905091905056fea264697066735822122030a66c4bd6cc51d0bfa6fbc966a2e2557a29b74163853d1ddf74b7c9d6fc84c464736f6c63430008210033000000000000000000000000d50f2dfffd62f94ee4aed9ca05c61d0753268abc6691cdcadd5d23ac68d2c1cf54dc97ab8242d2a888230de411094480252c2ed3
Deployed Bytecode
0x608060405234801561000f575f5ffd5b5060043610610086575f3560e01c80638da5cb5b116100595780638da5cb5b146100fe578063c9f00d571461011c578063d8fbc83314610138578063f2fde38b1461015657610086565b80636ed71ede1461008a578063715018a6146100a857806375d39356146100b25780638937e6ce146100e2575b5f5ffd5b610092610172565b60405161009f91906105bb565b60405180910390f35b6100b0610178565b005b6100cc60048036038101906100c7919061063b565b61018b565b6040516100d9919061067e565b60405180910390f35b6100fc60048036038101906100f791906106c1565b61024b565b005b610106610294565b60405161011391906106fb565b60405180910390f35b6101366004803603810190610131919061063b565b6102bb565b005b6101406103ab565b60405161014d919061076f565b60405180910390f35b610170600480360381019061016b919061063b565b6103d0565b005b60025481565b610180610454565b6101895f6104db565b565b5f5f60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166393c52062600254856040518363ffffffff1660e01b81526004016101eb929190610788565b606060405180830381865afa158015610206573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061022a919061090b565b905080604001516fffffffffffffffffffffffffffffffff16915050919050565b610253610454565b806002819055507fc04740e081dca61cc37383dbf40b10a83336f91ea2e64fc439246375f5b2c2e68160405161028991906105bb565b60405180910390a150565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6102c3610454565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610331576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032890610990565b60405180910390fd5b8060015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fe551a727ce84fcce18e75bb608983de9ef9cd63273a22c80c5d2b3eee9500056816040516103a091906106fb565b60405180910390a150565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6103d8610454565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610448575f6040517f1e4fbdf700000000000000000000000000000000000000000000000000000000815260040161043f91906106fb565b60405180910390fd5b610451816104db565b50565b61045c61059c565b73ffffffffffffffffffffffffffffffffffffffff1661047a610294565b73ffffffffffffffffffffffffffffffffffffffff16146104d95761049d61059c565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016104d091906106fb565b60405180910390fd5b565b5f5f5f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050815f5f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b5f33905090565b5f819050919050565b6105b5816105a3565b82525050565b5f6020820190506105ce5f8301846105ac565b92915050565b5f604051905090565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61060a826105e1565b9050919050565b61061a81610600565b8114610624575f5ffd5b50565b5f8135905061063581610611565b92915050565b5f602082840312156106505761064f6105dd565b5b5f61065d84828501610627565b91505092915050565b5f819050919050565b61067881610666565b82525050565b5f6020820190506106915f83018461066f565b92915050565b6106a0816105a3565b81146106aa575f5ffd5b50565b5f813590506106bb81610697565b92915050565b5f602082840312156106d6576106d56105dd565b5b5f6106e3848285016106ad565b91505092915050565b6106f581610600565b82525050565b5f60208201905061070e5f8301846106ec565b92915050565b5f819050919050565b5f61073761073261072d846105e1565b610714565b6105e1565b9050919050565b5f6107488261071d565b9050919050565b5f6107598261073e565b9050919050565b6107698161074f565b82525050565b5f6020820190506107825f830184610760565b92915050565b5f60408201905061079b5f8301856105ac565b6107a860208301846106ec565b9392505050565b5f5ffd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6107f9826107b3565b810181811067ffffffffffffffff82111715610818576108176107c3565b5b80604052505050565b5f61082a6105d4565b905061083682826107f0565b919050565b61084481610666565b811461084e575f5ffd5b50565b5f8151905061085f8161083b565b92915050565b5f6fffffffffffffffffffffffffffffffff82169050919050565b61088981610865565b8114610893575f5ffd5b50565b5f815190506108a481610880565b92915050565b5f606082840312156108bf576108be6107af565b5b6108c96060610821565b90505f6108d884828501610851565b5f8301525060206108eb84828501610896565b60208301525060406108ff84828501610896565b60408301525092915050565b5f606082840312156109205761091f6105dd565b5b5f61092d848285016108aa565b91505092915050565b5f82825260208201905092915050565b7f496e76616c6964204d6f7270686f2061646472657373000000000000000000005f82015250565b5f61097a601683610936565b915061098582610946565b602082019050919050565b5f6020820190508181035f8301526109a78161096e565b905091905056fea264697066735822122030a66c4bd6cc51d0bfa6fbc966a2e2557a29b74163853d1ddf74b7c9d6fc84c464736f6c63430008210033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000d50f2dfffd62f94ee4aed9ca05c61d0753268abc6691cdcadd5d23ac68d2c1cf54dc97ab8242d2a888230de411094480252c2ed3
-----Decoded View---------------
Arg [0] : _morphoAddress (address): 0xD50F2DffFd62f94Ee4AEd9ca05C61d0753268aBc
Arg [1] : _marketId (bytes32): 0x6691cdcadd5d23ac68d2c1cf54dc97ab8242d2a888230de411094480252c2ed3
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000d50f2dfffd62f94ee4aed9ca05c61d0753268abc
Arg [1] : 6691cdcadd5d23ac68d2c1cf54dc97ab8242d2a888230de411094480252c2ed3
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 36 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
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.