false
true
0

Contract Address Details

0x9F733b60E50B0D4ec5261bA576beC8617501e35c

Contract Name
Jug
Creator
0xbcaee0–64cea5 at 0xe36768–4b4326
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
21 Transactions
Transfers
0 Transfers
Gas Used
0
Last Balance Update
26066259
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
Contract name:
Jug




Optimization enabled
true
Compiler version
v0.6.12+commit.27d51765




Optimization runs
200
EVM Version
default




Verified at
2025-04-18T14:03:15.699463Z

Constructor Arguments

0x00000000000000000000000016ca93f2f65d5495c874109fff38d11d39850b67

Arg [0] (address) : 0x16ca93f2f65d5495c874109fff38d11d39850b67

              

Contract source code

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

/// jug.sol -- Dai Lending Rate

pragma solidity ^0.6.12;

interface VatLike {
    function ilks(bytes32) external returns (
        uint256 Art,   // [wad]
        uint256 rate   // [ray]
    );
    function fold(bytes32,address,int) external;
}

contract Jug {
    // --- Auth ---
    mapping (address => uint) public wards;
    function rely(address usr) external auth { wards[usr] = 1; }
    function deny(address usr) external auth { wards[usr] = 0; }
    modifier auth {
        require(wards[msg.sender] == 1, "Jug/not-authorized");
        _;
    }

    // --- Data ---
    struct Ilk {
        uint256 duty;  // Collateral-specific, per-second stability fee contribution [ray]
        uint256 rho;   // Time of last drip [unix epoch time]
    }

    mapping (bytes32 => Ilk) public ilks;
    VatLike                  public vat;   // CDP Engine
    address                  public vow;   // Debt Engine
    uint256                  public base;  // Global, per-second stability fee contribution [ray]

    // --- Events ---
    event Init(bytes32 indexed ilk, uint256 duty, uint256 rho);
    event FileIlk(bytes32 indexed ilk, bytes32 indexed what, uint256 data);
    event File(bytes32 indexed what, uint256 data);
    event FileAddress(bytes32 indexed what, address data);
    event Drip(bytes32 indexed ilk, uint256 rate);

    // --- Init ---
    constructor(address vat_) public {
        wards[msg.sender] = 1;
        vat = VatLike(vat_);
    }

    // --- Math ---
    function _rpow(uint x, uint n, uint b) internal pure returns (uint z) {
      assembly {
        switch x case 0 {switch n case 0 {z := b} default {z := 0}}
        default {
          switch mod(n, 2) case 0 { z := b } default { z := x }
          let half := div(b, 2)  // for rounding.
          for { n := div(n, 2) } n { n := div(n,2) } {
            let xx := mul(x, x)
            if iszero(eq(div(xx, x), x)) { revert(0,0) }
            let xxRound := add(xx, half)
            if lt(xxRound, xx) { revert(0,0) }
            x := div(xxRound, b)
            if mod(n,2) {
              let zx := mul(z, x)
              if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0,0) }
              let zxRound := add(zx, half)
              if lt(zxRound, zx) { revert(0,0) }
              z := div(zxRound, b)
            }
          }
        }
      }
    }
    uint256 constant ONE = 10 ** 27;
    function _add(uint x, uint y) internal pure returns (uint z) {
        z = x + y;
        require(z >= x);
    }
    function _diff(uint x, uint y) internal pure returns (int z) {
        z = int(x) - int(y);
        require(int(x) >= 0 && int(y) >= 0);
    }
    function _rmul(uint x, uint y) internal pure returns (uint z) {
        z = x * y;
        require(y == 0 || z / y == x);
        z = z / ONE;
    }

    // --- Administration ---
    function init(bytes32 ilk) external auth {
        Ilk storage i = ilks[ilk];
        require(i.duty == 0, "Jug/ilk-already-init");
        i.duty = ONE;
        i.rho  = now;
        emit Init(ilk, i.duty, i.rho);
    }
    function file(bytes32 ilk, bytes32 what, uint data) external auth {
        require(ilks[ilk].rho > 0, "Jug/ilk-not-initialized");
        if (what == "duty") ilks[ilk].duty = data;
        else revert("Jug/file-unrecognized-param");
        emit FileIlk(ilk, what, data);
    }
    function file(bytes32 what, uint data) external auth {
        if (what == "base") base = data;
        else revert("Jug/file-unrecognized-param");
        emit File(what, data);
    }
    function file(bytes32 what, address data) external auth {
        if (what == "vow") vow = data;
        else revert("Jug/file-unrecognized-param");
        emit FileAddress(what, data);
    }

    // --- Stability Fee Collection ---
    function drip(bytes32 ilk) external returns (uint rate) {
        require(now >= ilks[ilk].rho, "Jug/invalid-now");
        (, uint prev) = vat.ilks(ilk);
        rate = _rmul(_rpow(_add(base, ilks[ilk].duty), now - ilks[ilk].rho, ONE), prev);
        vat.fold(ilk, vow, _diff(rate, prev));
        ilks[ilk].rho = now;
        emit Drip(ilk, rate);
    }
}
        

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"vat_","internalType":"address"}]},{"type":"event","name":"Drip","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32","indexed":true},{"type":"uint256","name":"rate","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"File","inputs":[{"type":"bytes32","name":"what","internalType":"bytes32","indexed":true},{"type":"uint256","name":"data","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"FileAddress","inputs":[{"type":"bytes32","name":"what","internalType":"bytes32","indexed":true},{"type":"address","name":"data","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"FileIlk","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"what","internalType":"bytes32","indexed":true},{"type":"uint256","name":"data","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Init","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32","indexed":true},{"type":"uint256","name":"duty","internalType":"uint256","indexed":false},{"type":"uint256","name":"rho","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"base","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"deny","inputs":[{"type":"address","name":"usr","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint256","name":"rate","internalType":"uint256"}],"name":"drip","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"file","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32"},{"type":"bytes32","name":"what","internalType":"bytes32"},{"type":"uint256","name":"data","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"file","inputs":[{"type":"bytes32","name":"what","internalType":"bytes32"},{"type":"uint256","name":"data","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"file","inputs":[{"type":"bytes32","name":"what","internalType":"bytes32"},{"type":"address","name":"data","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"duty","internalType":"uint256"},{"type":"uint256","name":"rho","internalType":"uint256"}],"name":"ilks","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"init","inputs":[{"type":"bytes32","name":"ilk","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"rely","inputs":[{"type":"address","name":"usr","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract VatLike"}],"name":"vat","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"vow","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"wards","inputs":[{"type":"address","name":"","internalType":"address"}]}]
              

Contract Creation Code

Verify & Publish
0x608060405234801561001057600080fd5b50604051610b50380380610b508339818101604052602081101561003357600080fd5b505133600090815260208190526040902060019055600280546001600160a01b039092166001600160a01b0319909216919091179055610ad8806100786000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c8063626cb3c511610071578063626cb3c51461017f57806365fae35e146101875780639c52a7f1146101ad578063bf353dbb146101d3578063d4e8be83146101f9578063d9638d3614610225576100b4565b80631a0b287e146100b957806329ae8114146100e457806336569e77146101075780633b6631951461012b57806344e2a5a8146101485780635001f3b514610177575b600080fd5b6100e2600480360360608110156100cf57600080fd5b508035906020810135906040013561025b565b005b6100e2600480360360408110156100fa57600080fd5b50803590602001356103c6565b61010f61046d565b604080516001600160a01b039092168252519081900360200190f35b6100e26004803603602081101561014157600080fd5b503561047c565b6101656004803603602081101561015e57600080fd5b5035610586565b60408051918252519081900360200190f35b61016561078c565b61010f610792565b6100e26004803603602081101561019d57600080fd5b50356001600160a01b03166107a1565b6100e2600480360360208110156101c357600080fd5b50356001600160a01b0316610817565b610165600480360360208110156101e957600080fd5b50356001600160a01b031661088a565b6100e26004803603604081101561020f57600080fd5b50803590602001356001600160a01b031661089c565b6102426004803603602081101561023b57600080fd5b5035610961565b6040805192835260208301919091528051918290030190f35b336000908152602081905260409020546001146102b4576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b60008381526001602081905260409091200154610318576040805162461bcd60e51b815260206004820152601760248201527f4a75672f696c6b2d6e6f742d696e697469616c697a6564000000000000000000604482015290519081900360640190fd5b81636475747960e01b141561033d57600083815260016020526040902081905561038a565b6040805162461bcd60e51b815260206004820152601b60248201527f4a75672f66696c652d756e7265636f676e697a65642d706172616d0000000000604482015290519081900360640190fd5b604080518281529051839185917f6a0f336434beee3815f8cae285e0eaf64ae430276ba3c91f2a2c1adf83ee7d009181900360200190a3505050565b3360009081526020819052604090205460011461041f576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b81636261736560e01b141561033d57600481905560408051828152905183917fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7919081900360200190a25050565b6002546001600160a01b031681565b336000908152602081905260409020546001146104d5576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b600081815260016020526040902080541561052e576040805162461bcd60e51b8152602060048201526014602482015273129d59cbda5b1acb585b1c9958591e4b5a5b9a5d60621b604482015290519081900360640190fd5b6b033b2e3c9fd0803ce80000008082554260018301819055604080519283526020830191909152805184927f0c65b00139af14426dc3b2f637290e422512537713b15d964269c0aadff2f03592908290030190a25050565b6000818152600160208190526040822001544210156105de576040805162461bcd60e51b815260206004820152600f60248201526e4a75672f696e76616c69642d6e6f7760881b604482015290519081900360640190fd5b60025460408051636cb1c69b60e11b81526004810185905281516000936001600160a01b03169263d9638d36926024808201939182900301818787803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050506040513d604081101561065157600080fd5b50602090810151600454600086815260019093526040909220549092506106ad916106a791610680919061097a565b6000868152600160208190526040909120015442036b033b2e3c9fd0803ce8000000610990565b82610a4e565b6002546003549193506001600160a01b039081169163b65337df918691166106d58686610a84565b6040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561072257600080fd5b505af1158015610736573d6000803e3d6000fd5b50505060008481526001602081815260409283902042920191909155815185815291518693507f2fbd8559330c6faf38d4ee435b8463427bd58cd6bc7edd1a4e6f3ab6b57de71e9281900390910190a250919050565b60045481565b6003546001600160a01b031681565b336000908152602081905260409020546001146107fa576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b6001600160a01b0316600090815260208190526040902060019055565b33600090815260208190526040902054600114610870576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b6001600160a01b0316600090815260208190526040812055565b60006020819052908152604090205481565b336000908152602081905260409020546001146108f5576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b8162766f7760e81b141561033d57600380546001600160a01b0319166001600160a01b038316179055604080516001600160a01b0383168152905183917f41a50316b758972a692a69178de3d99c3138a652f5213364ee8eff829f22048a919081900360200190a25050565b6001602081905260009182526040909120805491015482565b8181018281101561098a57600080fd5b92915050565b6000838015610a30576001841680156109ab578592506109af565b8392505b50600283046002850494505b8415610a2a5785860286878204146109d257600080fd5b818101818110156109e257600080fd5b8590049650506001851615610a1f578583028387820414158715151615610a0857600080fd5b81810181811015610a1857600080fd5b8590049350505b6002850494506109bb565b50610a46565b838015610a405760009250610a44565b8392505b505b509392505050565b818102811580610a66575082828281610a6357fe5b04145b610a6f57600080fd5b6b033b2e3c9fd0803ce8000000900492915050565b80820360008312801590610a99575060008212155b61098a57600080fdfea26469706673582212202644f93683a260e759d9ec4cb60d693c79f71ffa63f32e74be754141857dcd9b64736f6c634300060c003300000000000000000000000016ca93f2f65d5495c874109fff38d11d39850b67

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063626cb3c511610071578063626cb3c51461017f57806365fae35e146101875780639c52a7f1146101ad578063bf353dbb146101d3578063d4e8be83146101f9578063d9638d3614610225576100b4565b80631a0b287e146100b957806329ae8114146100e457806336569e77146101075780633b6631951461012b57806344e2a5a8146101485780635001f3b514610177575b600080fd5b6100e2600480360360608110156100cf57600080fd5b508035906020810135906040013561025b565b005b6100e2600480360360408110156100fa57600080fd5b50803590602001356103c6565b61010f61046d565b604080516001600160a01b039092168252519081900360200190f35b6100e26004803603602081101561014157600080fd5b503561047c565b6101656004803603602081101561015e57600080fd5b5035610586565b60408051918252519081900360200190f35b61016561078c565b61010f610792565b6100e26004803603602081101561019d57600080fd5b50356001600160a01b03166107a1565b6100e2600480360360208110156101c357600080fd5b50356001600160a01b0316610817565b610165600480360360208110156101e957600080fd5b50356001600160a01b031661088a565b6100e26004803603604081101561020f57600080fd5b50803590602001356001600160a01b031661089c565b6102426004803603602081101561023b57600080fd5b5035610961565b6040805192835260208301919091528051918290030190f35b336000908152602081905260409020546001146102b4576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b60008381526001602081905260409091200154610318576040805162461bcd60e51b815260206004820152601760248201527f4a75672f696c6b2d6e6f742d696e697469616c697a6564000000000000000000604482015290519081900360640190fd5b81636475747960e01b141561033d57600083815260016020526040902081905561038a565b6040805162461bcd60e51b815260206004820152601b60248201527f4a75672f66696c652d756e7265636f676e697a65642d706172616d0000000000604482015290519081900360640190fd5b604080518281529051839185917f6a0f336434beee3815f8cae285e0eaf64ae430276ba3c91f2a2c1adf83ee7d009181900360200190a3505050565b3360009081526020819052604090205460011461041f576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b81636261736560e01b141561033d57600481905560408051828152905183917fe986e40cc8c151830d4f61050f4fb2e4add8567caad2d5f5496f9158e91fe4c7919081900360200190a25050565b6002546001600160a01b031681565b336000908152602081905260409020546001146104d5576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b600081815260016020526040902080541561052e576040805162461bcd60e51b8152602060048201526014602482015273129d59cbda5b1acb585b1c9958591e4b5a5b9a5d60621b604482015290519081900360640190fd5b6b033b2e3c9fd0803ce80000008082554260018301819055604080519283526020830191909152805184927f0c65b00139af14426dc3b2f637290e422512537713b15d964269c0aadff2f03592908290030190a25050565b6000818152600160208190526040822001544210156105de576040805162461bcd60e51b815260206004820152600f60248201526e4a75672f696e76616c69642d6e6f7760881b604482015290519081900360640190fd5b60025460408051636cb1c69b60e11b81526004810185905281516000936001600160a01b03169263d9638d36926024808201939182900301818787803b15801561062757600080fd5b505af115801561063b573d6000803e3d6000fd5b505050506040513d604081101561065157600080fd5b50602090810151600454600086815260019093526040909220549092506106ad916106a791610680919061097a565b6000868152600160208190526040909120015442036b033b2e3c9fd0803ce8000000610990565b82610a4e565b6002546003549193506001600160a01b039081169163b65337df918691166106d58686610a84565b6040518463ffffffff1660e01b815260040180848152602001836001600160a01b031681526020018281526020019350505050600060405180830381600087803b15801561072257600080fd5b505af1158015610736573d6000803e3d6000fd5b50505060008481526001602081815260409283902042920191909155815185815291518693507f2fbd8559330c6faf38d4ee435b8463427bd58cd6bc7edd1a4e6f3ab6b57de71e9281900390910190a250919050565b60045481565b6003546001600160a01b031681565b336000908152602081905260409020546001146107fa576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b6001600160a01b0316600090815260208190526040902060019055565b33600090815260208190526040902054600114610870576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b6001600160a01b0316600090815260208190526040812055565b60006020819052908152604090205481565b336000908152602081905260409020546001146108f5576040805162461bcd60e51b8152602060048201526012602482015271129d59cbdb9bdd0b585d5d1a1bdc9a5e995960721b604482015290519081900360640190fd5b8162766f7760e81b141561033d57600380546001600160a01b0319166001600160a01b038316179055604080516001600160a01b0383168152905183917f41a50316b758972a692a69178de3d99c3138a652f5213364ee8eff829f22048a919081900360200190a25050565b6001602081905260009182526040909120805491015482565b8181018281101561098a57600080fd5b92915050565b6000838015610a30576001841680156109ab578592506109af565b8392505b50600283046002850494505b8415610a2a5785860286878204146109d257600080fd5b818101818110156109e257600080fd5b8590049650506001851615610a1f578583028387820414158715151615610a0857600080fd5b81810181811015610a1857600080fd5b8590049350505b6002850494506109bb565b50610a46565b838015610a405760009250610a44565b8392505b505b509392505050565b818102811580610a66575082828281610a6357fe5b04145b610a6f57600080fd5b6b033b2e3c9fd0803ce8000000900492915050565b80820360008312801590610a99575060008212155b61098a57600080fdfea26469706673582212202644f93683a260e759d9ec4cb60d693c79f71ffa63f32e74be754141857dcd9b64736f6c634300060c0033