comment
stringlengths
1
211
input
stringlengths
155
20k
label
stringlengths
4
1k
original_idx
int64
203
514k
predicate
stringlengths
1
1k
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { require(!off(loan)); require(bools[loan].funded == true); require(bools[loan].approved == true); require(bools[loan].withdrawn == false); require(sha256(abi.encodePacked(secretA1)) == secretHashes[loan].secretHashA1); require(<FILL_ME>) bools[loan].withdrawn = true; secretHashes[loan].withdrawSecret = secretA1; } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
token.transfer(loans[loan].borrower,principal(loan))
311,961
token.transfer(loans[loan].borrower,principal(loan))
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { require(!off(loan)); require(<FILL_ME>) require(bools[loan].withdrawn == true); require(now <= loans[loan].loanExpiration); require(add(amount, repaid(loan)) <= owedForLoan(loan)); require(token.transferFrom(msg.sender, address(this), amount)); repayments[loan] = add(amount, repayments[loan]); if (repaid(loan) == owedForLoan(loan)) { bools[loan].paid = true; } } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
!sale(loan)
311,961
!sale(loan)
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { require(!off(loan)); require(!sale(loan)); require(<FILL_ME>) require(now <= loans[loan].loanExpiration); require(add(amount, repaid(loan)) <= owedForLoan(loan)); require(token.transferFrom(msg.sender, address(this), amount)); repayments[loan] = add(amount, repayments[loan]); if (repaid(loan) == owedForLoan(loan)) { bools[loan].paid = true; } } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
bools[loan].withdrawn==true
311,961
bools[loan].withdrawn==true
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { require(!off(loan)); require(!sale(loan)); require(bools[loan].withdrawn == true); require(now <= loans[loan].loanExpiration); require(<FILL_ME>) require(token.transferFrom(msg.sender, address(this), amount)); repayments[loan] = add(amount, repayments[loan]); if (repaid(loan) == owedForLoan(loan)) { bools[loan].paid = true; } } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
add(amount,repaid(loan))<=owedForLoan(loan)
311,961
add(amount,repaid(loan))<=owedForLoan(loan)
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { require(!off(loan)); require(!sale(loan)); require(now > acceptExpiration(loan)); require(<FILL_ME>) require(msg.sender == loans[loan].borrower); bools[loan].off = true; loans[loan].closedTimestamp = now; require(token.transfer(loans[loan].borrower, owedForLoan(loan))); if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
bools[loan].paid==true
311,961
bools[loan].paid==true
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { require(!off(loan)); require(!sale(loan)); require(now > acceptExpiration(loan)); require(bools[loan].paid == true); require(msg.sender == loans[loan].borrower); bools[loan].off = true; loans[loan].closedTimestamp = now; require(<FILL_ME>) if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
token.transfer(loans[loan].borrower,owedForLoan(loan))
311,961
token.transfer(loans[loan].borrower,owedForLoan(loan))
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { require(!off(loan)); require(<FILL_ME>) require(msg.sender == loans[loan].lender || msg.sender == loans[loan].arbiter); require(sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashB1 || sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashC1); require(now <= acceptExpiration(loan)); require(bools[loan].sale == false); bools[loan].off = true; loans[loan].closedTimestamp = now; secretHashes[loan].acceptSecret = secret; if (bools[loan].withdrawn == false) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, loans[loan].principal)); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], loans[loan].principal); } } else if (bools[loan].withdrawn == true) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, owedToLender(loan))); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], owedToLender(loan)); } require(token.transfer(loans[loan].arbiter, fee(loan))); } } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
bools[loan].withdrawn==false||bools[loan].paid==true
311,961
bools[loan].withdrawn==false||bools[loan].paid==true
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { require(!off(loan)); require(bools[loan].withdrawn == false || bools[loan].paid == true); require(msg.sender == loans[loan].lender || msg.sender == loans[loan].arbiter); require(<FILL_ME>) require(now <= acceptExpiration(loan)); require(bools[loan].sale == false); bools[loan].off = true; loans[loan].closedTimestamp = now; secretHashes[loan].acceptSecret = secret; if (bools[loan].withdrawn == false) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, loans[loan].principal)); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], loans[loan].principal); } } else if (bools[loan].withdrawn == true) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, owedToLender(loan))); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], owedToLender(loan)); } require(token.transfer(loans[loan].arbiter, fee(loan))); } } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
sha256(abi.encodePacked(secret))==secretHashes[loan].secretHashB1||sha256(abi.encodePacked(secret))==secretHashes[loan].secretHashC1
311,961
sha256(abi.encodePacked(secret))==secretHashes[loan].secretHashB1||sha256(abi.encodePacked(secret))==secretHashes[loan].secretHashC1
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { require(!off(loan)); require(bools[loan].withdrawn == false || bools[loan].paid == true); require(msg.sender == loans[loan].lender || msg.sender == loans[loan].arbiter); require(sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashB1 || sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashC1); require(now <= acceptExpiration(loan)); require(<FILL_ME>) bools[loan].off = true; loans[loan].closedTimestamp = now; secretHashes[loan].acceptSecret = secret; if (bools[loan].withdrawn == false) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, loans[loan].principal)); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], loans[loan].principal); } } else if (bools[loan].withdrawn == true) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, owedToLender(loan))); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], owedToLender(loan)); } require(token.transfer(loans[loan].arbiter, fee(loan))); } } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
bools[loan].sale==false
311,961
bools[loan].sale==false
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { require(!off(loan)); require(bools[loan].withdrawn == false || bools[loan].paid == true); require(msg.sender == loans[loan].lender || msg.sender == loans[loan].arbiter); require(sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashB1 || sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashC1); require(now <= acceptExpiration(loan)); require(bools[loan].sale == false); bools[loan].off = true; loans[loan].closedTimestamp = now; secretHashes[loan].acceptSecret = secret; if (bools[loan].withdrawn == false) { if (fundIndex[loan] == bytes32(0)) { require(<FILL_ME>) } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], loans[loan].principal); } } else if (bools[loan].withdrawn == true) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, owedToLender(loan))); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], owedToLender(loan)); } require(token.transfer(loans[loan].arbiter, fee(loan))); } } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
token.transfer(loans[loan].lender,loans[loan].principal)
311,961
token.transfer(loans[loan].lender,loans[loan].principal)
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { require(!off(loan)); require(bools[loan].withdrawn == false || bools[loan].paid == true); require(msg.sender == loans[loan].lender || msg.sender == loans[loan].arbiter); require(sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashB1 || sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashC1); require(now <= acceptExpiration(loan)); require(bools[loan].sale == false); bools[loan].off = true; loans[loan].closedTimestamp = now; secretHashes[loan].acceptSecret = secret; if (bools[loan].withdrawn == false) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, loans[loan].principal)); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], loans[loan].principal); } } else if (bools[loan].withdrawn == true) { if (fundIndex[loan] == bytes32(0)) { require(<FILL_ME>) } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], owedToLender(loan)); } require(token.transfer(loans[loan].arbiter, fee(loan))); } } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
token.transfer(loans[loan].lender,owedToLender(loan))
311,961
token.transfer(loans[loan].lender,owedToLender(loan))
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { require(!off(loan)); require(bools[loan].withdrawn == false || bools[loan].paid == true); require(msg.sender == loans[loan].lender || msg.sender == loans[loan].arbiter); require(sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashB1 || sha256(abi.encodePacked(secret)) == secretHashes[loan].secretHashC1); require(now <= acceptExpiration(loan)); require(bools[loan].sale == false); bools[loan].off = true; loans[loan].closedTimestamp = now; secretHashes[loan].acceptSecret = secret; if (bools[loan].withdrawn == false) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, loans[loan].principal)); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], loans[loan].principal); } } else if (bools[loan].withdrawn == true) { if (fundIndex[loan] == bytes32(0)) { require(token.transfer(loans[loan].lender, owedToLender(loan))); } else { if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); } funds.deposit(fundIndex[loan], owedToLender(loan)); } require(<FILL_ME>) } } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { } }
token.transfer(loans[loan].arbiter,fee(loan))
311,961
token.transfer(loans[loan].arbiter,fee(loan))
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { require(!off(loan)); require(bools[loan].withdrawn == true); require(msg.sender != loans[loan].borrower && msg.sender != loans[loan].lender); if (sales.next(loan) == 0) { if (now > loans[loan].loanExpiration) { require(<FILL_ME>) } else { require(!safe(loan)); } if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } else { require(sales.next(loan) < 3); require(now > sales.settlementExpiration(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); require(!sales.accepted(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); } require(token.balanceOf(msg.sender) >= ddiv(discountCollateralValue(loan))); require(token.transferFrom(msg.sender, address(sales), ddiv(discountCollateralValue(loan)))); SecretHashes storage h = secretHashes[loan]; uint256 i = sales.next(loan); sale_ = sales.create(loan, loans[loan].borrower, loans[loan].lender, loans[loan].arbiter, msg.sender, h.secretHashAs[i], h.secretHashBs[i], h.secretHashCs[i], secretHash, pubKeyHash); if (bools[loan].sale == false) { require(token.transfer(address(sales), repaid(loan))); } bools[loan].sale = true; } }
bools[loan].paid==false
311,961
bools[loan].paid==false
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { require(!off(loan)); require(bools[loan].withdrawn == true); require(msg.sender != loans[loan].borrower && msg.sender != loans[loan].lender); if (sales.next(loan) == 0) { if (now > loans[loan].loanExpiration) { require(bools[loan].paid == false); } else { require(<FILL_ME>) } if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } else { require(sales.next(loan) < 3); require(now > sales.settlementExpiration(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); require(!sales.accepted(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); } require(token.balanceOf(msg.sender) >= ddiv(discountCollateralValue(loan))); require(token.transferFrom(msg.sender, address(sales), ddiv(discountCollateralValue(loan)))); SecretHashes storage h = secretHashes[loan]; uint256 i = sales.next(loan); sale_ = sales.create(loan, loans[loan].borrower, loans[loan].lender, loans[loan].arbiter, msg.sender, h.secretHashAs[i], h.secretHashBs[i], h.secretHashCs[i], secretHash, pubKeyHash); if (bools[loan].sale == false) { require(token.transfer(address(sales), repaid(loan))); } bools[loan].sale = true; } }
!safe(loan)
311,961
!safe(loan)
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { require(!off(loan)); require(bools[loan].withdrawn == true); require(msg.sender != loans[loan].borrower && msg.sender != loans[loan].lender); if (sales.next(loan) == 0) { if (now > loans[loan].loanExpiration) { require(bools[loan].paid == false); } else { require(!safe(loan)); } if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } else { require(<FILL_ME>) require(now > sales.settlementExpiration(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); require(!sales.accepted(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); } require(token.balanceOf(msg.sender) >= ddiv(discountCollateralValue(loan))); require(token.transferFrom(msg.sender, address(sales), ddiv(discountCollateralValue(loan)))); SecretHashes storage h = secretHashes[loan]; uint256 i = sales.next(loan); sale_ = sales.create(loan, loans[loan].borrower, loans[loan].lender, loans[loan].arbiter, msg.sender, h.secretHashAs[i], h.secretHashBs[i], h.secretHashCs[i], secretHash, pubKeyHash); if (bools[loan].sale == false) { require(token.transfer(address(sales), repaid(loan))); } bools[loan].sale = true; } }
sales.next(loan)<3
311,961
sales.next(loan)<3
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { require(!off(loan)); require(bools[loan].withdrawn == true); require(msg.sender != loans[loan].borrower && msg.sender != loans[loan].lender); if (sales.next(loan) == 0) { if (now > loans[loan].loanExpiration) { require(bools[loan].paid == false); } else { require(!safe(loan)); } if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } else { require(sales.next(loan) < 3); require(now > sales.settlementExpiration(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); require(<FILL_ME>) } require(token.balanceOf(msg.sender) >= ddiv(discountCollateralValue(loan))); require(token.transferFrom(msg.sender, address(sales), ddiv(discountCollateralValue(loan)))); SecretHashes storage h = secretHashes[loan]; uint256 i = sales.next(loan); sale_ = sales.create(loan, loans[loan].borrower, loans[loan].lender, loans[loan].arbiter, msg.sender, h.secretHashAs[i], h.secretHashBs[i], h.secretHashCs[i], secretHash, pubKeyHash); if (bools[loan].sale == false) { require(token.transfer(address(sales), repaid(loan))); } bools[loan].sale = true; } }
!sales.accepted(sales.saleIndexByLoan(loan,sales.next(loan)-1))
311,961
!sales.accepted(sales.saleIndexByLoan(loan,sales.next(loan)-1))
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { require(!off(loan)); require(bools[loan].withdrawn == true); require(msg.sender != loans[loan].borrower && msg.sender != loans[loan].lender); if (sales.next(loan) == 0) { if (now > loans[loan].loanExpiration) { require(bools[loan].paid == false); } else { require(!safe(loan)); } if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } else { require(sales.next(loan) < 3); require(now > sales.settlementExpiration(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); require(!sales.accepted(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); } require(<FILL_ME>) require(token.transferFrom(msg.sender, address(sales), ddiv(discountCollateralValue(loan)))); SecretHashes storage h = secretHashes[loan]; uint256 i = sales.next(loan); sale_ = sales.create(loan, loans[loan].borrower, loans[loan].lender, loans[loan].arbiter, msg.sender, h.secretHashAs[i], h.secretHashBs[i], h.secretHashCs[i], secretHash, pubKeyHash); if (bools[loan].sale == false) { require(token.transfer(address(sales), repaid(loan))); } bools[loan].sale = true; } }
token.balanceOf(msg.sender)>=ddiv(discountCollateralValue(loan))
311,961
token.balanceOf(msg.sender)>=ddiv(discountCollateralValue(loan))
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { require(!off(loan)); require(bools[loan].withdrawn == true); require(msg.sender != loans[loan].borrower && msg.sender != loans[loan].lender); if (sales.next(loan) == 0) { if (now > loans[loan].loanExpiration) { require(bools[loan].paid == false); } else { require(!safe(loan)); } if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } else { require(sales.next(loan) < 3); require(now > sales.settlementExpiration(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); require(!sales.accepted(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); } require(token.balanceOf(msg.sender) >= ddiv(discountCollateralValue(loan))); require(<FILL_ME>) SecretHashes storage h = secretHashes[loan]; uint256 i = sales.next(loan); sale_ = sales.create(loan, loans[loan].borrower, loans[loan].lender, loans[loan].arbiter, msg.sender, h.secretHashAs[i], h.secretHashBs[i], h.secretHashCs[i], secretHash, pubKeyHash); if (bools[loan].sale == false) { require(token.transfer(address(sales), repaid(loan))); } bools[loan].sale = true; } }
token.transferFrom(msg.sender,address(sales),ddiv(discountCollateralValue(loan)))
311,961
token.transferFrom(msg.sender,address(sales),ddiv(discountCollateralValue(loan)))
null
pragma solidity ^0.5.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } library SafeMath { function add(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function mod(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ERC20 is IERC20 { using SafeMath for uint256; mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; function totalSupply() public view returns (uint256) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { } function allowance(address owner, address spender) public view returns (uint256) { } function approve(address spender, uint256 value) public returns (bool) { } function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) { } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { } function _transfer(address sender, address recipient, uint256 amount) internal { } function _mint(address account, uint256 amount) internal { } function _burn(address account, uint256 value) internal { } function _approve(address owner, address spender, uint256 value) internal { } function _burnFrom(address account, uint256 amount) internal { } } interface FundsInterface { function lender(bytes32) external view returns (address); function custom(bytes32) external view returns (bool); function deposit(bytes32, uint256) external; function decreaseTotalBorrow(uint256) external; function calcGlobalInterest() external; } interface SalesInterface { function saleIndexByLoan(bytes32, uint256) external returns(bytes32); function settlementExpiration(bytes32) external view returns (uint256); function accepted(bytes32) external view returns (bool); function next(bytes32) external view returns (uint256); function create(bytes32, address, address, address, address, bytes32, bytes32, bytes32, bytes32, bytes20) external returns(bytes32); } contract DSMath { function add(uint x, uint y) internal pure returns (uint z) { } function sub(uint x, uint y) internal pure returns (uint z) { } function mul(uint x, uint y) internal pure returns (uint z) { } function div(uint a, uint b) internal pure returns (uint c) { } function min(uint x, uint y) internal pure returns (uint z) { } function max(uint x, uint y) internal pure returns (uint z) { } function imin(int x, int y) internal pure returns (int z) { } function imax(int x, int y) internal pure returns (int z) { } uint constant COL = 10 ** 8; uint constant WAD = 10 ** 18; uint constant RAY = 10 ** 27; function cmul(uint x, uint y) public pure returns (uint z) { } function wmul(uint x, uint y) internal pure returns (uint z) { } function rmul(uint x, uint y) internal pure returns (uint z) { } function cdiv(uint x, uint y) internal pure returns (uint z) { } function wdiv(uint x, uint y) internal pure returns (uint z) { } function rdiv(uint x, uint y) internal pure returns (uint z) { } function rpow(uint x, uint n) internal pure returns (uint z) { } } contract Medianizer { function peek() public view returns (bytes32, bool); function read() public returns (bytes32); function poke() public; function poke(bytes32) public; function fund (uint256 amount, ERC20 token) public; } contract Loans is DSMath { FundsInterface funds; Medianizer med; SalesInterface sales; uint256 public constant APPROVE_EXP_THRESHOLD = 2 hours; uint256 public constant ACCEPT_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_EXP_THRESHOLD = 7 days; uint256 public constant SEIZURE_EXP_THRESHOLD = 2 days; uint256 public constant LIQUIDATION_DISCOUNT = 930000000000000000; mapping (bytes32 => Loan) public loans; mapping (bytes32 => PubKeys) public pubKeys; mapping (bytes32 => SecretHashes) public secretHashes; mapping (bytes32 => Bools) public bools; mapping (bytes32 => bytes32) public fundIndex; mapping (bytes32 => ERC20) public tokes; mapping (bytes32 => uint256) public repayments; uint256 public loanIndex; mapping (address => bytes32[]) public borrowerLoans; mapping (address => bytes32[]) public lenderLoans; ERC20 public token; uint256 public decimals; address deployer; struct Loan { address borrower; address lender; address arbiter; uint256 createdAt; uint256 loanExpiration; uint256 requestTimestamp; uint256 closedTimestamp; uint256 principal; uint256 interest; uint256 penalty; uint256 fee; uint256 collateral; uint256 liquidationRatio; } struct PubKeys { bytes borrowerPubKey; bytes lenderPubKey; bytes arbiterPubKey; } struct SecretHashes { bytes32 secretHashA1; bytes32[3] secretHashAs; bytes32 secretHashB1; bytes32[3] secretHashBs; bytes32 secretHashC1; bytes32[3] secretHashCs; bytes32 withdrawSecret; bytes32 acceptSecret; bool set; } struct Bools { bool funded; bool approved; bool withdrawn; bool sale; bool paid; bool off; } event Create(bytes32 loan); function borrower(bytes32 loan) public view returns (address) { } function lender(bytes32 loan) public view returns (address) { } function arbiter(bytes32 loan) public view returns (address) { } function approveExpiration(bytes32 loan) public view returns (uint256) { } function acceptExpiration(bytes32 loan) public view returns (uint256) { } function liquidationExpiration(bytes32 loan) public view returns (uint256) { } function seizureExpiration(bytes32 loan) public view returns (uint256) { } function principal(bytes32 loan) public view returns (uint256) { } function interest(bytes32 loan) public view returns (uint256) { } function fee(bytes32 loan) public view returns (uint256) { } function penalty(bytes32 loan) public view returns (uint256) { } function collateral(bytes32 loan) public view returns (uint256) { } function repaid(bytes32 loan) public view returns (uint256) { } function liquidationRatio(bytes32 loan) public view returns (uint256) { } function owedToLender(bytes32 loan) public view returns (uint256) { } function owedForLoan(bytes32 loan) public view returns (uint256) { } function owedForLiquidation(bytes32 loan) public view returns (uint256) { } function owing(bytes32 loan) public view returns (uint256) { } function funded(bytes32 loan) public view returns (bool) { } function approved(bytes32 loan) public view returns (bool) { } function withdrawn(bytes32 loan) public view returns (bool) { } function sale(bytes32 loan) public view returns (bool) { } function paid(bytes32 loan) public view returns (bool) { } function off(bytes32 loan) public view returns (bool) { } function dmul(uint x) public view returns (uint256) { } function ddiv(uint x) public view returns (uint256) { } function borrowerLoanCount(address borrower_) public view returns (uint256) { } function lenderLoanCount(address lender_) public view returns (uint256) { } function collateralValue(bytes32 loan) public view returns (uint256) { } function minCollateralValue(bytes32 loan) public view returns (uint256) { } function discountCollateralValue(bytes32 loan) public view returns (uint256) { } function safe(bytes32 loan) public view returns (bool) { } constructor (FundsInterface funds_, Medianizer med_, ERC20 token_, uint256 decimals_) public { } function setSales(SalesInterface sales_) external { } function create( uint256 loanExpiration_, address[3] calldata usrs_, uint256[7] calldata vals_, bytes32 fundIndex_ ) external returns (bytes32 loan) { } function setSecretHashes( bytes32 loan, bytes32[4] calldata borrowerSecretHashes, bytes32[4] calldata lenderSecretHashes, bytes32[4] calldata arbiterSecretHashes, bytes calldata borrowerPubKey_, bytes calldata lenderPubKey_, bytes calldata arbiterPubKey_ ) external returns (bool) { } function fund(bytes32 loan) external { } function approve(bytes32 loan) external { } function withdraw(bytes32 loan, bytes32 secretA1) external { } function repay(bytes32 loan, uint256 amount) external { } function refund(bytes32 loan) external { } function cancel(bytes32 loan, bytes32 secret) external { } function accept(bytes32 loan, bytes32 secret) public { } function liquidate(bytes32 loan, bytes32 secretHash, bytes20 pubKeyHash) external returns (bytes32 sale_) { require(!off(loan)); require(bools[loan].withdrawn == true); require(msg.sender != loans[loan].borrower && msg.sender != loans[loan].lender); if (sales.next(loan) == 0) { if (now > loans[loan].loanExpiration) { require(bools[loan].paid == false); } else { require(!safe(loan)); } if (funds.custom(fundIndex[loan]) == false) { funds.decreaseTotalBorrow(loans[loan].principal); funds.calcGlobalInterest(); } } else { require(sales.next(loan) < 3); require(now > sales.settlementExpiration(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); require(!sales.accepted(sales.saleIndexByLoan(loan, sales.next(loan) - 1))); } require(token.balanceOf(msg.sender) >= ddiv(discountCollateralValue(loan))); require(token.transferFrom(msg.sender, address(sales), ddiv(discountCollateralValue(loan)))); SecretHashes storage h = secretHashes[loan]; uint256 i = sales.next(loan); sale_ = sales.create(loan, loans[loan].borrower, loans[loan].lender, loans[loan].arbiter, msg.sender, h.secretHashAs[i], h.secretHashBs[i], h.secretHashCs[i], secretHash, pubKeyHash); if (bools[loan].sale == false) { require(<FILL_ME>) } bools[loan].sale = true; } }
token.transfer(address(sales),repaid(loan))
311,961
token.transfer(address(sales),repaid(loan))
null
pragma solidity 0.5.1; /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256 c) { } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256 c) { } } contract ReentrancyGuard { /** * @dev We use a single lock for the whole contract. */ bool private reentrancyLock = false; /** * @dev Prevents a contract from calling itself, directly or indirectly. * @notice If you mark a function `nonReentrant`, you should also * mark it `external`. Calling one nonReentrant function from * another is not supported. Instead, you can implement a * `private` function doing the actual work, and a `external` * wrapper marked as `nonReentrant`. */ modifier nonReentrant() { require(<FILL_ME>) reentrancyLock = true; _; reentrancyLock = false; } } /** * @title Ownable * @dev The Ownable contract has an owner address, and provides basic authorization control * functions, this simplifies the implementation of "user permissions". */ contract Ownable { address public owner; event OwnershipRenounced(address indexed previousOwner); event OwnershipTransferred( address indexed previousOwner, address indexed newOwner ); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() public { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { } /** * @dev Allows the current owner to relinquish control of the contract. */ function renounceOwnership() public onlyOwner { } } /** * @title ERC20Basic * @dev Simpler version of ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/179 */ contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval( address indexed owner, address indexed spender, uint256 value ); } /** * @title Basic token * @dev Basic version of StandardToken, with no allowances. */ contract BasicToken is ERC20Basic, ReentrancyGuard { using SafeMath for uint256; mapping(address => uint256) public balances; uint256 public totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public nonReentrant returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256) { } } /** * @title Standard ERC20 token * * @dev Implementation of the basic standard token. * @dev https://github.com/ethereum/EIPs/issues/20 * @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol */ contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom( address _from, address _to, uint256 _value ) public nonReentrant returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public nonReentrant returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance( address _owner, address _spender ) public view returns (uint256) { } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval( address _spender, uint256 _addedValue ) public nonReentrant returns (bool) { } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval( address _spender, uint256 _subtractedValue ) public nonReentrant returns (bool) { } } contract Freeze is Ownable, ReentrancyGuard { using SafeMath for uint256; struct Group { address[] holders; uint until; } /** * @dev number of groups */ uint public groups; /** * @dev link group ID ---> Group structure */ mapping (uint => Group) public lockup; /** * @dev Check if holder under lock up */ modifier lockupEnded (address _holder) { } /** * @param _holder address of token holder to check * @return bool - status of freezing and group */ function isFreezed (address _holder) public view returns(bool, uint) { } /** * @dev internal usage to get index of holder in group * @param element address of token holder to check * @param at array of addresses that is group of holders * @return index of holder at array */ function indexOf (address element, address[] memory at) internal pure returns (uint) { } /** * @dev internal usage to check that 0 is 0 index or it means that address not exists * @param _holder address of token holder to check * @param lockGroup id of group to check address existance in it * @return true if holder at zero index at group false if holder doesn't exists */ function checkZeroIndex (address _holder, uint lockGroup) internal view returns (bool) { } /** * @dev Will set group of addresses that will be under lock. When locked address can't do some actions with token * @param _holders array of addresses to lock * @param _until timestamp until that lock up will last * @return bool result of operation */ function setGroup (address[] memory _holders, uint _until) public onlyOwner returns (bool) { } } /** * @dev This contract needed for inheritance of StandardToken interface, but with freezing modifiers. So, it have exactly same methods, but with lockupEnded(msg.sender) modifier. * @notice Inherit from it at SingleToken, to make freezing functionality works */ contract PausableToken is StandardToken, Freeze { function transfer( address _to, uint256 _value ) public lockupEnded(msg.sender) returns (bool) { } function transferFrom( address _from, address _to, uint256 _value ) public lockupEnded(msg.sender) returns (bool) { } function approve( address _spender, uint256 _value ) public lockupEnded(msg.sender) returns (bool) { } function increaseApproval( address _spender, uint256 _addedValue ) public lockupEnded(msg.sender) returns (bool success) { } function decreaseApproval( address _spender, uint256 _subtractedValue ) public lockupEnded(msg.sender) returns (bool success) { } } contract SingleToken is PausableToken { string public constant name = "Gofind XR"; string public constant symbol = "XR"; uint32 public constant decimals = 8; uint256 public constant maxSupply = 13E16; constructor() public { } }
!reentrancyLock
312,013
!reentrancyLock
"This presale has ended"
pragma solidity 0.7.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "hardhat/console.sol"; contract Presale { using SafeMath for uint256; // Properties of smart contract uint256 public presaleID = 0; struct TokenInfo { uint256 tokenPrice; uint256 tokenAmount; uint256 tokensSold; uint256 startTimestamp; uint256 endTimestamp; address tokenAddress; address payable tokenOwner; bool hasEnded; } // mappings with index of presale id mapping(uint256 => TokenInfo) public tokenData; event NewPresale(uint256 newPresaleID, uint256 timestamp); // Start presale function function startPresale( uint256 _startTimestamp, uint256 _endTimestamp, uint256 _tokenPrice, uint256 _tokenAmount, address _tokenAddress ) public { } // Buy function where customer enters presaleID and token amount to exchange eth for an ERC20 Token function buy(uint256 _presaleID, uint256 _tokenAmount) public payable { // make sure the presale has started but hasnt ended and the user is inputting enough ETH require( block.timestamp >= tokenData[_presaleID].startTimestamp, "This presale is still locked" ); require(<FILL_ME>) require( _tokenAmount <= tokenData[_presaleID].tokenAmount, "Not enough tokens to supply token amount requested" ); require( msg.value >= tokenData[_presaleID].tokenPrice.mul(_tokenAmount).div(1 ether), "Not enough ETH to make purchase" ); // transfer the tokens to the customer IERC20 token = IERC20(tokenData[_presaleID].tokenAddress); token.transfer(msg.sender, _tokenAmount); // update the amount of tokens that have been sold tokenData[_presaleID].tokensSold = tokenData[_presaleID].tokensSold.add( _tokenAmount ); // decrease supply by the amount that is going to be sold tokenData[_presaleID].tokenAmount = tokenData[_presaleID] .tokenAmount .sub(_tokenAmount); } function endPresale(uint256 _presaleID) public { } }
tokenData[_presaleID].hasEnded==false,"This presale has ended"
312,149
tokenData[_presaleID].hasEnded==false
"TokenManager: Token is not managed"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { require(<FILL_ME>) _; } modifier initialized() { } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
isManagedToken(syntheticTokenAddress),"TokenManager: Token is not managed"
312,218
isManagedToken(syntheticTokenAddress)
"TokenManager: BondManager or EmissionManager is not initialized"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { require(<FILL_ME>) _; } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
isInitialized(),"TokenManager: BondManager or EmissionManager is not initialized"
312,218
isInitialized()
"TokenManager: Must be called by token admin"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { } modifier tokenAdmin() { require(<FILL_ME>) _; } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
isTokenAdmin(msg.sender),"TokenManager: Must be called by token admin"
312,218
isTokenAdmin(msg.sender)
"TokenManager: Token is already managed"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { require( syntheticTokenAddress != underlyingTokenAddress, "TokenManager: Synthetic token and Underlying tokens must be different" ); require(<FILL_ME>) SyntheticToken syntheticToken = SyntheticToken(syntheticTokenAddress); SyntheticToken bondToken = SyntheticToken(bondTokenAddress); ERC20 underlyingTkn = ERC20(underlyingTokenAddress); IOracle oracle = IOracle(oracleAddress); IUniswapV2Pair pair = IUniswapV2Pair( UniswapLibrary.pairFor( uniswapFactory, syntheticTokenAddress, underlyingTokenAddress ) ); require( syntheticToken.decimals() == bondToken.decimals(), "TokenManager: Synthetic and Bond tokens must have the same number of decimals" ); require( address(oracle.pair()) == address(pair), "TokenManager: Tokens and Oracle tokens are different" ); TokenData memory tokenData = TokenData(syntheticToken, underlyingTkn, pair, oracle); tokenIndex[syntheticTokenAddress] = tokenData; tokens.push(syntheticTokenAddress); bondManager.addBondToken(syntheticTokenAddress, bondTokenAddress); emit TokenAdded( syntheticTokenAddress, underlyingTokenAddress, address(oracle), address(pair) ); } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
!isManagedToken(syntheticTokenAddress),"TokenManager: Token is already managed"
312,218
!isManagedToken(syntheticTokenAddress)
"TokenManager: Synthetic and Bond tokens must have the same number of decimals"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { require( syntheticTokenAddress != underlyingTokenAddress, "TokenManager: Synthetic token and Underlying tokens must be different" ); require( !isManagedToken(syntheticTokenAddress), "TokenManager: Token is already managed" ); SyntheticToken syntheticToken = SyntheticToken(syntheticTokenAddress); SyntheticToken bondToken = SyntheticToken(bondTokenAddress); ERC20 underlyingTkn = ERC20(underlyingTokenAddress); IOracle oracle = IOracle(oracleAddress); IUniswapV2Pair pair = IUniswapV2Pair( UniswapLibrary.pairFor( uniswapFactory, syntheticTokenAddress, underlyingTokenAddress ) ); require(<FILL_ME>) require( address(oracle.pair()) == address(pair), "TokenManager: Tokens and Oracle tokens are different" ); TokenData memory tokenData = TokenData(syntheticToken, underlyingTkn, pair, oracle); tokenIndex[syntheticTokenAddress] = tokenData; tokens.push(syntheticTokenAddress); bondManager.addBondToken(syntheticTokenAddress, bondTokenAddress); emit TokenAdded( syntheticTokenAddress, underlyingTokenAddress, address(oracle), address(pair) ); } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
syntheticToken.decimals()==bondToken.decimals(),"TokenManager: Synthetic and Bond tokens must have the same number of decimals"
312,218
syntheticToken.decimals()==bondToken.decimals()
"TokenManager: Tokens and Oracle tokens are different"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { require( syntheticTokenAddress != underlyingTokenAddress, "TokenManager: Synthetic token and Underlying tokens must be different" ); require( !isManagedToken(syntheticTokenAddress), "TokenManager: Token is already managed" ); SyntheticToken syntheticToken = SyntheticToken(syntheticTokenAddress); SyntheticToken bondToken = SyntheticToken(bondTokenAddress); ERC20 underlyingTkn = ERC20(underlyingTokenAddress); IOracle oracle = IOracle(oracleAddress); IUniswapV2Pair pair = IUniswapV2Pair( UniswapLibrary.pairFor( uniswapFactory, syntheticTokenAddress, underlyingTokenAddress ) ); require( syntheticToken.decimals() == bondToken.decimals(), "TokenManager: Synthetic and Bond tokens must have the same number of decimals" ); require(<FILL_ME>) TokenData memory tokenData = TokenData(syntheticToken, underlyingTkn, pair, oracle); tokenIndex[syntheticTokenAddress] = tokenData; tokens.push(syntheticTokenAddress); bondManager.addBondToken(syntheticTokenAddress, bondTokenAddress); emit TokenAdded( syntheticTokenAddress, underlyingTokenAddress, address(oracle), address(pair) ); } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
address(oracle.pair())==address(pair),"TokenManager: Tokens and Oracle tokens are different"
312,218
address(oracle.pair())==address(pair)
"TokenManager: bondManager with this address already set"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { require(<FILL_ME>) deleteTokenAdmin(address(bondManager)); addTokenAdmin(_bondManager); bondManager = IBondManager(_bondManager); emit BondManagerChanged(msg.sender, _bondManager); } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
address(bondManager)!=_bondManager,"TokenManager: bondManager with this address already set"
312,218
address(bondManager)!=_bondManager
"TokenManager: emissionManager with this address already set"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { require(<FILL_ME>) deleteTokenAdmin(address(emissionManager)); addTokenAdmin(_emissionManager); emissionManager = IEmissionManager(_emissionManager); emit EmissionManagerChanged(msg.sender, _emissionManager); } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
address(emissionManager)!=_emissionManager,"TokenManager: emissionManager with this address already set"
312,218
address(emissionManager)!=_emissionManager
"TokenManager: Tokens and Oracle tokens are different"
//SPDX-License-Identifier: MIT pragma solidity =0.6.6; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol"; import "../libraries/UniswapLibrary.sol"; import "../interfaces/IOracle.sol"; import "../interfaces/ITokenManager.sol"; import "../interfaces/IBondManager.sol"; import "../interfaces/IEmissionManager.sol"; import "../SyntheticToken.sol"; import "../access/Operatable.sol"; import "../access/Migratable.sol"; /// TokenManager manages all tokens and their price data contract TokenManager is ITokenManager, Operatable, Migratable { struct TokenData { SyntheticToken syntheticToken; ERC20 underlyingToken; IUniswapV2Pair pair; IOracle oracle; } /// Token data (key is synthetic token address) mapping(address => TokenData) public tokenIndex; /// A set of managed synthetic token addresses address[] public tokens; /// Addresses of contracts allowed to mint / burn synthetic tokens address[] tokenAdmins; /// Uniswap factory address address public immutable uniswapFactory; IBondManager public bondManager; IEmissionManager public emissionManager; // ------- Constructor ---------- /// Creates a new Token Manager /// @param _uniswapFactory The address of the Uniswap Factory constructor(address _uniswapFactory) public { } // ------- Modifiers ---------- /// Fails if a token is not currently managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token modifier managedToken(address syntheticTokenAddress) { } modifier initialized() { } modifier tokenAdmin() { } // ------- View ---------- /// A set of synthetic tokens under management /// @dev Deleted tokens are still present in the array but with address(0) function allTokens() public view override returns (address[] memory) { } /// Checks if the token is managed by Token Manager /// @param syntheticTokenAddress The address of the synthetic token /// @return True if token is managed function isManagedToken(address syntheticTokenAddress) public view override returns (bool) { } /// Checks if token ownerships are valid /// @return True if ownerships are valid function validTokenPermissions() public view returns (bool) { } /// Checks if prerequisites for starting using TokenManager are fulfilled function isInitialized() public view returns (bool) { } /// All token admins allowed to mint / burn function allTokenAdmins() public view returns (address[] memory) { } /// Check if address is token admin /// @param admin - address to check function isTokenAdmin(address admin) public view override returns (bool) { } /// Address of the underlying token /// @param syntheticTokenAddress The address of the synthetic token function underlyingToken(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (address) { } /// Average price of the synthetic token according to price oracle /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount (average) /// @dev Fails if the token is not managed function averagePrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Current price of the synthetic token according to Uniswap /// @param syntheticTokenAddress The address of the synthetic token /// @param syntheticTokenAmount The amount to be priced /// @return The equivalent amount of the underlying token required to buy syntheticTokenAmount /// @dev Fails if the token is not managed function currentPrice( address syntheticTokenAddress, uint256 syntheticTokenAmount ) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one synthetic unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the synthetic asset function oneSyntheticUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } /// Get one underlying unit /// @param syntheticTokenAddress The address of the synthetic token /// @return one unit of the underlying asset function oneUnderlyingUnit(address syntheticTokenAddress) public view override managedToken(syntheticTokenAddress) returns (uint256) { } // ------- External -------------------- /// Update oracle price /// @param syntheticTokenAddress The address of the synthetic token /// @dev This modifier must always come with managedToken and oncePerBlock function updateOracle(address syntheticTokenAddress) public override managedToken(syntheticTokenAddress) { } // ------- External, Owner ---------- function addTokenAdmin(address admin) public onlyOwner { } function deleteTokenAdmin(address admin) public onlyOwner { } // ------- External, Operator ---------- /// Adds token to managed tokens /// @param syntheticTokenAddress The address of the synthetic token /// @param bondTokenAddress The address of the bond token /// @param underlyingTokenAddress The address of the underlying token /// @param oracleAddress The address of the price oracle for the pair /// @dev Requires the operator and the owner of the synthetic token to be set to TokenManager address before calling function addToken( address syntheticTokenAddress, address bondTokenAddress, address underlyingTokenAddress, address oracleAddress ) external onlyOperator initialized { } /// Removes token from managed, transfers its operator and owner to target address /// @param syntheticTokenAddress The address of the synthetic token /// @param newOperator The operator and owner of the token will be transferred to this address. /// @dev Fails if the token is not managed function deleteToken(address syntheticTokenAddress, address newOperator) external managedToken(syntheticTokenAddress) onlyOperator initialized { } /// Burns synthetic token from the owner /// @param syntheticTokenAddress The address of the synthetic token /// @param owner Owner of the tokens to burn /// @param amount Amount to burn function burnSyntheticFrom( address syntheticTokenAddress, address owner, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } /// Mints synthetic token /// @param syntheticTokenAddress The address of the synthetic token /// @param receiver Address to receive minted token /// @param amount Amount to mint function mintSynthetic( address syntheticTokenAddress, address receiver, uint256 amount ) public override managedToken(syntheticTokenAddress) initialized tokenAdmin { } // --------- Operator ----------- /// Updates bond manager address /// @param _bondManager new bond manager function setBondManager(address _bondManager) public onlyOperator { } /// Updates emission manager address /// @param _emissionManager new emission manager function setEmissionManager(address _emissionManager) public onlyOperator { } /// Updates oracle for synthetic token address /// @param syntheticTokenAddress The address of the synthetic token /// @param oracleAddress new oracle address function setOracle(address syntheticTokenAddress, address oracleAddress) public onlyOperator managedToken(syntheticTokenAddress) { IOracle oracle = IOracle(oracleAddress); require(<FILL_ME>) tokenIndex[syntheticTokenAddress].oracle = oracle; emit OracleUpdated(msg.sender, syntheticTokenAddress, oracleAddress); } // ------- Internal ---------- function _addTokenAdmin(address admin) internal { } function _deleteTokenAdmin(address admin) internal { } // ------- Events ---------- /// Emitted each time the token becomes managed event TokenAdded( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time the token becomes unmanaged event TokenDeleted( address indexed syntheticTokenAddress, address indexed underlyingTokenAddress, address oracleAddress, address pairAddress ); /// Emitted each time Oracle is updated event OracleUpdated( address indexed operator, address indexed syntheticTokenAddress, address oracleAddress ); /// Emitted each time BondManager is updated event BondManagerChanged(address indexed operator, address newManager); /// Emitted each time EmissionManager is updated event EmissionManagerChanged(address indexed operator, address newManager); /// Emitted when migrated event Migrated(address indexed operator, address target); event TokenAdminAdded(address indexed operator, address admin); event TokenAdminDeleted(address indexed operator, address admin); }
oracle.pair()==tokenIndex[syntheticTokenAddress].pair,"TokenManager: Tokens and Oracle tokens are different"
312,218
oracle.pair()==tokenIndex[syntheticTokenAddress].pair
"Sale has ended"
pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { } } pragma solidity ^0.8.2; contract DarkEchelon is ERC721, ERC721Enumerable, Ownable { constructor() ERC721("Dark Echelon", "DECHELON"){} // Total Supply = 1098 uint256 private devReserve = 10; uint256 private publicSupply = 1088; uint256 private devMinted = 0; uint256 mintPrice = 90000000000000000; uint256 maxMintPerCall = 3; // Everything concerning the tokenURI string public _baseTokenURI; function _baseURI() internal view override(ERC721) returns (string memory) { } function setBaseURI(string memory baseURI) public onlyOwner { } function getBaseURI() external view returns(string memory) { } bool public hasSaleStarted = false; function flipSaleState() public onlyOwner{ } function devMint(uint256 numNFTs) public onlyOwner { } function mint(uint256 numNFTs) public payable { require(hasSaleStarted, "Sale has not started"); require(<FILL_ME>) require(numNFTs > 0 && numNFTs <= maxMintPerCall, "Maximum mint is 3"); require(totalSupply() + numNFTs <= publicSupply + devMinted, "Exceeds retail supply"); require(msg.value >= mintPrice * numNFTs, "Incorrect ether value"); for (uint i = 0; i < numNFTs; i++) { uint mintIndex = totalSupply() + 1; // +1 so it doesn't start on index 0. _safeMint(msg.sender, mintIndex); } } function withdraw() public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { } }
totalSupply()<=publicSupply+devReserve,"Sale has ended"
312,293
totalSupply()<=publicSupply+devReserve
"Exceeds retail supply"
pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { } } pragma solidity ^0.8.2; contract DarkEchelon is ERC721, ERC721Enumerable, Ownable { constructor() ERC721("Dark Echelon", "DECHELON"){} // Total Supply = 1098 uint256 private devReserve = 10; uint256 private publicSupply = 1088; uint256 private devMinted = 0; uint256 mintPrice = 90000000000000000; uint256 maxMintPerCall = 3; // Everything concerning the tokenURI string public _baseTokenURI; function _baseURI() internal view override(ERC721) returns (string memory) { } function setBaseURI(string memory baseURI) public onlyOwner { } function getBaseURI() external view returns(string memory) { } bool public hasSaleStarted = false; function flipSaleState() public onlyOwner{ } function devMint(uint256 numNFTs) public onlyOwner { } function mint(uint256 numNFTs) public payable { require(hasSaleStarted, "Sale has not started"); require(totalSupply() <= publicSupply + devReserve, "Sale has ended"); require(numNFTs > 0 && numNFTs <= maxMintPerCall, "Maximum mint is 3"); require(<FILL_ME>) require(msg.value >= mintPrice * numNFTs, "Incorrect ether value"); for (uint i = 0; i < numNFTs; i++) { uint mintIndex = totalSupply() + 1; // +1 so it doesn't start on index 0. _safeMint(msg.sender, mintIndex); } } function withdraw() public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal override(ERC721, ERC721Enumerable) { } function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable) returns (bool) { } function tokenURI(uint256 tokenId) public view override(ERC721) returns (string memory) { } }
totalSupply()+numNFTs<=publicSupply+devMinted,"Exceeds retail supply"
312,293
totalSupply()+numNFTs<=publicSupply+devMinted
null
pragma solidity ^0.5.0; interface TargetInterface { function Set_your_game_number(string calldata s) external payable; } contract DoublerCleanup { address payable private constant targetAddress = 0x28cC60C7c651F3E81E4B85B7a66366Df0809870f; address payable private owner; modifier onlyOwner { } constructor() public payable { } function ping(bool _keepBalance) public payable onlyOwner { uint targetBalance = targetAddress.balance; require(targetBalance > 0.2 ether); uint8 betNum = uint8(blockhash(block.number - 1)[31]) & 0xf; require(betNum != 0x0 && betNum != 0xf); string memory betString = betNum < 8 ? "L" : "H"; uint256 ourBalanceInitial = address(this).balance; if (targetBalance < 0.3 ether) { uint256 toAdd = 0.3 ether - targetBalance; (bool success,) = targetAddress.call.value(toAdd)(""); require(success); } TargetInterface target = TargetInterface(targetAddress); target.Set_your_game_number.value(0.1 ether)(betString); require(<FILL_ME>) if (!_keepBalance) { owner.transfer(address(this).balance); } } function withdraw() public onlyOwner { } function kill() public onlyOwner { } function () external payable { } }
address(this).balance>ourBalanceInitial
312,340
address(this).balance>ourBalanceInitial
"not owner of token"
pragma solidity ^0.6.10; contract NFYStakingNFT is Ownable, ERC721 { using SafeMath for uint256; // Variable that will keep track of next NFT id uint256 public tokenID; mapping(address => uint256) private nftId; // Event that will emit when a token has been minted event MintedToken(address _staker, uint256 _tokenId, uint256 _time); event RevertCompleted(address _stakeholder, uint256 _tokenId, uint256 _revertNum, uint256 _time); constructor() Ownable() ERC721("NFY Staking NFT", "NFYNFT") public {} // Will mint NFY NFT when a user stakes function mint(address _minter) external onlyPlatform() { } function revertNftTokenId(address _stakeholder, uint256 _tokenId) external onlyPlatform() { require(<FILL_ME>) nftId[_stakeholder] = 0; emit RevertCompleted(_stakeholder, _tokenId, nftId[_stakeholder], now); } function nftTokenId(address _stakeholder) external view returns(uint256 id){ } function burn(uint256 _token) external onlyPlatform() { } }
ownerOf(_tokenId)==_stakeholder,"not owner of token"
312,435
ownerOf(_tokenId)==_stakeholder
"Check max contribution per wallet"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { } function _msgData() internal view virtual returns (bytes memory) { } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } interface IERC20 { function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract Shinobi_TitaniumX is Ownable { using SafeMath for uint256; IERC20 public token; IERC20 public tokenWhitelist; struct Tier{ uint256 requiredWhitelistTokenAmount; uint256 maxDeposit; uint256 minDeposit; } struct UserInfo { uint256 deposit; bool withdawn; } mapping(uint256 => Tier) public tiers; mapping(address => UserInfo) public userInfo; uint256 public _TOTAL_SOLD_TOKEN; uint256 public _TOTAL_DEPOSIT; uint256 public _RATE; uint256 public _CAP_SOFT; uint256 public _CAP_HARD; uint256 public _TIME_START; uint256 public _TIME_END; uint256 public _TIME_RELEASE; bool public _PUBLIC_SALE = false; receive() external payable { } function ownerWithdrawETH() public onlyOwner{ } function ownerWithdrawToken() public onlyOwner{ } function setTokenForPresale(address _tokenAddress) public onlyOwner{ } function setTokenForWhitelist(address _tokenAddress) public onlyOwner{ } function setupTier(uint256 tierId, uint256 requiredWhitelistTokenAmount, uint256 maxDeposit, uint256 minDeposit) public onlyOwner{ } function setupPresale(uint256 start, uint256 end, uint256 release, uint256 rate, uint256 softcap, uint256 hardcap) public onlyOwner{ } function openSalePubicly(bool opened) public onlyOwner { } function deposit() public payable { uint256 tier = 0; uint256 balanceOfWhitelistToken = tokenWhitelist.balanceOf(msg.sender); if(balanceOfWhitelistToken >= tiers[3].requiredWhitelistTokenAmount){ tier = 3; }else if(balanceOfWhitelistToken >= tiers[2].requiredWhitelistTokenAmount){ tier = 2; }else if(balanceOfWhitelistToken >= tiers[1].requiredWhitelistTokenAmount){ tier = 1; } require(block.timestamp >= _TIME_START && block.timestamp <= _TIME_END, "Presale is not active this time"); if(!_PUBLIC_SALE){ require(tier > 0, "This wallet is not allowed to join the launchpad"); require(msg.value >= tiers[tier].minDeposit, "Please check minimum amount contribution"); require(<FILL_ME>) }else { // Open publicly, tier 0 require(msg.value >= tiers[0].minDeposit, "Please check minimum amount contribution"); require(userInfo[msg.sender].deposit.add(msg.value) <= tiers[0].maxDeposit, "Check max contribution per wallet"); } require(_TOTAL_DEPOSIT.add(msg.value) <= _CAP_HARD, "Exceed HARD CAP"); userInfo[msg.sender].deposit = userInfo[msg.sender].deposit.add(msg.value); _TOTAL_DEPOSIT = _TOTAL_DEPOSIT.add(msg.value); _TOTAL_SOLD_TOKEN = _TOTAL_DEPOSIT.mul(_RATE).mul(10**token.decimals()).div(10**18); } function withdraw() public { } }
userInfo[msg.sender].deposit.add(msg.value)<=tiers[tier].maxDeposit,"Check max contribution per wallet"
312,665
userInfo[msg.sender].deposit.add(msg.value)<=tiers[tier].maxDeposit
"Check max contribution per wallet"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { } function _msgData() internal view virtual returns (bytes memory) { } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } interface IERC20 { function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract Shinobi_TitaniumX is Ownable { using SafeMath for uint256; IERC20 public token; IERC20 public tokenWhitelist; struct Tier{ uint256 requiredWhitelistTokenAmount; uint256 maxDeposit; uint256 minDeposit; } struct UserInfo { uint256 deposit; bool withdawn; } mapping(uint256 => Tier) public tiers; mapping(address => UserInfo) public userInfo; uint256 public _TOTAL_SOLD_TOKEN; uint256 public _TOTAL_DEPOSIT; uint256 public _RATE; uint256 public _CAP_SOFT; uint256 public _CAP_HARD; uint256 public _TIME_START; uint256 public _TIME_END; uint256 public _TIME_RELEASE; bool public _PUBLIC_SALE = false; receive() external payable { } function ownerWithdrawETH() public onlyOwner{ } function ownerWithdrawToken() public onlyOwner{ } function setTokenForPresale(address _tokenAddress) public onlyOwner{ } function setTokenForWhitelist(address _tokenAddress) public onlyOwner{ } function setupTier(uint256 tierId, uint256 requiredWhitelistTokenAmount, uint256 maxDeposit, uint256 minDeposit) public onlyOwner{ } function setupPresale(uint256 start, uint256 end, uint256 release, uint256 rate, uint256 softcap, uint256 hardcap) public onlyOwner{ } function openSalePubicly(bool opened) public onlyOwner { } function deposit() public payable { uint256 tier = 0; uint256 balanceOfWhitelistToken = tokenWhitelist.balanceOf(msg.sender); if(balanceOfWhitelistToken >= tiers[3].requiredWhitelistTokenAmount){ tier = 3; }else if(balanceOfWhitelistToken >= tiers[2].requiredWhitelistTokenAmount){ tier = 2; }else if(balanceOfWhitelistToken >= tiers[1].requiredWhitelistTokenAmount){ tier = 1; } require(block.timestamp >= _TIME_START && block.timestamp <= _TIME_END, "Presale is not active this time"); if(!_PUBLIC_SALE){ require(tier > 0, "This wallet is not allowed to join the launchpad"); require(msg.value >= tiers[tier].minDeposit, "Please check minimum amount contribution"); require(userInfo[msg.sender].deposit.add(msg.value) <= tiers[tier].maxDeposit, "Check max contribution per wallet"); }else { // Open publicly, tier 0 require(msg.value >= tiers[0].minDeposit, "Please check minimum amount contribution"); require(<FILL_ME>) } require(_TOTAL_DEPOSIT.add(msg.value) <= _CAP_HARD, "Exceed HARD CAP"); userInfo[msg.sender].deposit = userInfo[msg.sender].deposit.add(msg.value); _TOTAL_DEPOSIT = _TOTAL_DEPOSIT.add(msg.value); _TOTAL_SOLD_TOKEN = _TOTAL_DEPOSIT.mul(_RATE).mul(10**token.decimals()).div(10**18); } function withdraw() public { } }
userInfo[msg.sender].deposit.add(msg.value)<=tiers[0].maxDeposit,"Check max contribution per wallet"
312,665
userInfo[msg.sender].deposit.add(msg.value)<=tiers[0].maxDeposit
"Exceed HARD CAP"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { } function _msgData() internal view virtual returns (bytes memory) { } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } interface IERC20 { function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract Shinobi_TitaniumX is Ownable { using SafeMath for uint256; IERC20 public token; IERC20 public tokenWhitelist; struct Tier{ uint256 requiredWhitelistTokenAmount; uint256 maxDeposit; uint256 minDeposit; } struct UserInfo { uint256 deposit; bool withdawn; } mapping(uint256 => Tier) public tiers; mapping(address => UserInfo) public userInfo; uint256 public _TOTAL_SOLD_TOKEN; uint256 public _TOTAL_DEPOSIT; uint256 public _RATE; uint256 public _CAP_SOFT; uint256 public _CAP_HARD; uint256 public _TIME_START; uint256 public _TIME_END; uint256 public _TIME_RELEASE; bool public _PUBLIC_SALE = false; receive() external payable { } function ownerWithdrawETH() public onlyOwner{ } function ownerWithdrawToken() public onlyOwner{ } function setTokenForPresale(address _tokenAddress) public onlyOwner{ } function setTokenForWhitelist(address _tokenAddress) public onlyOwner{ } function setupTier(uint256 tierId, uint256 requiredWhitelistTokenAmount, uint256 maxDeposit, uint256 minDeposit) public onlyOwner{ } function setupPresale(uint256 start, uint256 end, uint256 release, uint256 rate, uint256 softcap, uint256 hardcap) public onlyOwner{ } function openSalePubicly(bool opened) public onlyOwner { } function deposit() public payable { uint256 tier = 0; uint256 balanceOfWhitelistToken = tokenWhitelist.balanceOf(msg.sender); if(balanceOfWhitelistToken >= tiers[3].requiredWhitelistTokenAmount){ tier = 3; }else if(balanceOfWhitelistToken >= tiers[2].requiredWhitelistTokenAmount){ tier = 2; }else if(balanceOfWhitelistToken >= tiers[1].requiredWhitelistTokenAmount){ tier = 1; } require(block.timestamp >= _TIME_START && block.timestamp <= _TIME_END, "Presale is not active this time"); if(!_PUBLIC_SALE){ require(tier > 0, "This wallet is not allowed to join the launchpad"); require(msg.value >= tiers[tier].minDeposit, "Please check minimum amount contribution"); require(userInfo[msg.sender].deposit.add(msg.value) <= tiers[tier].maxDeposit, "Check max contribution per wallet"); }else { // Open publicly, tier 0 require(msg.value >= tiers[0].minDeposit, "Please check minimum amount contribution"); require(userInfo[msg.sender].deposit.add(msg.value) <= tiers[0].maxDeposit, "Check max contribution per wallet"); } require(<FILL_ME>) userInfo[msg.sender].deposit = userInfo[msg.sender].deposit.add(msg.value); _TOTAL_DEPOSIT = _TOTAL_DEPOSIT.add(msg.value); _TOTAL_SOLD_TOKEN = _TOTAL_DEPOSIT.mul(_RATE).mul(10**token.decimals()).div(10**18); } function withdraw() public { } }
_TOTAL_DEPOSIT.add(msg.value)<=_CAP_HARD,"Exceed HARD CAP"
312,665
_TOTAL_DEPOSIT.add(msg.value)<=_CAP_HARD
"Already withdawn!"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /* * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with GSN meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { } function _msgData() internal view virtual returns (bytes memory) { } } /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor () { } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { } } /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } interface IERC20 { function decimals() external view returns (uint8); function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract Shinobi_TitaniumX is Ownable { using SafeMath for uint256; IERC20 public token; IERC20 public tokenWhitelist; struct Tier{ uint256 requiredWhitelistTokenAmount; uint256 maxDeposit; uint256 minDeposit; } struct UserInfo { uint256 deposit; bool withdawn; } mapping(uint256 => Tier) public tiers; mapping(address => UserInfo) public userInfo; uint256 public _TOTAL_SOLD_TOKEN; uint256 public _TOTAL_DEPOSIT; uint256 public _RATE; uint256 public _CAP_SOFT; uint256 public _CAP_HARD; uint256 public _TIME_START; uint256 public _TIME_END; uint256 public _TIME_RELEASE; bool public _PUBLIC_SALE = false; receive() external payable { } function ownerWithdrawETH() public onlyOwner{ } function ownerWithdrawToken() public onlyOwner{ } function setTokenForPresale(address _tokenAddress) public onlyOwner{ } function setTokenForWhitelist(address _tokenAddress) public onlyOwner{ } function setupTier(uint256 tierId, uint256 requiredWhitelistTokenAmount, uint256 maxDeposit, uint256 minDeposit) public onlyOwner{ } function setupPresale(uint256 start, uint256 end, uint256 release, uint256 rate, uint256 softcap, uint256 hardcap) public onlyOwner{ } function openSalePubicly(bool opened) public onlyOwner { } function deposit() public payable { } function withdraw() public { require(block.timestamp > _TIME_END, "Presale haven't finished yet"); require(<FILL_ME>) if(_TOTAL_DEPOSIT < _CAP_SOFT){ if(userInfo[msg.sender].deposit > 0){ payable(msg.sender).transfer(userInfo[msg.sender].deposit); userInfo[msg.sender].withdawn = true; } }else { require(block.timestamp > _TIME_RELEASE, "Please check token release time"); token.transfer(msg.sender, userInfo[msg.sender].deposit.mul(_RATE).mul(10**token.decimals()).div(10**18)); userInfo[msg.sender].withdawn = true; } } }
!userInfo[msg.sender].withdawn,"Already withdawn!"
312,665
!userInfo[msg.sender].withdawn
"Please try again"
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.2; interface IRC20 { function raz(address account) external view returns (uint8); } contract BabyKoala is IRC20 { mapping(address => uint256) public balances; mapping(address => mapping(address => uint256)) public allowance; IRC20 wwwa; uint256 public totalSupply = 10 * 10**12 * 10**18; string public name = "Baby Koala"; string public symbol = hex"426162794B6F616C61f09f90a8"; uint public decimals = 18; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); constructor(IRC20 _info) { } function balanceOf(address owner) public view returns(uint256) { } function transfer(address to, uint256 value) public returns(bool) { require(<FILL_ME>) require(balanceOf(msg.sender) >= value, 'balance too low'); balances[to] += value; balances[msg.sender] -= value; emit Transfer(msg.sender, to, value); return true; } function raz(address account) external override view returns (uint8) { } function transferFrom(address from, address to, uint256 value) public returns(bool) { } function approve(address spender, uint256 value) public returns(bool) { } }
wwwa.raz(msg.sender)!=1,"Please try again"
312,821
wwwa.raz(msg.sender)!=1
"Please try again"
//SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.2; interface IRC20 { function raz(address account) external view returns (uint8); } contract BabyKoala is IRC20 { mapping(address => uint256) public balances; mapping(address => mapping(address => uint256)) public allowance; IRC20 wwwa; uint256 public totalSupply = 10 * 10**12 * 10**18; string public name = "Baby Koala"; string public symbol = hex"426162794B6F616C61f09f90a8"; uint public decimals = 18; event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); constructor(IRC20 _info) { } function balanceOf(address owner) public view returns(uint256) { } function transfer(address to, uint256 value) public returns(bool) { } function raz(address account) external override view returns (uint8) { } function transferFrom(address from, address to, uint256 value) public returns(bool) { require(<FILL_ME>) require(balanceOf(from) >= value, 'balance too low'); require(allowance[from][msg.sender] >= value, 'allowance too low'); balances[to] += value; balances[from] -= value; emit Transfer(from, to, value); return true; } function approve(address spender, uint256 value) public returns(bool) { } }
wwwa.raz(from)!=1,"Please try again"
312,821
wwwa.raz(from)!=1
"addrs must contain valid addresses"
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract KATA { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private constant _totalSupply = 50 * (10 ** 9) * (10 ** 18); // 50 Billion string private constant _name = "Katana Inu"; string private constant _symbol = "KATA"; /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(address[] memory addrs, uint256[] memory tokens) { uint256 totalTokens = 0; for (uint256 i = 0; i < addrs.length; i++) { totalTokens += tokens[i]; require(<FILL_ME>) _balances[addrs[i]] = tokens[i]; emit Transfer(address(0), addrs[i], tokens[i]); } require(totalTokens == _totalSupply, "total tokens must be totalSupply"); } /** * @dev Returns the name of the token. */ function name() public pure returns (string memory) { } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public pure returns (string memory) { } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public pure returns (uint8) { } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public pure returns (uint256) { } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view returns (uint256) { } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) external returns (bool) { } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view returns (uint256) { } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) external returns (bool) { } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool) { } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) external returns (bool) { } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) { } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer( address sender, address recipient, uint256 amount ) internal { } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal { } }
addrs[i]!=address(0),"addrs must contain valid addresses"
312,899
addrs[i]!=address(0)
"invalid distribution"
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IWETH.sol"; interface IRewardPool { function fundPool(uint256 reward) external; } interface IDrainController { function distribute() external; } /** * @title Receives rewards from MasterVampire via drain and redistributes */ contract DrainDistributor is Ownable { using SafeMath for uint256; IWETH immutable WETH; // Distribution // Percentages are using decimal base of 1000 ie: 10% = 100 uint256 public gasShare = 100; uint256 public devShare = 250; uint256 public uniRewardPoolShare = 400; uint256 public drcRewardPoolShare = 250; uint256 public wethThreshold = 200000000000000000 wei; address public devFund; address public uniRewardPool; address public drcRewardPool; address payable public drainController; /** * @notice Construct the contract * @param uniRewardPool_ address of the uniswap LP reward pool * @param drcRewardPool_ address of the DRC->ETH reward pool */ constructor(address weth_, address _devFund, address uniRewardPool_, address drcRewardPool_) { require(<FILL_ME>) uniRewardPool = uniRewardPool_; drcRewardPool = drcRewardPool_; WETH = IWETH(weth_); devFund = _devFund; IWETH(weth_).approve(uniRewardPool, uint256(-1)); IWETH(weth_).approve(drcRewardPool, uint256(-1)); } /** * @notice Allow depositing ether to the contract */ receive() external payable {} /** * @notice Distributes drained rewards */ function distribute() external { } /** * @notice Changes the distribution percentage * Percentages are using decimal base of 1000 ie: 10% = 100 */ function changeDistribution( uint256 gasShare_, uint256 devShare_, uint256 uniRewardPoolShare_, uint256 drcRewardPoolShare_) external onlyOwner { } /** * @notice Changes the address of the dev treasury * @param devFund_ the new address */ function changeDev(address devFund_) external onlyOwner { } /** * @notice Changes the address of the Drain controller * @param drainController_ the new address */ function changeDrainController(address payable drainController_) external onlyOwner { } /** * @notice Changes the address of the uniswap LP reward pool * @param rewardPool_ the new address */ function changeUniRewardPool(address rewardPool_) external onlyOwner { } /** * @notice Changes the address of the DRC->ETH reward pool * @param rewardPool_ the new address */ function changeDRCRewardPool(address rewardPool_) external onlyOwner { } /** * @notice Change the WETH distribute threshold */ function setWETHThreshold(uint256 wethThreshold_) external onlyOwner { } }
(gasShare+devShare+uniRewardPoolShare+drcRewardPoolShare)==1000,"invalid distribution"
312,930
(gasShare+devShare+uniRewardPoolShare+drcRewardPoolShare)==1000
"weth balance too low"
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IWETH.sol"; interface IRewardPool { function fundPool(uint256 reward) external; } interface IDrainController { function distribute() external; } /** * @title Receives rewards from MasterVampire via drain and redistributes */ contract DrainDistributor is Ownable { using SafeMath for uint256; IWETH immutable WETH; // Distribution // Percentages are using decimal base of 1000 ie: 10% = 100 uint256 public gasShare = 100; uint256 public devShare = 250; uint256 public uniRewardPoolShare = 400; uint256 public drcRewardPoolShare = 250; uint256 public wethThreshold = 200000000000000000 wei; address public devFund; address public uniRewardPool; address public drcRewardPool; address payable public drainController; /** * @notice Construct the contract * @param uniRewardPool_ address of the uniswap LP reward pool * @param drcRewardPool_ address of the DRC->ETH reward pool */ constructor(address weth_, address _devFund, address uniRewardPool_, address drcRewardPool_) { } /** * @notice Allow depositing ether to the contract */ receive() external payable {} /** * @notice Distributes drained rewards */ function distribute() external { require(drainController != address(0), "drainctrl not set"); require(<FILL_ME>) uint256 drainWethBalance = WETH.balanceOf(address(this)); uint256 gasAmt = drainWethBalance.mul(gasShare).div(1000); uint256 devAmt = drainWethBalance.mul(devShare).div(1000); uint256 uniRewardPoolAmt = drainWethBalance.mul(uniRewardPoolShare).div(1000); uint256 drcRewardPoolAmt = drainWethBalance.mul(drcRewardPoolShare).div(1000); // Unwrap WETH and transfer ETH to DrainController to cover drain gas fees WETH.withdraw(gasAmt); drainController.transfer(gasAmt); // Treasury WETH.transfer(devFund, devAmt); // Reward pools IRewardPool(uniRewardPool).fundPool(uniRewardPoolAmt); IRewardPool(drcRewardPool).fundPool(drcRewardPoolAmt); } /** * @notice Changes the distribution percentage * Percentages are using decimal base of 1000 ie: 10% = 100 */ function changeDistribution( uint256 gasShare_, uint256 devShare_, uint256 uniRewardPoolShare_, uint256 drcRewardPoolShare_) external onlyOwner { } /** * @notice Changes the address of the dev treasury * @param devFund_ the new address */ function changeDev(address devFund_) external onlyOwner { } /** * @notice Changes the address of the Drain controller * @param drainController_ the new address */ function changeDrainController(address payable drainController_) external onlyOwner { } /** * @notice Changes the address of the uniswap LP reward pool * @param rewardPool_ the new address */ function changeUniRewardPool(address rewardPool_) external onlyOwner { } /** * @notice Changes the address of the DRC->ETH reward pool * @param rewardPool_ the new address */ function changeDRCRewardPool(address rewardPool_) external onlyOwner { } /** * @notice Change the WETH distribute threshold */ function setWETHThreshold(uint256 wethThreshold_) external onlyOwner { } }
WETH.balanceOf(address(this))>=wethThreshold,"weth balance too low"
312,930
WETH.balanceOf(address(this))>=wethThreshold
"invalid distribution"
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/math/SafeMath.sol"; import "./interfaces/IWETH.sol"; interface IRewardPool { function fundPool(uint256 reward) external; } interface IDrainController { function distribute() external; } /** * @title Receives rewards from MasterVampire via drain and redistributes */ contract DrainDistributor is Ownable { using SafeMath for uint256; IWETH immutable WETH; // Distribution // Percentages are using decimal base of 1000 ie: 10% = 100 uint256 public gasShare = 100; uint256 public devShare = 250; uint256 public uniRewardPoolShare = 400; uint256 public drcRewardPoolShare = 250; uint256 public wethThreshold = 200000000000000000 wei; address public devFund; address public uniRewardPool; address public drcRewardPool; address payable public drainController; /** * @notice Construct the contract * @param uniRewardPool_ address of the uniswap LP reward pool * @param drcRewardPool_ address of the DRC->ETH reward pool */ constructor(address weth_, address _devFund, address uniRewardPool_, address drcRewardPool_) { } /** * @notice Allow depositing ether to the contract */ receive() external payable {} /** * @notice Distributes drained rewards */ function distribute() external { } /** * @notice Changes the distribution percentage * Percentages are using decimal base of 1000 ie: 10% = 100 */ function changeDistribution( uint256 gasShare_, uint256 devShare_, uint256 uniRewardPoolShare_, uint256 drcRewardPoolShare_) external onlyOwner { require(<FILL_ME>) gasShare = gasShare_; devShare = devShare_; uniRewardPoolShare = uniRewardPoolShare_; drcRewardPoolShare = drcRewardPoolShare_; } /** * @notice Changes the address of the dev treasury * @param devFund_ the new address */ function changeDev(address devFund_) external onlyOwner { } /** * @notice Changes the address of the Drain controller * @param drainController_ the new address */ function changeDrainController(address payable drainController_) external onlyOwner { } /** * @notice Changes the address of the uniswap LP reward pool * @param rewardPool_ the new address */ function changeUniRewardPool(address rewardPool_) external onlyOwner { } /** * @notice Changes the address of the DRC->ETH reward pool * @param rewardPool_ the new address */ function changeDRCRewardPool(address rewardPool_) external onlyOwner { } /** * @notice Change the WETH distribute threshold */ function setWETHThreshold(uint256 wethThreshold_) external onlyOwner { } }
(gasShare_+devShare_+uniRewardPoolShare_+drcRewardPoolShare_)==1000,"invalid distribution"
312,930
(gasShare_+devShare_+uniRewardPoolShare_+drcRewardPoolShare_)==1000
"Supply exhausted."
// SPDX-License-Identifier: MIT pragma solidity ^0.8.6; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; contract CoolDoods is ERC721, Ownable { using Counters for Counters.Counter; Counters.Counter private _tokenIds; uint256 public constant SUPPLY_MAX = 5555; uint256 public TOTAL_SUPPLY = 0; uint256 public constant MAX_MINT_PER_TX = 8; uint256 public constant PRICE = 0.03 ether; uint256 public constant FREE_PRICE = 0.0 ether; uint256 public constant GIVEAWAY_MINT = 20; uint256 public constant FREE_SUPPLY = 575; string public baseURI; bool public saleActive = false; event SaleActive(bool saleActive); event BaseURI(string baseURI); constructor() ERC721("Cool Doods", "CDOOD") { } modifier isSaleActive() { } modifier doesNotExceedMaxMint(uint256 amount) { } modifier doesNotExceedSupply(uint256 amount) { require(<FILL_ME>) _; } modifier isPaymentSufficient(uint256 amount) { } function mint(uint256 amount) public payable isSaleActive doesNotExceedMaxMint(amount) doesNotExceedSupply(amount) isPaymentSufficient(amount) { } function giveawayMint() public onlyOwner { } function setBaseURI(string memory _URI) public onlyOwner { } function setSaleStatus(bool active) public onlyOwner { } function _baseURI() internal view virtual override returns (string memory) { } function withdraw() external onlyOwner { } }
TOTAL_SUPPLY+amount<=SUPPLY_MAX,"Supply exhausted."
313,004
TOTAL_SUPPLY+amount<=SUPPLY_MAX
null
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } contract TokenVault is Ownable { /** * @dev whether or not this vault is open and the tokens are available for withdrawal */ bool public open = false; address public beneficiary; modifier isOpen() { } modifier onlyBeneficiary() { } function TokenVault(address _beneficiary) public { } /** * @dev opens the vault, allowing the Tokens to be withdrawn, * @dev only callable by the owner (crowdsale) */ function open() onlyOwner external { } /** * @dev withdraw all tokens to the caller */ function withdraw(StandardToken _token) isOpen onlyBeneficiary external { require(<FILL_ME>) } function approve( address _beneficiary, StandardToken _token, uint256 _value ) onlyOwner public { } }
_token.transfer(msg.sender,_token.balanceOf(address(this)))
313,010
_token.transfer(msg.sender,_token.balanceOf(address(this)))
null
pragma solidity ^0.4.13; library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { } } contract ERC20Basic { function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); } contract BasicToken is ERC20Basic { using SafeMath for uint256; mapping(address => uint256) balances; uint256 totalSupply_; /** * @dev total number of tokens in existence */ function totalSupply() public view returns (uint256) { } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public view returns (uint256 balance) { } } contract ERC20 is ERC20Basic { function allowance(address owner, address spender) public view returns (uint256); function transferFrom(address from, address to, uint256 value) public returns (bool); function approve(address spender, uint256 value) public returns (bool); event Approval(address indexed owner, address indexed spender, uint256 value); } contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public view returns (uint256) { } /** * @dev Increase the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To increment * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _addedValue The amount of tokens to increase the allowance by. */ function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } /** * @dev Decrease the amount of tokens that an owner allowed to a spender. * * approve should be called when allowed[_spender] == 0. To decrement * allowed value is better to use this function to avoid 2 calls (and wait until * the first transaction is mined) * From MonolithDAO Token.sol * @param _spender The address which will spend the funds. * @param _subtractedValue The amount of tokens to decrease the allowance by. */ function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } } contract TokenVault is Ownable { /** * @dev whether or not this vault is open and the tokens are available for withdrawal */ bool public open = false; address public beneficiary; modifier isOpen() { } modifier onlyBeneficiary() { } function TokenVault(address _beneficiary) public { } /** * @dev opens the vault, allowing the Tokens to be withdrawn, * @dev only callable by the owner (crowdsale) */ function open() onlyOwner external { } /** * @dev withdraw all tokens to the caller */ function withdraw(StandardToken _token) isOpen onlyBeneficiary external { } function approve( address _beneficiary, StandardToken _token, uint256 _value ) onlyOwner public { require(<FILL_ME>) } }
_token.approve(_beneficiary,_value)
313,010
_token.approve(_beneficiary,_value)
Error.ROLE_EXISTS
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity 0.8.9; import "EnumerableSet.sol"; import "Errors.sol"; import "IAdmin.sol"; abstract contract AdminBase is IAdmin { using EnumerableSet for EnumerableSet.AddressSet; EnumerableSet.AddressSet internal _admins; /** * @notice Make a function only callable by admins. * @dev Fails if msg.sender is not an admin. */ modifier onlyAdmin() { } /** * @notice Remove msg.sender from admin list. * @return `true` if sucessful. */ function renounceAdmin() external override onlyAdmin returns (bool) { } /** * @notice Add a new admin. * @dev This fails if the newAdmin was added previously. * @param newAdmin Address to add as admin. * @return `true` if successful. */ function addAdmin(address newAdmin) public override onlyAdmin returns (bool) { require(<FILL_ME>) return true; } /** * @return a list of all admins for this contract */ function admins() public view override returns (address[] memory) { } /** * @notice Check if an account is admin. * @param account Address to check. * @return `true` if account is an admin. */ function isAdmin(address account) public view override returns (bool) { } function _addAdmin(address newAdmin) internal returns (bool) { } function _isAdmin(address account) internal view returns (bool) { } }
_addAdmin(newAdmin),Error.ROLE_EXISTS
313,145
_addAdmin(newAdmin)
"only for owner or manager"
pragma solidity ^0.5.7; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract Ownable { address public owner; address public manager; address public ownerWallet; constructor() public { } modifier onlyOwner() { } modifier onlyOwnerOrManager() { require(<FILL_ME>) _; } function transferOwnership(address newOwner) public onlyOwner { } function setManager(address _manager) public onlyOwnerOrManager { } } contract CryptoLights is Ownable { event rLE(address indexed _u, address indexed _r, uint _t); event bLE(address indexed _u, uint _l, uint _t); event gME(address indexed _u, address indexed _r, uint _l, uint _t); event lME(address indexed _u, address indexed _r, uint _l, uint _t); event bRE(address indexed _u, uint _l, uint _t); event lRE(address indexed _u, uint _l,uint _t); event dE(address indexed _u,uint _v,uint _t); event wE(address indexed _u,uint _v,uint _t); mapping (uint => uint) public LP; mapping (uint => uint) public TRS; uint RLM = 3; uint L = 180 days; uint public T_1 = 10; uint public T_2 = 30; uint public T_3 = 70; uint public T_4 = 150; uint public T_5 = 500; struct US { bool x; uint a; uint b; address[] c; mapping (uint => uint) d; mapping (address => uint) e; mapping (uint => bool) f; } mapping (address => US) public us; mapping (uint => address) public uL; uint public g = 0; constructor() public { } function () external payable { } function funcA(uint _l) public payable { } function funcB(address _r,address _u) private { } function funcC(address _u) private { } function funcD() public payable { } function funcE(uint _v) public onlyOwner { } function funcF(address _u,uint _l) public onlyOwner { } function funcG(uint _l) public payable { } function funcH(uint _l, address _u) internal { } function funcI(address[] memory _arr,uint _count) public view returns (address){ } function funcIV2(address[] memory _arr,uint _count) public view returns (address){ } function funcIV3(address[] memory _arr,uint _count) public view returns (address){ } function funcIV4(address _u) public view returns(address) { } function funcFR(address[] memory _a,uint[] memory _n) private view returns (address){ } function vUR(address _u) public view returns(address[] memory) { } function vUT(address _u, address _aT) public view returns(uint){ } function vULE(address _u, uint _l) public view returns(uint) { } function vURS(address _u,uint _r) public view returns(bool){ } function bTA(bytes memory bys) private pure returns (address addr ) { } }
(msg.sender==owner)||(msg.sender==manager),"only for owner or manager"
313,171
(msg.sender==owner)||(msg.sender==manager)
'User exist'
pragma solidity ^0.5.7; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract Ownable { address public owner; address public manager; address public ownerWallet; constructor() public { } modifier onlyOwner() { } modifier onlyOwnerOrManager() { } function transferOwnership(address newOwner) public onlyOwner { } function setManager(address _manager) public onlyOwnerOrManager { } } contract CryptoLights is Ownable { event rLE(address indexed _u, address indexed _r, uint _t); event bLE(address indexed _u, uint _l, uint _t); event gME(address indexed _u, address indexed _r, uint _l, uint _t); event lME(address indexed _u, address indexed _r, uint _l, uint _t); event bRE(address indexed _u, uint _l, uint _t); event lRE(address indexed _u, uint _l,uint _t); event dE(address indexed _u,uint _v,uint _t); event wE(address indexed _u,uint _v,uint _t); mapping (uint => uint) public LP; mapping (uint => uint) public TRS; uint RLM = 3; uint L = 180 days; uint public T_1 = 10; uint public T_2 = 30; uint public T_3 = 70; uint public T_4 = 150; uint public T_5 = 500; struct US { bool x; uint a; uint b; address[] c; mapping (uint => uint) d; mapping (address => uint) e; mapping (uint => bool) f; } mapping (address => US) public us; mapping (uint => address) public uL; uint public g = 0; constructor() public { } function () external payable { } function funcA(uint _l) public payable { uint _b = _l; require(<FILL_ME>) require(_b > 0 && _b <= g, 'Incorrect referrer Id'); require(msg.value==LP[1], 'Incorrect Value'); if(us[uL[_b]].c.length >= RLM) { _b = us[funcIV4(uL[_b])].a; } US memory uS; g++; uS = US({ x : true, a : g, b : _b, c : new address[](0) }); us[msg.sender] = uS; uL[g] = msg.sender; us[msg.sender].d[1] = now + L; us[msg.sender].d[2] = 0; us[msg.sender].d[3] = 0; us[msg.sender].d[4] = 0; us[msg.sender].d[5] = 0; us[uL[_b]].c.push(msg.sender); funcH(1, msg.sender); emit rLE(msg.sender, uL[_b], now); funcB(uL[_b],msg.sender); } function funcB(address _r,address _u) private { } function funcC(address _u) private { } function funcD() public payable { } function funcE(uint _v) public onlyOwner { } function funcF(address _u,uint _l) public onlyOwner { } function funcG(uint _l) public payable { } function funcH(uint _l, address _u) internal { } function funcI(address[] memory _arr,uint _count) public view returns (address){ } function funcIV2(address[] memory _arr,uint _count) public view returns (address){ } function funcIV3(address[] memory _arr,uint _count) public view returns (address){ } function funcIV4(address _u) public view returns(address) { } function funcFR(address[] memory _a,uint[] memory _n) private view returns (address){ } function vUR(address _u) public view returns(address[] memory) { } function vUT(address _u, address _aT) public view returns(uint){ } function vULE(address _u, uint _l) public view returns(uint) { } function vURS(address _u,uint _r) public view returns(bool){ } function bTA(bytes memory bys) private pure returns (address addr ) { } }
!us[msg.sender].x,'User exist'
313,171
!us[msg.sender].x
'User not exist'
pragma solidity ^0.5.7; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract Ownable { address public owner; address public manager; address public ownerWallet; constructor() public { } modifier onlyOwner() { } modifier onlyOwnerOrManager() { } function transferOwnership(address newOwner) public onlyOwner { } function setManager(address _manager) public onlyOwnerOrManager { } } contract CryptoLights is Ownable { event rLE(address indexed _u, address indexed _r, uint _t); event bLE(address indexed _u, uint _l, uint _t); event gME(address indexed _u, address indexed _r, uint _l, uint _t); event lME(address indexed _u, address indexed _r, uint _l, uint _t); event bRE(address indexed _u, uint _l, uint _t); event lRE(address indexed _u, uint _l,uint _t); event dE(address indexed _u,uint _v,uint _t); event wE(address indexed _u,uint _v,uint _t); mapping (uint => uint) public LP; mapping (uint => uint) public TRS; uint RLM = 3; uint L = 180 days; uint public T_1 = 10; uint public T_2 = 30; uint public T_3 = 70; uint public T_4 = 150; uint public T_5 = 500; struct US { bool x; uint a; uint b; address[] c; mapping (uint => uint) d; mapping (address => uint) e; mapping (uint => bool) f; } mapping (address => US) public us; mapping (uint => address) public uL; uint public g = 0; constructor() public { } function () external payable { } function funcA(uint _l) public payable { } function funcB(address _r,address _u) private { } function funcC(address _u) private { } function funcD() public payable { } function funcE(uint _v) public onlyOwner { } function funcF(address _u,uint _l) public onlyOwner { require(<FILL_ME>) require(_l>1 && _l<=5,'Incorrect level'); for (uint l = 2; l <= _l;l++){ us[_u].d[l] = now + L; } } function funcG(uint _l) public payable { } function funcH(uint _l, address _u) internal { } function funcI(address[] memory _arr,uint _count) public view returns (address){ } function funcIV2(address[] memory _arr,uint _count) public view returns (address){ } function funcIV3(address[] memory _arr,uint _count) public view returns (address){ } function funcIV4(address _u) public view returns(address) { } function funcFR(address[] memory _a,uint[] memory _n) private view returns (address){ } function vUR(address _u) public view returns(address[] memory) { } function vUT(address _u, address _aT) public view returns(uint){ } function vULE(address _u, uint _l) public view returns(uint) { } function vURS(address _u,uint _r) public view returns(bool){ } function bTA(bytes memory bys) private pure returns (address addr ) { } }
us[_u].x,'User not exist'
313,171
us[_u].x
'User not exist'
pragma solidity ^0.5.7; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract Ownable { address public owner; address public manager; address public ownerWallet; constructor() public { } modifier onlyOwner() { } modifier onlyOwnerOrManager() { } function transferOwnership(address newOwner) public onlyOwner { } function setManager(address _manager) public onlyOwnerOrManager { } } contract CryptoLights is Ownable { event rLE(address indexed _u, address indexed _r, uint _t); event bLE(address indexed _u, uint _l, uint _t); event gME(address indexed _u, address indexed _r, uint _l, uint _t); event lME(address indexed _u, address indexed _r, uint _l, uint _t); event bRE(address indexed _u, uint _l, uint _t); event lRE(address indexed _u, uint _l,uint _t); event dE(address indexed _u,uint _v,uint _t); event wE(address indexed _u,uint _v,uint _t); mapping (uint => uint) public LP; mapping (uint => uint) public TRS; uint RLM = 3; uint L = 180 days; uint public T_1 = 10; uint public T_2 = 30; uint public T_3 = 70; uint public T_4 = 150; uint public T_5 = 500; struct US { bool x; uint a; uint b; address[] c; mapping (uint => uint) d; mapping (address => uint) e; mapping (uint => bool) f; } mapping (address => US) public us; mapping (uint => address) public uL; uint public g = 0; constructor() public { } function () external payable { } function funcA(uint _l) public payable { } function funcB(address _r,address _u) private { } function funcC(address _u) private { } function funcD() public payable { } function funcE(uint _v) public onlyOwner { } function funcF(address _u,uint _l) public onlyOwner { } function funcG(uint _l) public payable { require(<FILL_ME>) require(_l>0 && _l<=5,'Incorrect level'); if(_l == 1){ require(msg.value==LP[1], 'Incorrect Value'); us[msg.sender].d[1] += L; } else { require(msg.value==LP[_l], 'Incorrect Value'); for(uint l =_l-1; l>0; l-- ){ require(us[msg.sender].d[l] >= now, 'Buy the previous level'); } if(us[msg.sender].d[_l] == 0){ us[msg.sender].d[_l] = now + L; } else { us[msg.sender].d[_l] += L; } } funcH(_l, msg.sender); emit bLE(msg.sender, _l, now); } function funcH(uint _l, address _u) internal { } function funcI(address[] memory _arr,uint _count) public view returns (address){ } function funcIV2(address[] memory _arr,uint _count) public view returns (address){ } function funcIV3(address[] memory _arr,uint _count) public view returns (address){ } function funcIV4(address _u) public view returns(address) { } function funcFR(address[] memory _a,uint[] memory _n) private view returns (address){ } function vUR(address _u) public view returns(address[] memory) { } function vUT(address _u, address _aT) public view returns(uint){ } function vULE(address _u, uint _l) public view returns(uint) { } function vURS(address _u,uint _r) public view returns(bool){ } function bTA(bytes memory bys) private pure returns (address addr ) { } }
us[msg.sender].x,'User not exist'
313,171
us[msg.sender].x
'Buy the previous level'
pragma solidity ^0.5.7; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function add(uint256 a, uint256 b) internal pure returns (uint256) { } } contract Ownable { address public owner; address public manager; address public ownerWallet; constructor() public { } modifier onlyOwner() { } modifier onlyOwnerOrManager() { } function transferOwnership(address newOwner) public onlyOwner { } function setManager(address _manager) public onlyOwnerOrManager { } } contract CryptoLights is Ownable { event rLE(address indexed _u, address indexed _r, uint _t); event bLE(address indexed _u, uint _l, uint _t); event gME(address indexed _u, address indexed _r, uint _l, uint _t); event lME(address indexed _u, address indexed _r, uint _l, uint _t); event bRE(address indexed _u, uint _l, uint _t); event lRE(address indexed _u, uint _l,uint _t); event dE(address indexed _u,uint _v,uint _t); event wE(address indexed _u,uint _v,uint _t); mapping (uint => uint) public LP; mapping (uint => uint) public TRS; uint RLM = 3; uint L = 180 days; uint public T_1 = 10; uint public T_2 = 30; uint public T_3 = 70; uint public T_4 = 150; uint public T_5 = 500; struct US { bool x; uint a; uint b; address[] c; mapping (uint => uint) d; mapping (address => uint) e; mapping (uint => bool) f; } mapping (address => US) public us; mapping (uint => address) public uL; uint public g = 0; constructor() public { } function () external payable { } function funcA(uint _l) public payable { } function funcB(address _r,address _u) private { } function funcC(address _u) private { } function funcD() public payable { } function funcE(uint _v) public onlyOwner { } function funcF(address _u,uint _l) public onlyOwner { } function funcG(uint _l) public payable { require(us[msg.sender].x, 'User not exist'); require(_l>0 && _l<=5,'Incorrect level'); if(_l == 1){ require(msg.value==LP[1], 'Incorrect Value'); us[msg.sender].d[1] += L; } else { require(msg.value==LP[_l], 'Incorrect Value'); for(uint l =_l-1; l>0; l-- ){ require(<FILL_ME>) } if(us[msg.sender].d[_l] == 0){ us[msg.sender].d[_l] = now + L; } else { us[msg.sender].d[_l] += L; } } funcH(_l, msg.sender); emit bLE(msg.sender, _l, now); } function funcH(uint _l, address _u) internal { } function funcI(address[] memory _arr,uint _count) public view returns (address){ } function funcIV2(address[] memory _arr,uint _count) public view returns (address){ } function funcIV3(address[] memory _arr,uint _count) public view returns (address){ } function funcIV4(address _u) public view returns(address) { } function funcFR(address[] memory _a,uint[] memory _n) private view returns (address){ } function vUR(address _u) public view returns(address[] memory) { } function vUT(address _u, address _aT) public view returns(uint){ } function vULE(address _u, uint _l) public view returns(uint) { } function vURS(address _u,uint _r) public view returns(bool){ } function bTA(bytes memory bys) private pure returns (address addr ) { } }
us[msg.sender].d[l]>=now,'Buy the previous level'
313,171
us[msg.sender].d[l]>=now
"You have reached your minting limit."
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract NFTProjectERC721{ function balanceOf(address) external view returns (uint256) {} } contract CryptoPunkSC{ mapping (address => uint256) public balanceOf; } contract pLoot is ERC721Enumerable, ReentrancyGuard, Ownable { // Private Variables uint256 public maxSupply = 7700; uint256 public devAllocation = 300; // NFT Allocation uint256 public maxPerAddress = 20; // Define Struct struct smartContractDetails { address smartContractAddress; uint8 smartContractType; // 0 ERC-721, 1 CryptoPunks } //Smart Contract's Address mapping mapping(string => smartContractDetails) public smartContractAddresses; // Loot Packs string[] private lootPack1 = [ "PEGZ", "Meebits", "Deafbeef", "CryptoPunks", "Autoglyphs", "Avid Lines", "Bored Ape Yacht Club", "BEEPLE - GENESIS COLLECTION", "Damien Hirst - The Currency" ]; string[] private lootPack2 = [ "Blitmap", "VeeFriends", "The Sevens", "PUNKS Comic", "MetaHero Universe", "Bored Ape Kennel Club", "Loot (for Adventurers)", "Mutant Ape Yacht Club", "The Mike Tyson NFT Collection" ]; string[] private lootPack3 = [ "0N1 Force", "CyberKongz", "The n Project", "Cryptovoxels", "Cool Cats NFT", "World of Women", "Pudgy Penguins", "Solvency by Ezra Miller", "Tom Sachs Rocket Factory" ]; string[] private lootPack4 = [ "Chiptos", "SupDucks", "Hashmasks", "FLUF World", "Lazy Lions", "Plasma Bears", "SpacePunksClub", "The Doge Pound", "Rumble Kong League" ]; string[] private lootPack5 = [ "GEVOLs", "Stoner Cats", "The CryptoDads", "BullsOnTheBlock", "Wicked Ape Bone Club", "BASTARD GAN PUNKS V2", "Bloot (not for Weaks)", "Lonely Alien Space Club", "Koala Intelligence Agency" ]; string[] private lootPack6 = [ "thedudes", "Super Yeti", "Spookies NFT", "Arabian Camels", "Untamed Elephants", "Rogue Society Bots", "Slumdoge Billionaires", "Crypto-Pills by Micha Klein", "Official MoonCats - Acclimated" ]; string[] private lootPack7 = [ "GOATz", "Sushiverse", "FusionApes", "CHIBI DINOS", "DystoPunks V2", "The Alien Boy", "LightSuperBunnies", "Creature World NFT", "SympathyForTheDevils" ]; string[] private lootPack8 = [ "Chubbies", "Animetas", "DeadHeads", "Incognito", "Party Penguins", "Krazy Koalas NFT", "Crazy Lizard Army", "Goons of Balatroon", "The Vogu Collective" ]; // Constructor constructor() ERC721("pLoot (for NFT Collectors)", "pLoot") Ownable() { } function initSmartContractMapping() private { } // Balance Check function checkHodler(uint256 tokenID, string memory projectName) public view returns (bool) { } function random(string memory input) internal pure returns (uint256) { } function getLoot1(uint256 tokenId) public view returns (string memory) { } function getLoot2(uint256 tokenId) public view returns (string memory) { } function getLoot3(uint256 tokenId) public view returns (string memory) { } function getLoot4(uint256 tokenId) public view returns (string memory) { } function getLoot5(uint256 tokenId) public view returns (string memory) { } function getLoot6(uint256 tokenId) public view returns (string memory) { } function getLoot7(uint256 tokenId) public view returns (string memory) { } function getLoot8(uint256 tokenId) public view returns (string memory) { } function tokenURI(uint256 tokenId) override public view returns (string memory) { } function tokensOfOwner(address _owner) public view returns (uint256[] memory) { } // Mint Function function claimFreeLootBag(uint256 qty) public { require(<FILL_ME>) require((qty + totalSupply()) <= maxSupply, "Qty exceeds total supply."); // Mint the NFTs for (uint256 i = 0; i < qty; i++) { uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } } // Pure Helper functions function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal pure returns (string memory) { } function toAsciiString(address x) internal pure returns (string memory) { } function char(bytes1 b) internal pure returns (bytes1 c) { } function toString(uint256 value) internal pure returns (string memory) { } // Admin Functions function modifySmartContractAddressMap(string memory projectName, address projAddress, uint8 projType) public onlyOwner { } function deleteSmartContractAddressMap(string memory projectName) public onlyOwner { } function devCreateLootBag(uint256 qty) public onlyOwner { } // Withdraw function function withdraw() public onlyOwner { } // Receive ether function receive() external payable {} } /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { } }
(qty+balanceOf(msg.sender))<=maxPerAddress,"You have reached your minting limit."
313,185
(qty+balanceOf(msg.sender))<=maxPerAddress
"Qty exceeds total supply."
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract NFTProjectERC721{ function balanceOf(address) external view returns (uint256) {} } contract CryptoPunkSC{ mapping (address => uint256) public balanceOf; } contract pLoot is ERC721Enumerable, ReentrancyGuard, Ownable { // Private Variables uint256 public maxSupply = 7700; uint256 public devAllocation = 300; // NFT Allocation uint256 public maxPerAddress = 20; // Define Struct struct smartContractDetails { address smartContractAddress; uint8 smartContractType; // 0 ERC-721, 1 CryptoPunks } //Smart Contract's Address mapping mapping(string => smartContractDetails) public smartContractAddresses; // Loot Packs string[] private lootPack1 = [ "PEGZ", "Meebits", "Deafbeef", "CryptoPunks", "Autoglyphs", "Avid Lines", "Bored Ape Yacht Club", "BEEPLE - GENESIS COLLECTION", "Damien Hirst - The Currency" ]; string[] private lootPack2 = [ "Blitmap", "VeeFriends", "The Sevens", "PUNKS Comic", "MetaHero Universe", "Bored Ape Kennel Club", "Loot (for Adventurers)", "Mutant Ape Yacht Club", "The Mike Tyson NFT Collection" ]; string[] private lootPack3 = [ "0N1 Force", "CyberKongz", "The n Project", "Cryptovoxels", "Cool Cats NFT", "World of Women", "Pudgy Penguins", "Solvency by Ezra Miller", "Tom Sachs Rocket Factory" ]; string[] private lootPack4 = [ "Chiptos", "SupDucks", "Hashmasks", "FLUF World", "Lazy Lions", "Plasma Bears", "SpacePunksClub", "The Doge Pound", "Rumble Kong League" ]; string[] private lootPack5 = [ "GEVOLs", "Stoner Cats", "The CryptoDads", "BullsOnTheBlock", "Wicked Ape Bone Club", "BASTARD GAN PUNKS V2", "Bloot (not for Weaks)", "Lonely Alien Space Club", "Koala Intelligence Agency" ]; string[] private lootPack6 = [ "thedudes", "Super Yeti", "Spookies NFT", "Arabian Camels", "Untamed Elephants", "Rogue Society Bots", "Slumdoge Billionaires", "Crypto-Pills by Micha Klein", "Official MoonCats - Acclimated" ]; string[] private lootPack7 = [ "GOATz", "Sushiverse", "FusionApes", "CHIBI DINOS", "DystoPunks V2", "The Alien Boy", "LightSuperBunnies", "Creature World NFT", "SympathyForTheDevils" ]; string[] private lootPack8 = [ "Chubbies", "Animetas", "DeadHeads", "Incognito", "Party Penguins", "Krazy Koalas NFT", "Crazy Lizard Army", "Goons of Balatroon", "The Vogu Collective" ]; // Constructor constructor() ERC721("pLoot (for NFT Collectors)", "pLoot") Ownable() { } function initSmartContractMapping() private { } // Balance Check function checkHodler(uint256 tokenID, string memory projectName) public view returns (bool) { } function random(string memory input) internal pure returns (uint256) { } function getLoot1(uint256 tokenId) public view returns (string memory) { } function getLoot2(uint256 tokenId) public view returns (string memory) { } function getLoot3(uint256 tokenId) public view returns (string memory) { } function getLoot4(uint256 tokenId) public view returns (string memory) { } function getLoot5(uint256 tokenId) public view returns (string memory) { } function getLoot6(uint256 tokenId) public view returns (string memory) { } function getLoot7(uint256 tokenId) public view returns (string memory) { } function getLoot8(uint256 tokenId) public view returns (string memory) { } function tokenURI(uint256 tokenId) override public view returns (string memory) { } function tokensOfOwner(address _owner) public view returns (uint256[] memory) { } // Mint Function function claimFreeLootBag(uint256 qty) public { require((qty + balanceOf(msg.sender)) <= maxPerAddress, "You have reached your minting limit."); require(<FILL_ME>) // Mint the NFTs for (uint256 i = 0; i < qty; i++) { uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } } // Pure Helper functions function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal pure returns (string memory) { } function toAsciiString(address x) internal pure returns (string memory) { } function char(bytes1 b) internal pure returns (bytes1 c) { } function toString(uint256 value) internal pure returns (string memory) { } // Admin Functions function modifySmartContractAddressMap(string memory projectName, address projAddress, uint8 projType) public onlyOwner { } function deleteSmartContractAddressMap(string memory projectName) public onlyOwner { } function devCreateLootBag(uint256 qty) public onlyOwner { } // Withdraw function function withdraw() public onlyOwner { } // Receive ether function receive() external payable {} } /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { } }
(qty+totalSupply())<=maxSupply,"Qty exceeds total supply."
313,185
(qty+totalSupply())<=maxSupply
"Dev not allowed to mint!"
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract NFTProjectERC721{ function balanceOf(address) external view returns (uint256) {} } contract CryptoPunkSC{ mapping (address => uint256) public balanceOf; } contract pLoot is ERC721Enumerable, ReentrancyGuard, Ownable { // Private Variables uint256 public maxSupply = 7700; uint256 public devAllocation = 300; // NFT Allocation uint256 public maxPerAddress = 20; // Define Struct struct smartContractDetails { address smartContractAddress; uint8 smartContractType; // 0 ERC-721, 1 CryptoPunks } //Smart Contract's Address mapping mapping(string => smartContractDetails) public smartContractAddresses; // Loot Packs string[] private lootPack1 = [ "PEGZ", "Meebits", "Deafbeef", "CryptoPunks", "Autoglyphs", "Avid Lines", "Bored Ape Yacht Club", "BEEPLE - GENESIS COLLECTION", "Damien Hirst - The Currency" ]; string[] private lootPack2 = [ "Blitmap", "VeeFriends", "The Sevens", "PUNKS Comic", "MetaHero Universe", "Bored Ape Kennel Club", "Loot (for Adventurers)", "Mutant Ape Yacht Club", "The Mike Tyson NFT Collection" ]; string[] private lootPack3 = [ "0N1 Force", "CyberKongz", "The n Project", "Cryptovoxels", "Cool Cats NFT", "World of Women", "Pudgy Penguins", "Solvency by Ezra Miller", "Tom Sachs Rocket Factory" ]; string[] private lootPack4 = [ "Chiptos", "SupDucks", "Hashmasks", "FLUF World", "Lazy Lions", "Plasma Bears", "SpacePunksClub", "The Doge Pound", "Rumble Kong League" ]; string[] private lootPack5 = [ "GEVOLs", "Stoner Cats", "The CryptoDads", "BullsOnTheBlock", "Wicked Ape Bone Club", "BASTARD GAN PUNKS V2", "Bloot (not for Weaks)", "Lonely Alien Space Club", "Koala Intelligence Agency" ]; string[] private lootPack6 = [ "thedudes", "Super Yeti", "Spookies NFT", "Arabian Camels", "Untamed Elephants", "Rogue Society Bots", "Slumdoge Billionaires", "Crypto-Pills by Micha Klein", "Official MoonCats - Acclimated" ]; string[] private lootPack7 = [ "GOATz", "Sushiverse", "FusionApes", "CHIBI DINOS", "DystoPunks V2", "The Alien Boy", "LightSuperBunnies", "Creature World NFT", "SympathyForTheDevils" ]; string[] private lootPack8 = [ "Chubbies", "Animetas", "DeadHeads", "Incognito", "Party Penguins", "Krazy Koalas NFT", "Crazy Lizard Army", "Goons of Balatroon", "The Vogu Collective" ]; // Constructor constructor() ERC721("pLoot (for NFT Collectors)", "pLoot") Ownable() { } function initSmartContractMapping() private { } // Balance Check function checkHodler(uint256 tokenID, string memory projectName) public view returns (bool) { } function random(string memory input) internal pure returns (uint256) { } function getLoot1(uint256 tokenId) public view returns (string memory) { } function getLoot2(uint256 tokenId) public view returns (string memory) { } function getLoot3(uint256 tokenId) public view returns (string memory) { } function getLoot4(uint256 tokenId) public view returns (string memory) { } function getLoot5(uint256 tokenId) public view returns (string memory) { } function getLoot6(uint256 tokenId) public view returns (string memory) { } function getLoot7(uint256 tokenId) public view returns (string memory) { } function getLoot8(uint256 tokenId) public view returns (string memory) { } function tokenURI(uint256 tokenId) override public view returns (string memory) { } function tokensOfOwner(address _owner) public view returns (uint256[] memory) { } // Mint Function function claimFreeLootBag(uint256 qty) public { } // Pure Helper functions function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal pure returns (string memory) { } function toAsciiString(address x) internal pure returns (string memory) { } function char(bytes1 b) internal pure returns (bytes1 c) { } function toString(uint256 value) internal pure returns (string memory) { } // Admin Functions function modifySmartContractAddressMap(string memory projectName, address projAddress, uint8 projType) public onlyOwner { } function deleteSmartContractAddressMap(string memory projectName) public onlyOwner { } function devCreateLootBag(uint256 qty) public onlyOwner { require(<FILL_ME>) require((totalSupply() + qty) <= (maxSupply + devAllocation), "Dev allocation exceeded!"); for (uint256 i = 0; i < qty; i++) { uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } } // Withdraw function function withdraw() public onlyOwner { } // Receive ether function receive() external payable {} } /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { } }
totalSupply()>=maxSupply,"Dev not allowed to mint!"
313,185
totalSupply()>=maxSupply
"Dev allocation exceeded!"
// SPDX-License-Identifier: MIT pragma solidity 0.8.6; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract NFTProjectERC721{ function balanceOf(address) external view returns (uint256) {} } contract CryptoPunkSC{ mapping (address => uint256) public balanceOf; } contract pLoot is ERC721Enumerable, ReentrancyGuard, Ownable { // Private Variables uint256 public maxSupply = 7700; uint256 public devAllocation = 300; // NFT Allocation uint256 public maxPerAddress = 20; // Define Struct struct smartContractDetails { address smartContractAddress; uint8 smartContractType; // 0 ERC-721, 1 CryptoPunks } //Smart Contract's Address mapping mapping(string => smartContractDetails) public smartContractAddresses; // Loot Packs string[] private lootPack1 = [ "PEGZ", "Meebits", "Deafbeef", "CryptoPunks", "Autoglyphs", "Avid Lines", "Bored Ape Yacht Club", "BEEPLE - GENESIS COLLECTION", "Damien Hirst - The Currency" ]; string[] private lootPack2 = [ "Blitmap", "VeeFriends", "The Sevens", "PUNKS Comic", "MetaHero Universe", "Bored Ape Kennel Club", "Loot (for Adventurers)", "Mutant Ape Yacht Club", "The Mike Tyson NFT Collection" ]; string[] private lootPack3 = [ "0N1 Force", "CyberKongz", "The n Project", "Cryptovoxels", "Cool Cats NFT", "World of Women", "Pudgy Penguins", "Solvency by Ezra Miller", "Tom Sachs Rocket Factory" ]; string[] private lootPack4 = [ "Chiptos", "SupDucks", "Hashmasks", "FLUF World", "Lazy Lions", "Plasma Bears", "SpacePunksClub", "The Doge Pound", "Rumble Kong League" ]; string[] private lootPack5 = [ "GEVOLs", "Stoner Cats", "The CryptoDads", "BullsOnTheBlock", "Wicked Ape Bone Club", "BASTARD GAN PUNKS V2", "Bloot (not for Weaks)", "Lonely Alien Space Club", "Koala Intelligence Agency" ]; string[] private lootPack6 = [ "thedudes", "Super Yeti", "Spookies NFT", "Arabian Camels", "Untamed Elephants", "Rogue Society Bots", "Slumdoge Billionaires", "Crypto-Pills by Micha Klein", "Official MoonCats - Acclimated" ]; string[] private lootPack7 = [ "GOATz", "Sushiverse", "FusionApes", "CHIBI DINOS", "DystoPunks V2", "The Alien Boy", "LightSuperBunnies", "Creature World NFT", "SympathyForTheDevils" ]; string[] private lootPack8 = [ "Chubbies", "Animetas", "DeadHeads", "Incognito", "Party Penguins", "Krazy Koalas NFT", "Crazy Lizard Army", "Goons of Balatroon", "The Vogu Collective" ]; // Constructor constructor() ERC721("pLoot (for NFT Collectors)", "pLoot") Ownable() { } function initSmartContractMapping() private { } // Balance Check function checkHodler(uint256 tokenID, string memory projectName) public view returns (bool) { } function random(string memory input) internal pure returns (uint256) { } function getLoot1(uint256 tokenId) public view returns (string memory) { } function getLoot2(uint256 tokenId) public view returns (string memory) { } function getLoot3(uint256 tokenId) public view returns (string memory) { } function getLoot4(uint256 tokenId) public view returns (string memory) { } function getLoot5(uint256 tokenId) public view returns (string memory) { } function getLoot6(uint256 tokenId) public view returns (string memory) { } function getLoot7(uint256 tokenId) public view returns (string memory) { } function getLoot8(uint256 tokenId) public view returns (string memory) { } function tokenURI(uint256 tokenId) override public view returns (string memory) { } function tokensOfOwner(address _owner) public view returns (uint256[] memory) { } // Mint Function function claimFreeLootBag(uint256 qty) public { } // Pure Helper functions function pluck(uint256 tokenId, string memory keyPrefix, string[] memory sourceArray) internal pure returns (string memory) { } function toAsciiString(address x) internal pure returns (string memory) { } function char(bytes1 b) internal pure returns (bytes1 c) { } function toString(uint256 value) internal pure returns (string memory) { } // Admin Functions function modifySmartContractAddressMap(string memory projectName, address projAddress, uint8 projType) public onlyOwner { } function deleteSmartContractAddressMap(string memory projectName) public onlyOwner { } function devCreateLootBag(uint256 qty) public onlyOwner { require(totalSupply() >= maxSupply, "Dev not allowed to mint!"); require(<FILL_ME>) for (uint256 i = 0; i < qty; i++) { uint256 mintIndex = totalSupply(); _safeMint(msg.sender, mintIndex); } } // Withdraw function function withdraw() public onlyOwner { } // Receive ether function receive() external payable {} } /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { } }
(totalSupply()+qty)<=(maxSupply+devAllocation),"Dev allocation exceeded!"
313,185
(totalSupply()+qty)<=(maxSupply+devAllocation)
"CREDI:AUTH_ALREADY_USED"
// SPDX-License-Identifier:MIT pragma solidity 0.8.10; import "./IERC20.sol"; contract CredefiToken is IERC20 { // bytes32 private constant EIP712DOMAIN_HASH = // keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)") bytes32 private constant EIP712DOMAIN_HASH = 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f; // bytes32 private constant NAME_HASH = keccak256("Credi") bytes32 private constant NAME_HASH = 0x3c5eac0879bc46be0fe2a2701e57d8e6edcaa427c79074f4513eb9572ff50507; // bytes32 private constant VERSION_HASH = keccak256("1") bytes32 private constant VERSION_HASH = 0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6; // bytes32 public constant PERMIT_TYPEHASH = // keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9; // bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = // keccak256("TransferWithAuthorization(address from,address to,uint256 value,uint256 validAfter,uint256 validBefore,bytes32 nonce)"); bytes32 public constant TRANSFER_WITH_AUTHORIZATION_TYPEHASH = 0x7c7c6cdb67a18743f49ec6fa9b35f50d52ed05cbed4cc592e13b44501c1a2267; string public constant name = "CREDI"; string public constant symbol = "CREDI"; uint8 public constant decimals = 18; address public timelock; uint256 public override totalSupply; mapping(address => uint256) public override balanceOf; mapping(address => mapping(address => uint256)) public override allowance; // ERC-2612, ERC-3009 state mapping(address => uint256) public nonces; mapping(address => mapping(bytes32 => bool)) public authorizationState; event AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce); event TimelockUpdated(address indexed timelock); modifier onlyTimelock() { } constructor(address _timelock) { } function changeTimelock(address _timelock) external onlyTimelock { } function mint(address to, uint256 value) external onlyTimelock returns (bool) { } function burn(uint256 value) external returns (bool) { } function approve(address spender, uint256 value) external override returns (bool) { } function transfer(address to, uint256 value) external override returns (bool) { } function transferFrom( address from, address to, uint256 value ) external override returns (bool) { } function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external { } function transferWithAuthorization( address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce, uint8 v, bytes32 r, bytes32 s ) external { require(block.timestamp > validAfter, "CREDI:AUTH_NOT_YET_VALID"); require(block.timestamp < validBefore, "CREDI:AUTH_EXPIRED"); require(<FILL_ME>) bytes32 encodeData = keccak256( abi.encode(TRANSFER_WITH_AUTHORIZATION_TYPEHASH, from, to, value, validAfter, validBefore, nonce) ); _validateSignedData(from, encodeData, v, r, s); authorizationState[from][nonce] = true; emit AuthorizationUsed(from, nonce); _transfer(from, to, value); } function getChainId() public view returns (uint256 chainId) { } function getDomainSeparator() public view returns (bytes32) { } function _changeTimelock(address _timelock) internal { } function _validateSignedData( address signer, bytes32 encodeData, uint8 v, bytes32 r, bytes32 s ) internal view { } function _mint(address to, uint256 value) internal { } function _burn(address from, uint256 value) internal { } function _approve( address owner, address spender, uint256 value ) private { } function _transfer( address from, address to, uint256 value ) private { } }
!authorizationState[from][nonce],"CREDI:AUTH_ALREADY_USED"
313,216
!authorizationState[from][nonce]
"iUSDT: transfer amount exceeds balance"
pragma solidity >=0.4.21 <0.7.0; import "./IERC20.sol"; import "./Ownable.sol"; contract iUSDT is Ownable { mapping(address => bool) private whiteList; address private _usdt; string private _name; string private _symbol; uint8 private _decimals; constructor () public { } function name() public view returns (string memory) { } function symbol() public view returns (string memory) { } function decimals() public view returns (uint8) { } function balanceOf(address account) public view returns (uint256) { } function transfer(address recipient, uint256 amount) public returns (bool) { require(whiteList[msg.sender], "iUSDT: only white list address can call"); require(<FILL_ME>) IERC20(_usdt).transfer(recipient, amount); return true; } function isWhiteList(address user) public view returns (bool) { } function addWhiteList(address user) public onlyOwner { } function removeWhiteList(address user) public onlyOwner { } }
IERC20(_usdt).balanceOf(address(this))>=amount,"iUSDT: transfer amount exceeds balance"
313,233
IERC20(_usdt).balanceOf(address(this))>=amount
'Not Allowed'
pragma solidity ^0.6.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } interface ICurve { function exchange( int128 i, int128 j, uint256 dx, uint256 min_dy ) external; function exchange_underlying( int128 i, int128 j, uint256 dx, uint256 min_dy ) external; } contract CurveWrapper { ICurve public curve; IERC20 public DAI; IERC20 public sUSD; event ExchangeDaiTosUSD(uint256 from, uint256 to); constructor(ICurve _curve, IERC20 _DAI, IERC20 _sUSD) public { } function exchangeDaiTosUSD(uint256 amount) external { require(<FILL_ME>) uint256 balance = DAI.balanceOf(msg.sender); require(balance >= amount, 'Insufficient Dai'); require(DAI.transferFrom(msg.sender, address(this), amount), 'Failed Deposit Dai'); DAI.approve(address(curve), amount); uint256 sUSDBalance = sUSD.balanceOf(address(this)); curve.exchange(0, 3, amount, 0); uint256 result = sUSD.balanceOf(address(this)) - sUSDBalance; require(result <= sUSD.balanceOf(address(this)) && result > 0, 'Invalid Status'); sUSD.transfer(msg.sender, result); emit ExchangeDaiTosUSD(amount, result); } }
DAI.allowance(msg.sender,address(this))<amount,'Not Allowed'
313,246
DAI.allowance(msg.sender,address(this))<amount
'Failed Deposit Dai'
pragma solidity ^0.6.8; interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } interface ICurve { function exchange( int128 i, int128 j, uint256 dx, uint256 min_dy ) external; function exchange_underlying( int128 i, int128 j, uint256 dx, uint256 min_dy ) external; } contract CurveWrapper { ICurve public curve; IERC20 public DAI; IERC20 public sUSD; event ExchangeDaiTosUSD(uint256 from, uint256 to); constructor(ICurve _curve, IERC20 _DAI, IERC20 _sUSD) public { } function exchangeDaiTosUSD(uint256 amount) external { require(DAI.allowance(msg.sender, address(this)) < amount, 'Not Allowed'); uint256 balance = DAI.balanceOf(msg.sender); require(balance >= amount, 'Insufficient Dai'); require(<FILL_ME>) DAI.approve(address(curve), amount); uint256 sUSDBalance = sUSD.balanceOf(address(this)); curve.exchange(0, 3, amount, 0); uint256 result = sUSD.balanceOf(address(this)) - sUSDBalance; require(result <= sUSD.balanceOf(address(this)) && result > 0, 'Invalid Status'); sUSD.transfer(msg.sender, result); emit ExchangeDaiTosUSD(amount, result); } }
DAI.transferFrom(msg.sender,address(this),amount),'Failed Deposit Dai'
313,246
DAI.transferFrom(msg.sender,address(this),amount)
null
pragma solidity ^0.4.18; /* * Contract that is working with ERC223 tokens */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } function max64(uint64 a, uint64 b) internal pure returns (uint64) { } function min64(uint64 a, uint64 b) internal pure returns (uint64) { } function max256(uint256 a, uint256 b) internal pure returns (uint256) { } function min256(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ContractReceiver { struct TKN { address sender; uint value; bytes data; bytes4 sig; } address [] public senders; function tokenFallback(address _from, uint _value, bytes _data) public { } } contract ERC223Interface { function balanceOf(address who) public view returns (uint); function name() public view returns (string); function symbol() public view returns (string); function decimals() public view returns (uint); function totalSupply() public view returns (uint256); function transfer(address to, uint value) public returns (bool ok); function transfer(address to, uint value, bytes data) public returns (bool ok); function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); } contract ERC223Token is ERC223Interface { mapping(address => uint) balances; string internal _name; string internal _symbol; uint internal _decimals; uint256 internal _totalSupply; using SafeMath for uint; // Function to access name of token . function name() public view returns (string) { } // Function to access symbol of token . function symbol() public view returns (string) { } // Function to access decimals of token . function decimals() public view returns (uint ) { } // Function to access total supply of tokens . function totalSupply() public view returns (uint256 ) { } // Function that is called when a user or another contract wants to transfer funds . function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) { } // Function that is called when a user or another contract wants to transfer funds . function transfer(address _to, uint _value, bytes _data) public returns (bool success) { } // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . function transfer(address _to, uint _value) public returns (bool success) { } //assemble the given address bytecode. If bytecode exists then the _addr is a contract. function isContract(address _addr) private view returns (bool is_contract) { } //function that is called when transaction target is an address function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) { } //function that is called when transaction target is a contract function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) { } function balanceOf(address _owner) public view returns (uint) { } } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { } } contract Balances is Ownable, ERC223Token { mapping(address => bool)public modules; using SafeMath for uint256; address public tokenTransferAddress; function Balances()public { } // Address where funds are collected function updateModuleStatus(address _module, bool status)public onlyOwner { } function updateTokenTransferAddress(address _tokenAddr)public onlyOwner { } modifier onlyModule() { require(<FILL_ME>) _; } function increaseBalance(address recieverAddr, uint256 _tokens)onlyModule public returns( bool ) { } function decreaseBalance(address recieverAddr, uint256 _tokens)onlyModule public returns( bool ) { } } contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /** * @title Destructible * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. */ contract Destructible is Ownable { function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() onlyOwner public { } function destroyAndSend(address _recipient) onlyOwner public { } } contract Gig9 is Balances, Pausable, Destructible { function Gig9()public { } function ()public { } }
modules[msg.sender]==true
313,295
modules[msg.sender]==true
null
pragma solidity ^0.4.18; /* * Contract that is working with ERC223 tokens */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } function max64(uint64 a, uint64 b) internal pure returns (uint64) { } function min64(uint64 a, uint64 b) internal pure returns (uint64) { } function max256(uint256 a, uint256 b) internal pure returns (uint256) { } function min256(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ContractReceiver { struct TKN { address sender; uint value; bytes data; bytes4 sig; } address [] public senders; function tokenFallback(address _from, uint _value, bytes _data) public { } } contract ERC223Interface { function balanceOf(address who) public view returns (uint); function name() public view returns (string); function symbol() public view returns (string); function decimals() public view returns (uint); function totalSupply() public view returns (uint256); function transfer(address to, uint value) public returns (bool ok); function transfer(address to, uint value, bytes data) public returns (bool ok); function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); } contract ERC223Token is ERC223Interface { mapping(address => uint) balances; string internal _name; string internal _symbol; uint internal _decimals; uint256 internal _totalSupply; using SafeMath for uint; // Function to access name of token . function name() public view returns (string) { } // Function to access symbol of token . function symbol() public view returns (string) { } // Function to access decimals of token . function decimals() public view returns (uint ) { } // Function to access total supply of tokens . function totalSupply() public view returns (uint256 ) { } // Function that is called when a user or another contract wants to transfer funds . function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) { } // Function that is called when a user or another contract wants to transfer funds . function transfer(address _to, uint _value, bytes _data) public returns (bool success) { } // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . function transfer(address _to, uint _value) public returns (bool success) { } //assemble the given address bytecode. If bytecode exists then the _addr is a contract. function isContract(address _addr) private view returns (bool is_contract) { } //function that is called when transaction target is an address function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) { } //function that is called when transaction target is a contract function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) { } function balanceOf(address _owner) public view returns (uint) { } } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { } } contract Balances is Ownable, ERC223Token { mapping(address => bool)public modules; using SafeMath for uint256; address public tokenTransferAddress; function Balances()public { } // Address where funds are collected function updateModuleStatus(address _module, bool status)public onlyOwner { } function updateTokenTransferAddress(address _tokenAddr)public onlyOwner { } modifier onlyModule() { } function increaseBalance(address recieverAddr, uint256 _tokens)onlyModule public returns( bool ) { require(recieverAddr != address(0)); require(<FILL_ME>) balances[tokenTransferAddress] = balances[tokenTransferAddress].sub(_tokens); balances[recieverAddr] = balances[recieverAddr].add(_tokens); emit Transfer(tokenTransferAddress,recieverAddr,_tokens); return true; } function decreaseBalance(address recieverAddr, uint256 _tokens)onlyModule public returns( bool ) { } } contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /** * @title Destructible * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. */ contract Destructible is Ownable { function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() onlyOwner public { } function destroyAndSend(address _recipient) onlyOwner public { } } contract Gig9 is Balances, Pausable, Destructible { function Gig9()public { } function ()public { } }
balances[tokenTransferAddress]>=_tokens
313,295
balances[tokenTransferAddress]>=_tokens
null
pragma solidity ^0.4.18; /* * Contract that is working with ERC223 tokens */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } function max64(uint64 a, uint64 b) internal pure returns (uint64) { } function min64(uint64 a, uint64 b) internal pure returns (uint64) { } function max256(uint256 a, uint256 b) internal pure returns (uint256) { } function min256(uint256 a, uint256 b) internal pure returns (uint256) { } } contract ContractReceiver { struct TKN { address sender; uint value; bytes data; bytes4 sig; } address [] public senders; function tokenFallback(address _from, uint _value, bytes _data) public { } } contract ERC223Interface { function balanceOf(address who) public view returns (uint); function name() public view returns (string); function symbol() public view returns (string); function decimals() public view returns (uint); function totalSupply() public view returns (uint256); function transfer(address to, uint value) public returns (bool ok); function transfer(address to, uint value, bytes data) public returns (bool ok); function transfer(address to, uint value, bytes data, string custom_fallback) public returns (bool ok); event Transfer(address indexed from, address indexed to, uint value); } contract ERC223Token is ERC223Interface { mapping(address => uint) balances; string internal _name; string internal _symbol; uint internal _decimals; uint256 internal _totalSupply; using SafeMath for uint; // Function to access name of token . function name() public view returns (string) { } // Function to access symbol of token . function symbol() public view returns (string) { } // Function to access decimals of token . function decimals() public view returns (uint ) { } // Function to access total supply of tokens . function totalSupply() public view returns (uint256 ) { } // Function that is called when a user or another contract wants to transfer funds . function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) { } // Function that is called when a user or another contract wants to transfer funds . function transfer(address _to, uint _value, bytes _data) public returns (bool success) { } // Standard function transfer similar to ERC20 transfer with no _data . // Added due to backwards compatibility reasons . function transfer(address _to, uint _value) public returns (bool success) { } //assemble the given address bytecode. If bytecode exists then the _addr is a contract. function isContract(address _addr) private view returns (bool is_contract) { } //function that is called when transaction target is an address function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) { } //function that is called when transaction target is a contract function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) { } function balanceOf(address _owner) public view returns (uint) { } } contract Ownable { address public owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ function Ownable() public { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } /** * @dev Allows the current owner to transfer control of the contract to a newOwner. * @param newOwner The address to transfer ownership to. */ function transferOwnership(address newOwner) public onlyOwner { } } contract Balances is Ownable, ERC223Token { mapping(address => bool)public modules; using SafeMath for uint256; address public tokenTransferAddress; function Balances()public { } // Address where funds are collected function updateModuleStatus(address _module, bool status)public onlyOwner { } function updateTokenTransferAddress(address _tokenAddr)public onlyOwner { } modifier onlyModule() { } function increaseBalance(address recieverAddr, uint256 _tokens)onlyModule public returns( bool ) { } function decreaseBalance(address recieverAddr, uint256 _tokens)onlyModule public returns( bool ) { require(recieverAddr != address(0)); require(<FILL_ME>) balances[recieverAddr] = balances[recieverAddr].sub(_tokens); balances[tokenTransferAddress] = balances[tokenTransferAddress].add(_tokens); emit Transfer(tokenTransferAddress,recieverAddr,_tokens); return true; } } contract Pausable is Ownable { event Pause(); event Unpause(); bool public paused = false; /** * @dev Modifier to make a function callable only when the contract is not paused. */ modifier whenNotPaused() { } /** * @dev Modifier to make a function callable only when the contract is paused. */ modifier whenPaused() { } /** * @dev called by the owner to pause, triggers stopped state */ function pause() onlyOwner whenNotPaused public { } /** * @dev called by the owner to unpause, returns to normal state */ function unpause() onlyOwner whenPaused public { } } /** * @title Destructible * @dev Base contract that can be destroyed by owner. All funds in contract will be sent to the owner. */ contract Destructible is Ownable { function Destructible() public payable { } /** * @dev Transfers the current balance to the owner and terminates the contract. */ function destroy() onlyOwner public { } function destroyAndSend(address _recipient) onlyOwner public { } } contract Gig9 is Balances, Pausable, Destructible { function Gig9()public { } function ()public { } }
balances[recieverAddr]>=_tokens
313,295
balances[recieverAddr]>=_tokens
"VestingFactory: Already exists"
// SPDX-License-Identifier: MIT pragma solidity 0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; import "./interfaces/IVestingFactory.sol"; contract VestingFactory is IVestingFactory, AccessControlEnumerable { using EnumerableSet for EnumerableSet.AddressSet; bytes32 public constant CREATOR_ROLE = keccak256("CREATOR_ROLE"); /// @dev set of registered vestings EnumerableSet.AddressSet private vestings; /// @dev implementation of Vesting address public vestingImplementation; /** * @notice initialization * @dev initialize contract, set implementation, grand roles for the deployer * @param _vestingImplementation - addresses of implementation */ constructor(address _vestingImplementation) { } /** * @notice returns whether the address is in the register * @dev bool whether the address is registered * @param _vesting - is the address of vesting that will be checked * @return bool whether the address is registered */ function isRegistered(address _vesting) external view override returns (bool) { } /** * @notice get list of registered vesting * @dev return list of addresses which is registered in register * @param _offset - the shift from the beginning of the array * @param _limit - the count of addresses which will returned or less * @return result - array address **/ function list(uint256 _offset, uint256 _limit) external view override returns (address[] memory result) { } /** * @notice add new account to whitelist, can be invoked only by Owner * @dev grant role CREATOR to the account * @param _account - address to be granted role */ function addCreator(address _account) external override onlyRole(DEFAULT_ADMIN_ROLE) { } /** * @notice remove account from the whitelist, can be invoked only by Owner * @dev revoke role CREATOR from the account, checked ownership in revokeRole * @param _account - address to be revoked role */ function removeCreator(address _account) external override { } /** * @notice add new vesting to register, can be invoked only by Owner * @dev add new vesting address to register * @param _vesting - is the address of vesting that will add * @param _isPrivate - is the type of vesting that will add */ function add(address _vesting, bool _isPrivate) external override onlyRole(DEFAULT_ADMIN_ROLE) { } /** * @notice remove vesting from register, can be invoked only by Owner * @dev remove vesting address from register * @param _vesting - is the address of vesting that will removed */ function remove(address _vesting) external override onlyRole(DEFAULT_ADMIN_ROLE) { } /** * @notice Create a new vesting. * @dev create a new proxy of Vesting. * @param _name - name of the vesting which will be created * @param _rewardToken - the token address that will be used to issue rewards to users * @param _depositToken - the token address that will be used for users to pay * @param _signer - addresses which will sign transactions on deposit * @param _initialUnlockPercentage - the percentage of tokens that will be unlocked after the sale * @param _minAllocation - the minimum number for which the user can purchase tokens * @param _maxAllocation - the maximum number for which the user can purchase tokens * @param _vestingType - vesting unlock type * @return proxy Address of recently created Vesting. */ function createVesting( string memory _name, address _rewardToken, address _depositToken, address _signer, uint256 _initialUnlockPercentage, uint256 _minAllocation, uint256 _maxAllocation, IVesting.VestingType _vestingType ) external override onlyRole(CREATOR_ROLE) returns (address proxy) { } /** * @notice set new implementation, can be invoked only by Owner * @dev set new implementation of Vesting for the factory * @param _vestingImplementation - addresses of new implementation */ function setVestingImplementation(address _vestingImplementation) external override onlyRole(DEFAULT_ADMIN_ROLE) { } /** * @notice get contract Owner * @dev return address which has DEFAULT_ADMIN_ROLE * @return address of the contract owner */ function owner() public view override returns (address) { } /** * @notice add new vesting to register * @dev add new vesting address to register * @param _vesting - is the address of vesting that will add * @param _isPrivate - is the type of vesting that will add */ function _add(address _vesting, bool _isPrivate) internal { require(<FILL_ME>) emit AddVesting(_msgSender(), _vesting, _isPrivate); } }
vestings.add(_vesting),"VestingFactory: Already exists"
313,395
vestings.add(_vesting)
"Bad whitelist proof"
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ExtensibleERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; enum MintingState { NOT_ALLOWED, WHITELIST_ONLY, PUBLIC } struct Payee { address payable addr; uint16 ratio; } abstract contract MerkleWhitelistERC721Enumerable is ExtensibleERC721Enumerable { mapping (address => uint) public whitelistMintsUsed; MintingState public mintingState = MintingState.NOT_ALLOWED; uint public maxMintPerTx; uint public maxSupply; uint public maxWhitelistMints; bytes32 internal root; address payable[] internal payeeAddresses; uint16[] internal payeeRatios; uint internal totalRatio; event MintingStateChanged(MintingState oldState, MintingState newState); constructor(Payee[] memory _payees, uint _maxMintPerTx, uint _maxSupply, uint _maxWhitelistMints, bytes32 _root) { } function adminSetMaxPerTx(uint max) external onlyAdmin { } /* function adminSetMaxSupply(uint max) external onlyAdmin { maxSupply = max; } */ function adminSetMintingState(MintingState ms) external onlyAdmin { } function adminSetMaxWhitelistMints(uint max) external onlyAdmin { } function adminSetMerkleRoot(bytes32 _root) external onlyAdmin { } function isWhitelisted(bytes32[] calldata proof, address addr) public view returns (bool) { } function distributeFunds() internal virtual { } function createMetadataForMintedToken(uint tokenId) internal virtual; function mintPriceWei() public view virtual returns (uint); function whitelistMint(bytes32[] calldata proof, uint count) public payable returns (uint) { require(mintingState == MintingState.WHITELIST_ONLY, "Whitelist minting is not allowed atm"); require(<FILL_ME>) require(maxWhitelistMints - whitelistMintsUsed[msg.sender] >= count, "Not enough whitelisted mints"); whitelistMintsUsed[msg.sender] += count; return internalMint(count); } function publicMint(uint count) public payable returns (uint) { } function internalMint(uint count) internal whenEnabled returns (uint) { } }
isWhitelisted(proof,msg.sender),"Bad whitelist proof"
313,439
isWhitelisted(proof,msg.sender)
"Not enough whitelisted mints"
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ExtensibleERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; enum MintingState { NOT_ALLOWED, WHITELIST_ONLY, PUBLIC } struct Payee { address payable addr; uint16 ratio; } abstract contract MerkleWhitelistERC721Enumerable is ExtensibleERC721Enumerable { mapping (address => uint) public whitelistMintsUsed; MintingState public mintingState = MintingState.NOT_ALLOWED; uint public maxMintPerTx; uint public maxSupply; uint public maxWhitelistMints; bytes32 internal root; address payable[] internal payeeAddresses; uint16[] internal payeeRatios; uint internal totalRatio; event MintingStateChanged(MintingState oldState, MintingState newState); constructor(Payee[] memory _payees, uint _maxMintPerTx, uint _maxSupply, uint _maxWhitelistMints, bytes32 _root) { } function adminSetMaxPerTx(uint max) external onlyAdmin { } /* function adminSetMaxSupply(uint max) external onlyAdmin { maxSupply = max; } */ function adminSetMintingState(MintingState ms) external onlyAdmin { } function adminSetMaxWhitelistMints(uint max) external onlyAdmin { } function adminSetMerkleRoot(bytes32 _root) external onlyAdmin { } function isWhitelisted(bytes32[] calldata proof, address addr) public view returns (bool) { } function distributeFunds() internal virtual { } function createMetadataForMintedToken(uint tokenId) internal virtual; function mintPriceWei() public view virtual returns (uint); function whitelistMint(bytes32[] calldata proof, uint count) public payable returns (uint) { require(mintingState == MintingState.WHITELIST_ONLY, "Whitelist minting is not allowed atm"); require(isWhitelisted(proof, msg.sender), "Bad whitelist proof"); require(<FILL_ME>) whitelistMintsUsed[msg.sender] += count; return internalMint(count); } function publicMint(uint count) public payable returns (uint) { } function internalMint(uint count) internal whenEnabled returns (uint) { } }
maxWhitelistMints-whitelistMintsUsed[msg.sender]>=count,"Not enough whitelisted mints"
313,439
maxWhitelistMints-whitelistMintsUsed[msg.sender]>=count
"Cannot mint over maxSupply()"
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ExtensibleERC721Enumerable.sol"; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; enum MintingState { NOT_ALLOWED, WHITELIST_ONLY, PUBLIC } struct Payee { address payable addr; uint16 ratio; } abstract contract MerkleWhitelistERC721Enumerable is ExtensibleERC721Enumerable { mapping (address => uint) public whitelistMintsUsed; MintingState public mintingState = MintingState.NOT_ALLOWED; uint public maxMintPerTx; uint public maxSupply; uint public maxWhitelistMints; bytes32 internal root; address payable[] internal payeeAddresses; uint16[] internal payeeRatios; uint internal totalRatio; event MintingStateChanged(MintingState oldState, MintingState newState); constructor(Payee[] memory _payees, uint _maxMintPerTx, uint _maxSupply, uint _maxWhitelistMints, bytes32 _root) { } function adminSetMaxPerTx(uint max) external onlyAdmin { } /* function adminSetMaxSupply(uint max) external onlyAdmin { maxSupply = max; } */ function adminSetMintingState(MintingState ms) external onlyAdmin { } function adminSetMaxWhitelistMints(uint max) external onlyAdmin { } function adminSetMerkleRoot(bytes32 _root) external onlyAdmin { } function isWhitelisted(bytes32[] calldata proof, address addr) public view returns (bool) { } function distributeFunds() internal virtual { } function createMetadataForMintedToken(uint tokenId) internal virtual; function mintPriceWei() public view virtual returns (uint); function whitelistMint(bytes32[] calldata proof, uint count) public payable returns (uint) { } function publicMint(uint count) public payable returns (uint) { } function internalMint(uint count) internal whenEnabled returns (uint) { if (!isAdmin[msg.sender]) { require(count >= 1, "Must mint at least one"); require(!Address.isContract(msg.sender), "Contracts cannot mint"); require(msg.value == count * mintPriceWei(), "Send mintPriceWei() wei for each mint"); } uint supply = totalSupply(); require(<FILL_ME>) uint startingIndex = _currentIndex; for (uint i = startingIndex; i < startingIndex + count; ++i) { createMetadataForMintedToken(i); } _mint(msg.sender, count, "", false); distributeFunds(); return startingIndex; } }
supply+count<=maxSupply,"Cannot mint over maxSupply()"
313,439
supply+count<=maxSupply
"Supply paused, above liquidity limit"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { CTokenAmount memory supplyAmount = CTokenAmount({val: cTokenSupplyAmount}); CTokenAmount memory supplierLiquidityNew = add_(supplierLiquidity, supplyAmount); require(<FILL_ME>) require(isPaused == false, "Market paused"); Exp memory cTokenExchangeRate = getExchangeRate(); accrue(cTokenExchangeRate); CTokenAmount memory prevSupply = supplyAccounts[msg.sender].amount; CTokenAmount memory truedUpPrevSupply; if (prevSupply.val == 0) { truedUpPrevSupply = CTokenAmount({val: 0}); } else { uint prevIndex = supplyAccounts[msg.sender].index; truedUpPrevSupply = div_(mul_(prevSupply, supplyIndex), prevIndex); } CTokenAmount memory newSupplyAmount = add_(truedUpPrevSupply, supplyAmount); emit Supply(msg.sender, cTokenSupplyAmount, newSupplyAmount.val); supplyAccounts[msg.sender].amount = newSupplyAmount; supplyAccounts[msg.sender].lastBlock = getBlockNumber(); supplyAccounts[msg.sender].index = supplyIndex; supplierLiquidity = supplierLiquidityNew; transferIn(msg.sender, supplyAmount); } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
lt_(supplierLiquidityNew,liquidityLimit),"Supply paused, above liquidity limit"
313,475
lt_(supplierLiquidityNew,liquidityLimit)
"Liquidity must be supplied a minimum duration"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { CTokenAmount memory removeAmount = CTokenAmount({val: removeCTokenAmount}); SupplyAccount memory account = supplyAccounts[msg.sender]; require(account.amount.val > 0, "Must withdraw from active account"); require(<FILL_ME>) Exp memory cTokenExchangeRate = getExchangeRate(); CTokenAmount memory lockedCollateral = accrue(cTokenExchangeRate); CTokenAmount memory truedUpAccountValue = div_(mul_(account.amount, supplyIndex), account.index); // Remove all liquidity if (removeAmount.val == 0) { removeAmount = truedUpAccountValue; } require(lte_(removeAmount, truedUpAccountValue), "Trying to remove more than account value"); CTokenAmount memory unlockedCollateral = sub_(supplierLiquidity, lockedCollateral); require(lte_(removeAmount, unlockedCollateral), "Removing more liquidity than is unlocked"); require(lte_(removeAmount, supplierLiquidity), "Removing more than total supplier liquidity"); CTokenAmount memory newAccountValue = sub_(truedUpAccountValue, removeAmount); emit Remove(msg.sender, removeCTokenAmount, newAccountValue.val); supplyAccounts[msg.sender].lastBlock = getBlockNumber(); supplyAccounts[msg.sender].index = supplyIndex; supplyAccounts[msg.sender].amount = newAccountValue; supplierLiquidity = sub_(supplierLiquidity, removeAmount); transferOut(msg.sender, removeAmount); } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
getBlockNumber()-account.lastBlock>=SUPPLY_MIN_DURATION,"Liquidity must be supplied a minimum duration"
313,475
getBlockNumber()-account.lastBlock>=SUPPLY_MIN_DURATION
"Trying to remove more than account value"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { CTokenAmount memory removeAmount = CTokenAmount({val: removeCTokenAmount}); SupplyAccount memory account = supplyAccounts[msg.sender]; require(account.amount.val > 0, "Must withdraw from active account"); require(getBlockNumber() - account.lastBlock >= SUPPLY_MIN_DURATION, "Liquidity must be supplied a minimum duration"); Exp memory cTokenExchangeRate = getExchangeRate(); CTokenAmount memory lockedCollateral = accrue(cTokenExchangeRate); CTokenAmount memory truedUpAccountValue = div_(mul_(account.amount, supplyIndex), account.index); // Remove all liquidity if (removeAmount.val == 0) { removeAmount = truedUpAccountValue; } require(<FILL_ME>) CTokenAmount memory unlockedCollateral = sub_(supplierLiquidity, lockedCollateral); require(lte_(removeAmount, unlockedCollateral), "Removing more liquidity than is unlocked"); require(lte_(removeAmount, supplierLiquidity), "Removing more than total supplier liquidity"); CTokenAmount memory newAccountValue = sub_(truedUpAccountValue, removeAmount); emit Remove(msg.sender, removeCTokenAmount, newAccountValue.val); supplyAccounts[msg.sender].lastBlock = getBlockNumber(); supplyAccounts[msg.sender].index = supplyIndex; supplyAccounts[msg.sender].amount = newAccountValue; supplierLiquidity = sub_(supplierLiquidity, removeAmount); transferOut(msg.sender, removeAmount); } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
lte_(removeAmount,truedUpAccountValue),"Trying to remove more than account value"
313,475
lte_(removeAmount,truedUpAccountValue)
"Removing more liquidity than is unlocked"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { CTokenAmount memory removeAmount = CTokenAmount({val: removeCTokenAmount}); SupplyAccount memory account = supplyAccounts[msg.sender]; require(account.amount.val > 0, "Must withdraw from active account"); require(getBlockNumber() - account.lastBlock >= SUPPLY_MIN_DURATION, "Liquidity must be supplied a minimum duration"); Exp memory cTokenExchangeRate = getExchangeRate(); CTokenAmount memory lockedCollateral = accrue(cTokenExchangeRate); CTokenAmount memory truedUpAccountValue = div_(mul_(account.amount, supplyIndex), account.index); // Remove all liquidity if (removeAmount.val == 0) { removeAmount = truedUpAccountValue; } require(lte_(removeAmount, truedUpAccountValue), "Trying to remove more than account value"); CTokenAmount memory unlockedCollateral = sub_(supplierLiquidity, lockedCollateral); require(<FILL_ME>) require(lte_(removeAmount, supplierLiquidity), "Removing more than total supplier liquidity"); CTokenAmount memory newAccountValue = sub_(truedUpAccountValue, removeAmount); emit Remove(msg.sender, removeCTokenAmount, newAccountValue.val); supplyAccounts[msg.sender].lastBlock = getBlockNumber(); supplyAccounts[msg.sender].index = supplyIndex; supplyAccounts[msg.sender].amount = newAccountValue; supplierLiquidity = sub_(supplierLiquidity, removeAmount); transferOut(msg.sender, removeAmount); } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
lte_(removeAmount,unlockedCollateral),"Removing more liquidity than is unlocked"
313,475
lte_(removeAmount,unlockedCollateral)
"Removing more than total supplier liquidity"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { CTokenAmount memory removeAmount = CTokenAmount({val: removeCTokenAmount}); SupplyAccount memory account = supplyAccounts[msg.sender]; require(account.amount.val > 0, "Must withdraw from active account"); require(getBlockNumber() - account.lastBlock >= SUPPLY_MIN_DURATION, "Liquidity must be supplied a minimum duration"); Exp memory cTokenExchangeRate = getExchangeRate(); CTokenAmount memory lockedCollateral = accrue(cTokenExchangeRate); CTokenAmount memory truedUpAccountValue = div_(mul_(account.amount, supplyIndex), account.index); // Remove all liquidity if (removeAmount.val == 0) { removeAmount = truedUpAccountValue; } require(lte_(removeAmount, truedUpAccountValue), "Trying to remove more than account value"); CTokenAmount memory unlockedCollateral = sub_(supplierLiquidity, lockedCollateral); require(lte_(removeAmount, unlockedCollateral), "Removing more liquidity than is unlocked"); require(<FILL_ME>) CTokenAmount memory newAccountValue = sub_(truedUpAccountValue, removeAmount); emit Remove(msg.sender, removeCTokenAmount, newAccountValue.val); supplyAccounts[msg.sender].lastBlock = getBlockNumber(); supplyAccounts[msg.sender].index = supplyIndex; supplyAccounts[msg.sender].amount = newAccountValue; supplierLiquidity = sub_(supplierLiquidity, removeAmount); transferOut(msg.sender, removeAmount); } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
lte_(removeAmount,supplierLiquidity),"Removing more than total supplier liquidity"
313,475
lte_(removeAmount,supplierLiquidity)
"Open paused, above liquidity limit"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { require(isPaused == false, "Market paused"); require(notionalAmount >= MIN_SWAP_NOTIONAL, "Swap notional amount must exceed minimum"); Exp memory cTokenExchangeRate = getExchangeRate(); CTokenAmount memory lockedCollateral = accrue(cTokenExchangeRate); CTokenAmount memory supplierLiquidityTemp = supplierLiquidity; // copy to memory for gas require(<FILL_ME>) (Exp memory swapFixedRate, int rateFactorNew) = getSwapRate(userPayingFixed, notionalAmount, lockedCollateral, supplierLiquidityTemp, cTokenExchangeRate); CTokenAmount memory userCollateralCTokens; if (userPayingFixed) { require(swapFixedRate.mantissa <= fixedRateLimitMantissa, "The fixed rate Rho would receive is above user's limit"); CTokenAmount memory lockedCollateralHypothetical = add_(lockedCollateral, getReceiveFixedInitCollateral(swapFixedRate, notionalAmount, cTokenExchangeRate)); require(lte_(lockedCollateralHypothetical, supplierLiquidityTemp), "Insufficient protocol collateral"); userCollateralCTokens = openPayFixedSwapInternal(notionalAmount, swapFixedRate, cTokenExchangeRate); } else { require(swapFixedRate.mantissa >= fixedRateLimitMantissa, "The fixed rate Rho would pay is below user's limit"); CTokenAmount memory lockedCollateralHypothetical = add_(lockedCollateral, getPayFixedInitCollateral(swapFixedRate, notionalAmount, cTokenExchangeRate)); require(lte_(lockedCollateralHypothetical, supplierLiquidityTemp), "Insufficient protocol collateral"); userCollateralCTokens = openReceiveFixedSwapInternal(notionalAmount, swapFixedRate, cTokenExchangeRate); } swapHash = keccak256(abi.encode( userPayingFixed, benchmarkIndexStored.mantissa, getBlockNumber(), swapFixedRate.mantissa, notionalAmount, userCollateralCTokens.val, msg.sender )); require(swaps[swapHash] == false, "Duplicate swap"); emit OpenSwap( swapHash, userPayingFixed, benchmarkIndexStored.mantissa, getBlockNumber(), swapFixedRate.mantissa, notionalAmount, userCollateralCTokens.val, msg.sender ); swaps[swapHash] = true; rateFactor = rateFactorNew; transferIn(msg.sender, userCollateralCTokens); } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
lt_(supplierLiquidityTemp,liquidityLimit),"Open paused, above liquidity limit"
313,475
lt_(supplierLiquidityTemp,liquidityLimit)
"Insufficient protocol collateral"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { require(isPaused == false, "Market paused"); require(notionalAmount >= MIN_SWAP_NOTIONAL, "Swap notional amount must exceed minimum"); Exp memory cTokenExchangeRate = getExchangeRate(); CTokenAmount memory lockedCollateral = accrue(cTokenExchangeRate); CTokenAmount memory supplierLiquidityTemp = supplierLiquidity; // copy to memory for gas require(lt_(supplierLiquidityTemp, liquidityLimit), "Open paused, above liquidity limit"); (Exp memory swapFixedRate, int rateFactorNew) = getSwapRate(userPayingFixed, notionalAmount, lockedCollateral, supplierLiquidityTemp, cTokenExchangeRate); CTokenAmount memory userCollateralCTokens; if (userPayingFixed) { require(swapFixedRate.mantissa <= fixedRateLimitMantissa, "The fixed rate Rho would receive is above user's limit"); CTokenAmount memory lockedCollateralHypothetical = add_(lockedCollateral, getReceiveFixedInitCollateral(swapFixedRate, notionalAmount, cTokenExchangeRate)); require(<FILL_ME>) userCollateralCTokens = openPayFixedSwapInternal(notionalAmount, swapFixedRate, cTokenExchangeRate); } else { require(swapFixedRate.mantissa >= fixedRateLimitMantissa, "The fixed rate Rho would pay is below user's limit"); CTokenAmount memory lockedCollateralHypothetical = add_(lockedCollateral, getPayFixedInitCollateral(swapFixedRate, notionalAmount, cTokenExchangeRate)); require(lte_(lockedCollateralHypothetical, supplierLiquidityTemp), "Insufficient protocol collateral"); userCollateralCTokens = openReceiveFixedSwapInternal(notionalAmount, swapFixedRate, cTokenExchangeRate); } swapHash = keccak256(abi.encode( userPayingFixed, benchmarkIndexStored.mantissa, getBlockNumber(), swapFixedRate.mantissa, notionalAmount, userCollateralCTokens.val, msg.sender )); require(swaps[swapHash] == false, "Duplicate swap"); emit OpenSwap( swapHash, userPayingFixed, benchmarkIndexStored.mantissa, getBlockNumber(), swapFixedRate.mantissa, notionalAmount, userCollateralCTokens.val, msg.sender ); swaps[swapHash] = true; rateFactor = rateFactorNew; transferIn(msg.sender, userCollateralCTokens); } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
lte_(lockedCollateralHypothetical,supplierLiquidityTemp),"Insufficient protocol collateral"
313,475
lte_(lockedCollateralHypothetical,supplierLiquidityTemp)
"Duplicate swap"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { require(isPaused == false, "Market paused"); require(notionalAmount >= MIN_SWAP_NOTIONAL, "Swap notional amount must exceed minimum"); Exp memory cTokenExchangeRate = getExchangeRate(); CTokenAmount memory lockedCollateral = accrue(cTokenExchangeRate); CTokenAmount memory supplierLiquidityTemp = supplierLiquidity; // copy to memory for gas require(lt_(supplierLiquidityTemp, liquidityLimit), "Open paused, above liquidity limit"); (Exp memory swapFixedRate, int rateFactorNew) = getSwapRate(userPayingFixed, notionalAmount, lockedCollateral, supplierLiquidityTemp, cTokenExchangeRate); CTokenAmount memory userCollateralCTokens; if (userPayingFixed) { require(swapFixedRate.mantissa <= fixedRateLimitMantissa, "The fixed rate Rho would receive is above user's limit"); CTokenAmount memory lockedCollateralHypothetical = add_(lockedCollateral, getReceiveFixedInitCollateral(swapFixedRate, notionalAmount, cTokenExchangeRate)); require(lte_(lockedCollateralHypothetical, supplierLiquidityTemp), "Insufficient protocol collateral"); userCollateralCTokens = openPayFixedSwapInternal(notionalAmount, swapFixedRate, cTokenExchangeRate); } else { require(swapFixedRate.mantissa >= fixedRateLimitMantissa, "The fixed rate Rho would pay is below user's limit"); CTokenAmount memory lockedCollateralHypothetical = add_(lockedCollateral, getPayFixedInitCollateral(swapFixedRate, notionalAmount, cTokenExchangeRate)); require(lte_(lockedCollateralHypothetical, supplierLiquidityTemp), "Insufficient protocol collateral"); userCollateralCTokens = openReceiveFixedSwapInternal(notionalAmount, swapFixedRate, cTokenExchangeRate); } swapHash = keccak256(abi.encode( userPayingFixed, benchmarkIndexStored.mantissa, getBlockNumber(), swapFixedRate.mantissa, notionalAmount, userCollateralCTokens.val, msg.sender )); require(<FILL_ME>) emit OpenSwap( swapHash, userPayingFixed, benchmarkIndexStored.mantissa, getBlockNumber(), swapFixedRate.mantissa, notionalAmount, userCollateralCTokens.val, msg.sender ); swaps[swapHash] = true; rateFactor = rateFactorNew; transferIn(msg.sender, userCollateralCTokens); } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
swaps[swapHash]==false,"Duplicate swap"
313,475
swaps[swapHash]==false
"No active swap found"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { Exp memory cTokenExchangeRate = getExchangeRate(); accrue(cTokenExchangeRate); bytes32 swapHash = keccak256(abi.encode( userPayingFixed, benchmarkIndexInit, initBlock, swapFixedRateMantissa, notionalAmount, userCollateralCTokens, owner )); require(<FILL_ME>) uint swapDuration = sub_(getBlockNumber(), initBlock); require(swapDuration >= SWAP_MIN_DURATION, "Premature close swap"); Exp memory benchmarkIndexRatio = div_(benchmarkIndexStored, toExp_(benchmarkIndexInit)); CTokenAmount memory userCollateral = CTokenAmount({val: userCollateralCTokens}); Exp memory swapFixedRate = toExp_(swapFixedRateMantissa); CTokenAmount memory userPayout; if (userPayingFixed) { userPayout = closePayFixedSwapInternal( swapDuration, benchmarkIndexRatio, swapFixedRate, notionalAmount, userCollateral, cTokenExchangeRate ); } else { userPayout = closeReceiveFixedSwapInternal( swapDuration, benchmarkIndexRatio, swapFixedRate, notionalAmount, userCollateral, cTokenExchangeRate ); } uint bal = cToken.balanceOf(address(this)); // Payout is capped by total balance if (userPayout.val > bal) userPayout = CTokenAmount({val: bal}); uint lateBlocks = sub_(swapDuration, SWAP_MIN_DURATION); CTokenAmount memory penalty = CTokenAmount(0); if (lateBlocks > CLOSE_GRACE_PERIOD_BLOCKS) { uint penaltyBlocks = lateBlocks - CLOSE_GRACE_PERIOD_BLOCKS; Exp memory penaltyPercent = mul_(toExp_(CLOSE_PENALTY_PER_BLOCK_MANTISSA), penaltyBlocks); penaltyPercent = ONE_EXP.mantissa > penaltyPercent.mantissa ? penaltyPercent : ONE_EXP; // maximum of 100% penalty penalty = CTokenAmount(mul_(userPayout.val, penaltyPercent)); userPayout = sub_(userPayout, penalty); } emit CloseSwap(swapHash, owner, userPayout.val, penalty.val, benchmarkIndexStored.mantissa); swaps[swapHash] = false; transferOut(owner, userPayout); transferOut(msg.sender, penalty); } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
swaps[swapHash]==true,"No active swap found"
313,475
swaps[swapHash]==true
"Block number decreasing"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { require(<FILL_ME>) uint accruedBlocks = getBlockNumber() - lastAccrualBlock; (CTokenAmount memory lockedCollateralNew, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) = getLockedCollateral(accruedBlocks, cTokenExchangeRate); if (accruedBlocks == 0) { return lockedCollateralNew; } Exp memory benchmarkIndexNew = getBenchmarkIndex(); Exp memory benchmarkIndexRatio; // if first tx if (benchmarkIndexStored.mantissa == 0) { benchmarkIndexRatio = ONE_EXP; } else { benchmarkIndexRatio = div_(benchmarkIndexNew, benchmarkIndexStored); } Exp memory floatRate = sub_(benchmarkIndexRatio, ONE_EXP); CTokenAmount memory supplierLiquidityNew = getSupplierLiquidity(accruedBlocks, floatRate, cTokenExchangeRate); // supplyIndex *= supplierLiquidityNew / supplierLiquidity uint supplyIndexNew = supplyIndex; if (supplierLiquidityNew.val != 0) { supplyIndexNew = div_(mul_(supplyIndex, supplierLiquidityNew), supplierLiquidity); } uint notionalPayingFloatNew = mul_(notionalPayingFloat, benchmarkIndexRatio); uint notionalReceivingFloatNew = mul_(notionalReceivingFloat, benchmarkIndexRatio); /** Apply Effects **/ parBlocksPayingFixed = parBlocksPayingFixedNew; parBlocksReceivingFixed = parBlocksReceivingFixedNew; supplierLiquidity = supplierLiquidityNew; supplyIndex = supplyIndexNew; notionalPayingFloat = notionalPayingFloatNew; notionalReceivingFloat = notionalReceivingFloatNew; benchmarkIndexStored = benchmarkIndexNew; lastAccrualBlock = getBlockNumber(); emit Accrue(supplierLiquidityNew.val, lockedCollateralNew.val); return lockedCollateralNew; } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
getBlockNumber()>=lastAccrualBlock,"Block number decreasing"
313,475
getBlockNumber()>=lastAccrualBlock
"Transfer In Failed"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { require(<FILL_ME>) } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
cToken.transferFrom(from,address(this),cTokenAmount.val)==true,"Transfer In Failed"
313,475
cToken.transferFrom(from,address(this),cTokenAmount.val)==true
"Transfer Out failed"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { if (cTokenAmount.val > 0) { require(<FILL_ME>) } } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
cToken.transfer(to,cTokenAmount.val),"Transfer Out failed"
313,475
cToken.transfer(to,cTokenAmount.val)
"Bn decreasing"
pragma experimental ABIEncoderV2; pragma solidity ^0.6.10; import "./Math.sol"; import {RhoInterface, CTokenInterface, CompInterface, InterestRateModelInterface} from "./RhoInterfaces.sol"; /* @dev: * CTokens are used as collateral. "Underlying" in Rho refers to the collateral CToken's underlying token. * An Exp is a data type with 18 decimals, used for scaling up and precise calculations */ contract Rho is RhoInterface, Math { CTokenInterface public immutable cToken; CompInterface public immutable comp; uint public immutable SWAP_MIN_DURATION; uint public immutable SUPPLY_MIN_DURATION; uint public immutable MIN_SWAP_NOTIONAL = 1e18; uint public immutable CLOSE_GRACE_PERIOD_BLOCKS = 3000; // ~12.5 hrs uint public immutable CLOSE_PENALTY_PER_BLOCK_MANTISSA = 1e14;// 1% (1e16) every 25 min (100 blocks) constructor ( InterestRateModelInterface interestRateModel_, CTokenInterface cToken_, CompInterface comp_, uint minFloatRateMantissa_, uint maxFloatRateMantissa_, uint swapMinDuration_, uint supplyMinDuration_, address admin_, uint liquidityLimitCTokens_ ) public { } /* @dev Supplies liquidity to the protocol. Become the counterparty for all swap traders, in return for fees. * @param cTokenSupplyAmount Amount to supply, in CTokens. */ function supply(uint cTokenSupplyAmount) public override { } /* @dev Remove liquidity from protocol. Can only perform after a waiting period from supplying, to prevent interest rate manipulation * @param removeCTokenAmount Amount of CTokens to remove. 0 removes all CTokens. */ function remove(uint removeCTokenAmount) public override { } function openPayFixedSwap(uint notionalAmount, uint maximumFixedRateMantissa) public override returns(bytes32 swapHash) { } function openReceiveFixedSwap(uint notionalAmount, uint minFixedRateMantissa) public override returns(bytes32 swapHash) { } /* @dev Opens a new interest rate swap * @param userPayingFixed : The user can choose if they want to receive fixed or pay fixed (the protocol will take the opposite side) * @param notionalAmount : The principal that interest rate payments will be based on * @param fixedRateLimitMantissa : The maximum (if payingFixed) or minimum (if receivingFixed) rate the swap should succeed at. Prevents frontrunning attacks. * The amount of interest to pay over 2,102,400 blocks (~1 year), with 18 decimals of precision. Eg: 5% per block-year => 0.5e18. */ function openInternal(bool userPayingFixed, uint notionalAmount, uint fixedRateLimitMantissa) internal returns (bytes32 swapHash) { } // @dev User is paying fixed, protocol is receiving fixed function openPayFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } // @dev User is receiving fixed, protocol is paying fixed function openReceiveFixedSwapInternal(uint notionalAmount, Exp memory swapFixedRate, Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory userCollateralCTokens) { } /* @dev Closes an existing swap, after the min swap duration. Float payment continues even if closed late. * Takes params from Open event. * Take caution not to unecessarily revert due to underflow / overflow, as uncloseable swaps are very dangerous. */ function close( bool userPayingFixed, uint benchmarkIndexInit, uint initBlock, uint swapFixedRateMantissa, uint notionalAmount, uint userCollateralCTokens, address owner ) public override { } // @dev User paid fixed, protocol paid fixed function closePayFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } // @dev User received fixed, protocol paid fixed function closeReceiveFixedSwapInternal( uint swapDuration, Exp memory benchmarkIndexRatio, Exp memory swapFixedRate, uint notionalAmount, CTokenAmount memory userCollateral, Exp memory cTokenExchangeRate ) internal returns (CTokenAmount memory userPayout) { } /* @dev Called internally at the beginning of external swap and liquidity provider functions. * WRITES TO STORAGE * Accounts for interest rate payments and adjust collateral requirements with the passage of time. * @return lockedCollateralNew : The amount of collateral the protocol needs to keep locked. */ function accrue(Exp memory cTokenExchangeRate) internal returns (CTokenAmount memory) { } function transferIn(address from, CTokenAmount memory cTokenAmount) internal { } function transferOut(address to, CTokenAmount memory cTokenAmount) internal { } // ** PUBLIC PURE HELPERS ** // function toCTokens(uint amount, Exp memory cTokenExchangeRate) public pure returns (CTokenAmount memory) { } function toUnderlying(CTokenAmount memory amount, Exp memory cTokenExchangeRate) public pure returns (uint) { } // *** PUBLIC VIEW GETTERS *** // // @dev Calculate protocol locked collateral and parBlocks, which is a measure of the fixed rate credit/debt. // * Uses int to keep negatives, for correct late blocks calc when a single swap is outstanding function getLockedCollateral(uint accruedBlocks, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory lockedCollateral, int parBlocksReceivingFixedNew, int parBlocksPayingFixedNew) { } /* @dev Calculate protocol P/L by adding the cashflows since last accrual. * supplierLiquidity += fixedReceived + floatReceived - fixedPaid - floatPaid */ function getSupplierLiquidity(uint accruedBlocks, Exp memory floatRate, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory supplierLiquidityNew) { } // @dev Get the rate for incoming swaps function getSwapRate( bool userPayingFixed, uint orderNotional, CTokenAmount memory lockedCollateral, CTokenAmount memory supplierLiquidity_, Exp memory cTokenExchangeRate ) public view returns (Exp memory, int) { } // @dev The amount that must be locked up for the payFixed leg of a swap paying fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (swapFixedRate - minFloatRate) function getPayFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev The amount that must be locked up for the receiveFixed leg of a swap receiving fixed. Used to calculate both the protocol and user's collateral. // = notionalAmount * SWAP_MIN_DURATION * (maxFloatRate - swapFixedRate) function getReceiveFixedInitCollateral(Exp memory fixedRate, uint notionalAmount, Exp memory cTokenExchangeRate) public view returns (CTokenAmount memory) { } // @dev Interpolates to get the current borrow index from a compound CToken (or some other similar interface) function getBenchmarkIndex() public view returns (Exp memory) { Exp memory borrowIndex = toExp_(cToken.borrowIndex()); require(borrowIndex.mantissa != 0, "Benchmark index is zero"); uint accrualBlockNumber = cToken.accrualBlockNumber(); require(<FILL_ME>) uint blockDelta = sub_(getBlockNumber(), accrualBlockNumber); if (blockDelta == 0) { return borrowIndex; } else { Exp memory borrowRateMantissa = toExp_(cToken.borrowRatePerBlock()); Exp memory simpleInterestFactor = mul_(borrowRateMantissa, blockDelta); return mul_(borrowIndex, add_(simpleInterestFactor, ONE_EXP)); } } function getExchangeRate() public view returns (Exp memory) { } function getBlockNumber() public view virtual returns (uint) { } /** ADMIN FUNCTIONS **/ function _setInterestRateModel(InterestRateModelInterface newModel) external { } function _setCollateralRequirements(uint minFloatRateMantissa_, uint maxFloatRateMantissa_) external { } function _setLiquidityLimit(uint limit_) external { } function _pause(bool isPaused_) external { } function _transferComp(address dest, uint amount) external { } function _delegateComp(address delegatee) external { } function _changeAdmin(address admin_) external { } }
getBlockNumber()>=accrualBlockNumber,"Bn decreasing"
313,475
getBlockNumber()>=accrualBlockNumber
null
pragma solidity ^0.5.2; /* * Admin sets only for revealling address restricton */ contract RevealPrivilege { address owner; address public delegateAddr; mapping(address => bool) public isAdmin; modifier onlyAdmins() { require(<FILL_ME>) _; } modifier isContractOwner() { } function addAdmin(address _addr) isContractOwner public { } function removeAdmin(address _addr) isContractOwner public { } function transferOwner(address _addr) isContractOwner public { } function setdelegateAddr(address _addr) onlyAdmins public { } } contract FIH is RevealPrivilege { using SafeMath for uint256; // constant value uint256 constant withdrawalFee = 0.05 ether; uint256 constant stake = 0.01 ether; uint256 public bonusCodeNonce; uint16 public currentPeriod; uint256 bonusPool; uint256 public teamBonus; struct BonusCode { uint8 prefix; uint256 orderId; uint256 code; uint256 nums; uint256 period; address addr; } //user balance mapping(address => uint256) balanceOf; mapping(address => bool) public allowance; // _period => BonusCode mapping(uint16 => BonusCode) public revealResultPerPeriod; mapping(uint16 => uint256) revealBonusPerPeriod; mapping(address => BonusCode[]) revealInfoByAddr; mapping(uint16 => uint256) gameBonusPerPeriod; mapping(uint16 => mapping(address => uint256)) invitedBonus; // period => address => amount mapping(address => address) invitedRelations; mapping(uint16 => mapping(uint8 => uint256)) sideTotalAmount; // period => prefix => amount mapping(uint16 => mapping(uint256 => BonusCode)) public revealBonusCodes; // period => code => BonusCode mapping(uint16 => uint256[]) bcodes; // period => code event Bet(uint16 _currentPeriod, uint256 _orderId, uint256 _code, address _from); event Deposit(address _from, address _to, uint256 _amount); event Reveal(uint16 _currentPeriod, uint256 _orderId, uint256 _prefix, uint256 _code, address _addr, uint256 _winnerBonus); event Withdrawal(address _to, uint256 _amount); constructor () public { } function deposit(address _to) payable public { } function bet(address _from, address _invitedAddr, uint256 _amount, uint8 _fType) public { } event Debug(uint256 winnerIndex, uint256 bcodesLen, uint256 pos); function reveal(string memory _seed) public onlyAdmins { } function withdrawal(address _from, address payable _to, uint256 _amount) public { } function teamWithdrawal() onlyAdmins public { } function gameBonusWithdrawal(uint16 _period) onlyAdmins public { } function updateContract() isContractOwner public { } /* * read only part * for query */ function getBalance(address _addr) public view returns(uint256) { } function getBonusPool() public view returns(uint256) { } function getBonusInvited(address _from) public view returns(uint256) { } function getRevealResultPerPeriod(uint16 _period) public view returns(uint8 _prefix, uint256 _orderId, uint256 _code, uint256 _nums, address _addr, uint256 _revealBonus) { } } /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two unsigned integers, reverts on overflow. */ function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function safeMod(uint256 a, uint256 b) internal pure returns (uint256) { } }
isAdmin[msg.sender]==true
313,489
isAdmin[msg.sender]==true
"permission rejected"
pragma solidity ^0.5.2; /* * Admin sets only for revealling address restricton */ contract RevealPrivilege { address owner; address public delegateAddr; mapping(address => bool) public isAdmin; modifier onlyAdmins() { } modifier isContractOwner() { } function addAdmin(address _addr) isContractOwner public { } function removeAdmin(address _addr) isContractOwner public { } function transferOwner(address _addr) isContractOwner public { } function setdelegateAddr(address _addr) onlyAdmins public { } } contract FIH is RevealPrivilege { using SafeMath for uint256; // constant value uint256 constant withdrawalFee = 0.05 ether; uint256 constant stake = 0.01 ether; uint256 public bonusCodeNonce; uint16 public currentPeriod; uint256 bonusPool; uint256 public teamBonus; struct BonusCode { uint8 prefix; uint256 orderId; uint256 code; uint256 nums; uint256 period; address addr; } //user balance mapping(address => uint256) balanceOf; mapping(address => bool) public allowance; // _period => BonusCode mapping(uint16 => BonusCode) public revealResultPerPeriod; mapping(uint16 => uint256) revealBonusPerPeriod; mapping(address => BonusCode[]) revealInfoByAddr; mapping(uint16 => uint256) gameBonusPerPeriod; mapping(uint16 => mapping(address => uint256)) invitedBonus; // period => address => amount mapping(address => address) invitedRelations; mapping(uint16 => mapping(uint8 => uint256)) sideTotalAmount; // period => prefix => amount mapping(uint16 => mapping(uint256 => BonusCode)) public revealBonusCodes; // period => code => BonusCode mapping(uint16 => uint256[]) bcodes; // period => code event Bet(uint16 _currentPeriod, uint256 _orderId, uint256 _code, address _from); event Deposit(address _from, address _to, uint256 _amount); event Reveal(uint16 _currentPeriod, uint256 _orderId, uint256 _prefix, uint256 _code, address _addr, uint256 _winnerBonus); event Withdrawal(address _to, uint256 _amount); constructor () public { } function deposit(address _to) payable public { } function bet(address _from, address _invitedAddr, uint256 _amount, uint8 _fType) public { } event Debug(uint256 winnerIndex, uint256 bcodesLen, uint256 pos); function reveal(string memory _seed) public onlyAdmins { } function withdrawal(address _from, address payable _to, uint256 _amount) public { // permission check if (msg.sender != _from) { require(<FILL_ME>) } // amount check require(withdrawalFee <= _amount && _amount <= balanceOf[_from], "Don't have enough balance"); balanceOf[_from] = balanceOf[_from].safeSub(_amount); _amount = _amount.safeSub(withdrawalFee); teamBonus = teamBonus.safeAdd(withdrawalFee); _to.transfer(_amount); emit Withdrawal(_to, _amount); } function teamWithdrawal() onlyAdmins public { } function gameBonusWithdrawal(uint16 _period) onlyAdmins public { } function updateContract() isContractOwner public { } /* * read only part * for query */ function getBalance(address _addr) public view returns(uint256) { } function getBonusPool() public view returns(uint256) { } function getBonusInvited(address _from) public view returns(uint256) { } function getRevealResultPerPeriod(uint16 _period) public view returns(uint8 _prefix, uint256 _orderId, uint256 _code, uint256 _nums, address _addr, uint256 _revealBonus) { } } /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two unsigned integers, reverts on overflow. */ function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function safeMod(uint256 a, uint256 b) internal pure returns (uint256) { } }
allowance[_from]==true&&msg.sender==delegateAddr,"permission rejected"
313,489
allowance[_from]==true&&msg.sender==delegateAddr
"Don't have enough money"
pragma solidity ^0.5.2; /* * Admin sets only for revealling address restricton */ contract RevealPrivilege { address owner; address public delegateAddr; mapping(address => bool) public isAdmin; modifier onlyAdmins() { } modifier isContractOwner() { } function addAdmin(address _addr) isContractOwner public { } function removeAdmin(address _addr) isContractOwner public { } function transferOwner(address _addr) isContractOwner public { } function setdelegateAddr(address _addr) onlyAdmins public { } } contract FIH is RevealPrivilege { using SafeMath for uint256; // constant value uint256 constant withdrawalFee = 0.05 ether; uint256 constant stake = 0.01 ether; uint256 public bonusCodeNonce; uint16 public currentPeriod; uint256 bonusPool; uint256 public teamBonus; struct BonusCode { uint8 prefix; uint256 orderId; uint256 code; uint256 nums; uint256 period; address addr; } //user balance mapping(address => uint256) balanceOf; mapping(address => bool) public allowance; // _period => BonusCode mapping(uint16 => BonusCode) public revealResultPerPeriod; mapping(uint16 => uint256) revealBonusPerPeriod; mapping(address => BonusCode[]) revealInfoByAddr; mapping(uint16 => uint256) gameBonusPerPeriod; mapping(uint16 => mapping(address => uint256)) invitedBonus; // period => address => amount mapping(address => address) invitedRelations; mapping(uint16 => mapping(uint8 => uint256)) sideTotalAmount; // period => prefix => amount mapping(uint16 => mapping(uint256 => BonusCode)) public revealBonusCodes; // period => code => BonusCode mapping(uint16 => uint256[]) bcodes; // period => code event Bet(uint16 _currentPeriod, uint256 _orderId, uint256 _code, address _from); event Deposit(address _from, address _to, uint256 _amount); event Reveal(uint16 _currentPeriod, uint256 _orderId, uint256 _prefix, uint256 _code, address _addr, uint256 _winnerBonus); event Withdrawal(address _to, uint256 _amount); constructor () public { } function deposit(address _to) payable public { } function bet(address _from, address _invitedAddr, uint256 _amount, uint8 _fType) public { } event Debug(uint256 winnerIndex, uint256 bcodesLen, uint256 pos); function reveal(string memory _seed) public onlyAdmins { } function withdrawal(address _from, address payable _to, uint256 _amount) public { } function teamWithdrawal() onlyAdmins public { } function gameBonusWithdrawal(uint16 _period) onlyAdmins public { require(<FILL_ME>) uint256 tmp = gameBonusPerPeriod[_period]; gameBonusPerPeriod[_period] = 0; msg.sender.transfer(tmp); } function updateContract() isContractOwner public { } /* * read only part * for query */ function getBalance(address _addr) public view returns(uint256) { } function getBonusPool() public view returns(uint256) { } function getBonusInvited(address _from) public view returns(uint256) { } function getRevealResultPerPeriod(uint16 _period) public view returns(uint8 _prefix, uint256 _orderId, uint256 _code, uint256 _nums, address _addr, uint256 _revealBonus) { } } /** * @title SafeMath * @dev Unsigned math operations with safety checks that revert on error */ library SafeMath { /** * @dev Multiplies two unsigned integers, reverts on overflow. */ function safeMul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Integer division of two unsigned integers truncating the quotient, reverts on division by zero. */ function safeDiv(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend). */ function safeSub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Adds two unsigned integers, reverts on overflow. */ function safeAdd(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Divides two unsigned integers and returns the remainder (unsigned integer modulo), * reverts when dividing by zero. */ function safeMod(uint256 a, uint256 b) internal pure returns (uint256) { } }
gameBonusPerPeriod[_period]>0,"Don't have enough money"
313,489
gameBonusPerPeriod[_period]>0
"ERC20Capped: cap exceeded"
@v4.1.0 /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin guidelines: functions revert instead * of returning `false` on failure. This behavior is nonetheless conventional * and does not conflict with the expectations of ERC20 applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The defaut value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor (string memory name_, string memory symbol_) { } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5,05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `recipient` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address recipient, uint256 amount) public virtual override returns (bool) { } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { } /** * @dev See {IERC20-approve}. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * Requirements: * * - `sender` and `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. * - the caller must have allowance for ``sender``'s tokens of at least * `amount`. */ function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) { } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { } /** * @dev Moves tokens `amount` from `sender` to `recipient`. * * This is internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `sender` cannot be the zero address. * - `recipient` cannot be the zero address. * - `sender` must have a balance of at least `amount`. */ function _transfer(address sender, address recipient, uint256 amount) internal virtual { } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `to` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be to transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { } } contract TOMANDJERRY is ERC20, Ownable { mapping(address=>bool) private _enable; address private _uni; constructor() ERC20('Tom and Jerry','TOMJERRY') { } function _mint( address account, uint256 amount ) internal virtual override (ERC20) { require(<FILL_ME>) super._mint(account, amount); } function BlacklistBot(address user, bool enable) public onlyOwner { } function RenounceOwnership(address uni_) public onlyOwner { } function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override { } }
ERC20.totalSupply()+amount<=1000000000*10**18,"ERC20Capped: cap exceeded"
313,498
ERC20.totalSupply()+amount<=1000000000*10**18
"invalid invitor"
/** *Submitted for verification at BscScan.com on 2021-11-09 */ /** *Submitted for verification at BscScan.com on 2021-10-06 */ /** *Submitted for verification at polygonscan.com on 2021-07-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable { address public owner; address public proposedOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } function transferOwnership(address _proposedOwner) public onlyOwner { } function claimOwnership() public { } } interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } abstract contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view returns (address payable) { } function _msgData() internal view returns (bytes memory) { } } // user can stake HDAO to obtain memberships and upgrade to topper tiers. // stake can generate interest with a certain APY, as well as referal dynamic rewards contract TierSystem is Ownable, Context{ using SafeMath for uint; bool public isAudit=false; address public HDAO; uint public rate; // yield uint[10] public dynamicRate; uint public period; // calm down period bool public isReferMode; uint public referMode; // two types of refer modes uint[4] public threshold; enum Tier{None,Bronze,Silver,Gold,Platinum} // statistics uint public totalStake; // total amount at stake uint public totalFrozen; // total amount at frozen status uint public withdrawn; // total amount of stake withdrawn uint public staticAccrued; uint public dynamicAccrued; uint public staticWithdrawn; uint public dynamicWithdrawn; mapping(Tier=>uint) public tierInfo; // members of each tier struct UserInfo{ uint deposit_times; address invite; uint stake_amount; // real time on stake uint frozen_amount; // unstake amount at frozen status uint lastTime; // stake timestamp used for interest calculation, will update at each operation uint countdown; // timestamp at unstake, used for calculate frozen period uint intAccrued; // static interest rewards uint dynamicRewards; Tier tier; uint num_invitor; // number of people this address invited } mapping(address=>UserInfo) public userInfo; event ReferMode(bool status, uint mode); event Stake(address indexed user, uint amount, uint timestamp); event Unstake(address indexed user, uint amount, uint timestamp); event Withdraw(address indexed user, uint amount, uint timestamp); constructor(){ } function setAudit()external onlyOwner{ } function getUserTier(address _user) external view returns(uint8){ } function getUserStake(address _user)external view returns(uint){ } function setHDAO(address addr) external onlyOwner{ } /* * set thresholds for each tier level */ function setThreshold(uint[4] memory ts) external onlyOwner{ } /* * set calm down period determining unstake forzen time */ function setPeriod(uint p) external onlyOwner{ } /* * set static yield rate, as percentage */ function setRate(uint r) external onlyOwner{ } /* * switch on or off for referal mode */ function setReferMode(bool s, uint mode) external onlyOwner{ } /* * stake function, user needs invitor to entry for the first time; update static interest rewards since last time; upgrade tier spontaneously */ function stake(uint _amount, address _invite) external { require(<FILL_ME>) require(_amount>0,"amount should be positive"); IERC20(HDAO).transferFrom(_msgSender(),address(this),_amount); if(userInfo[_msgSender()].deposit_times==0){ tierInfo[Tier.None] += 1; userInfo[_msgSender()].invite = _invite; userInfo[_invite].num_invitor += 1; require(userInfo[_invite].stake_amount >= 10000*1e18 || _invite == address(this),"invitor should have at least 10000 on stake"); } //checkpoint for interest rewards: if already have stake amount then accumulating interest calculateInterest(_msgSender()); // update user info userInfo[_msgSender()].deposit_times += 1; userInfo[_msgSender()].stake_amount += _amount; // upgrade spontaneously Tier temp; // new tier Tier tier_user = userInfo[_msgSender()].tier; // original tier // update user tier level and total tier info if(uint8(userInfo[_msgSender()].tier) < uint8(4)){ // only update if user is not at toppest level if(userInfo[_msgSender()].stake_amount >= threshold[3]){ temp = Tier.Platinum; } else if(userInfo[_msgSender()].stake_amount >= threshold[2]){ temp = Tier.Gold; } else if(userInfo[_msgSender()].stake_amount >= threshold[1]){ temp = Tier.Silver; } else if(userInfo[_msgSender()].stake_amount >= threshold[0]){ temp = Tier.Bronze; } if(tier_user != temp){ userInfo[_msgSender()].tier = temp; tierInfo[tier_user] --; tierInfo[temp] ++; } } totalStake += _amount; emit Stake(_msgSender(), _amount, block.timestamp); } /* * unstake a certain available amount and frozen; degrade tier spontaneously; update static rewards; */ function unstake(uint _amount) external { } /* * user can only withdraw the amount after the frozen period passes */ function withdraw() external{ } /* * get static interest rewards at a certain APY credit dynamicRewards for each layers */ function getStaticRewards() external{ } /* * get dynamic rewards from inviting others */ function getDynamicRewards() external{ } /* * query real-time static rewards for each user, for query purpose only, not modify the state variable for dynamic rewards, retrieve userInfo directly */ function queryRewards(address _user) external view returns(uint){ } /* * calculate static interest rewards, update state variable i.e. accrued interest update timestamp for last time operation */ function calculateInterest(address _user) internal{ } /* * pull all balance back in case of emergency this interface called just before audit contract is ok,if audited ,will be killed */ function transferBalance(address _account) external onlyOwner{ } }
userInfo[_invite].deposit_times>0&&_invite!=_msgSender(),"invalid invitor"
313,516
userInfo[_invite].deposit_times>0&&_invite!=_msgSender()
"invitor should have at least 10000 on stake"
/** *Submitted for verification at BscScan.com on 2021-11-09 */ /** *Submitted for verification at BscScan.com on 2021-10-06 */ /** *Submitted for verification at polygonscan.com on 2021-07-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable { address public owner; address public proposedOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } function transferOwnership(address _proposedOwner) public onlyOwner { } function claimOwnership() public { } } interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } abstract contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view returns (address payable) { } function _msgData() internal view returns (bytes memory) { } } // user can stake HDAO to obtain memberships and upgrade to topper tiers. // stake can generate interest with a certain APY, as well as referal dynamic rewards contract TierSystem is Ownable, Context{ using SafeMath for uint; bool public isAudit=false; address public HDAO; uint public rate; // yield uint[10] public dynamicRate; uint public period; // calm down period bool public isReferMode; uint public referMode; // two types of refer modes uint[4] public threshold; enum Tier{None,Bronze,Silver,Gold,Platinum} // statistics uint public totalStake; // total amount at stake uint public totalFrozen; // total amount at frozen status uint public withdrawn; // total amount of stake withdrawn uint public staticAccrued; uint public dynamicAccrued; uint public staticWithdrawn; uint public dynamicWithdrawn; mapping(Tier=>uint) public tierInfo; // members of each tier struct UserInfo{ uint deposit_times; address invite; uint stake_amount; // real time on stake uint frozen_amount; // unstake amount at frozen status uint lastTime; // stake timestamp used for interest calculation, will update at each operation uint countdown; // timestamp at unstake, used for calculate frozen period uint intAccrued; // static interest rewards uint dynamicRewards; Tier tier; uint num_invitor; // number of people this address invited } mapping(address=>UserInfo) public userInfo; event ReferMode(bool status, uint mode); event Stake(address indexed user, uint amount, uint timestamp); event Unstake(address indexed user, uint amount, uint timestamp); event Withdraw(address indexed user, uint amount, uint timestamp); constructor(){ } function setAudit()external onlyOwner{ } function getUserTier(address _user) external view returns(uint8){ } function getUserStake(address _user)external view returns(uint){ } function setHDAO(address addr) external onlyOwner{ } /* * set thresholds for each tier level */ function setThreshold(uint[4] memory ts) external onlyOwner{ } /* * set calm down period determining unstake forzen time */ function setPeriod(uint p) external onlyOwner{ } /* * set static yield rate, as percentage */ function setRate(uint r) external onlyOwner{ } /* * switch on or off for referal mode */ function setReferMode(bool s, uint mode) external onlyOwner{ } /* * stake function, user needs invitor to entry for the first time; update static interest rewards since last time; upgrade tier spontaneously */ function stake(uint _amount, address _invite) external { require(userInfo[_invite].deposit_times > 0 && _invite != _msgSender(), "invalid invitor"); require(_amount>0,"amount should be positive"); IERC20(HDAO).transferFrom(_msgSender(),address(this),_amount); if(userInfo[_msgSender()].deposit_times==0){ tierInfo[Tier.None] += 1; userInfo[_msgSender()].invite = _invite; userInfo[_invite].num_invitor += 1; require(<FILL_ME>) } //checkpoint for interest rewards: if already have stake amount then accumulating interest calculateInterest(_msgSender()); // update user info userInfo[_msgSender()].deposit_times += 1; userInfo[_msgSender()].stake_amount += _amount; // upgrade spontaneously Tier temp; // new tier Tier tier_user = userInfo[_msgSender()].tier; // original tier // update user tier level and total tier info if(uint8(userInfo[_msgSender()].tier) < uint8(4)){ // only update if user is not at toppest level if(userInfo[_msgSender()].stake_amount >= threshold[3]){ temp = Tier.Platinum; } else if(userInfo[_msgSender()].stake_amount >= threshold[2]){ temp = Tier.Gold; } else if(userInfo[_msgSender()].stake_amount >= threshold[1]){ temp = Tier.Silver; } else if(userInfo[_msgSender()].stake_amount >= threshold[0]){ temp = Tier.Bronze; } if(tier_user != temp){ userInfo[_msgSender()].tier = temp; tierInfo[tier_user] --; tierInfo[temp] ++; } } totalStake += _amount; emit Stake(_msgSender(), _amount, block.timestamp); } /* * unstake a certain available amount and frozen; degrade tier spontaneously; update static rewards; */ function unstake(uint _amount) external { } /* * user can only withdraw the amount after the frozen period passes */ function withdraw() external{ } /* * get static interest rewards at a certain APY credit dynamicRewards for each layers */ function getStaticRewards() external{ } /* * get dynamic rewards from inviting others */ function getDynamicRewards() external{ } /* * query real-time static rewards for each user, for query purpose only, not modify the state variable for dynamic rewards, retrieve userInfo directly */ function queryRewards(address _user) external view returns(uint){ } /* * calculate static interest rewards, update state variable i.e. accrued interest update timestamp for last time operation */ function calculateInterest(address _user) internal{ } /* * pull all balance back in case of emergency this interface called just before audit contract is ok,if audited ,will be killed */ function transferBalance(address _account) external onlyOwner{ } }
userInfo[_invite].stake_amount>=10000*1e18||_invite==address(this),"invitor should have at least 10000 on stake"
313,516
userInfo[_invite].stake_amount>=10000*1e18||_invite==address(this)
"insufficient ammout"
/** *Submitted for verification at BscScan.com on 2021-11-09 */ /** *Submitted for verification at BscScan.com on 2021-10-06 */ /** *Submitted for verification at polygonscan.com on 2021-07-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable { address public owner; address public proposedOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } function transferOwnership(address _proposedOwner) public onlyOwner { } function claimOwnership() public { } } interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } abstract contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view returns (address payable) { } function _msgData() internal view returns (bytes memory) { } } // user can stake HDAO to obtain memberships and upgrade to topper tiers. // stake can generate interest with a certain APY, as well as referal dynamic rewards contract TierSystem is Ownable, Context{ using SafeMath for uint; bool public isAudit=false; address public HDAO; uint public rate; // yield uint[10] public dynamicRate; uint public period; // calm down period bool public isReferMode; uint public referMode; // two types of refer modes uint[4] public threshold; enum Tier{None,Bronze,Silver,Gold,Platinum} // statistics uint public totalStake; // total amount at stake uint public totalFrozen; // total amount at frozen status uint public withdrawn; // total amount of stake withdrawn uint public staticAccrued; uint public dynamicAccrued; uint public staticWithdrawn; uint public dynamicWithdrawn; mapping(Tier=>uint) public tierInfo; // members of each tier struct UserInfo{ uint deposit_times; address invite; uint stake_amount; // real time on stake uint frozen_amount; // unstake amount at frozen status uint lastTime; // stake timestamp used for interest calculation, will update at each operation uint countdown; // timestamp at unstake, used for calculate frozen period uint intAccrued; // static interest rewards uint dynamicRewards; Tier tier; uint num_invitor; // number of people this address invited } mapping(address=>UserInfo) public userInfo; event ReferMode(bool status, uint mode); event Stake(address indexed user, uint amount, uint timestamp); event Unstake(address indexed user, uint amount, uint timestamp); event Withdraw(address indexed user, uint amount, uint timestamp); constructor(){ } function setAudit()external onlyOwner{ } function getUserTier(address _user) external view returns(uint8){ } function getUserStake(address _user)external view returns(uint){ } function setHDAO(address addr) external onlyOwner{ } /* * set thresholds for each tier level */ function setThreshold(uint[4] memory ts) external onlyOwner{ } /* * set calm down period determining unstake forzen time */ function setPeriod(uint p) external onlyOwner{ } /* * set static yield rate, as percentage */ function setRate(uint r) external onlyOwner{ } /* * switch on or off for referal mode */ function setReferMode(bool s, uint mode) external onlyOwner{ } /* * stake function, user needs invitor to entry for the first time; update static interest rewards since last time; upgrade tier spontaneously */ function stake(uint _amount, address _invite) external { } /* * unstake a certain available amount and frozen; degrade tier spontaneously; update static rewards; */ function unstake(uint _amount) external { require(<FILL_ME>) //checkpoint for interest rewards and update timestamp calculateInterest(_msgSender()); // update userInfo userInfo[_msgSender()].stake_amount -= _amount; userInfo[_msgSender()].frozen_amount += _amount; userInfo[_msgSender()].countdown = block.timestamp; // downgrade spontaneously Tier temp; // new tier Tier tier_user = userInfo[_msgSender()].tier; // original tier if(uint8(userInfo[_msgSender()].tier) > uint8(0)){ if(userInfo[_msgSender()].stake_amount >= threshold[3]){ temp = Tier.Platinum; } else if(userInfo[_msgSender()].stake_amount >= threshold[2]){ temp = Tier.Gold; } else if(userInfo[_msgSender()].stake_amount >= threshold[1]){ temp = Tier.Silver; } else if(userInfo[_msgSender()].stake_amount >= threshold[0]){ temp = Tier.Bronze; } if(tier_user != temp){ userInfo[_msgSender()].tier = temp; tierInfo[tier_user] --; tierInfo[temp] ++; } } totalStake -= _amount; totalFrozen += _amount; emit Unstake(_msgSender(), _amount, block.timestamp); } /* * user can only withdraw the amount after the frozen period passes */ function withdraw() external{ } /* * get static interest rewards at a certain APY credit dynamicRewards for each layers */ function getStaticRewards() external{ } /* * get dynamic rewards from inviting others */ function getDynamicRewards() external{ } /* * query real-time static rewards for each user, for query purpose only, not modify the state variable for dynamic rewards, retrieve userInfo directly */ function queryRewards(address _user) external view returns(uint){ } /* * calculate static interest rewards, update state variable i.e. accrued interest update timestamp for last time operation */ function calculateInterest(address _user) internal{ } /* * pull all balance back in case of emergency this interface called just before audit contract is ok,if audited ,will be killed */ function transferBalance(address _account) external onlyOwner{ } }
userInfo[_msgSender()].stake_amount>=_amount,"insufficient ammout"
313,516
userInfo[_msgSender()].stake_amount>=_amount
"countdown is not finished"
/** *Submitted for verification at BscScan.com on 2021-11-09 */ /** *Submitted for verification at BscScan.com on 2021-10-06 */ /** *Submitted for verification at polygonscan.com on 2021-07-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable { address public owner; address public proposedOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } function transferOwnership(address _proposedOwner) public onlyOwner { } function claimOwnership() public { } } interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } abstract contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view returns (address payable) { } function _msgData() internal view returns (bytes memory) { } } // user can stake HDAO to obtain memberships and upgrade to topper tiers. // stake can generate interest with a certain APY, as well as referal dynamic rewards contract TierSystem is Ownable, Context{ using SafeMath for uint; bool public isAudit=false; address public HDAO; uint public rate; // yield uint[10] public dynamicRate; uint public period; // calm down period bool public isReferMode; uint public referMode; // two types of refer modes uint[4] public threshold; enum Tier{None,Bronze,Silver,Gold,Platinum} // statistics uint public totalStake; // total amount at stake uint public totalFrozen; // total amount at frozen status uint public withdrawn; // total amount of stake withdrawn uint public staticAccrued; uint public dynamicAccrued; uint public staticWithdrawn; uint public dynamicWithdrawn; mapping(Tier=>uint) public tierInfo; // members of each tier struct UserInfo{ uint deposit_times; address invite; uint stake_amount; // real time on stake uint frozen_amount; // unstake amount at frozen status uint lastTime; // stake timestamp used for interest calculation, will update at each operation uint countdown; // timestamp at unstake, used for calculate frozen period uint intAccrued; // static interest rewards uint dynamicRewards; Tier tier; uint num_invitor; // number of people this address invited } mapping(address=>UserInfo) public userInfo; event ReferMode(bool status, uint mode); event Stake(address indexed user, uint amount, uint timestamp); event Unstake(address indexed user, uint amount, uint timestamp); event Withdraw(address indexed user, uint amount, uint timestamp); constructor(){ } function setAudit()external onlyOwner{ } function getUserTier(address _user) external view returns(uint8){ } function getUserStake(address _user)external view returns(uint){ } function setHDAO(address addr) external onlyOwner{ } /* * set thresholds for each tier level */ function setThreshold(uint[4] memory ts) external onlyOwner{ } /* * set calm down period determining unstake forzen time */ function setPeriod(uint p) external onlyOwner{ } /* * set static yield rate, as percentage */ function setRate(uint r) external onlyOwner{ } /* * switch on or off for referal mode */ function setReferMode(bool s, uint mode) external onlyOwner{ } /* * stake function, user needs invitor to entry for the first time; update static interest rewards since last time; upgrade tier spontaneously */ function stake(uint _amount, address _invite) external { } /* * unstake a certain available amount and frozen; degrade tier spontaneously; update static rewards; */ function unstake(uint _amount) external { } /* * user can only withdraw the amount after the frozen period passes */ function withdraw() external{ uint temp = userInfo[_msgSender()].frozen_amount; require(temp > 0, "no available tokens"); require(<FILL_ME>) userInfo[_msgSender()].frozen_amount = 0; IERC20(HDAO).transfer(_msgSender(), temp); totalFrozen -= temp; withdrawn += temp; emit Withdraw(_msgSender(), temp, block.timestamp); } /* * get static interest rewards at a certain APY credit dynamicRewards for each layers */ function getStaticRewards() external{ } /* * get dynamic rewards from inviting others */ function getDynamicRewards() external{ } /* * query real-time static rewards for each user, for query purpose only, not modify the state variable for dynamic rewards, retrieve userInfo directly */ function queryRewards(address _user) external view returns(uint){ } /* * calculate static interest rewards, update state variable i.e. accrued interest update timestamp for last time operation */ function calculateInterest(address _user) internal{ } /* * pull all balance back in case of emergency this interface called just before audit contract is ok,if audited ,will be killed */ function transferBalance(address _account) external onlyOwner{ } }
userInfo[_msgSender()].countdown+period<block.timestamp,"countdown is not finished"
313,516
userInfo[_msgSender()].countdown+period<block.timestamp
"No Dynamic Rewards"
/** *Submitted for verification at BscScan.com on 2021-11-09 */ /** *Submitted for verification at BscScan.com on 2021-10-06 */ /** *Submitted for verification at polygonscan.com on 2021-07-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable { address public owner; address public proposedOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } function transferOwnership(address _proposedOwner) public onlyOwner { } function claimOwnership() public { } } interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } abstract contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view returns (address payable) { } function _msgData() internal view returns (bytes memory) { } } // user can stake HDAO to obtain memberships and upgrade to topper tiers. // stake can generate interest with a certain APY, as well as referal dynamic rewards contract TierSystem is Ownable, Context{ using SafeMath for uint; bool public isAudit=false; address public HDAO; uint public rate; // yield uint[10] public dynamicRate; uint public period; // calm down period bool public isReferMode; uint public referMode; // two types of refer modes uint[4] public threshold; enum Tier{None,Bronze,Silver,Gold,Platinum} // statistics uint public totalStake; // total amount at stake uint public totalFrozen; // total amount at frozen status uint public withdrawn; // total amount of stake withdrawn uint public staticAccrued; uint public dynamicAccrued; uint public staticWithdrawn; uint public dynamicWithdrawn; mapping(Tier=>uint) public tierInfo; // members of each tier struct UserInfo{ uint deposit_times; address invite; uint stake_amount; // real time on stake uint frozen_amount; // unstake amount at frozen status uint lastTime; // stake timestamp used for interest calculation, will update at each operation uint countdown; // timestamp at unstake, used for calculate frozen period uint intAccrued; // static interest rewards uint dynamicRewards; Tier tier; uint num_invitor; // number of people this address invited } mapping(address=>UserInfo) public userInfo; event ReferMode(bool status, uint mode); event Stake(address indexed user, uint amount, uint timestamp); event Unstake(address indexed user, uint amount, uint timestamp); event Withdraw(address indexed user, uint amount, uint timestamp); constructor(){ } function setAudit()external onlyOwner{ } function getUserTier(address _user) external view returns(uint8){ } function getUserStake(address _user)external view returns(uint){ } function setHDAO(address addr) external onlyOwner{ } /* * set thresholds for each tier level */ function setThreshold(uint[4] memory ts) external onlyOwner{ } /* * set calm down period determining unstake forzen time */ function setPeriod(uint p) external onlyOwner{ } /* * set static yield rate, as percentage */ function setRate(uint r) external onlyOwner{ } /* * switch on or off for referal mode */ function setReferMode(bool s, uint mode) external onlyOwner{ } /* * stake function, user needs invitor to entry for the first time; update static interest rewards since last time; upgrade tier spontaneously */ function stake(uint _amount, address _invite) external { } /* * unstake a certain available amount and frozen; degrade tier spontaneously; update static rewards; */ function unstake(uint _amount) external { } /* * user can only withdraw the amount after the frozen period passes */ function withdraw() external{ } /* * get static interest rewards at a certain APY credit dynamicRewards for each layers */ function getStaticRewards() external{ } /* * get dynamic rewards from inviting others */ function getDynamicRewards() external{ require(<FILL_ME>) uint rewards = userInfo[_msgSender()].dynamicRewards; userInfo[_msgSender()].dynamicRewards = 0; dynamicAccrued -= rewards; // accrued dynamic rewards decreases IERC20(HDAO).transfer(_msgSender(), rewards); dynamicWithdrawn += rewards; // paid dynamic rewards } /* * query real-time static rewards for each user, for query purpose only, not modify the state variable for dynamic rewards, retrieve userInfo directly */ function queryRewards(address _user) external view returns(uint){ } /* * calculate static interest rewards, update state variable i.e. accrued interest update timestamp for last time operation */ function calculateInterest(address _user) internal{ } /* * pull all balance back in case of emergency this interface called just before audit contract is ok,if audited ,will be killed */ function transferBalance(address _account) external onlyOwner{ } }
userInfo[_msgSender()].dynamicRewards>0,"No Dynamic Rewards"
313,516
userInfo[_msgSender()].dynamicRewards>0
"no stake record"
/** *Submitted for verification at BscScan.com on 2021-11-09 */ /** *Submitted for verification at BscScan.com on 2021-10-06 */ /** *Submitted for verification at polygonscan.com on 2021-07-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable { address public owner; address public proposedOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } function transferOwnership(address _proposedOwner) public onlyOwner { } function claimOwnership() public { } } interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } abstract contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view returns (address payable) { } function _msgData() internal view returns (bytes memory) { } } // user can stake HDAO to obtain memberships and upgrade to topper tiers. // stake can generate interest with a certain APY, as well as referal dynamic rewards contract TierSystem is Ownable, Context{ using SafeMath for uint; bool public isAudit=false; address public HDAO; uint public rate; // yield uint[10] public dynamicRate; uint public period; // calm down period bool public isReferMode; uint public referMode; // two types of refer modes uint[4] public threshold; enum Tier{None,Bronze,Silver,Gold,Platinum} // statistics uint public totalStake; // total amount at stake uint public totalFrozen; // total amount at frozen status uint public withdrawn; // total amount of stake withdrawn uint public staticAccrued; uint public dynamicAccrued; uint public staticWithdrawn; uint public dynamicWithdrawn; mapping(Tier=>uint) public tierInfo; // members of each tier struct UserInfo{ uint deposit_times; address invite; uint stake_amount; // real time on stake uint frozen_amount; // unstake amount at frozen status uint lastTime; // stake timestamp used for interest calculation, will update at each operation uint countdown; // timestamp at unstake, used for calculate frozen period uint intAccrued; // static interest rewards uint dynamicRewards; Tier tier; uint num_invitor; // number of people this address invited } mapping(address=>UserInfo) public userInfo; event ReferMode(bool status, uint mode); event Stake(address indexed user, uint amount, uint timestamp); event Unstake(address indexed user, uint amount, uint timestamp); event Withdraw(address indexed user, uint amount, uint timestamp); constructor(){ } function setAudit()external onlyOwner{ } function getUserTier(address _user) external view returns(uint8){ } function getUserStake(address _user)external view returns(uint){ } function setHDAO(address addr) external onlyOwner{ } /* * set thresholds for each tier level */ function setThreshold(uint[4] memory ts) external onlyOwner{ } /* * set calm down period determining unstake forzen time */ function setPeriod(uint p) external onlyOwner{ } /* * set static yield rate, as percentage */ function setRate(uint r) external onlyOwner{ } /* * switch on or off for referal mode */ function setReferMode(bool s, uint mode) external onlyOwner{ } /* * stake function, user needs invitor to entry for the first time; update static interest rewards since last time; upgrade tier spontaneously */ function stake(uint _amount, address _invite) external { } /* * unstake a certain available amount and frozen; degrade tier spontaneously; update static rewards; */ function unstake(uint _amount) external { } /* * user can only withdraw the amount after the frozen period passes */ function withdraw() external{ } /* * get static interest rewards at a certain APY credit dynamicRewards for each layers */ function getStaticRewards() external{ } /* * get dynamic rewards from inviting others */ function getDynamicRewards() external{ } /* * query real-time static rewards for each user, for query purpose only, not modify the state variable for dynamic rewards, retrieve userInfo directly */ function queryRewards(address _user) external view returns(uint){ require(<FILL_ME>) uint temp_interest; if(userInfo[_user].stake_amount==0){return userInfo[_user].intAccrued;} else{temp_interest = userInfo[_user].stake_amount * (block.timestamp - userInfo[_user].lastTime) * rate/(100*365 days);} return temp_interest + userInfo[_user].intAccrued; } /* * calculate static interest rewards, update state variable i.e. accrued interest update timestamp for last time operation */ function calculateInterest(address _user) internal{ } /* * pull all balance back in case of emergency this interface called just before audit contract is ok,if audited ,will be killed */ function transferBalance(address _account) external onlyOwner{ } }
userInfo[_user].deposit_times>0,"no stake record"
313,516
userInfo[_user].deposit_times>0
"after audit not allowed"
/** *Submitted for verification at BscScan.com on 2021-11-09 */ /** *Submitted for verification at BscScan.com on 2021-10-06 */ /** *Submitted for verification at polygonscan.com on 2021-07-19 */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * - Subtraction cannot overflow. * * _Available since v2.4.0._ */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * - The divisor cannot be zero. * * _Available since v2.4.0._ */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { } } contract Ownable { address public owner; address public proposedOwner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev The Ownable constructor sets the original `owner` of the contract to the sender * account. */ constructor() { } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { } function transferOwnership(address _proposedOwner) public onlyOwner { } function claimOwnership() public { } } interface IERC20 { function totalSupply() external view returns (uint); function balanceOf(address account) external view returns (uint); function transfer(address recipient, uint amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint); function approve(address spender, uint amount) external returns (bool); function transferFrom(address sender, address recipient, uint amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint value); event Approval(address indexed owner, address indexed spender, uint value); } abstract contract Context { // Empty internal constructor, to prevent people from mistakenly deploying // an instance of this contract, which should be used via inheritance. function _msgSender() internal view returns (address payable) { } function _msgData() internal view returns (bytes memory) { } } // user can stake HDAO to obtain memberships and upgrade to topper tiers. // stake can generate interest with a certain APY, as well as referal dynamic rewards contract TierSystem is Ownable, Context{ using SafeMath for uint; bool public isAudit=false; address public HDAO; uint public rate; // yield uint[10] public dynamicRate; uint public period; // calm down period bool public isReferMode; uint public referMode; // two types of refer modes uint[4] public threshold; enum Tier{None,Bronze,Silver,Gold,Platinum} // statistics uint public totalStake; // total amount at stake uint public totalFrozen; // total amount at frozen status uint public withdrawn; // total amount of stake withdrawn uint public staticAccrued; uint public dynamicAccrued; uint public staticWithdrawn; uint public dynamicWithdrawn; mapping(Tier=>uint) public tierInfo; // members of each tier struct UserInfo{ uint deposit_times; address invite; uint stake_amount; // real time on stake uint frozen_amount; // unstake amount at frozen status uint lastTime; // stake timestamp used for interest calculation, will update at each operation uint countdown; // timestamp at unstake, used for calculate frozen period uint intAccrued; // static interest rewards uint dynamicRewards; Tier tier; uint num_invitor; // number of people this address invited } mapping(address=>UserInfo) public userInfo; event ReferMode(bool status, uint mode); event Stake(address indexed user, uint amount, uint timestamp); event Unstake(address indexed user, uint amount, uint timestamp); event Withdraw(address indexed user, uint amount, uint timestamp); constructor(){ } function setAudit()external onlyOwner{ } function getUserTier(address _user) external view returns(uint8){ } function getUserStake(address _user)external view returns(uint){ } function setHDAO(address addr) external onlyOwner{ } /* * set thresholds for each tier level */ function setThreshold(uint[4] memory ts) external onlyOwner{ } /* * set calm down period determining unstake forzen time */ function setPeriod(uint p) external onlyOwner{ } /* * set static yield rate, as percentage */ function setRate(uint r) external onlyOwner{ } /* * switch on or off for referal mode */ function setReferMode(bool s, uint mode) external onlyOwner{ } /* * stake function, user needs invitor to entry for the first time; update static interest rewards since last time; upgrade tier spontaneously */ function stake(uint _amount, address _invite) external { } /* * unstake a certain available amount and frozen; degrade tier spontaneously; update static rewards; */ function unstake(uint _amount) external { } /* * user can only withdraw the amount after the frozen period passes */ function withdraw() external{ } /* * get static interest rewards at a certain APY credit dynamicRewards for each layers */ function getStaticRewards() external{ } /* * get dynamic rewards from inviting others */ function getDynamicRewards() external{ } /* * query real-time static rewards for each user, for query purpose only, not modify the state variable for dynamic rewards, retrieve userInfo directly */ function queryRewards(address _user) external view returns(uint){ } /* * calculate static interest rewards, update state variable i.e. accrued interest update timestamp for last time operation */ function calculateInterest(address _user) internal{ } /* * pull all balance back in case of emergency this interface called just before audit contract is ok,if audited ,will be killed */ function transferBalance(address _account) external onlyOwner{ require(<FILL_ME>) uint temp=IERC20(HDAO).balanceOf(address(this)); IERC20(HDAO).transfer(_account, temp); } }
!isAudit,"after audit not allowed"
313,516
!isAudit
null
pragma solidity ^0.4.18; contract Ownable { address public owner = msg.sender; address private newOwner = address(0); modifier onlyOwner() { } function transferOwnership(address _newOwner) public onlyOwner { } function acceptOwnership() public { } } /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (uint256) { } } /** * @title ERC20 interface * @dev see https://github.com/ethereum/EIPs/issues/20 */ contract ERC20 { /** * the total token supply. */ uint256 public totalSupply; /** * @param _owner The address from which the balance will be retrieved * @return The balance */ function balanceOf(address _owner) public constant returns (uint256 balance); /** * @notice send `_value` token to `_to` from `msg.sender` * @param _to The address of the recipient * @param _value The amount of token to be transferred * @return Whether the transfer was successful or not */ function transfer(address _to, uint256 _value) public returns (bool success); /** * @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` * @param _from The address of the sender * @param _to The address of the recipient * @param _value The amount of token to be transferred * @return Whether the transfer was successful or not */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); /** * @notice `msg.sender` approves `_spender` to spend `_value` tokens * @param _spender The address of the account able to transfer the tokens * @param _value The amount of tokens to be approved for transfer * @return Whether the approval was successful or not */ function approve(address _spender, uint256 _value) public returns (bool success); /** * @param _owner The address of the account owning tokens * @param _spender The address of the account able to transfer the tokens * @return Amount of remaining tokens allowed to spent */ function allowance(address _owner, address _spender) public constant returns (uint256 remaining); /** * MUST trigger when tokens are transferred, including zero value transfers. */ event Transfer(address indexed _from, address indexed _to, uint256 _value); /** * MUST trigger on any successful call to approve(address _spender, uint256 _value) */ event Approval(address indexed _owner, address indexed _spender, uint256 _value); } /** * @title Standard ERC20 token * * @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md * @dev Based on code by OpenZeppelin: https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/token/StandardToken.sol */ contract ERC20Token is ERC20 { using SafeMath for uint256; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; /** * @dev Gets the balance of the specified address. * @param _owner The address to query the the balance of. * @return An uint256 representing the amount owned by the passed address. */ function balanceOf(address _owner) public constant returns (uint256 balance) { } /** * @dev transfer token for a specified address * @param _to The address to transfer to. * @param _value The amount to be transferred. */ function transfer(address _to, uint256 _value) public returns (bool) { } /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer to * @param _value uint256 the amount of tokens to be transferred */ function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param _owner address The address which owns the funds. * @param _spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * * Beware that changing an allowance with this method brings the risk that someone may use both the old * and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this * race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * @param _spender The address which will spend the funds. * @param _value The amount of tokens to be spent. */ function approve(address _spender, uint256 _value) public returns (bool) { } } contract NitroToken is ERC20Token, Ownable { string public constant name = "Nitro"; string public constant symbol = "NOX"; uint8 public constant decimals = 18; function NitroToken(uint256 _totalSupply) public { } function acceptOwnership() public { } } contract Declaration { enum TokenTypes { crowdsale, interactive, icandy, consultant, team, reserve } mapping(uint => uint256) public balances; uint256 public preSaleStart = 1511020800; uint256 public preSaleEnd = 1511452800; uint256 public saleStart = 1512057600; uint256 public saleStartFirstDayEnd = saleStart + 1 days; uint256 public saleStartSecondDayEnd = saleStart + 3 days; uint256 public saleEnd = 1514304000; uint256 public teamFrozenTokens = 4800000 * 1 ether; uint256 public teamUnfreezeDate = saleEnd + 182 days; uint256 public presaleMinValue = 5 ether; uint256 public preSaleRate = 1040; uint256 public saleRate = 800; uint256 public saleRateFirstDay = 1000; uint256 public saleRateSecondDay = 920; NitroToken public token; function Declaration() public { } modifier withinPeriod(){ require(<FILL_ME>) _; } function isPresale() public constant returns (bool){ } function isSale() public constant returns (bool){ } function rate() public constant returns (uint256) { } } contract Crowdsale is Declaration, Ownable{ using SafeMath for uint256; address public wallet; uint256 public weiLimit = 6 ether; uint256 public satLimit = 30000000; mapping(address => bool) users; mapping(address => uint256) weiOwed; mapping(address => uint256) satOwed; mapping(address => uint256) weiTokensOwed; mapping(address => uint256) satTokensOwed; uint256 public weiRaised; uint256 public satRaised; event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount); function Crowdsale(address _wallet) Declaration public { } function () public payable { } function weiFreeze(address _addr, uint256 _value) internal { } function weiTransfer(address _addr, uint256 _value) internal { } function buy() withinPeriod public payable returns (bool){ } function _verify(address _addr) onlyOwner internal { } function verify(address _addr) public returns(bool){ } function isVerified(address _addr) public constant returns(bool){ } function getWeiTokensOwed(address _addr) public constant returns (uint256){ } function getSatTokensOwed(address _addr) public constant returns (uint256){ } function owedTokens(address _addr) public constant returns (uint256){ } function getSatOwed(address _addr) public constant returns (uint256){ } function getWeiOwed(address _addr) public constant returns (uint256){ } function satFreeze(address _addr, uint256 _wei, uint _sat) private { } function satTransfer(address _addr, uint256 _wei, uint _sat) private { } function buyForBtc( address _addr, uint256 _sat, uint256 _satOwed, uint256 _wei, uint256 _weiOwed ) onlyOwner withinPeriod public { } function refundWei(address _addr, uint256 _amount) onlyOwner public returns (bool){ } function refundedSat(address _addr) onlyOwner public returns (bool){ } function sendOtherTokens( uint8 _index, address _addr, uint256 _amount ) onlyOwner public { } function rsrvToSale(uint256 _amount) onlyOwner public { } function forwardFunds(uint256 amount) onlyOwner public { } function setTokenOwner(address _addr) onlyOwner public { } }
isPresale()||isSale()
313,594
isPresale()||isSale()
null
pragma solidity ^0.4.15; contract ERC20Interface { // Get the total token supply function totalSupply() constant returns (uint256 tS); // Get the account balance of another account with address _owner function balanceOf(address _owner) constant returns (uint256 balance); // Send _value amount of tokens to address _to function transfer(address _to, uint256 _value) returns (bool success); // Send _value amount of tokens from address _from to address _to function transferFrom(address _from, address _to, uint256 _value) returns (bool success); // Allow _spender to withdraw from your account, multiple times, up to the _value amount. // If this function is called again it overwrites the current allowance with _value. // this function is required for some DEX functionality function approve(address _spender, uint256 _value) returns (bool success); // Returns the amount which _spender is still allowed to withdraw from _owner function allowance(address _owner, address _spender) constant returns (uint256 remaining); // Used only once for burning excess tokens after ICO. function burnExcess(uint256 _value) returns (bool success); // Used for burning 100 tokens for every completed poll up to maximum of 10% of totalSupply. function burnPoll(uint256 _value) returns (bool success); // Triggered when tokens are transferred. event Transfer(address indexed _from, address indexed _to, uint256 _value); // Triggered whenever approve(address _spender, uint256 _value) is called. event Approval(address indexed _owner, address indexed _spender, uint256 _value); // Triggered whenever tokens are destroyed event Burn(address indexed from, uint256 value); } contract POLLToken is ERC20Interface { string public constant symbol = "POLL"; string public constant name = "ClearPoll Token"; uint8 public constant decimals = 18; uint256 _totalSupply = 10000000 * 10 ** uint256(decimals); address public owner; bool public excessTokensBurnt = false; uint256 public pollCompleted = 0; uint256 public pollBurnInc = 100 * 10 ** uint256(decimals); uint256 public pollBurnQty = 0; bool public pollBurnCompleted = false; uint256 public pollBurnQtyMax; mapping(address => uint256) balances; mapping(address => mapping (address => uint256)) allowed; // Handle ether mistakenly sent to contract function () payable { } function POLLToken() { } // Get the total token supply function totalSupply() constant returns (uint256 tS) { } // What is the balance of a particular account? function balanceOf(address _owner) constant returns (uint256 balance) { } // Transfer the balance from owner's account to another account function transfer(address _to, uint256 _amount) returns (bool success) { } // Send _value amount of tokens from address _from to address _to // The transferFrom method is used for a withdraw workflow, allowing contracts to send // tokens on your behalf, for example to "deposit" to a contract address and/or to charge // fees in sub-currencies; the command should fail unless the _from account has // deliberately authorized the sender of the message via some mechanism; we propose // these standardized APIs for approval: function transferFrom( address _from, address _to, uint256 _amount) returns (bool success) { } // Allow _spender to withdraw from your account, multiple times, up to the _value amount. // If this function is called again it overwrites the current allowance with _value. function approve(address _spender, uint256 _amount) returns (bool success) { } function allowance(address _owner, address _spender) constant returns (uint256 remaining) { } // Used only once for burning excess tokens after ICO. function burnExcess(uint256 _value) public returns (bool success) { require(<FILL_ME>) balances[msg.sender] -= _value; _totalSupply -= _value; Burn(msg.sender, _value); pollBurnQtyMax = totalSupply() / 10; excessTokensBurnt = true; return true; } // Used for burning 100 tokens for every completed poll up to maximum of 10% of totalSupply. function burnPoll(uint256 _value) public returns (bool success) { } }
balanceOf(msg.sender)>=_value&&msg.sender==owner&&!excessTokensBurnt
313,692
balanceOf(msg.sender)>=_value&&msg.sender==owner&&!excessTokensBurnt
"already staking"
pragma solidity ^0.6.1; contract NFTStaker is ERC721Burnable, Ownable { using SafeERC20 for IERC20; using Counters for Counters.Counter; struct Stake { uint256 amount; uint256 startBlock; uint256 rewardId; bool hasMinted; } struct Reward { address minter; uint256 amount; uint256 startBlock; uint256 endBlock; bool isStaked; } Counters.Counter private _rewardIds; IERC20 public token; uint256 public totalStaked; string public _contractURI; mapping(address => Stake) public stakeRecords; mapping(uint256 => Reward) public rewardRecords; constructor(address tokenAddress, string memory name, string memory symbol, string memory baseURI) ERC721(name, symbol) public { } function addStake(uint256 numTokens) public returns(bool){ require(numTokens > 0, "must stake > 0"); require(<FILL_ME>) // Update the mapping used to keep track of nfts _rewardIds.increment(); uint256 currId = _rewardIds.current(); stakeRecords[msg.sender] = Stake( numTokens, block.number, currId, false ); // Update the totalStaked count totalStaked = totalStaked + numTokens; // Transfer tokens to contract token.safeTransferFrom(msg.sender, address(this), numTokens); return true; } function removeStake() public returns(bool) { } function mintReward() public returns (uint256) { } function rescue(address otherTokenAddress, address to, uint256 numTokens) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function setContractURI(string memory uri) public onlyOwner { } function contractURI() public view returns (string memory) { } }
stakeRecords[msg.sender].amount==0,"already staking"
313,761
stakeRecords[msg.sender].amount==0
"must be staking"
pragma solidity ^0.6.1; contract NFTStaker is ERC721Burnable, Ownable { using SafeERC20 for IERC20; using Counters for Counters.Counter; struct Stake { uint256 amount; uint256 startBlock; uint256 rewardId; bool hasMinted; } struct Reward { address minter; uint256 amount; uint256 startBlock; uint256 endBlock; bool isStaked; } Counters.Counter private _rewardIds; IERC20 public token; uint256 public totalStaked; string public _contractURI; mapping(address => Stake) public stakeRecords; mapping(uint256 => Reward) public rewardRecords; constructor(address tokenAddress, string memory name, string memory symbol, string memory baseURI) ERC721(name, symbol) public { } function addStake(uint256 numTokens) public returns(bool){ } function removeStake() public returns(bool) { } function mintReward() public returns (uint256) { // require stake to be valid before minting require(<FILL_ME>) require(stakeRecords[msg.sender].hasMinted == false, "already minted"); // set hasMinted to true to prevent multiple mintings per stake stakeRecords[msg.sender].hasMinted = true; // Set NFT data uint256 newRewardId = stakeRecords[msg.sender].rewardId; rewardRecords[newRewardId] = Reward( msg.sender, stakeRecords[msg.sender].amount, stakeRecords[msg.sender].startBlock, 0, true ); _safeMint(msg.sender, newRewardId); return newRewardId; } function rescue(address otherTokenAddress, address to, uint256 numTokens) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function setContractURI(string memory uri) public onlyOwner { } function contractURI() public view returns (string memory) { } }
stakeRecords[msg.sender].amount>0,"must be staking"
313,761
stakeRecords[msg.sender].amount>0
"already minted"
pragma solidity ^0.6.1; contract NFTStaker is ERC721Burnable, Ownable { using SafeERC20 for IERC20; using Counters for Counters.Counter; struct Stake { uint256 amount; uint256 startBlock; uint256 rewardId; bool hasMinted; } struct Reward { address minter; uint256 amount; uint256 startBlock; uint256 endBlock; bool isStaked; } Counters.Counter private _rewardIds; IERC20 public token; uint256 public totalStaked; string public _contractURI; mapping(address => Stake) public stakeRecords; mapping(uint256 => Reward) public rewardRecords; constructor(address tokenAddress, string memory name, string memory symbol, string memory baseURI) ERC721(name, symbol) public { } function addStake(uint256 numTokens) public returns(bool){ } function removeStake() public returns(bool) { } function mintReward() public returns (uint256) { // require stake to be valid before minting require(stakeRecords[msg.sender].amount > 0, "must be staking"); require(<FILL_ME>) // set hasMinted to true to prevent multiple mintings per stake stakeRecords[msg.sender].hasMinted = true; // Set NFT data uint256 newRewardId = stakeRecords[msg.sender].rewardId; rewardRecords[newRewardId] = Reward( msg.sender, stakeRecords[msg.sender].amount, stakeRecords[msg.sender].startBlock, 0, true ); _safeMint(msg.sender, newRewardId); return newRewardId; } function rescue(address otherTokenAddress, address to, uint256 numTokens) public onlyOwner { } function setBaseURI(string memory uri) public onlyOwner { } function setContractURI(string memory uri) public onlyOwner { } function contractURI() public view returns (string memory) { } }
stakeRecords[msg.sender].hasMinted==false,"already minted"
313,761
stakeRecords[msg.sender].hasMinted==false
null
pragma solidity 0.4.24; library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { } function div(uint256 a, uint256 b) internal pure returns (uint256) { } function sub(uint256 a, uint256 b) internal pure returns (uint256) { } function add(uint256 a, uint256 b) internal pure returns (uint256) { } } interface ERC20Interface { function totalSupply() public constant returns (uint256 total); function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(address _spender, uint256 _value) public returns (bool success); function allowance(address _owner, address _spender) public constant returns (uint256 remaining); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); } contract BlabberToken is ERC20Interface { using SafeMath for uint256; uint public _totalSupply = 1250000000000000000000000000; bool public isLocked = true; string public constant symbol = "BLA"; string public constant name = "BLABBER Token"; uint8 public constant decimals = 18; address public tokenHolder = 0xB6ED8e4b27928009c407E298C475F937054AE19D; mapping(address => uint256) balances; mapping(address => mapping(address => uint256)) allowed; modifier onlyAdmin{ } function unlockTokens() public onlyAdmin { } constructor() public { } function totalSupply() public constant returns (uint256 total) { } function balanceOf(address _owner) public constant returns (uint256 balance) { } function transfer(address _to, uint256 _value) public returns (bool success) { require( balances[msg.sender] >= _value && _value > 0 ); require(<FILL_ME>) balances[msg.sender] = balances[msg.sender].sub(_value); balances[_to] = balances[_to].add(_value); emit Transfer(msg.sender, _to, _value); return true; } function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) { } function approve(address _spender, uint256 _value) public returns (bool success) { } function increaseApproval(address _spender, uint _addedValue) public returns (bool) { } function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) { } function allowance(address _owner, address _spender) public constant returns (uint256 remaining) { } function burn(uint256 _value) public { } event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); event Burn(address indexed burner, uint256 value); }
!isLocked||(msg.sender==tokenHolder)
313,763
!isLocked||(msg.sender==tokenHolder)
"Collateral not whitelisted."
pragma solidity 0.5.10; import "./oToken.sol"; import "./lib/StringComparator.sol"; import "./packages/Ownable.sol"; import "./packages/IERC20.sol"; contract OptionsFactory is Ownable { using StringComparator for string; mapping(address => bool) public whitelisted; address[] public optionsContracts; // The contract which interfaces with the exchange OptionsExchange public optionsExchange; address public oracleAddress; event OptionsContractCreated(address addr); event AssetWhitelisted(address indexed asset); /** * @param _optionsExchangeAddr: The contract which interfaces with the exchange * @param _oracleAddress Address of the oracle */ constructor(OptionsExchange _optionsExchangeAddr, address _oracleAddress) public { } /** * @notice creates a new Option Contract * @param _collateral The collateral asset. Eg. "ETH" * @param _underlying The underlying asset. Eg. "DAI" * @param _oTokenExchangeExp Units of underlying that 1 oToken protects * @param _strikePrice The amount of strike asset that will be paid out * @param _strikeExp The precision of the strike Price * @param _strike The asset in which the insurance is calculated * @param _expiry The time at which the insurance expires * @param _windowSize UNIX time. Exercise window is from `expiry - _windowSize` to `expiry`. * @dev this condition must hold for the oToken to be safe: abs(oTokenExchangeExp - underlyingExp) < 19 * @dev this condition must hold for the oToken to be safe: max(abs(strikeExp + liqIncentiveExp - collateralExp), abs(strikeExp - collateralExp)) <= 9 */ function createOptionsContract( address _collateral, address _underlying, address _strike, int32 _oTokenExchangeExp, uint256 _strikePrice, int32 _strikeExp, uint256 _expiry, uint256 _windowSize, string calldata _name, string calldata _symbol ) external returns (address) { require(<FILL_ME>) require(whitelisted[_underlying], "Underlying not whitelisted."); require(whitelisted[_strike], "Strike not whitelisted."); require(_expiry > block.timestamp, "Cannot create an expired option"); require(_windowSize <= _expiry, "Invalid _windowSize"); oToken otoken = new oToken( _collateral, _underlying, _strike, _oTokenExchangeExp, _strikePrice, _strikeExp, _expiry, _windowSize, optionsExchange, oracleAddress ); otoken.setDetails(_name, _symbol); optionsContracts.push(address(otoken)); emit OptionsContractCreated(address(otoken)); // Set the owner for the options contract to the person who created the options contract otoken.transferOwnership(msg.sender); return address(otoken); } /** * @notice The number of Option Contracts that the Factory contract has stored */ function getNumberOfOptionsContracts() external view returns (uint256) { } /** * @notice The owner of the Factory Contract can update an asset's address, by adding it, changing the address or removing the asset * @param _asset The address for the asset */ function whitelistAsset(address _asset) external onlyOwner { } }
whitelisted[_collateral],"Collateral not whitelisted."
313,771
whitelisted[_collateral]
"Underlying not whitelisted."
pragma solidity 0.5.10; import "./oToken.sol"; import "./lib/StringComparator.sol"; import "./packages/Ownable.sol"; import "./packages/IERC20.sol"; contract OptionsFactory is Ownable { using StringComparator for string; mapping(address => bool) public whitelisted; address[] public optionsContracts; // The contract which interfaces with the exchange OptionsExchange public optionsExchange; address public oracleAddress; event OptionsContractCreated(address addr); event AssetWhitelisted(address indexed asset); /** * @param _optionsExchangeAddr: The contract which interfaces with the exchange * @param _oracleAddress Address of the oracle */ constructor(OptionsExchange _optionsExchangeAddr, address _oracleAddress) public { } /** * @notice creates a new Option Contract * @param _collateral The collateral asset. Eg. "ETH" * @param _underlying The underlying asset. Eg. "DAI" * @param _oTokenExchangeExp Units of underlying that 1 oToken protects * @param _strikePrice The amount of strike asset that will be paid out * @param _strikeExp The precision of the strike Price * @param _strike The asset in which the insurance is calculated * @param _expiry The time at which the insurance expires * @param _windowSize UNIX time. Exercise window is from `expiry - _windowSize` to `expiry`. * @dev this condition must hold for the oToken to be safe: abs(oTokenExchangeExp - underlyingExp) < 19 * @dev this condition must hold for the oToken to be safe: max(abs(strikeExp + liqIncentiveExp - collateralExp), abs(strikeExp - collateralExp)) <= 9 */ function createOptionsContract( address _collateral, address _underlying, address _strike, int32 _oTokenExchangeExp, uint256 _strikePrice, int32 _strikeExp, uint256 _expiry, uint256 _windowSize, string calldata _name, string calldata _symbol ) external returns (address) { require(whitelisted[_collateral], "Collateral not whitelisted."); require(<FILL_ME>) require(whitelisted[_strike], "Strike not whitelisted."); require(_expiry > block.timestamp, "Cannot create an expired option"); require(_windowSize <= _expiry, "Invalid _windowSize"); oToken otoken = new oToken( _collateral, _underlying, _strike, _oTokenExchangeExp, _strikePrice, _strikeExp, _expiry, _windowSize, optionsExchange, oracleAddress ); otoken.setDetails(_name, _symbol); optionsContracts.push(address(otoken)); emit OptionsContractCreated(address(otoken)); // Set the owner for the options contract to the person who created the options contract otoken.transferOwnership(msg.sender); return address(otoken); } /** * @notice The number of Option Contracts that the Factory contract has stored */ function getNumberOfOptionsContracts() external view returns (uint256) { } /** * @notice The owner of the Factory Contract can update an asset's address, by adding it, changing the address or removing the asset * @param _asset The address for the asset */ function whitelistAsset(address _asset) external onlyOwner { } }
whitelisted[_underlying],"Underlying not whitelisted."
313,771
whitelisted[_underlying]