ETH Price: $2,428.51 (+5.35%)

Contract

0xf36960b9AE39C53c8B1e7e497aAd2d56e7EC02eB
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
199801572024-05-30 4:04:23112 days ago1717041863  Contract Creation0 ETH
Loading...
Loading

Minimal Proxy Contract for 0xccabad4923c14e48c9c27e6c4556c1caf4e91ebb

Contract Name:
DAIEscrow

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 200 runs

Other Settings:
london EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 2 : DAIEscrow.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "src/interfaces/IERC20.sol";

// @dev Caution: We assume all failed transfers cause reverts and ignore the returned bool.
interface IDSR {
    function daiBalance(address usr) external returns (uint wad);
    function pieOf(address usr) external view returns (uint wad);
    function join(address dst, uint wad) external;
    function exit(address dst, uint wad) external;
    function exitAll(address dst) external;
    function pot() external view returns (address);
}

interface IPot {
    function chi() external view returns (uint);
    function drip() external;
    function pie(address) external view returns (uint slice);
}

/**
 * @title DAI Escrow
 * @notice Collateral is stored in unique escrow contracts for every user and every market.
 * This escrow allows user to deposit DAI collateral directly into the DSR contract, earning DAI yyield
 * @dev Caution: This is a proxy implementation. Follow proxy pattern best practices
 */
contract DAIEscrow {

    address public market;
    IERC20 public constant token = IERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
    IDSR public constant DSR_MANAGER = IDSR(0x373238337Bfe1146fb49989fc222523f83081dDb);
    IPot public constant POT = IPot(0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7);

    /**
     * @notice Initialize escrow with a token
     * @dev Must be called right after proxy is created. Unecessary to set both token and beneficiary, as escrow only works with DAI
     */
    function initialize(IERC20, address) public {
        require(market == address(0), "ALREADY INITIALIZED");
        market = msg.sender;
        token.approve(address(DSR_MANAGER), type(uint).max);
    }
    
    /**
     * @notice Transfers the associated ERC20 token to a recipient.
     * @param recipient The address to receive payment from the escrow
     * @param amount The amount of ERC20 token to be transferred.
     */
    function pay(address recipient, uint amount) public {
        require(msg.sender == market, "ONLY MARKET");
        if(balance() == amount){
            //If trying to pay full balance, use exitAll to avoid dust being left over
            DSR_MANAGER.exitAll(recipient);
        } else {
            DSR_MANAGER.exit(recipient, amount);
        }
    }

    /**
    * @notice Get the token balance of the escrow
    * @return The balance accrued in the DSR up until the last `drip` function call
    */
    function balance() public view returns (uint) {
        return rmul(POT.chi(), DSR_MANAGER.pieOf(address(this)));
    }
    
    /**
     * @notice Function called by market on deposit. Will deposit DAI into the DSR
     * @dev This function should remain callable by anyone to handle direct inbound transfers.
     */
    function onDeposit() public {
        uint daiBalance = token.balanceOf(address(this));
        if(daiBalance > 0) {
            DSR_MANAGER.join(address(this), daiBalance);
        }
    }

    function rmul(uint x, uint y) internal pure returns(uint){
        uint256 RAY = 10 ** 27;
        // always rounds down
        return x * y / RAY;
    }
}

File 2 of 2 : IERC20.sol
pragma solidity ^0.8.13;

interface IERC20 {
    function approve(address,uint) external;
    function transfer(address,uint) external returns (bool);
    function transferFrom(address,address,uint) external returns (bool);
    function balanceOf(address) external view returns (uint);
    function allowance(address from, address to) external view returns (uint);
}

interface IDelegateableERC20 is IERC20 {
    function delegate(address delegatee) external;
    function delegates(address delegator) external view returns (address delegatee);
}

Settings
{
  "remappings": [
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {}
}

Contract ABI

[{"inputs":[],"name":"DSR_MANAGER","outputs":[{"internalType":"contract IDSR","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POT","outputs":[{"internalType":"contract IPot","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"balance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"market","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onDeposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"pay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ 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.