Description:
Decentralized Finance (DeFi) protocol contract providing Liquidity, Factory, Oracle functionality.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"src/Bot.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
type Id is bytes32;
struct Market {
uint128 totalSupplyAssets;
uint128 totalSupplyShares;
uint128 totalBorrowAssets;
uint128 totalBorrowShares;
uint128 lastUpdate;
uint128 fee;
}
struct MarketParams {
address loanToken;
address collateralToken;
address oracle;
address irm;
uint256 lltv;
}
interface IMorpho {
function market(Id id) external view returns (Market memory m);
function repay(
MarketParams memory marketParams,
uint256 assets,
uint256 shares,
address onBehalf,
bytes calldata data
) external returns (uint256, uint256);
}
interface IVault {
function withdraw(
uint256 assets,
address receiver,
address owner
) external returns (uint256 shares);
function maxWithdraw(address owner) external view returns (uint256 assets);
function approve(address spender, uint256 amount) external returns (bool);
}
contract Bot {
IMorpho immutable MORPHO =
IMorpho(0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb);
IVault immutable VAULT = IVault(0x94643e86aa5E38DDAc6c7791C1297f4E40cD96c1);
Id MARKET_ID =
Id.wrap(
0x0f9563442d64ab3bd3bcb27058db0b0d4046a4c46f0acd811dacae9551d2b129
);
address private owner = 0x1467b99d8FEC651CB85a4498BFf47094cBA95250;
function maxWithdraw() public view returns (uint256) {
return VAULT.maxWithdraw(owner);
}
function withdraw() external {
uint256 _maxWithdraw = VAULT.maxWithdraw(owner);
require(_maxWithdraw > 0, "Not enough liquidity");
VAULT.withdraw(_maxWithdraw, owner, owner);
}
}
"
}
},
"settings": {
"remappings": [
"forge-std/=lib/forge-std/src/"
],
"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
}
}}
Submitted on: 2025-11-05 14:01:26
Comments
Log in to comment.
No comments yet.