Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x2D3cD7b81c93f188F3CB8aD87c8Acc73d6226e3A
Balance 0 ETH
Nonce 1
Code Size 2154 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

2154 bytes
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806367aea3131161007157806367aea3131461014a578063894ba8331461016e57806394f3f81d14610176578063d8dfeb451461019c578063e824600f146101a4578063ef693bed146101ac576100a9565b806324ba5884146100ae578063313ce567146100e657806335b28153146100ee5780633b4da69f1461011657806341b3a0d914610142575b600080fd5b6100d4600480360360208110156100c457600080fd5b50356001600160a01b03166101d8565b60408051918252519081900360200190f35b6100d46101ea565b6101146004803603602081101561010457600080fd5b50356001600160a01b03166101f0565b005b6101146004803603604081101561012c57600080fd5b506001600160a01b038135169060200135610290565b6100d46104bc565b6101526104c2565b604080516001600160a01b039092168252519081900360200190f35b6101146104d1565b6101146004803603602081101561018c57600080fd5b50356001600160a01b031661054f565b6101526105ee565b6100d46105fd565b610114600480360360408110156101c257600080fd5b506001600160a01b038135169060200135610603565b60006020819052908152604090205481565b60045481565b3360009081526020819052604090205460011461023e5760405162461bcd60e51b81526004018080602001828103825260268152602001806107ec6026913960400191505060405180910390fd5b6001600160a01b0381166000818152602081815260409182902060019055815192835290517f599a298163e1678bb1c676052a8930bf0b8a1261ed6e01b8a2391e55f70001029281900390910190a150565b6005546001146102d15760405162461bcd60e51b81526004018080602001828103825260238152602001806108126023913960400191505060405180910390fd5b6000811215610322576040805162461bcd60e51b8152602060048201526018602482015277436f6c6c61746572616c4a6f696e312f6f766572666c6f7760401b604482015290519081900360640190fd5b60015460025460408051632508c12f60e11b815260048101929092526001600160a01b038581166024840152604483018590529051921691634a11825e9160648082019260009290919082900301818387803b15801561038157600080fd5b505af1158015610395573d6000803e3d6000fd5b5050600354604080516323b872dd60e01b81523360048201523060248201526044810186905290516001600160a01b0390921693506323b872dd92506064808201926020929091908290030181600087803b1580156103f357600080fd5b505af1158015610407573d6000803e3d6000fd5b505050506040513d602081101561041d57600080fd5b5051610470576040805162461bcd60e51b815260206004820152601f60248201527f436f6c6c61746572616c4a6f696e312f6661696c65642d7472616e7366657200604482015290519081900360640190fd5b604080513381526001600160a01b038416602082015280820183905290517f0e64978d073561c3dfd4d4e3e4dce066cde2ab246a44f990fabb0a21a4a3bd959181900360600190a15050565b60055481565b6001546001600160a01b031681565b3360009081526020819052604090205460011461051f5760405162461bcd60e51b81526004018080602001828103825260268152602001806107ec6026913960400191505060405180910390fd5b600060058190556040517f2d4b4ecff7bd7503135271925520a2f6c0d98c9473ffc1a1e72c92502f51b25e9190a1565b3360009081526020819052604090205460011461059d5760405162461bcd60e51b81526004018080602001828103825260268152602001806107ec6026913960400191505060405180910390fd5b6001600160a01b03811660008181526020818152604080832092909255815192835290517f8834a87e641e9716be4f34527af5d23e11624f1ddeefede6ad75a9acfc31b9039281900390910190a150565b6003546001600160a01b031681565b60025481565b600160ff1b811115610657576040805162461bcd60e51b8152602060048201526018602482015277436f6c6c61746572616c4a6f696e312f6f766572666c6f7760401b604482015290519081900360640190fd5b60015460025460408051632508c12f60e11b815260048101929092523360248301526000848103604484015290516001600160a01b0390931692634a11825e92606480820193929182900301818387803b1580156106b457600080fd5b505af11580156106c8573d6000803e3d6000fd5b50506003546040805163a9059cbb60e01b81526001600160a01b03878116600483015260248201879052915191909216935063a9059cbb925060448083019260209291908290030181600087803b15801561072257600080fd5b505af1158015610736573d6000803e3d6000fd5b505050506040513d602081101561074c57600080fd5b505161079f576040805162461bcd60e51b815260206004820152601f60248201527f436f6c6c61746572616c4a6f696e312f6661696c65642d7472616e7366657200604482015290519081900360640190fd5b604080513381526001600160a01b038416602082015280820183905290517fbc2a67d422c268da6fe45f3e7d194e1d98906d221f1cfad62a5c80f2cd209f4c9181900360600190a1505056fe436f6c6c61746572616c4a6f696e312f6163636f756e742d6e6f742d617574686f72697a6564436f6c6c61746572616c4a6f696e312f6e6f742d636f6e7472616374456e61626c6564a26469706673582212206e7b805da2badefc70b8b3e3260ec0e7fc48f46a9edb1f97c12206ef8f580a5564736f6c63430006070033

Verified Source Code Partial Match

Compiler: v0.6.7+commit.b8d736ae EVM: istanbul Optimization: Yes (200 runs)
CollateralJoin1.sol 109 lines
/// AdvancedTokenAdapters.sol

// Copyright (C) 2018 Rain <[email protected]>
//
// 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.7;

abstract contract SAFEEngineLike {
    function modifyCollateralBalance(bytes32,address,int) virtual public;
}

// CollateralJoin1
abstract contract CollateralLike {
    function decimals() virtual public view returns (uint);
    function transfer(address,uint) virtual public returns (bool);
    function transferFrom(address,address,uint) virtual public returns (bool);
}

contract CollateralJoin1 {
    // --- Auth ---
    mapping (address => uint) public authorizedAccounts;
    /**
     * @notice Add auth to an account
     * @param account Account to add auth to
     */
    function addAuthorization(address account) external isAuthorized {
        authorizedAccounts[account] = 1;
        emit AddAuthorization(account);
    }
    /**
     * @notice Remove auth from an account
     * @param account Account to remove auth from
     */
    function removeAuthorization(address account) external isAuthorized {
        authorizedAccounts[account] = 0;
        emit RemoveAuthorization(account);
    }
    /**
    * @notice Checks whether msg.sender can call an authed function
    **/
    modifier isAuthorized {
        require(authorizedAccounts[msg.sender] == 1, "CollateralJoin1/account-not-authorized");
        _;
    }

    SAFEEngineLike public safeEngine;
    bytes32        public collateralType;
    CollateralLike public collateral;
    uint           public decimals;
    uint           public contractEnabled;  // Access Flag

    // --- Events ---
    event AddAuthorization(address account);
    event RemoveAuthorization(address account);
    event DisableContract();
    event Join(address sender, address usr, uint wad);
    event Exit(address sender, address usr, uint wad);

    constructor(address safeEngine_, bytes32 collateralType_, address collateral_) public {
        authorizedAccounts[msg.sender] = 1;
        contractEnabled = 1;
        safeEngine = SAFEEngineLike(safeEngine_);
        collateralType = collateralType_;
        collateral = CollateralLike(collateral_);
        decimals = collateral.decimals();
        require(decimals == 18, "CollateralJoin1/not-18-decimals");
        emit AddAuthorization(msg.sender);
    }

    // --- Math ---
    function addition(uint x, int y) internal pure returns (uint z) {
        z = x + uint(y);
        require(y >= 0 || z <= x);
        require(y <= 0 || z >= x);
    }

    // --- Administration ---
    function disableContract() external isAuthorized {
        contractEnabled = 0;
        emit DisableContract();
    }

    // --- Collateral Gateway ---
    function join(address usr, uint wad) external {
        require(contractEnabled == 1, "CollateralJoin1/not-contractEnabled");
        require(int(wad) >= 0, "CollateralJoin1/overflow");
        safeEngine.modifyCollateralBalance(collateralType, usr, int(wad));
        require(collateral.transferFrom(msg.sender, address(this), wad), "CollateralJoin1/failed-transfer");
        emit Join(msg.sender, usr, wad);
    }
    function exit(address usr, uint wad) external {
        require(wad <= 2 ** 255, "CollateralJoin1/overflow");
        safeEngine.modifyCollateralBalance(collateralType, msg.sender, -int(wad));
        require(collateral.transfer(usr, wad), "CollateralJoin1/failed-transfer");
        emit Exit(msg.sender, usr, wad);
    }
}

Read Contract

authorizedAccounts 0x24ba5884 → uint256
collateral 0xd8dfeb45 → address
collateralType 0xe824600f → bytes32
contractEnabled 0x41b3a0d9 → uint256
decimals 0x313ce567 → uint256
safeEngine 0x67aea313 → address

Write Contract 5 functions

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

addAuthorization 0x35b28153
address account
disableContract 0x894ba833
No parameters
exit 0xef693bed
address usr
uint256 wad
join 0x3b4da69f
address usr
uint256 wad
removeAuthorization 0x94f3f81d
address account

Recent Transactions

No transactions found for this address