Chargement du reste de cette comparaison.

Kashi <> Cauldron

Créé Le diff n'expire jamais
218 suppressions
681 lignes
190 ajouts
646 lignes
/**
/**
*Submitted for verification at Etherscan.io on 2021-03-27
*Submitted for verification at Etherscan.io on 2021-07-06
*/
*/


// SPDX-License-Identifier: UNLICENSED
// SPDX-License-Identifier: MIXED
// Kashi Lending Medium Risk

// __ __ __ __ _____ __ __
// | |/ .---.-.-----| |--|__| | |_.-----.-----.--| |__.-----.-----.
// | <| _ |__ --| | | | | -__| | _ | | | _ |
// |__|\__|___._|_____|__|__|__| |_______|_____|__|__|_____|__|__|__|___ |
// |_____|

// Copyright (c) 2021 BoringCrypto - All rights reserved
// Twitter: @Boring_Crypto

// Special thanks to:
// @0xKeno - for all his invaluable contributions
// @burger_crypto - for the idea of trying to let the LPs benefit from liquidations

// Version: 22-Feb-2021
Text moved to lines 622-624
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;

// solhint-disable avoid-low-level-calls
// solhint-disable no-inline-assembly
// solhint-disable not-rely-on-time


// File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.0
// File @boringcrypto/boring-solidity/contracts/libraries/BoringMath.sol@v1.2.2
// License-Identifier: MIT
// License-Identifier: MIT
pragma solidity 0.6.12;


/// @notice A library for performing overflow-/underflow-safe math,
/// @notice A library for performing overflow-/underflow-safe math,
/// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math).
/// updated with awesomeness from of DappHub (https://github.com/dapphub/ds-math).
library BoringMath {
library BoringMath {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
}


function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
function sub(uint256 a, uint256 b) internal pure returns (uint256 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
require((c = a - b) <= a, "BoringMath: Underflow");
}
}


function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow");
require(b == 0 || (c = a * b) / b == a, "BoringMath: Mul Overflow");
}
}


function to128(uint256 a) internal pure returns (uint128 c) {
function to128(uint256 a) internal pure returns (uint128 c) {
require(a <= uint128(-1), "BoringMath: uint128 Overflow");
require(a <= uint128(-1), "BoringMath: uint128 Overflow");
c = uint128(a);
c = uint128(a);
}
}


function to64(uint256 a) internal pure returns (uint64 c) {
function to64(uint256 a) internal pure returns (uint64 c) {
require(a <= uint64(-1), "BoringMath: uint64 Overflow");
require(a <= uint64(-1), "BoringMath: uint64 Overflow");
c = uint64(a);
c = uint64(a);
}
}


function to32(uint256 a) internal pure returns (uint32 c) {
function to32(uint256 a) internal pure returns (uint32 c) {
require(a <= uint32(-1), "BoringMath: uint32 Overflow");
require(a <= uint32(-1), "BoringMath: uint32 Overflow");
c = uint32(a);
c = uint32(a);
}
}
}
}


/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint128.
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint128.
library BoringMath128 {
library BoringMath128 {
function add(uint128 a, uint128 b) internal pure returns (uint128 c) {
function add(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
require((c = a + b) >= b, "BoringMath: Add Overflow");
}
}


function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {
function sub(uint128 a, uint128 b) internal pure returns (uint128 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
require((c = a - b) <= a, "BoringMath: Underflow");
}
}
}
}


// File @boringcrypto/boring-solidity/contracts/BoringOwnable.sol@v1.2.0
/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint64.
library BoringMath64 {
function add(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}

function sub(uint64 a, uint64 b) internal pure returns (uint64 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}

/// @notice A library for performing overflow-/underflow-safe addition and subtraction on uint32.
library BoringMath32 {
function add(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a + b) >= b, "BoringMath: Add Overflow");
}

function sub(uint32 a, uint32 b) internal pure returns (uint32 c) {
require((c = a - b) <= a, "BoringMath: Underflow");
}
}

// File @boringcrypto/boring-solidity/contracts/BoringOwnable.sol@v1.2.2
// License-Identifier: MIT
// License-Identifier: MIT
pragma solidity 0.6.12;


// Audit on 5-Jan-2021 by Keno and BoringCrypto
// Audit on 5-Jan-2021 by Keno and BoringCrypto
// Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol + Claimable.sol
// Source: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol + Claimable.sol
// Edited by BoringCrypto
// Edited by BoringCrypto


contract BoringOwnableData {
contract BoringOwnableData {
address public owner;
address public owner;
address public pendingOwner;
address public pendingOwner;
}
}


contract BoringOwnable is BoringOwnableData {
contract BoringOwnable is BoringOwnableData {
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);


/// @notice `owner` defaults to msg.sender on construction.
/// @notice `owner` defaults to msg.sender on construction.
constructor() public {
constructor() public {
owner = msg.sender;
owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
emit OwnershipTransferred(address(0), msg.sender);
}
}


/// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner.
/// @notice Transfers ownership to `newOwner`. Either directly or claimable by the new pending owner.
/// Can only be invoked by the current `owner`.
/// Can only be invoked by the current `owner`.
/// @param newOwner Address of the new owner.
/// @param newOwner Address of the new owner.
/// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`.
/// @param direct True if `newOwner` should be set immediately. False if `newOwner` needs to use `claimOwnership`.
/// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise.
/// @param renounce Allows the `newOwner` to be `address(0)` if `direct` and `renounce` is True. Has no effect otherwise.
function transferOwnership(
function transferOwnership(
address newOwner,
address newOwner,
bool direct,
bool direct,
bool renounce
bool renounce
) public onlyOwner {
) public onlyOwner {
if (direct) {
if (direct) {
// Checks
// Checks
require(newOwner != address(0) || renounce, "Ownable: zero address");
require(newOwner != address(0) || renounce, "Ownable: zero address");


// Effects
// Effects
emit OwnershipTransferred(owner, newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
owner = newOwner;
pendingOwner = address(0);
pendingOwner = address(0);
} else {
} else {
// Effects
// Effects
pendingOwner = newOwner;
pendingOwner = newOwner;
}
}
}
}


/// @notice Needs to be called by `pendingOwner` to claim ownership.
/// @notice Needs to be called by `pendingOwner` to claim ownership.
function claimOwnership() public {
function claimOwnership() public {