ETH Price: $2,944.05 (-4.03%)
Gas: 1 Gwei

Contract

0x893d69Eb3CF5313a85C8FeEfdDd2ef49a2Bf0d45
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x6108ca51202194302024-07-02 14:28:475 days ago1719930527IN
 Create: Vyper_contract
0 ETH0.005003895.99564436

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.3.10

Optimization Enabled:
N/A

Other Settings:
None license

Contract Source Code (Vyper language format)

# pragma version 0.3.10
# pragma evm-version cancun

interface ERC20:
    def approve(_to: address, _value: uint256): nonpayable
    def transfer(_to: address, _value: uint256) -> bool: nonpayable
    def transferFrom(_from: address, _to: address, _value: uint256) -> bool: nonpayable
    def balanceOf(_owner: address) -> uint256: view
    def decimals() -> uint256: view

interface StableSwap:
    def get_p(i: uint256=0) -> uint256: view
    def price_oracle(i: uint256=0) -> uint256: view
    def get_balances() -> uint256[2]: view
    def exchange(i: int128, j: int128, _dx: uint256, _min_dy: uint256, _receiver: address = msg.sender) -> uint256: nonpayable
    def A_precise() -> uint256: view
    def fee() -> uint256: view
    def coins(i: uint256) -> ERC20: view

interface Regulator:
    def price_deviation() -> uint256: view

interface PegKeeper:
    def pool() -> StableSwap: view
    def IS_INVERSE() -> bool: view
    def update(_receiver: address = msg.sender) -> uint256: nonpayable

interface Morpho:
    def flashLoan(token: address, assets: uint256, data: Bytes[256]):nonpayable

struct Params:
    balances: uint256[2]
    decimals: uint256[2]
    p_o: uint256
    cur_p: uint256
    A: uint256
    fee: uint256
    is_inverse: bool

struct SandwichParams:
    amount: uint256
    i: int128
    pk: PegKeeper
    pool: StableSwap
    coin: ERC20
    receiver: address

REGULATOR: immutable(Regulator)
MORPHO: immutable(Morpho)

sandwich_params: transient(SandwichParams)

@external
def __init__(_regulator: Regulator, _morpho: Morpho, _pools: StableSwap[4]):
    REGULATOR = _regulator
    MORPHO = _morpho

    for pool in _pools:
        for i in range(2):
            pool.coins(i).approve(pool.address, max_value(uint256))


@view
@external
def get_params(pk: PegKeeper) -> Params:
    pool: StableSwap = pk.pool()
    cur_p: uint256 = 0
    success: bool = False
    success = raw_call(
        pool.address, method_id("get_p()"),
        revert_on_failure=False,
        is_static_call=True,
    )
    if success:
        cur_p = pool.get_p()
    else:
        cur_p = pool.get_p(0)
    return Params({
        balances: pool.get_balances(),
        decimals: [pool.coins(0).decimals(), pool.coins(1).decimals()],
        p_o: pool.price_oracle(),
        cur_p: cur_p,
        A: pool.A_precise(),
        fee: pool.fee(),
        is_inverse: pk.IS_INVERSE()
    })


@external
def call(pk: PegKeeper, amount: uint256, i: int128, _receiver: address=msg.sender):
    if amount > 0:
        pool: StableSwap = pk.pool()
        coin: ERC20 = pool.coins(convert(i, uint256))
        self.sandwich_params = SandwichParams({
            amount: amount,
            i: i,
            pk: pk,
            pool: pool,
            coin: coin,
            receiver: _receiver,
        })
        MORPHO.flashLoan(coin.address, amount, b"")
        coin.transfer(_receiver, coin.balanceOf(self))
        return

    pk.update(_receiver)


@external
def onMorphoFlashLoan(assets: uint256, data: Bytes[256]):
    sp: SandwichParams = self.sandwich_params
    dy: uint256 = sp.pool.exchange(sp.i, 1-sp.i, sp.amount, 0)

    sp.pk.update(sp.receiver)

    sp.pool.exchange(1-sp.i, sp.i, dy, 0)

    sp.coin.approve(msg.sender, assets)


@external
def approve(_pool: StableSwap):
    _pool.coins(0).approve(_pool.address, max_value(uint256))
    _pool.coins(1).approve(_pool.address, max_value(uint256))

Contract Security Audit

Contract ABI

[{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_regulator","type":"address"},{"name":"_morpho","type":"address"},{"name":"_pools","type":"address[4]"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"get_params","inputs":[{"name":"pk","type":"address"}],"outputs":[{"name":"","type":"tuple","components":[{"name":"balances","type":"uint256[2]"},{"name":"decimals","type":"uint256[2]"},{"name":"p_o","type":"uint256"},{"name":"cur_p","type":"uint256"},{"name":"A","type":"uint256"},{"name":"fee","type":"uint256"},{"name":"is_inverse","type":"bool"}]}]},{"stateMutability":"nonpayable","type":"function","name":"call","inputs":[{"name":"pk","type":"address"},{"name":"amount","type":"uint256"},{"name":"i","type":"int128"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"call","inputs":[{"name":"pk","type":"address"},{"name":"amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"_receiver","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"onMorphoFlashLoan","inputs":[{"name":"assets","type":"uint256"},{"name":"data","type":"bytes"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"approve","inputs":[{"name":"_pool","type":"address"}],"outputs":[]}]

6108ca515034610177576020610a3a5f395f518060a01c610177576040526020610a5a5f395f518060a01c610177576060526020610a7a5f395f518060a01c610177576080526020610a9a5f395f518060a01c6101775760a0526020610aba5f395f518060a01c6101775760c0526020610ada5f395f518060a01c6101775760e0526040516108aa526060516108ca525f6004905b8060051b60800151610100525f6002905b80610120526101005163c66106576101405261012051610160526020610140602461015c845afa6100d8573d5f5f3e3d5ffd5b60203d1061017757610140518060a01c610177576101805261018090505163095ea7b36101a052610100516101c0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101e052803b15610177575f6101a060446101bc5f855af161014c573d5f5f3e3d5ffd5b506001018181186100a55750506001018181186100945750506108aa61017b610000396108ea610000f35b5f80fd5f3560e01c60026003821660011b6108a201601e395f51565b63ce90a07681186103615760243610341761089e576004358060a01c61089e576040526040516316f0115b608052602060806004609c845afa61005d573d5f5f3e3d5ffd5b60203d1061089e576080518060a01c61089e5760c05260c09050516060526040366080376060515a600460c0527ff2388acb0000000000000000000000000000000000000000000000000000000060e05260c0505f5f60c05160e08585fa9050905060a05260a0516101045760605163ec02386260c0525f60e052602060c0602460dc845afa6100ef573d5f5f3e3d5ffd5b60203d1061089e5760c0905051608052610137565b60605163f2388acb60c052602060c0600460dc845afa610126573d5f5f3e3d5ffd5b60203d1061089e5760c09050516080525b6060516314f0597960c052604060c0600460dc845afa610159573d5f5f3e3d5ffd5b60403d1061089e5760c090506040816103805e5060605163c6610657610120525f610140526020610120602461013c845afa610197573d5f5f3e3d5ffd5b60203d1061089e57610120518060a01c61089e576101605261016090505163313ce567610180526020610180600461019c845afa6101d7573d5f5f3e3d5ffd5b60203d1061089e576101809050516103c05260605163c66106576101c05260016101e05260206101c060246101dc845afa610214573d5f5f3e3d5ffd5b60203d1061089e576101c0518060a01c61089e576102005261020090505163313ce567610220526020610220600461023c845afa610254573d5f5f3e3d5ffd5b60203d1061089e576102209050516103e0526060516386fc88d3610260526020610260600461027c845afa61028b573d5f5f3e3d5ffd5b60203d1061089e5761026090505161040052608051610420526060516376a2f0f06102a05260206102a060046102bc845afa6102c9573d5f5f3e3d5ffd5b60203d1061089e576102a09050516104405260605163ddca3f436102e05260206102e060046102fc845afa610300573d5f5f3e3d5ffd5b60203d1061089e576102e09050516104605260405163f96b9f18610320526020610320600461033c845afa610337573d5f5f3e3d5ffd5b60203d1061089e57610320518060011c61089e576103605261036090505161048052610120610380f35b6331f57072811861089a5760643610341761089e5760243560040161010081351161089e576020813501808260403750505f6006905b805c8160051b61016001526001018181186103975750506101c051633df02124610240526101805161026052610180518060010380600f0b811861089e57905061028052610160516102a0525f6102c0526020610240608461025c5f855af1610402573d5f5f3e3d5ffd5b60203d1061089e57610240905051610220526101a051631c1b87726102405261020051610260526020610240602461025c5f855af1610443573d5f5f3e3d5ffd5b60203d1061089e5761024050506101c051633df0212461024052610180518060010380600f0b811861089e579050610260526101805161028052610220516102a0525f6102c0526020610240608461025c5f855af16104a4573d5f5f3e3d5ffd5b60203d1061089e5761024050506101e05163095ea7b361024052336102605260043561028052803b1561089e575f610240604461025c5f855af16104ea573d5f5f3e3d5ffd5b500061089a565b63a7edbdf3811861050f5760643610341761089e5733608052610533565b63d84a054b811861089a5760843610341761089e576064358060a01c61089e576080525b6004358060a01c61089e5760405260443580600f0b811861089e5760605260243515610712576040516316f0115b60c052602060c0600460dc845afa61057b573d5f5f3e3d5ffd5b60203d1061089e5760c0518060a01c61089e576101005261010090505160a05260a05163c661065760e0526060515f811261089e5761010052602060e0602460fc845afa6105cb573d5f5f3e3d5ffd5b60203d1061089e5760e0518060a01c61089e576101205261012090505160c0526024355f5d60605160015d60405160025d60a05160035d60c05160045d60805160055d60206108ca5f395f5163e0232b4261010052606060c051610120526024356101405280610160525f60e05260e081610120015f81528051806020830101601f825f03163682375050601f19601f825160200101169050905081015050803b1561089e575f610100608461011c5f855af161068a573d5f5f3e3d5ffd5b5060c05163a9059cbb610120526080516101405260c0516370a0823160e0523061010052602060e0602460fc845afa6106c5573d5f5f3e3d5ffd5b60203d1061089e5760e0905051610160526020610120604461013c5f855af16106f0573d5f5f3e3d5ffd5b60203d1061089e57610120518060011c61089e57610180526101805050610748565b604051631c1b877260a05260805160c052602060a0602460bc5f855af161073b573d5f5f3e3d5ffd5b60203d1061089e5760a050505b0061089a565b63daea85c5811861089a5760243610341761089e576004358060a01c61089e5760405260405163c66106576060525f608052602060606024607c845afa610797573d5f5f3e3d5ffd5b60203d1061089e576060518060a01c61089e5760a05260a090505163095ea7b360c05260405160e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010052803b1561089e575f60c0604460dc5f855af1610803573d5f5f3e3d5ffd5b5060405163c66106576060526001608052602060606024607c845afa61082b573d5f5f3e3d5ffd5b60203d1061089e576060518060a01c61089e5760a05260a090505163095ea7b360c05260405160e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010052803b1561089e575f60c0604460dc5f855af1610897573d5f5f3e3d5ffd5b50005b5f5ffd5b5f80fd089a074e001804f1841908aa81081840a16576797065728300030a001500000000000000000000000036a04caffc681fa179558b2aaba30395cddd855f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb000000000000000000000000390f3595bca2df7d23783dfd126427cceb997bf40000000000000000000000004dece678ceceb27446b35c672dc7d61f30bad69e000000000000000000000000625e92624bc2d88619accc1788365a69767f620000000000000000000000000034d655069f4cac1547e4c8ca284ffff5ad4a8db0

Deployed Bytecode

0x5f3560e01c60026003821660011b6108a201601e395f51565b63ce90a07681186103615760243610341761089e576004358060a01c61089e576040526040516316f0115b608052602060806004609c845afa61005d573d5f5f3e3d5ffd5b60203d1061089e576080518060a01c61089e5760c05260c09050516060526040366080376060515a600460c0527ff2388acb0000000000000000000000000000000000000000000000000000000060e05260c0505f5f60c05160e08585fa9050905060a05260a0516101045760605163ec02386260c0525f60e052602060c0602460dc845afa6100ef573d5f5f3e3d5ffd5b60203d1061089e5760c0905051608052610137565b60605163f2388acb60c052602060c0600460dc845afa610126573d5f5f3e3d5ffd5b60203d1061089e5760c09050516080525b6060516314f0597960c052604060c0600460dc845afa610159573d5f5f3e3d5ffd5b60403d1061089e5760c090506040816103805e5060605163c6610657610120525f610140526020610120602461013c845afa610197573d5f5f3e3d5ffd5b60203d1061089e57610120518060a01c61089e576101605261016090505163313ce567610180526020610180600461019c845afa6101d7573d5f5f3e3d5ffd5b60203d1061089e576101809050516103c05260605163c66106576101c05260016101e05260206101c060246101dc845afa610214573d5f5f3e3d5ffd5b60203d1061089e576101c0518060a01c61089e576102005261020090505163313ce567610220526020610220600461023c845afa610254573d5f5f3e3d5ffd5b60203d1061089e576102209050516103e0526060516386fc88d3610260526020610260600461027c845afa61028b573d5f5f3e3d5ffd5b60203d1061089e5761026090505161040052608051610420526060516376a2f0f06102a05260206102a060046102bc845afa6102c9573d5f5f3e3d5ffd5b60203d1061089e576102a09050516104405260605163ddca3f436102e05260206102e060046102fc845afa610300573d5f5f3e3d5ffd5b60203d1061089e576102e09050516104605260405163f96b9f18610320526020610320600461033c845afa610337573d5f5f3e3d5ffd5b60203d1061089e57610320518060011c61089e576103605261036090505161048052610120610380f35b6331f57072811861089a5760643610341761089e5760243560040161010081351161089e576020813501808260403750505f6006905b805c8160051b61016001526001018181186103975750506101c051633df02124610240526101805161026052610180518060010380600f0b811861089e57905061028052610160516102a0525f6102c0526020610240608461025c5f855af1610402573d5f5f3e3d5ffd5b60203d1061089e57610240905051610220526101a051631c1b87726102405261020051610260526020610240602461025c5f855af1610443573d5f5f3e3d5ffd5b60203d1061089e5761024050506101c051633df0212461024052610180518060010380600f0b811861089e579050610260526101805161028052610220516102a0525f6102c0526020610240608461025c5f855af16104a4573d5f5f3e3d5ffd5b60203d1061089e5761024050506101e05163095ea7b361024052336102605260043561028052803b1561089e575f610240604461025c5f855af16104ea573d5f5f3e3d5ffd5b500061089a565b63a7edbdf3811861050f5760643610341761089e5733608052610533565b63d84a054b811861089a5760843610341761089e576064358060a01c61089e576080525b6004358060a01c61089e5760405260443580600f0b811861089e5760605260243515610712576040516316f0115b60c052602060c0600460dc845afa61057b573d5f5f3e3d5ffd5b60203d1061089e5760c0518060a01c61089e576101005261010090505160a05260a05163c661065760e0526060515f811261089e5761010052602060e0602460fc845afa6105cb573d5f5f3e3d5ffd5b60203d1061089e5760e0518060a01c61089e576101205261012090505160c0526024355f5d60605160015d60405160025d60a05160035d60c05160045d60805160055d60206108ca5f395f5163e0232b4261010052606060c051610120526024356101405280610160525f60e05260e081610120015f81528051806020830101601f825f03163682375050601f19601f825160200101169050905081015050803b1561089e575f610100608461011c5f855af161068a573d5f5f3e3d5ffd5b5060c05163a9059cbb610120526080516101405260c0516370a0823160e0523061010052602060e0602460fc845afa6106c5573d5f5f3e3d5ffd5b60203d1061089e5760e0905051610160526020610120604461013c5f855af16106f0573d5f5f3e3d5ffd5b60203d1061089e57610120518060011c61089e57610180526101805050610748565b604051631c1b877260a05260805160c052602060a0602460bc5f855af161073b573d5f5f3e3d5ffd5b60203d1061089e5760a050505b0061089a565b63daea85c5811861089a5760243610341761089e576004358060a01c61089e5760405260405163c66106576060525f608052602060606024607c845afa610797573d5f5f3e3d5ffd5b60203d1061089e576060518060a01c61089e5760a05260a090505163095ea7b360c05260405160e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010052803b1561089e575f60c0604460dc5f855af1610803573d5f5f3e3d5ffd5b5060405163c66106576060526001608052602060606024607c845afa61082b573d5f5f3e3d5ffd5b60203d1061089e576060518060a01c61089e5760a05260a090505163095ea7b360c05260405160e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61010052803b1561089e575f60c0604460dc5f855af1610897573d5f5f3e3d5ffd5b50005b5f5ffd5b5f80fd089a074e001804f100000000000000000000000036a04caffc681fa179558b2aaba30395cddd855f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000036a04caffc681fa179558b2aaba30395cddd855f000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb000000000000000000000000390f3595bca2df7d23783dfd126427cceb997bf40000000000000000000000004dece678ceceb27446b35c672dc7d61f30bad69e000000000000000000000000625e92624bc2d88619accc1788365a69767f620000000000000000000000000034d655069f4cac1547e4c8ca284ffff5ad4a8db0

-----Decoded View---------------
Arg [0] : _regulator (address): 0x36a04CAffc681fa179558B2Aaba30395CDdd855f
Arg [1] : _morpho (address): 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb
Arg [2] : _pools (address[4]): 0x390f3595bCa2Df7d23783dFd126427CCeb997BF4,0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E,0x625E92624Bc2D88619ACCc1788365A69767f6200,0x34D655069F4cAc1547E4C8cA284FfFF5ad4A8db0

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000036a04caffc681fa179558b2aaba30395cddd855f
Arg [1] : 000000000000000000000000bbbbbbbbbb9cc5e90e3b3af64bdaf62c37eeffcb
Arg [2] : 000000000000000000000000390f3595bca2df7d23783dfd126427cceb997bf4
Arg [3] : 0000000000000000000000004dece678ceceb27446b35c672dc7d61f30bad69e
Arg [4] : 000000000000000000000000625e92624bc2d88619accc1788365a69767f6200
Arg [5] : 00000000000000000000000034d655069f4cac1547e4c8ca284ffff5ad4a8db0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.