sUSDS Base vs Mainnet

बनाया गया Diff कभी समाप्त नहीं होता
45 हटाए गए
264 लाइनें
273 जोड़े गए
483 लाइनें
// SPDX-License-Identifier: AGPL-3.0-or-later
// SPDX-License-Identifier: AGPL-3.0-or-later


/// SUsds.sol -- SUsds token
/// SUsds.sol


// Copyright (C) 2017, 2018, 2019 dbrock, rain, mrchico
// Copyright (C) 2017, 2018, 2019 dbrock, rain, mrchico
// Copyright (C) 2024 Dai Foundation
// Copyright (C) 2021 Dai Foundation
//
//
// This program is free software: you can redistribute it and/or modify
// 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
// 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
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// (at your option) any later version.
//
//
// This program is distributed in the hope that it will be useful,
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// GNU Affero General Public License for more details.
//
//
// You should have received a copy of the GNU Affero General Public License
// 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/>.
// along with this program. If not, see <https://www.gnu.org/licenses/>.


pragma solidity ^0.8.21;
pragma solidity ^0.8.21;


import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";


interface IERC1271 {
interface IERC1271 {
function isValidSignature(
function isValidSignature(
bytes32,
bytes32,
bytes memory
bytes memory
) external view returns (bytes4);
) external view returns (bytes4);
}
}


interface VatLike {
function hope(address) external;
function suck(address, address, uint256) external;
}

interface UsdsJoinLike {
function vat() external view returns (address);
function usds() external view returns (address);
function exit(address, uint256) external;
}

interface UsdsLike {
function transfer(address, uint256) external;
function transferFrom(address, address, uint256) external;
}

contract SUsds is UUPSUpgradeable {
contract SUsds is UUPSUpgradeable {

// --- Storage Variables ---

// Admin
mapping (address => uint256) public wards;
mapping (address => uint256) public wards;
// ERC20
uint256 public totalSupply;
Text moved from lines 42-44
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
mapping (address => uint256) public nonces;
// Savings yield
uint192 public chi; // The Rate Accumulator [ray]
uint64 public rho; // Time of last drip [unix epoch time]
uint256 public ssr; // The USDS Savings Rate [ray]


// --- ERC20 Data ---
// --- Constants ---

// ERC20
string public constant name = "Savings USDS";
string public constant name = "Savings USDS";
string public constant symbol = "sUSDS";
string public constant symbol = "sUSDS";
string public constant version = "1";
string public constant version = "1";
uint8 public constant decimals = 18;
uint8 public constant decimals = 18;
// Math
uint256 public totalSupply;
uint256 private constant RAY = 10 ** 27;


// --- Immutables ---

// EIP712
Text moved to lines 56-58
mapping (address => uint256) public balanceOf;
bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
// Savings yield
UsdsJoinLike public immutable usdsJoin;
VatLike public immutable vat;
mapping (address => mapping (address => uint256)) public allowance;
UsdsLike public immutable usds;
mapping (address => uint256) public nonces;
address public immutable vow;


// --- Events ---
// --- Events ---

// Admin
event Rely(address indexed usr);
event Rely(address indexed usr);
event Deny(address indexed usr);
event Deny(address indexed usr);
event File(bytes32 indexed what, uint256 data);
// ERC20
event Approval(address indexed owner, address indexed spender, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint256 value);
// ERC4626
event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);
event Withdraw(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares);
// Referral
event Referral(uint16 indexed referral, address indexed owner, uint256 assets, uint256 shares);
// Savings yield
event Drip(uint256 chi, uint256 diff);