ETH Price: $2,506.10 (-0.75%)

Contract

0x8377CD01a5834a6EaD3b7efb482f678f2092b77e
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Exit179584262023-08-20 20:45:11379 days ago1692564311IN
Maker: MCD Cropper
0 ETH0.0027357916.57997802
Get Or Create Pr...179583552023-08-20 20:30:59379 days ago1692563459IN
Maker: MCD Cropper
0 ETH0.0023458115.60351971
Get Or Create Pr...143780362022-03-13 11:27:23904 days ago1647170843IN
Maker: MCD Cropper
0 ETH0.0022994815.29879552
Deny143399862022-03-07 13:32:53910 days ago1646659973IN
Maker: MCD Cropper
0 ETH0.0005117921.9983794
Rely143399842022-03-07 13:32:33910 days ago1646659953IN
Maker: MCD Cropper
0 ETH0.0010586722.41487195
Set Implementati...143399832022-03-07 13:32:22910 days ago1646659942IN
Maker: MCD Cropper
0 ETH0.0009471420.0360934
0x60806040143399752022-03-07 13:31:21910 days ago1646659881IN
 Create: Cropper
0 ETH0.0105742124.55583991

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
179583552023-08-20 20:30:59379 days ago1692563459
Maker: MCD Cropper
 Contract Creation0 ETH
167336322023-03-01 12:00:11551 days ago1677672011
Maker: MCD Cropper
 Contract Creation0 ETH
165722672023-02-06 20:54:59574 days ago1675716899
Maker: MCD Cropper
 Contract Creation0 ETH
165178452023-01-30 6:27:35582 days ago1675060055
Maker: MCD Cropper
 Contract Creation0 ETH
165171212023-01-30 4:02:11582 days ago1675051331
Maker: MCD Cropper
 Contract Creation0 ETH
162826192022-12-28 10:21:35615 days ago1672222895
Maker: MCD Cropper
 Contract Creation0 ETH
160445462022-11-25 4:14:35648 days ago1669349675
Maker: MCD Cropper
 Contract Creation0 ETH
160055112022-11-19 17:19:59653 days ago1668878399
Maker: MCD Cropper
 Contract Creation0 ETH
159775042022-11-15 19:25:23657 days ago1668540323
Maker: MCD Cropper
 Contract Creation0 ETH
156606352022-10-02 13:03:23701 days ago1664715803
Maker: MCD Cropper
 Contract Creation0 ETH
156455982022-09-30 10:37:11704 days ago1664534231
Maker: MCD Cropper
 Contract Creation0 ETH
155382272022-09-15 9:31:47719 days ago1663234307
Maker: MCD Cropper
 Contract Creation0 ETH
154675292022-09-03 20:43:04730 days ago1662237784
Maker: MCD Cropper
 Contract Creation0 ETH
153234892022-08-11 23:06:14753 days ago1660259174
Maker: MCD Cropper
 Contract Creation0 ETH
153006252022-08-08 9:00:32757 days ago1659949232
Maker: MCD Cropper
 Contract Creation0 ETH
151799472022-07-20 14:03:01775 days ago1658325781
Maker: MCD Cropper
 Contract Creation0 ETH
151451042022-07-15 4:24:10781 days ago1657859050
Maker: MCD Cropper
 Contract Creation0 ETH
151406392022-07-14 12:04:27781 days ago1657800267
Maker: MCD Cropper
 Contract Creation0 ETH
148620212022-05-28 19:08:04828 days ago1653764884
Maker: MCD Cropper
 Contract Creation0 ETH
148381722022-05-24 21:57:55832 days ago1653429475
Maker: MCD Cropper
 Contract Creation0 ETH
147484952022-05-10 12:13:53846 days ago1652184833
Maker: MCD Cropper
 Contract Creation0 ETH
147001812022-05-02 19:37:40854 days ago1651520260
Maker: MCD Cropper
 Contract Creation0 ETH
145684612022-04-12 3:59:31875 days ago1649735971
Maker: MCD Cropper
 Contract Creation0 ETH
145656322022-04-11 17:09:26875 days ago1649696966
Maker: MCD Cropper
 Contract Creation0 ETH
145126902022-04-03 10:42:12883 days ago1648982532
Maker: MCD Cropper
 Contract Creation0 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Cropper

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2022-03-07
*/

// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2021 Dai Foundation
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

pragma solidity 0.6.12;

interface VatLike {
    function live() external view returns (uint256);
    function wards(address) external view returns (uint256);
    function urns(bytes32, address) external view returns (uint256, uint256);
    function dai(address) external view returns (uint256);
    function fork(bytes32, address, address, int256, int256) external;
    function frob(bytes32, address, address, address, int256, int256) external;
    function flux(bytes32, address, address, uint256) external;
    function move(address, address, uint256) external;
    function hope(address) external;
    function nope(address) external;
}

interface CropLike {
    function gem() external view returns (GemLike);
    function ilk() external view returns (bytes32);
    function join(address, address, uint256) external;
    function exit(address, address, uint256) external;
    function tack(address, address, uint256) external;
    function flee(address, address, uint256) external;
}

interface GemLike {
    function approve(address, uint256) external;
    function transferFrom(address, address, uint256) external;
}

contract UrnProxy {
    address immutable public usr;

    constructor(address vat_, address usr_) public {
        usr = usr_;
        VatLike(vat_).hope(msg.sender);
    }
}

contract Cropper {
    address public implementation;
    mapping (address => uint256) public wards;

    event Rely(address indexed usr);
    event Deny(address indexed usr);
    event SetImplementation(address indexed);

    modifier auth {
        require(wards[msg.sender] == 1, "Cropper/not-authed");
        _;
    }

    constructor() public {
        wards[msg.sender] = 1;
        emit Rely(msg.sender);
    }

    function rely(address usr) external auth {
        wards[usr] = 1;
        emit Rely(usr);
    }

    function deny(address usr) external auth {
        wards[usr] = 0;
        emit Deny(usr);
    }

    function setImplementation(address implementation_) external auth {
        implementation = implementation_;
        emit SetImplementation(implementation_);
    }

    fallback() external {
        address _impl = implementation;
        require(_impl != address(0));

        assembly {
            let ptr := mload(0x40)
            calldatacopy(ptr, 0, calldatasize())
            let result := delegatecall(gas(), _impl, ptr, calldatasize(), 0, 0)
            let size := returndatasize()
            returndatacopy(ptr, 0, size)

            switch result
            case 0 { revert(ptr, size) }
            default { return(ptr, size) }
        }
    }
}

contract CropperImp {
    bytes32 slot0;
    bytes32 slot1;
    mapping (address => address) public proxy; // UrnProxy per user
    mapping (address => mapping (address => uint256)) public can;

    event Hope(address indexed from, address indexed to);
    event Nope(address indexed from, address indexed to);
    event NewProxy(address indexed usr, address indexed urp);

    address public immutable vat;
    constructor(address vat_) public {
        vat = vat_;
    }

    modifier allowed(address usr) {
        require(msg.sender == usr || can[usr][msg.sender] == 1, "Cropper/not-allowed");
        _;
    }

    function hope(address usr) external {
        can[msg.sender][usr] = 1;
        emit Hope(msg.sender, usr);
    }

    function nope(address usr) external {
        can[msg.sender][usr] = 0;
        emit Nope(msg.sender, usr);
    }

    function getOrCreateProxy(address usr) public returns (address urp) {
        urp = proxy[usr];
        if (urp == address(0)) {
            urp = proxy[usr] = address(new UrnProxy(address(vat), usr));
            emit NewProxy(usr, urp);
        }
    }

    function join(address crop, address usr, uint256 val) external {
        require(VatLike(vat).wards(crop) == 1, "Cropper/crop-not-authorized");

        GemLike gem = CropLike(crop).gem();
        gem.transferFrom(msg.sender, address(this), val);
        gem.approve(crop, val);
        CropLike(crop).join(getOrCreateProxy(usr), usr, val);
    }

    function exit(address crop, address usr, uint256 val) external {
        require(VatLike(vat).wards(crop) == 1, "Cropper/crop-not-authorized");

        address urp = proxy[msg.sender];
        require(urp != address(0), "Cropper/non-existing-urp");
        CropLike(crop).exit(urp, usr, val);
    }

    function flee(address crop, address usr, uint256 val) external {
        require(VatLike(vat).wards(crop) == 1, "Cropper/crop-not-authorized");

        address urp = proxy[msg.sender];
        require(urp != address(0), "Cropper/non-existing-urp");
        CropLike(crop).flee(urp, usr, val);
    }

    function move(address u, address dst, uint256 rad) external allowed(u) {
        address urp = proxy[u];
        require(urp != address(0), "Cropper/non-existing-urp");

        VatLike(vat).move(urp, dst, rad);
    }

    function frob(bytes32 ilk, address u, address v, address w, int256 dink, int256 dart) external allowed(u) allowed(w) {
        // The u == v requirement can never be relaxed as otherwise tack() can lose track of the rewards
        require(u == v, "Cropper/not-matching");
        address urp = getOrCreateProxy(u);

        VatLike(vat).frob(ilk, urp, urp, w, dink, dart);
    }

    function flux(address crop, address src, address dst, uint256 wad) external allowed(src) {
        require(VatLike(vat).wards(crop) == 1, "Cropper/crop-not-authorized");

        address surp = proxy[src];
        require(surp != address(0), "Cropper/non-existing-surp");
        address durp = getOrCreateProxy(dst);

        VatLike(vat).flux(CropLike(crop).ilk(), surp, durp, wad);
        CropLike(crop).tack(surp, durp, wad);
    }

    function onLiquidation(address crop, address usr, uint256 wad) external {
        // NOTE - this is not permissioned so be careful with what is done here
        // Send any outstanding rewards to usr and tack to the clipper
        address urp = proxy[usr];
        require(urp != address(0), "Cropper/non-existing-urp");
        CropLike(crop).join(urp, usr, 0);
        CropLike(crop).tack(urp, msg.sender, wad);
    }

    function onVatFlux(address crop, address from, address to, uint256 wad) external {
        // NOTE - this is not permissioned so be careful with what is done here
        CropLike(crop).tack(from, to, wad);
    }

    function quit(bytes32 ilk, address u, address dst) external allowed(u) allowed(dst) {
        require(VatLike(vat).live() == 0, "Cropper/vat-still-live");

        address urp = proxy[u];
        require(urp != address(0), "Cropper/non-existing-urp");

        (uint256 ink, uint256 art) = VatLike(vat).urns(ilk, urp);
        require(int256(ink) >= 0, "Cropper/overflow");
        require(int256(art) >= 0, "Cropper/overflow");
        VatLike(vat).fork(
            ilk,
            urp,
            dst,
            int256(ink),
            int256(art)
        );
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Deny","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"usr","type":"address"}],"name":"Rely","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"","type":"address"}],"name":"SetImplementation","type":"event"},{"stateMutability":"nonpayable","type":"fallback"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"deny","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"implementation","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"usr","type":"address"}],"name":"rely","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"implementation_","type":"address"}],"name":"setImplementation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"wards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5060018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a2610664806100a76000396000f3fe608060405234801561001057600080fd5b506004361061005b5760003560e01c80635c60da1b146100e357806365fae35e146101175780639c52a7f11461015b578063bf353dbb1461019f578063d784d426146101f75761005c565b5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100bc57600080fd5b60405136600082376000803683855af43d806000843e81600081146100df578184f35b8184fd5b6100eb61023b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101596004803603602081101561012d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061025f565b005b61019d6004803603602081101561017157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061039d565b005b6101e1600480360360208110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104dc565b6040518082815260200191505060405180910390f35b6102396004803603602081101561020d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f4565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610313576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43726f707065722f6e6f742d617574686564000000000000000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610451576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43726f707065722f6e6f742d617574686564000000000000000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b60016020528060005260406000206000915090505481565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146105a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43726f707065722f6e6f742d617574686564000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fddebe6de740fe0dd01cc33ffa314d11c6ac6acbbe50b80513c4c360ae7aa4f0460405160405180910390a25056fea2646970667358221220c317511c354d655cd87aec6fa1210926e3a74e8f12855193a83fda333d6f665a64736f6c634300060c0033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061005b5760003560e01c80635c60da1b146100e357806365fae35e146101175780639c52a7f11461015b578063bf353dbb1461019f578063d784d426146101f75761005c565b5b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156100bc57600080fd5b60405136600082376000803683855af43d806000843e81600081146100df578184f35b8184fd5b6100eb61023b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101596004803603602081101561012d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061025f565b005b61019d6004803603602081101561017157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061039d565b005b6101e1600480360360208110156101b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104dc565b6040518082815260200191505060405180910390f35b6102396004803603602081101561020d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104f4565b005b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610313576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43726f707065722f6e6f742d617574686564000000000000000000000000000081525060200191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a6060405160405180910390a250565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610451576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43726f707065722f6e6f742d617574686564000000000000000000000000000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508073ffffffffffffffffffffffffffffffffffffffff167f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b60405160405180910390a250565b60016020528060005260406000206000915090505481565b60018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146105a8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43726f707065722f6e6f742d617574686564000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167fddebe6de740fe0dd01cc33ffa314d11c6ac6acbbe50b80513c4c360ae7aa4f0460405160405180910390a25056fea2646970667358221220c317511c354d655cd87aec6fa1210926e3a74e8f12855193a83fda333d6f665a64736f6c634300060c0033

Deployed Bytecode Sourcemap

2112:1340:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2974:13;2990:14;;;;;;;;;;;2974:30;;3040:1;3023:19;;:5;:19;;;;3015:28;;;;;;3097:4;3091:11;3137:14;3134:1;3129:3;3116:36;3231:1;3228;3212:14;3207:3;3200:5;3193;3180:53;3259:16;3312:4;3309:1;3304:3;3289:28;3340:6;3365:1;3360:28;;;;3424:4;3419:3;3412:17;3360:28;3381:4;3376:3;3369:17;2136:29;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;2554:99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;2661;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;2172:41;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;2768:167;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;2136:29;;;;;;;;;;;;:::o;2554:99::-;2401:1;2380:5;:17;2386:10;2380:17;;;;;;;;;;;;;;;;:22;2372:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2619:1:::1;2606:5:::0;:10:::1;2612:3;2606:10;;;;;;;;;;;;;;;:14;;;;2641:3;2636:9;;;;;;;;;;;;2554:99:::0;:::o;2661:::-;2401:1;2380:5;:17;2386:10;2380:17;;;;;;;;;;;;;;;;:22;2372:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2726:1:::1;2713:5;:10;2719:3;2713:10;;;;;;;;;;;;;;;:14;;;;2748:3;2743:9;;;;;;;;;;;;2661:99:::0;:::o;2172:41::-;;;;;;;;;;;;;;;;;:::o;2768:167::-;2401:1;2380:5;:17;2386:10;2380:17;;;;;;;;;;;;;;;;:22;2372:53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2862:15:::1;2845:14;::::0;:32:::1;;;;;;;;;;;;;;;;;;2911:15;2893:34;;;;;;;;;;;;2768:167:::0;:::o

Swarm Source

ipfs://c317511c354d655cd87aec6fa1210926e3a74e8f12855193a83fda333d6f665a

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  ]
[ 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.