Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x217e42CEB2eAE9ECB788fDF0e31c806c531760A3
Balance 0 ETH
Nonce 1
Code Size 3369 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3369 bytes
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c80639c52a7f11161008c578063c5ce281e11610066578063c5ce281e146101ca578063d14b1e4b146101d2578063ef693bed14610208578063f79eb32c14610234576100cf565b80639c52a7f114610176578063b3bcfa821461019c578063bf353dbb146101a4576100cf565b80633033a4e5146100d457806336569e771461010257806365fae35e14610126578063692450091461014c5780637bd2bea714610154578063957aa58c1461015c575b600080fd5b610100600480360360408110156100ea57600080fd5b506001600160a01b03813516906020013561025a565b005b61010a6102ca565b604080516001600160a01b039092168252519081900360200190f35b6101006004803603602081101561013c57600080fd5b50356001600160a01b03166102ee565b61010061034f565b61010a61039b565b6101646103bf565b60408051918252519081900360200190f35b6101006004803603602081101561018c57600080fd5b50356001600160a01b03166103c5565b610164610425565b610164600480360360208110156101ba57600080fd5b50356001600160a01b0316610449565b61016461045b565b610164600480360360608110156101e857600080fd5b506001600160a01b0381358116916020810135916040909101351661047f565b6101006004803603604081101561021e57600080fd5b506001600160a01b038135169060200135610922565b6101646004803603602081101561024a57600080fd5b50356001600160a01b0316610c03565b3360009081526020819052604090205460011461027657600080fd5b6001600160a01b038216600081815260026020908152604091829020849055815184815291517f9e7efe2a0901c0fbf67f5eda11c52da7621f37e3707997d0e89ef28090e682b99281900390910190a25050565b7f000000000000000000000000ff77f6209239deb2c076179499f2346b0032097f81565b3360009081526020819052604090205460011461030a57600080fd5b6001600160a01b03811660008181526020819052604080822060019055517fdd0e34038ac38b2a1ce960229778ac48a8719bc900b6c4f8d0475c6e8b385a609190a250565b3360009081526020819052604090205460011461036b57600080fd5b600060018190556040517f2308ed18a14e800c39b86eb6ea43270105955ca385b603b64eca89f98ae8fbda9190a1565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec781565b60015481565b336000908152602081905260409020546001146103e157600080fd5b6001600160a01b038116600081815260208190526040808220829055517f184450df2e323acec0ed3b5c7531b81f9b4cdef7914dfd4c0a4317416bb5251b9190a250565b7f000000000000000000000000000000000000000000000000000000000000000681565b60006020819052908152604090205481565b7f50534d2d555344542d410000000000000000000000000000000000000000000081565b3360009081526020819052604081205460011461049b57600080fd5b6001546001146104ea576040805162461bcd60e51b81526020600482015260156024820152744175746847656d4a6f696e372f6e6f742d6c69766560581b604482015290519081900360640190fd5b600260007f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b03166326976e3f6040518163ffffffff1660e01b815260040160206040518083038186803b15801561054757600080fd5b505afa15801561055b573d6000803e3d6000fd5b505050506040513d602081101561057157600080fd5b50516001600160a01b031681526020810191909152604001600020546001146105cb5760405162461bcd60e51b8152600401808060200182810382526023815260200180610cd16023913960400191505060405180910390fd5b60007f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561063a57600080fd5b505afa15801561064e573d6000803e3d6000fd5b505050506040513d602081101561066457600080fd5b5051604080516323b872dd60e01b81526001600160a01b0386811660048301523060248301526044820188905291519293507f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7909116916323b872dd9160648082019260009290919082900301818387803b1580156106e257600080fd5b505af11580156106f6573d6000803e3d6000fd5b50505050600061079e7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561076c57600080fd5b505afa158015610780573d6000803e3d6000fd5b505050506040513d602081101561079657600080fd5b505183610c15565b90506107d0817f0000000000000000000000000000000000000000000000000000000000000006601203600a0a610c6c565b92506000831215610820576040805162461bcd60e51b81526020600482015260156024820152744175746847656d4a6f696e372f6f766572666c6f7760581b604482015290519081900360640190fd5b7f000000000000000000000000ff77f6209239deb2c076179499f2346b0032097f6001600160a01b0316637cdd3fde7f50534d2d555344542d410000000000000000000000000000000000000000000088866040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b1580156108bf57600080fd5b505af11580156108d3573d6000803e3d6000fd5b50506040805184815290516001600160a01b0380891694508a1692507f16c03c2fe01ac285473b0d10ba5c5de59ede582fcac27a866b5827415fe44b039181900360200190a350509392505050565b6000610954827f0000000000000000000000000000000000000000000000000000000000000006601203600a0a610c6c565b905060008112156109a4576040805162461bcd60e51b81526020600482015260156024820152744175746847656d4a6f696e372f6f766572666c6f7760581b604482015290519081900360640190fd5b600260007f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b03166326976e3f6040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0157600080fd5b505afa158015610a15573d6000803e3d6000fd5b505050506040513d6020811015610a2b57600080fd5b50516001600160a01b03168152602081019190915260400160002054600114610a855760405162461bcd60e51b8152600401808060200182810382526023815260200180610cd16023913960400191505060405180910390fd5b60408051633e6e9fef60e11b81527f50534d2d555344542d410000000000000000000000000000000000000000000060048201523360248201526000838103604483015291516001600160a01b037f000000000000000000000000ff77f6209239deb2c076179499f2346b0032097f1692637cdd3fde926064808201939182900301818387803b158015610b1857600080fd5b505af1158015610b2c573d6000803e3d6000fd5b505050507f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b031663a9059cbb84846040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b158015610ba757600080fd5b505af1158015610bbb573d6000803e3d6000fd5b50506040805185815290516001600160a01b03871693507f22d324652c93739755cf4581508b60875ebdd78c20c0cff5cf8e23452b29963192509081900360200190a2505050565b60026020526000908152604090205481565b80820382811115610c66576040805162461bcd60e51b81526020600482015260166024820152754175746847656d4a6f696e372f756e646572666c6f7760501b604482015290519081900360640190fd5b92915050565b6000811580610c8757505080820282828281610c8457fe5b04145b610c66576040805162461bcd60e51b81526020600482015260156024820152744175746847656d4a6f696e372f6f766572666c6f7760581b604482015290519081900360640190fdfe4175746847656d4a6f696e372f696d706c656d656e746174696f6e2d696e76616c6964a2646970667358221220856af103547bdbce710471844b09e1a9bbbfe4e50d7286ad886cb1a0a29cfd4d64736f6c634300060c0033

Verified Source Code Full Match

Compiler: v0.6.12+commit.27d51765 EVM: istanbul Optimization: Yes (200 runs)
join-7-auth.sol 118 lines
// SPDX-License-Identifier: AGPL-3.0-or-later

/// join-7-auth.sol -- Non-standard token adapters

// Copyright (C) 2018 Rain <[email protected]>
// Copyright (C) 2018-2020 Maker Ecosystem Growth Holdings, INC.
//
// 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 slip(bytes32, address, int256) external;
}

interface GemLike {
    function decimals() external view returns (uint256);
    function transfer(address, uint256) external;
    function transferFrom(address, address, uint256) external;
    function balanceOf(address) external view returns (uint256);
    function upgradedAddress() external view returns (address);
}

// AuthGemJoin7
// For an upgradable token (like USDT) which doesn't return bool on transfers and may charge fees
//  If the token is deprecated changing the implementation behind, this prevents joins
//   and exits until the implementation is reviewed and approved by governance.

contract AuthGemJoin7 {
    mapping (address => uint256) public wards;
    function rely(address usr) external auth {
        wards[usr] = 1;
        emit Rely(usr);
    }
    function deny(address usr) external auth {
        wards[usr] = 0;
        emit Deny(usr);
    }
    modifier auth { require(wards[msg.sender] == 1); _; }

    VatLike public immutable vat;
    bytes32 public immutable ilk;
    GemLike public immutable gem;
    uint256 public immutable dec;
    uint256 public live; // Access flag

    // Events
    event Rely(address indexed usr);
    event Deny(address indexed usr);
    event Join(address indexed usr, uint256 amt, address indexed msgSender);
    event Exit(address indexed usr, uint256 amt);
    event Cage();
    event SetImplementation(address indexed implementation, uint256 permitted);

    mapping (address => uint256) public implementations;

    constructor(address vat_, bytes32 ilk_, address gem_) public {
        gem = GemLike(gem_);
        uint256 dec_ = dec = GemLike(gem_).decimals();
        require(dec_ < 18, "AuthGemJoin7/decimals-18-or-higher");
        wards[msg.sender] = 1;
        live = 1;
        vat = VatLike(vat_);
        ilk = ilk_;
        setImplementation(address(GemLike(gem_).upgradedAddress()), 1);
        emit Rely(msg.sender);
    }

    function cage() external auth {
        live = 0;
        emit Cage();
    }

    function setImplementation(address implementation, uint256 permitted) public auth {
        implementations[implementation] = permitted; // 1 live, 0 disable
        emit SetImplementation(implementation, permitted);
    }

    function mul(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require(y == 0 || (z = x * y) / y == x, "AuthGemJoin7/overflow");
    }

    function sub(uint256 x, uint256 y) internal pure returns (uint256 z) {
        require((z = x - y) <= x, "AuthGemJoin7/underflow");
    }

    function join(address usr, uint256 amt, address msgSender) external auth returns (uint256 wad) {
        require(live == 1, "AuthGemJoin7/not-live");
        require(implementations[gem.upgradedAddress()] == 1, "AuthGemJoin7/implementation-invalid");
        uint256 bal = gem.balanceOf(address(this));
        gem.transferFrom(msgSender, address(this), amt);
        uint256 actualAmt = sub(gem.balanceOf(address(this)), bal);
        wad = mul(actualAmt, 10 ** (18 - dec));
        require(int256(wad) >= 0, "AuthGemJoin7/overflow");
        vat.slip(ilk, usr, int256(wad));
        emit Join(usr, actualAmt, msgSender);
    }

    function exit(address usr, uint256 amt) external {
        uint256 wad = mul(amt, 10 ** (18 - dec));
        require(int256(wad) >= 0, "AuthGemJoin7/overflow");
        require(implementations[gem.upgradedAddress()] == 1, "AuthGemJoin7/implementation-invalid");
        vat.slip(ilk, msg.sender, -int256(wad));
        gem.transfer(usr, amt);
        emit Exit(usr, amt);
    }
}

Read Contract

dec 0xb3bcfa82 → uint256
gem 0x7bd2bea7 → address
ilk 0xc5ce281e → bytes32
implementations 0xf79eb32c → uint256
live 0x957aa58c → uint256
vat 0x36569e77 → address
wards 0xbf353dbb → uint256

Write Contract 6 functions

These functions modify contract state and require a wallet transaction to execute.

cage 0x69245009
No parameters
deny 0x9c52a7f1
address usr
exit 0xef693bed
address usr
uint256 amt
join 0xd14b1e4b
address usr
uint256 amt
address msgSender
returns: uint256
rely 0x65fae35e
address usr
setImplementation 0x3033a4e5
address implementation
uint256 permitted

Recent Transactions

No transactions found for this address