Skip to content
Verified contractExactAGPL-3.0-or-later

AuthGemJoin

Address0xae20c8f0e9dc566bdf5e5628fc2ea0e66fd60437
Balance

0 ETH

 

Transactions

3

 

Compiler

solc 0.6.12

 

Same code

1 more contract

 

Details

Compiler
solc 0.6.12+commit.27d51765
Language
solidity
Optimization
Yes, 200 runs
EVM version
istanbul
License
AGPL-3.0-or-later
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
15,103,762
Creation transaction
0xc76a96ec31…d9bf9df9fe

lib/dss-gem-joins/src/join-auth.sol

// SPDX-License-Identifier: AGPL-3.0-or-later

/// join-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.5.12;

interface VatLike {
    function slip(bytes32, address, int256) external;
}

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

// For a token that needs restriction on the sources which are able to execute the join function (like SAI through Migration contract)

contract AuthGemJoin {
    VatLike public vat;
    bytes32 public ilk;
    GemLike public gem;
    uint256 public dec;
    uint256 public live;  // Access Flag

    // --- Auth ---
    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, "AuthGemJoin/non-authed"); _; }

    // Events
    event Rely(address indexed usr);
    event Deny(address indexed usr);
    event Join(address indexed usr, uint256 wad);
    event Exit(address indexed usr, uint256 wad);
    event Cage();

    constructor(address vat_, bytes32 ilk_, address gem_) public {
        wards[msg.sender] = 1;
        live = 1;
        vat = VatLike(vat_);
        ilk = ilk_;
        gem = GemLike(gem_);
        dec = gem.decimals();
        emit Rely(msg.sender);
    }

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

    function join(address usr, uint256 wad) external auth {
        require(live == 1, "AuthGemJoin/not-live");
        require(int256(wad) >= 0, "AuthGemJoin/overflow");
        vat.slip(ilk, usr, int256(wad));
        require(gem.transferFrom(msg.sender, address(this), wad), "AuthGemJoin/failed-transfer");
        emit Join(usr, wad);
    }

    function exit(address usr, uint256 wad) external {
        require(wad <= 2 ** 255, "AuthGemJoin/overflow");
        vat.slip(ilk, msg.sender, -int256(wad));
        require(gem.transfer(usr, wad), "AuthGemJoin/failed-transfer");
        emit Exit(usr, wad);
    }
}
Compiler settingsShow
{
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "istanbul",
  "remappings": [
    "clipper-mom/=lib/dss-exec-lib/lib/clipper-mom/src/",
    "ds-auth/=lib/ds-token/lib/ds-auth/src/",
    "ds-math/=lib/ds-math/src/",
    "ds-note/=lib/ds-value/lib/ds-thing/lib/ds-note/src/",
    "ds-pause/=lib/dss-gem-joins/lib/dss-deploy/lib/ds-pause/src/",
    "ds-proxy/=lib/dss-exec-lib/lib/ds-proxy/src/",
    "ds-stop/=lib/dss-exec-lib/lib/osm-mom/lib/osm/lib/ds-stop/src/",
    "ds-test/=lib/ds-test/src/",
    "ds-thing/=lib/ds-value/lib/ds-thing/src/",
    "ds-token/=lib/ds-token/src/",
    "ds-value/=lib/ds-value/src/",
    "dss-auto-line/=lib/dss-exec-lib/lib/dss-auto-line/src/",
    "dss-chain-log/=lib/mip21-toolkit/lib/dss-chain-log/src/",
    "dss-deploy/=lib/dss-gem-joins/lib/dss-deploy/src/",
    "dss-direct-deposit/=lib/dss-exec-lib/lib/dss-direct-deposit/src/",
    "dss-exec-lib/=lib/dss-exec-lib/src/",
    "dss-gem-joins/=lib/dss-gem-joins/src/",
    "dss-interfaces/=lib/dss-interfaces/src/",
    "dss-lerp/=lib/dss-exec-lib/lib/dss-lerp/src/",
    "dss/=lib/dss/src/",
    "esm/=lib/dss-gem-joins/lib/dss-deploy/lib/esm/src/",
    "flipper-mom/=lib/dss-exec-lib/lib/flipper-mom/src/",
    "forward-proxy/=lib/forward-proxy/src/",
    "ilk-registry/=lib/dss-exec-lib/lib/ilk-registry/src/",
    "median/=lib/dss-exec-lib/lib/median/src/",
    "mip21-toolkit/=lib/mip21-toolkit/src/",
    "mkr-authority/=lib/dss-exec-lib/lib/mkr-authority/src/",
    "osm-mom/=lib/dss-exec-lib/lib/osm-mom/src/",
    "osm/=lib/dss-exec-lib/lib/osm-mom/lib/osm/src/",
    "univ2-lp-oracle/=lib/dss-exec-lib/lib/univ2-lp-oracle/src/",
    "src/=src/",
    "src/=src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.