Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 7 from a total of 7 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Exit | 17958426 | 379 days ago | IN | 0 ETH | 0.00273579 | ||||
Get Or Create Pr... | 17958355 | 379 days ago | IN | 0 ETH | 0.00234581 | ||||
Get Or Create Pr... | 14378036 | 904 days ago | IN | 0 ETH | 0.00229948 | ||||
Deny | 14339986 | 910 days ago | IN | 0 ETH | 0.00051179 | ||||
Rely | 14339984 | 910 days ago | IN | 0 ETH | 0.00105867 | ||||
Set Implementati... | 14339983 | 910 days ago | IN | 0 ETH | 0.00094714 | ||||
0x60806040 | 14339975 | 910 days ago | IN | 0 ETH | 0.01057421 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
Contract Name:
Cropper
Compiler Version
v0.6.12+commit.27d51765
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
- No Contract Security Audit Submitted- Submit Audit Here
[{"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"}]
Contract Creation Code
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
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.