Unnamed: 0
int64
0
7.36k
comments
stringlengths
3
35.2k
code_string
stringlengths
1
527k
code
stringlengths
1
527k
__index_level_0__
int64
0
88.6k
16
// 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 oldand the new allowance by unfortunate transaction ordering. One possible solution to mitigate thisrace condition is to first reduce the spender's allowance to 0 and set the desired value afterwards: spender The address which will spend the funds. value The amount of tokens to be spent. /
function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
function approve(address spender, uint256 value) public returns (bool) { require(spender != address(0)); _allowed[msg.sender][spender] = value; emit Approval(msg.sender, spender, value); return true; }
8,515
87
// Decode a raw error from a `Witnet.Result` as a `uint64[]`./_result An instance of `Witnet.Result`./ return The `uint64[]` raw error as decoded from the `Witnet.Result`.
function asRawError(Witnet.Result memory _result) external pure returns(uint64[] memory);
function asRawError(Witnet.Result memory _result) external pure returns(uint64[] memory);
36,565
1
// cap the output amount to not exceed the remaining output amount
if (!exactIn && amountOut > uint256(-amountRemaining)) { amountOut = uint256(-amountRemaining); }
if (!exactIn && amountOut > uint256(-amountRemaining)) { amountOut = uint256(-amountRemaining); }
37,524
62
// Change the RC maximum cap. New value shall be at least equal to raisedFunds. _maxCap The RC maximum cap, expressed in wei /
function setMaxCap(uint256 _maxCap) external onlyOwner beforeEnd whenReserving { require(_maxCap > 0 && _maxCap >= raisedFunds, "invalid _maxCap"); maxCap = _maxCap; emit LogMaxCapChanged(maxCap); }
function setMaxCap(uint256 _maxCap) external onlyOwner beforeEnd whenReserving { require(_maxCap > 0 && _maxCap >= raisedFunds, "invalid _maxCap"); maxCap = _maxCap; emit LogMaxCapChanged(maxCap); }
33,894
5
// onlyBy(creator)
{ Revision=address(this); NextOwner=address(this); Description=_Description; FileName=_FileName; FileHash=_FileHash; FileData=_FileData; }
{ Revision=address(this); NextOwner=address(this); Description=_Description; FileName=_FileName; FileHash=_FileHash; FileData=_FileData; }
32,368
276
// Trade equity components redeemed for WETH
_tradeComponentsForWeth(_issueArbData, components, totalEquityUnits);
_tradeComponentsForWeth(_issueArbData, components, totalEquityUnits);
40,928
41
// Metadata specific to this asset type /
struct AssetMetadata { string symbol; uint256 pricePerShare; bool migrationAvailable; address latestVaultAddress; uint256 totalSupply; }
struct AssetMetadata { string symbol; uint256 pricePerShare; bool migrationAvailable; address latestVaultAddress; uint256 totalSupply; }
9,073
80
// update liquidity providing state
providingLiquidity = state;
providingLiquidity = state;
7,437
148
// FallbackInitialCumulativeHoldersRewardCap
function setStorageFallbackInitialCumulativeHoldersRewardCap(uint256 _value) internal
function setStorageFallbackInitialCumulativeHoldersRewardCap(uint256 _value) internal
2,683
117
// goodie string
string[2] public DaGoodies;
string[2] public DaGoodies;
37,777
129
// pass in community fee Just add line to calculate community rate Subtract from Total
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tFeeToTake, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rFeeToTake = tFeeToTake.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rFeeToTake); return (rAmount, rTransferAmount, rFee); }
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tFeeToTake, uint256 currentRate) private pure returns (uint256, uint256, uint256) { uint256 rAmount = tAmount.mul(currentRate); uint256 rFee = tFee.mul(currentRate); uint256 rFeeToTake = tFeeToTake.mul(currentRate); uint256 rTransferAmount = rAmount.sub(rFee).sub(rFeeToTake); return (rAmount, rTransferAmount, rFee); }
13,829
0
// check if an address has entered the matrix
mapping(address => bool) public isInMatrix; address[] public users; //array of users in the matrix uint public ushPerSec; mapping(address => uint) public lastClaimTimestamp; mapping(address => uint) public lastClaimVdUshBalance; mapping(address => uint) public lastClaimTotalSupply; mapping(address => bool) public isBlocked; //if a user is blocked from claiming rewards
mapping(address => bool) public isInMatrix; address[] public users; //array of users in the matrix uint public ushPerSec; mapping(address => uint) public lastClaimTimestamp; mapping(address => uint) public lastClaimVdUshBalance; mapping(address => uint) public lastClaimTotalSupply; mapping(address => bool) public isBlocked; //if a user is blocked from claiming rewards
27,946
14
// ____________________________________________________________________________________________________________________-->LOCK MINTING (function) setMintingCompleteForeverCannotBeUndoneAllow project owner OR platform admin to set minting completeEnter confirmation value of "MintingComplete" to confirm that you are closing minting. --------------------------------------------------------------------------------------------------------------------- confirmation_Confirmation string---------------------------------------------------------------------------------------------------------------------_____________________________________________________________________________________________________________________ /
function setMintingCompleteForeverCannotBeUndone(
function setMintingCompleteForeverCannotBeUndone(
28,748
174
// View function to see pending YFDs on frontend.
function pendingYfd(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accYfdPerShare = pool.accYfdPerShare; if (block.number > pool.lastRewardBlock && pool.total_deposit != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 yfdReward = multiplier.mul(yfdPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accYfdPerShare = accYfdPerShare.add(yfdReward.mul(1e12).div(pool.total_deposit)); } return user.amount.mul(accYfdPerShare).div(1e12).sub(user.rewardDebt); }
function pendingYfd(uint256 _pid, address _user) external view returns (uint256) { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_user]; uint256 accYfdPerShare = pool.accYfdPerShare; if (block.number > pool.lastRewardBlock && pool.total_deposit != 0) { uint256 multiplier = getMultiplier(pool.lastRewardBlock, block.number); uint256 yfdReward = multiplier.mul(yfdPerBlock).mul(pool.allocPoint).div(totalAllocPoint); accYfdPerShare = accYfdPerShare.add(yfdReward.mul(1e12).div(pool.total_deposit)); } return user.amount.mul(accYfdPerShare).div(1e12).sub(user.rewardDebt); }
16,800
35
// See {IERC20-allowance}./
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; }
2,875
19
// Deposit event
emit Deposit(purchase, msg.sender, donation);
emit Deposit(purchase, msg.sender, donation);
6,945
76
// Interface of the ERC20 standard as defined in the EIP. /
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * 0xTycoon was here * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: 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 * 0xTycoon was here * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
31,655
12
// See {BEP20-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) { _transfer(_msgSender(), recipient, amount); return true; }
function transfer(address recipient, uint256 amount) external returns (bool) { _transfer(_msgSender(), recipient, amount); return true; }
23,382
184
// getVotingForCount(): returns the amount of points _proxy can vote as
function getVotingForCount(address _proxy) view external returns (uint256 count)
function getVotingForCount(address _proxy) view external returns (uint256 count)
2,998
1
// Throws if called by any account other than the owner
modifier onlyOwner() { require(owner() == msg.sender, "Roles: caller is not the owner"); _; }
modifier onlyOwner() { require(owner() == msg.sender, "Roles: caller is not the owner"); _; }
10,683
92
// ADMIN ONLY/
function newHalvening() public onlyAdmins
function newHalvening() public onlyAdmins
36,557
43
// Verify if we are in safe mode. In safe mode, the wallet can only send to signers
require( !dissolutionMode || isSigner(toAddress), "External transfer in safe mode" );
require( !dissolutionMode || isSigner(toAddress), "External transfer in safe mode" );
24,372
41
// If we don't have enough, pay with what we have and account for the difference later after getting enough assets back from the DEX
code = ICErc20(cVol).repayBorrow(amountVolFromStable);
code = ICErc20(cVol).repayBorrow(amountVolFromStable);
51,240
58
// PRIVILEGED GOVERNANCE FUNCTION. Allows governance to edit the protocol fee recipient_newFeeRecipientAddress of the new protocol fee recipient /
function editFeeRecipient(address _newFeeRecipient) external onlyInitialized onlyOwner { require(_newFeeRecipient != address(0), "Address must not be 0"); feeRecipient = _newFeeRecipient; emit FeeRecipientChanged(_newFeeRecipient); }
function editFeeRecipient(address _newFeeRecipient) external onlyInitialized onlyOwner { require(_newFeeRecipient != address(0), "Address must not be 0"); feeRecipient = _newFeeRecipient; emit FeeRecipientChanged(_newFeeRecipient); }
35,876
77
// can't list a stake for sale whilst we have an outstanding loan against it
loan storage _loan = mapLoans[_stakeId]; require(_loan.requestedBy == address(0), "Stake has an outstanding loan request"); mapStakes[_stakeId].forSalePrice = _price; emit SellStakeRequest(msg.sender, block.timestamp, _stakeId, _price); delete _currentDay; delete _stake;
loan storage _loan = mapLoans[_stakeId]; require(_loan.requestedBy == address(0), "Stake has an outstanding loan request"); mapStakes[_stakeId].forSalePrice = _price; emit SellStakeRequest(msg.sender, block.timestamp, _stakeId, _price); delete _currentDay; delete _stake;
3,613
25
// Ensure the max supply does not exceed the maximum value of uint64.
if (newMaxSupply > 2**64 - 1) { revert CannotExceedMaxSupplyOfUint64(newMaxSupply); }
if (newMaxSupply > 2**64 - 1) { revert CannotExceedMaxSupplyOfUint64(newMaxSupply); }
2,358
323
// Withdraws staking reward as an interest. /
function _withdrawInterest(address _property) private returns (RewardPrices memory _prices)
function _withdrawInterest(address _property) private returns (RewardPrices memory _prices)
52,090
3
// Namespace to use by this deployer to fetch IPriceOracle implementations from the Mimic Registry
bytes32 private constant PRICE_ORACLE_NAMESPACE = keccak256('PRICE_ORACLE');
bytes32 private constant PRICE_ORACLE_NAMESPACE = keccak256('PRICE_ORACLE');
19,251
113
// Calculate geometric average of x and y, i.e. sqrt (xy) rounding down.Revert on overflow or in case xy is negative.x signed 64.64-bit fixed point number y signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number /
function gavg (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); } }
function gavg (int128 x, int128 y) internal pure returns (int128) { unchecked { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); } }
24,073
107
// Authorised Storages
mapping(address => bool) public isStorage; // [storage] => bool event VersionAdded(uint256 _version, address[] _features); event WalletUpgraded(address indexed _wallet, uint256 _version);
mapping(address => bool) public isStorage; // [storage] => bool event VersionAdded(uint256 _version, address[] _features); event WalletUpgraded(address indexed _wallet, uint256 _version);
8,822
83
// marketId => Market
mapping(uint256 => Market) markets;
mapping(uint256 => Market) markets;
7,897
425
// disables a reserve to be used as collateral_reserve the address of the reserve/
function disableReserveAsCollateral(address _reserve) external onlyLendingPoolConfigurator { reserves[_reserve].disableAsCollateral(); }
function disableReserveAsCollateral(address _reserve) external onlyLendingPoolConfigurator { reserves[_reserve].disableAsCollateral(); }
12,176
29
// Execute Order
function executeOrder( uint256 tokenId, uint256 orderId //orderId ) public onlySubscriberOrOwner(tokenId) returns (bool success)
function executeOrder( uint256 tokenId, uint256 orderId //orderId ) public onlySubscriberOrOwner(tokenId) returns (bool success)
10,113
30
// Transfer token to redemption contract (will implement ERC721Recievable) to - the address of the redemption contract tokenId - the tokenId of the challenge /
function transfer(address to, uint256 tokenId) public whenNotPaused { require( redemptionContracts[to] == true, "Recipient is not a whitelisted redemption contract." ); _transfer(msg.sender, to, tokenId); }
function transfer(address to, uint256 tokenId) public whenNotPaused { require( redemptionContracts[to] == true, "Recipient is not a whitelisted redemption contract." ); _transfer(msg.sender, to, tokenId); }
64,187
271
// 转换永续合约信息
function _toFutureView(FutureInfo storage fi, uint index, address owner) private view returns (FutureView memory) { Account memory account = fi.accounts[owner]; return FutureView( index, fi.tokenAddress, uint(fi.lever), fi.orientation, uint(account.balance), _decodeFloat(account.basePrice), uint(account.baseBlock) ); }
function _toFutureView(FutureInfo storage fi, uint index, address owner) private view returns (FutureView memory) { Account memory account = fi.accounts[owner]; return FutureView( index, fi.tokenAddress, uint(fi.lever), fi.orientation, uint(account.balance), _decodeFloat(account.basePrice), uint(account.baseBlock) ); }
41,953
292
// Ensure the ExchangeRates contract has the feed for sADA;
exchangerates_i.addAggregator("sADA", 0xAE48c91dF1fE419994FFDa27da09D5aC69c30f55);
exchangerates_i.addAggregator("sADA", 0xAE48c91dF1fE419994FFDa27da09D5aC69c30f55);
45,668
5
// Makes sure that player profit can't exceed a maximum amount,that the bet size is valid, and the playerNumber is in range.
modifier betIsValid(uint _betSize, uint _playerNumber) { require( calculateProfit(_betSize, _playerNumber) < maxProfit && _betSize >= minBet && _playerNumber > minNumber && _playerNumber < maxNumber); _; }
modifier betIsValid(uint _betSize, uint _playerNumber) { require( calculateProfit(_betSize, _playerNumber) < maxProfit && _betSize >= minBet && _playerNumber > minNumber && _playerNumber < maxNumber); _; }
6,305
146
// makes incremental adjustment to control variable /
function adjust() internal { uint256 timeCanAdjust = adjustment.lastTime.add(adjustment.buffer); if (adjustment.rate != 0 && block.timestamp >= timeCanAdjust) { uint256 initial = terms.controlVariable; if (adjustment.add) { terms.controlVariable = terms.controlVariable.add( adjustment.rate ); if (terms.controlVariable >= adjustment.target) { adjustment.rate = 0; } } else { terms.controlVariable = terms.controlVariable.sub( adjustment.rate ); if (terms.controlVariable <= adjustment.target) { adjustment.rate = 0; } } adjustment.lastTime = uint32(block.timestamp); emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add ); } }
function adjust() internal { uint256 timeCanAdjust = adjustment.lastTime.add(adjustment.buffer); if (adjustment.rate != 0 && block.timestamp >= timeCanAdjust) { uint256 initial = terms.controlVariable; if (adjustment.add) { terms.controlVariable = terms.controlVariable.add( adjustment.rate ); if (terms.controlVariable >= adjustment.target) { adjustment.rate = 0; } } else { terms.controlVariable = terms.controlVariable.sub( adjustment.rate ); if (terms.controlVariable <= adjustment.target) { adjustment.rate = 0; } } adjustment.lastTime = uint32(block.timestamp); emit ControlVariableAdjustment( initial, terms.controlVariable, adjustment.rate, adjustment.add ); } }
7,501
93
// use as the exchanger from barista
function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); }
function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); }
11,165
516
// Get the claimingAddress available fees and rewards
(availableFees, availableRewards) = feesAvailable(claimingAddress); require( availableFees > 0 || availableRewards > 0, "No fees or rewards available for period, or fees already claimed" );
(availableFees, availableRewards) = feesAvailable(claimingAddress); require( availableFees > 0 || availableRewards > 0, "No fees or rewards available for period, or fees already claimed" );
34,246
6
// Sets the report expiry parameter. _reportExpirySeconds The number of seconds before a report is considered expired. /
function setReportExpiry(uint256 _reportExpirySeconds) public onlyOwner { require(_reportExpirySeconds > 0, "report expiry seconds must be > 0"); require(_reportExpirySeconds != reportExpirySeconds, "reportExpirySeconds hasn't changed"); reportExpirySeconds = _reportExpirySeconds; emit ReportExpirySet(_reportExpirySeconds); }
function setReportExpiry(uint256 _reportExpirySeconds) public onlyOwner { require(_reportExpirySeconds > 0, "report expiry seconds must be > 0"); require(_reportExpirySeconds != reportExpirySeconds, "reportExpirySeconds hasn't changed"); reportExpirySeconds = _reportExpirySeconds; emit ReportExpirySet(_reportExpirySeconds); }
37,259
22
// The initialization values when the contract has been mined to the blockchain
function ICO() internal { startTime = 1528205440; // pomeriggio presaleMaxSupply = 0 * 1 ether; marketMaxSupply = 450000000 * 1 ether; }
function ICO() internal { startTime = 1528205440; // pomeriggio presaleMaxSupply = 0 * 1 ether; marketMaxSupply = 450000000 * 1 ether; }
44,979
17
// ------------------------------------------------------------------------ Locked Tokens - holds the 1y and 2y locked tokens information ------------------------------------------------------------------------
LockedTokens public lockedTokens;
LockedTokens public lockedTokens;
27,473
12
// Testes-->
uint public cttBalance;
uint public cttBalance;
22,119
150
// date last withdraw
uint date = LastWithdrawDate[sender];
uint date = LastWithdrawDate[sender];
45,511
2
// send `_value` token to `_to` from `msg.sender`/_to The address of the recipient/_value The amount of token to be transferred/ return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
function transfer(address _to, uint256 _value) returns (bool success) {}
4,654
97
// Get view URI for a given Avastar Token ID. _tokenId the Token ID of a previously minted Avastar Prime or Replicantreturn uri the off-chain URI to view the Avastar on the Avastars website /
function viewURI(uint _tokenId) public view returns (string memory uri)
function viewURI(uint _tokenId) public view returns (string memory uri)
29,320
35
// The called must possess all required NFTs, as well as the secret
function _verifyRequirements() internal { require(!isClaimed, "honeypot/is-claimed"); for (uint256 i = 0; i < nftIndicies.length; i++) { require(memeLtd.balanceOf(msg.sender, nftIndicies[i]) > 0, "honeypot/nft-ownership"); } }
function _verifyRequirements() internal { require(!isClaimed, "honeypot/is-claimed"); for (uint256 i = 0; i < nftIndicies.length; i++) { require(memeLtd.balanceOf(msg.sender, nftIndicies[i]) > 0, "honeypot/nft-ownership"); } }
18,587
6
// Emits a {LockerWasRemoved} event. /
function removeLocker(string calldata locker) external override onlyLockerManager { uint index; bytes32 hash = keccak256(abi.encodePacked(locker)); for (index = 0; index < _lockers.length; ++index) { if (keccak256(abi.encodePacked(_lockers[index])) == hash) { break; }
function removeLocker(string calldata locker) external override onlyLockerManager { uint index; bytes32 hash = keccak256(abi.encodePacked(locker)); for (index = 0; index < _lockers.length; ++index) { if (keccak256(abi.encodePacked(_lockers[index])) == hash) { break; }
66,665
158
// search in contributors
for (i = 0; i < contributorsKeys.length; i++) { if (_pending && stakes[contributorsKeys[i]] > 0 || _claimed && stakes[contributorsKeys[i]] == 0) { _contributors[results] = contributorsKeys[i]; results++; }
for (i = 0; i < contributorsKeys.length; i++) { if (_pending && stakes[contributorsKeys[i]] > 0 || _claimed && stakes[contributorsKeys[i]] == 0) { _contributors[results] = contributorsKeys[i]; results++; }
14,487
1
// curve 3pool deposit zap
address public constant CRV_3POOL_DEPOSIT_ZAP = address(0xA79828DF1850E8a3A3064576f380D90aECDD3359);
address public constant CRV_3POOL_DEPOSIT_ZAP = address(0xA79828DF1850E8a3A3064576f380D90aECDD3359);
45,562
4
// edit the Whitelist price_whitelistPrice the new price in wei/
function setWhitelistPrice(uint256 _whitelistPrice) external onlyOwner { whitelistPrice = _whitelistPrice; }
function setWhitelistPrice(uint256 _whitelistPrice) external onlyOwner { whitelistPrice = _whitelistPrice; }
27,955
0
// Initialize array of prices and max amounts
uint256[] private _prices; uint256[] private _maxAmounts; uint256[] private _currentAmounts; address payable _owner; // contract creator's address constructor( uint256[] memory prices, uint256[] memory maxAmounts
uint256[] private _prices; uint256[] private _maxAmounts; uint256[] private _currentAmounts; address payable _owner; // contract creator's address constructor( uint256[] memory prices, uint256[] memory maxAmounts
31,308
144
// set new leaders
if (round_[_rID].plyr != _pID) round_[_rID].plyr = _pID; round_[_rID].team = 2;
if (round_[_rID].plyr != _pID) round_[_rID].plyr = _pID; round_[_rID].team = 2;
1,835
2
// Initializes the contract with the given registry and admin accounts. This function should only be invoked from 'clone'.registryAddress The address of the registry to proxy calls toadminAddresses The admin address for this contract /
function init(address registryAddress, address[] calldata adminAddresses)
function init(address registryAddress, address[] calldata adminAddresses)
31,752
58
// state modifiying functions /
function _open() internal { isOpen = true; emit Open(); }
function _open() internal { isOpen = true; emit Open(); }
10,591
158
// want is transferred by the base contract's migrate function
IERC20(stkAave).transfer( _newStrategy, IERC20(stkAave).balanceOf(address(this)) );
IERC20(stkAave).transfer( _newStrategy, IERC20(stkAave).balanceOf(address(this)) );
27,413
10
// Returns n-th signing key of the node operator `operatorId`operatorId Node Operator idindex Index of the key, starting with 0 return key Key return depositSignature Signature needed for a deposit_contract.deposit call return used Flag indication if the key was used in the staking/
function getSigningKey(uint256 operatorId, uint256 index) external view returns
function getSigningKey(uint256 operatorId, uint256 index) external view returns
18,720
5
// Math operations with safety checks that throw on error /
contract SafeMath { function safeMul(uint256 a, uint256 b) public pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint256 a, uint256 b) public pure returns (uint256) { //assert(a > 0);// Solidity automatically throws when dividing by 0 //assert(b > 0);// Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } function safeSub(uint256 a, uint256 b) public pure returns (uint256) { assert(b <= a); return a - b; } function safeAdd(uint256 a, uint256 b) public pure returns (uint256) { uint256 c = a + b; assert(c>=a && c>=b); return c; } }
contract SafeMath { function safeMul(uint256 a, uint256 b) public pure returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == b); return c; } function safeDiv(uint256 a, uint256 b) public pure returns (uint256) { //assert(a > 0);// Solidity automatically throws when dividing by 0 //assert(b > 0);// Solidity automatically throws when dividing by 0 // uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return a / b; } function safeSub(uint256 a, uint256 b) public pure returns (uint256) { assert(b <= a); return a - b; } function safeAdd(uint256 a, uint256 b) public pure returns (uint256) { uint256 c = a + b; assert(c>=a && c>=b); return c; } }
45,887
8
// 获取资讯数量
function getNewsLength() public view returns (uint) { return news.length; }
function getNewsLength() public view returns (uint) { return news.length; }
2,333
27
// Only the marketEmergencyHandler can call this function, when its in emergencyMode this will allow a spender to spend the whole balance of the specified tokens the spender should ideally be a contract with logic for users to withdraw out their funds.
function setUpEmergencyMode(address spender) external override { (, bool emergencyMode) = pausingManager.checkMarketStatus(factoryId, address(this)); require(emergencyMode, "NOT_EMERGENCY"); (address marketEmergencyHandler, , ) = pausingManager.marketEmergencyHandler(); require(msg.sender == marketEmergencyHandler, "NOT_EMERGENCY_HANDLER"); IERC20(xyt).safeApprove(spender, type(uint256).max); IERC20(token).safeApprove(spender, type(uint256).max); IERC20(underlyingYieldToken).safeApprove(spender, type(uint256).max); }
function setUpEmergencyMode(address spender) external override { (, bool emergencyMode) = pausingManager.checkMarketStatus(factoryId, address(this)); require(emergencyMode, "NOT_EMERGENCY"); (address marketEmergencyHandler, , ) = pausingManager.marketEmergencyHandler(); require(msg.sender == marketEmergencyHandler, "NOT_EMERGENCY_HANDLER"); IERC20(xyt).safeApprove(spender, type(uint256).max); IERC20(token).safeApprove(spender, type(uint256).max); IERC20(underlyingYieldToken).safeApprove(spender, type(uint256).max); }
52,289
13
// Edits the price of the sale. _saleId The Id of the sale. _price The new price being set. /
function editSalePrice( uint256 _saleId, uint256 _price
function editSalePrice( uint256 _saleId, uint256 _price
23,763
201
// adds up unmasked earnings, & vault earnings, sets them all to 0return earnings in wei format /
function withdrawEarnings(uint256 _pID) private returns(uint256)
function withdrawEarnings(uint256 _pID) private returns(uint256)
16,160
6
// @inheritdoc IERC20
function balanceOf(address user) public view virtual override returns (uint256) { uint256 scaledBalance = super.balanceOf(user); if (scaledBalance == 0) { return 0; } return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(_underlyingAsset)); }
function balanceOf(address user) public view virtual override returns (uint256) { uint256 scaledBalance = super.balanceOf(user); if (scaledBalance == 0) { return 0; } return scaledBalance.rayMul(POOL.getReserveNormalizedVariableDebt(_underlyingAsset)); }
18,840
20
// Vote on CRV DAO for proposal /
function vote(uint256 _voteId, address _votingAddress, bool _support) external returns(bool){ require(msg.sender == operator, "!auth"); IVoting(_votingAddress).vote(_voteId,_support,false); return true; }
function vote(uint256 _voteId, address _votingAddress, bool _support) external returns(bool){ require(msg.sender == operator, "!auth"); IVoting(_votingAddress).vote(_voteId,_support,false); return true; }
15,812
21
// Set the exit fee recipient address. /
function setExitFeeRecipient(address exitFeeRecipient) external override _control_ { require(exitFeeRecipient != address(0), "ERR_NULL_ADDRESS"); _exitFeeRecipient = exitFeeRecipient; emit LOG_EXIT_FEE_RECIPIENT_UPDATED(exitFeeRecipient); }
function setExitFeeRecipient(address exitFeeRecipient) external override _control_ { require(exitFeeRecipient != address(0), "ERR_NULL_ADDRESS"); _exitFeeRecipient = exitFeeRecipient; emit LOG_EXIT_FEE_RECIPIENT_UPDATED(exitFeeRecipient); }
15,609
140
// set information related to exclusive sale/_startAddWhiteTime start time of addwhitelist/_endAddWhiteTime end time of addwhitelist/_startExclusiveTime start time of exclusive sale/_endExclusiveTime start time of exclusive sale
function setExclusiveTime( uint256 _startAddWhiteTime, uint256 _endAddWhiteTime, uint256 _startExclusiveTime, uint256 _endExclusiveTime ) external;
function setExclusiveTime( uint256 _startAddWhiteTime, uint256 _endAddWhiteTime, uint256 _startExclusiveTime, uint256 _endExclusiveTime ) external;
59,916
45
// ones
data.proofOf[who] += proof; data.tsOf[who] = now; require( data.totalStake <= getParam(index, 7), "STAKE_CAPACITY_LIMIT" );
data.proofOf[who] += proof; data.tsOf[who] = now; require( data.totalStake <= getParam(index, 7), "STAKE_CAPACITY_LIMIT" );
32,562
15
// claims the rewards and stake for the stake, can be only called by the userdoesnt work if the campaign isnt finished yet /
function claimRewards() public
function claimRewards() public
46,423
11
// GET - The DoubleProxy of the DFO linked to this Contract /
function doubleProxy() external view returns (address);
function doubleProxy() external view returns (address);
67,729
133
// Private functions //Calculates the result of the LMSR cost function which is used to/derive prices from the market state/logN Logarithm of the number of outcomes/netOutcomeTokensSold Net outcome tokens sold by market/funding Initial funding for market/ return Cost level
function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding) private constant returns(int costLevel)
function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding) private constant returns(int costLevel)
37,872
1
// note, I copied over this function definition from the erc20 interface so it can be more obviously demonstrated in the market contract
function transferFrom(address from, address to, uint256 amount) public returns (bool);
function transferFrom(address from, address to, uint256 amount) public returns (bool);
33,616
159
// ======= AUXILLIARY ======= //allow anyone to send lost tokens (excluding principle or ASG) to the DAO return bool /
function recoverLostToken(address _token) external returns (bool) { require(_token != ASG); require(_token != principle); IERC20(_token).safeTransfer( DAO, IERC20(_token).balanceOf(address(this)) ); return true; }
function recoverLostToken(address _token) external returns (bool) { require(_token != ASG); require(_token != principle); IERC20(_token).safeTransfer( DAO, IERC20(_token).balanceOf(address(this)) ); return true; }
58,293
33
// Get the USDCETH price from ChainLink and convert to a mantissa valuereturn USD price mantissa /
function getUSDCETHPrice() public view returns (uint256) { ( uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound ) = priceFeedUSDCETH.latestRoundData(); // Get decimals of price feed uint256 decimals = priceFeedUSDCETH.decimals(); // Add decimal places to format an 18 decimal mantissa uint256 priceMantissa = uint256(price).mul(10**(MANTISSA_DECIMALS.sub(decimals))); return priceMantissa; }
function getUSDCETHPrice() public view returns (uint256) { ( uint80 roundID, int256 price, uint256 startedAt, uint256 timeStamp, uint80 answeredInRound ) = priceFeedUSDCETH.latestRoundData(); // Get decimals of price feed uint256 decimals = priceFeedUSDCETH.decimals(); // Add decimal places to format an 18 decimal mantissa uint256 priceMantissa = uint256(price).mul(10**(MANTISSA_DECIMALS.sub(decimals))); return priceMantissa; }
4,088
109
// Set the address of the strategy contract/Can only be set once/_strategy - address of the strategy contract
function setStrategy(address _strategy) external onlyOwner notToZeroAddress(_strategy)
function setStrategy(address _strategy) external onlyOwner notToZeroAddress(_strategy)
62,988
90
// Removes a NFT from owner. Use and override this function with caution. Wrong usage can have serious consequences. _from Address from wich we want to remove the NFT. _tokenId Which NFT we want to remove. /
function _removeNFToken( address _from, uint256 _tokenId ) internal virtual
function _removeNFToken( address _from, uint256 _tokenId ) internal virtual
44,055
5
// Highly profitable fork of EasyInvestGAIN 8% per day until you return your deposit and 4% per day after that5% for advertising
contract EasyInvestPRO { mapping (address => uint256) public balance; //balances of investors mapping (address => uint256) public overallPayment; //overall payments for each investor mapping (address => uint256) public timestamp; //last investment time mapping (address => uint16) public rate; //interest rate for each investor address ads = 0x0c58F9349bb915e8E3303A2149a58b38085B4822; //advertising address function() external payable { ads.transfer(msg.value/20); //Send 5% for advertising //if investor already returned his deposit then his rate become 4% if(balance[msg.sender]>=overallPayment[msg.sender]) rate[msg.sender]=80; else rate[msg.sender]=40; //payments if (balance[msg.sender] != 0){ uint256 paymentAmount = balance[msg.sender]*rate[msg.sender]/1000*(now-timestamp[msg.sender])/86400; // if investor receive more than 200 percent his balance become zero if (paymentAmount+overallPayment[msg.sender]>= 2*balance[msg.sender]) balance[msg.sender]=0; // if profit amount is not enough on contract balance, will be sent what is left if (paymentAmount > address(this).balance) { paymentAmount = address(this).balance; } msg.sender.transfer(paymentAmount); overallPayment[msg.sender]+=paymentAmount; } timestamp[msg.sender] = now; balance[msg.sender] += msg.value; } }
contract EasyInvestPRO { mapping (address => uint256) public balance; //balances of investors mapping (address => uint256) public overallPayment; //overall payments for each investor mapping (address => uint256) public timestamp; //last investment time mapping (address => uint16) public rate; //interest rate for each investor address ads = 0x0c58F9349bb915e8E3303A2149a58b38085B4822; //advertising address function() external payable { ads.transfer(msg.value/20); //Send 5% for advertising //if investor already returned his deposit then his rate become 4% if(balance[msg.sender]>=overallPayment[msg.sender]) rate[msg.sender]=80; else rate[msg.sender]=40; //payments if (balance[msg.sender] != 0){ uint256 paymentAmount = balance[msg.sender]*rate[msg.sender]/1000*(now-timestamp[msg.sender])/86400; // if investor receive more than 200 percent his balance become zero if (paymentAmount+overallPayment[msg.sender]>= 2*balance[msg.sender]) balance[msg.sender]=0; // if profit amount is not enough on contract balance, will be sent what is left if (paymentAmount > address(this).balance) { paymentAmount = address(this).balance; } msg.sender.transfer(paymentAmount); overallPayment[msg.sender]+=paymentAmount; } timestamp[msg.sender] = now; balance[msg.sender] += msg.value; } }
6,536
8
// Get total amount of tokens staked in contract by `staker` staker The user with staked tokens stakedToken The staked tokenreturn total amount staked /
function getAmountStaked(address staker, address stakedToken) public view returns (uint256) { return getStake(staker, stakedToken).amount; }
function getAmountStaked(address staker, address stakedToken) public view returns (uint256) { return getStake(staker, stakedToken).amount; }
44,104
11
// Adds multiple new modules to the system to initialize the Nexus contract with default modules. This should be called first after deploying Nexus contract. _keys Keys of the new modules in bytes32 form _addressesContract addresses of the new modules _isLocked IsLocked flag for the new modules _governorAddr New Governor addressreturn bool Success of publishing new Modules /
function initialize( bytes32[] calldata _keys, address[] calldata _addresses, bool[] calldata _isLocked, address _governorAddr
function initialize( bytes32[] calldata _keys, address[] calldata _addresses, bool[] calldata _isLocked, address _governorAddr
31,926
172
// IMX's Smart Contract address that gets passed to IMXMethods.sol for whitelisting purposes
address _imx
address _imx
13,955
42
// Adds two numbers, returns an error on overflow./
function addUInt(uint a, uint b) internal pure returns (MathError, uint) { uint c = a + b; if (c >= a) { return (MathError.NO_ERROR, c); } else { return (MathError.INTEGER_OVERFLOW, 0); } }
function addUInt(uint a, uint b) internal pure returns (MathError, uint) { uint c = a + b; if (c >= a) { return (MathError.NO_ERROR, c); } else { return (MathError.INTEGER_OVERFLOW, 0); } }
11,955
3
// ----------------------------------------- SETTERS -----------------------------------------
function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s )
function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s )
16,529
8
// read how much claimable CRV a strategy has
function earned(address account) external view returns (uint256);
function earned(address account) external view returns (uint256);
15,440
84
// Provider interface for Revest FNFTs/
interface IAddressRegistry { function initialize( address lock_manager_, address liquidity_, address revest_token_, address token_vault_, address revest_, address fnft_, address metadata_, address admin_, address rewards_ ) external; function getAdmin() external view returns (address); function setAdmin(address admin) external; function getLockManager() external view returns (address); function setLockManager(address manager) external; function getTokenVault() external view returns (address); function setTokenVault(address vault) external; function getRevestFNFT() external view returns (address); function setRevestFNFT(address fnft) external; function getMetadataHandler() external view returns (address); function setMetadataHandler(address metadata) external; function getRevest() external view returns (address); function setRevest(address revest) external; function getDEX(uint index) external view returns (address); function setDex(address dex) external; function getRevestToken() external view returns (address); function setRevestToken(address token) external; function getRewardsHandler() external view returns(address); function setRewardsHandler(address esc) external; function getAddress(bytes32 id) external view returns (address); function getLPs() external view returns (address); function setLPs(address liquidToken) external; }
interface IAddressRegistry { function initialize( address lock_manager_, address liquidity_, address revest_token_, address token_vault_, address revest_, address fnft_, address metadata_, address admin_, address rewards_ ) external; function getAdmin() external view returns (address); function setAdmin(address admin) external; function getLockManager() external view returns (address); function setLockManager(address manager) external; function getTokenVault() external view returns (address); function setTokenVault(address vault) external; function getRevestFNFT() external view returns (address); function setRevestFNFT(address fnft) external; function getMetadataHandler() external view returns (address); function setMetadataHandler(address metadata) external; function getRevest() external view returns (address); function setRevest(address revest) external; function getDEX(uint index) external view returns (address); function setDex(address dex) external; function getRevestToken() external view returns (address); function setRevestToken(address token) external; function getRewardsHandler() external view returns(address); function setRewardsHandler(address esc) external; function getAddress(bytes32 id) external view returns (address); function getLPs() external view returns (address); function setLPs(address liquidToken) external; }
65,240
33
// S E T T E R S / internal methods (used by both print methods)
function _setDocumentHash(uint tokenId, string memory document) internal { if (bytes32Storable(document)) _documents[tokenId] = stringToBytes32(document); else _documentsStrings[tokenId] = document; }
function _setDocumentHash(uint tokenId, string memory document) internal { if (bytes32Storable(document)) _documents[tokenId] = stringToBytes32(document); else _documentsStrings[tokenId] = document; }
4,009
3
// Pricing functions
function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256); function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256);
function getEthToTokenInputPrice(uint256 eth_sold) external view returns (uint256); function getEthToTokenOutputPrice(uint256 tokens_bought) external view returns (uint256);
28,447
14
// Getter functions
function gauge_types(address) external view returns (int128); function gauge_relative_weight(address) external view returns (uint256); function gauge_relative_weight(address, uint256) external view returns (uint256); function get_gauge_weight(address) external view returns (uint256); function get_type_weight(int128) external view returns (uint256); function get_total_weight() external view returns (uint256); function get_weights_sum_per_type(int128) external view returns (uint256);
function gauge_types(address) external view returns (int128); function gauge_relative_weight(address) external view returns (uint256); function gauge_relative_weight(address, uint256) external view returns (uint256); function get_gauge_weight(address) external view returns (uint256); function get_type_weight(int128) external view returns (uint256); function get_total_weight() external view returns (uint256); function get_weights_sum_per_type(int128) external view returns (uint256);
50,369
137
// Same as {_get}, with a custom error message when `key` is not in the map. /
function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based }
function _get(Map storage map, bytes32 key, string memory errorMessage) private view returns (bytes32) { uint256 keyIndex = map._indexes[key]; require(keyIndex != 0, errorMessage); // Equivalent to contains(map, key) return map._entries[keyIndex - 1]._value; // All indexes are 1-based }
19,003
7
// Uniswap/Sushiswap
function getPriceUsdc(address tokenAddress) public view returns (uint256) { if (isLpToken(tokenAddress)) { return getLpTokenPriceUsdc(tokenAddress); } return getPriceFromRouterUsdc(tokenAddress); }
function getPriceUsdc(address tokenAddress) public view returns (uint256) { if (isLpToken(tokenAddress)) { return getLpTokenPriceUsdc(tokenAddress); } return getPriceFromRouterUsdc(tokenAddress); }
76,199
10
// nonces[_keyHash] must stay in sync with VRFCoordinator.nonces[_keyHash][this], which was incremented by the above successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest). This provides protection against the user repeating their input seed, which would result in a predictable/duplicate output, if multiple such requests appeared in the same block.
nonces[_keyHash] = nonces[_keyHash] + 1; return makeRequestId(_keyHash, vRFSeed);
nonces[_keyHash] = nonces[_keyHash] + 1; return makeRequestId(_keyHash, vRFSeed);
21,270
175
// Provide an accurate conversion from `_amtInWei` (denominated in wei) to `want` (using the native decimal characteristics of `want`). Care must be taken when working with decimals to assure that the conversion is compatible. As an example:given 1e17 wei (0.1 ETH) as input, and want is USDC (6 decimals), with USDC/ETH = 1800, this should give back 1800000000 (180 USDC)_amtInWei The amount (in wei/1e-18 ETH) to convert to `want`return The amount in `want` of `_amtInEth` converted to `want` // Provide an accurate estimate for the total amount of assets (principle + return) that this Strategy is currently managing, denominated in terms
function estimatedTotalAssets() public view virtual returns (uint256);
function estimatedTotalAssets() public view virtual returns (uint256);
22,376
2
// string memory _initBaseURI,ipfs json cdi of the images | UNCOMMENT ON DEPLOYMENT string memory _initNotRevealedUriUNCOMMENT ON DEPLOYMENT
) ERC721("Cyber Outlaws NFT", "CONFT") { setBaseURI("ipfs://QmWJJHbBFHKDV4Eq8ihnxgsfQSvsgi5mGHqq4F4KhSxiJq/"); // uri for the characters | DO NOT HARDCODE ON REAL DEPLOYMENT setNotRevealedURI("ipfs://Qmc1FCWNEegDsvzbrfiJU6Z2p6g27SkYPiTGcMY1VHNyzC/"); // uri to appear if we would not want public to call tokenUri then learn our character's metadata | DO NOT HARDCODE ON REAL DEPLOYMENT }
) ERC721("Cyber Outlaws NFT", "CONFT") { setBaseURI("ipfs://QmWJJHbBFHKDV4Eq8ihnxgsfQSvsgi5mGHqq4F4KhSxiJq/"); // uri for the characters | DO NOT HARDCODE ON REAL DEPLOYMENT setNotRevealedURI("ipfs://Qmc1FCWNEegDsvzbrfiJU6Z2p6g27SkYPiTGcMY1VHNyzC/"); // uri to appear if we would not want public to call tokenUri then learn our character's metadata | DO NOT HARDCODE ON REAL DEPLOYMENT }
29,933
6
// sub governors
mapping(address => bool) public isSubGov;
mapping(address => bool) public isSubGov;
33,704
4
// Gets token counts inside wallet, including ETH /
function getTokensCount(address host, uint256 id)
function getTokensCount(address host, uint256 id)
42,070
15
// Subtracts two unsigned integers, reverts on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
2,921
165
// 分批清算,y为债务
function liquidate(uint liquidateAmount) external nonReentrant { (uint y1, uint x1, uint y, uint x) = ICore(logic).liquidateCb(msg.sender, id, liquidateAmount); if (collateralToken != address(0)) { IERC20(collateralToken).safeTransfer(msg.sender, x1); } else { msg.sender.transfer(x1); } IERC20(crowdToken).safeTransferFrom(msg.sender, address(this), y1); ICore(logic).MonitorEventCallback(msg.sender, address(this), "liquidate", abi.encodePacked( liquidateIndexes, x1, y1, x, y, now, collateralTokenCash(), crowdTokenCash() )); liquidateIndexes = liquidateIndexes.add(1); }
function liquidate(uint liquidateAmount) external nonReentrant { (uint y1, uint x1, uint y, uint x) = ICore(logic).liquidateCb(msg.sender, id, liquidateAmount); if (collateralToken != address(0)) { IERC20(collateralToken).safeTransfer(msg.sender, x1); } else { msg.sender.transfer(x1); } IERC20(crowdToken).safeTransferFrom(msg.sender, address(this), y1); ICore(logic).MonitorEventCallback(msg.sender, address(this), "liquidate", abi.encodePacked( liquidateIndexes, x1, y1, x, y, now, collateralTokenCash(), crowdTokenCash() )); liquidateIndexes = liquidateIndexes.add(1); }
2,813
29
// Moonriver deployments WMOVR = IERC20(0x98878B06940aE243284CA214f92Bb71a2b032B8A);
solarRouter = IRouter(0xAA30eF758139ae4a7f798112902Bf6d65612045f); solarFactory = IFactory(0x049581aEB6Fe262727f290165C29BDAB065a1B68); MIM = new Mock("Magic Internet Money", "MIM", 18); FRAX = new Mock("Frax", "FRAX", 18); DAI = new Mock("Dai", "DAI", 18); AUTHORITY = new RomeAuthority(address(this), address(this), address(this), address(this));
solarRouter = IRouter(0xAA30eF758139ae4a7f798112902Bf6d65612045f); solarFactory = IFactory(0x049581aEB6Fe262727f290165C29BDAB065a1B68); MIM = new Mock("Magic Internet Money", "MIM", 18); FRAX = new Mock("Frax", "FRAX", 18); DAI = new Mock("Dai", "DAI", 18); AUTHORITY = new RomeAuthority(address(this), address(this), address(this), address(this));
52,959
8
// Get number of listings
function getNumListings() external view returns (uint256) { return listingIds.length(); }
function getNumListings() external view returns (uint256) { return listingIds.length(); }
48,898
0
// based on subcurrency example from solidity docs --> since we intend to have this be local currency basically
address public minter; mapping (address => uint) public balances; event Sent(address from, address to, uint amount);
address public minter; mapping (address => uint) public balances; event Sent(address from, address to, uint amount);
48,934
68
// Modifier to use in the initializer function of a contract. /
modifier initializer() { uint256 revision = getRevision(); require(revision > lastInitializedRevision, "Contract instance has already been initialized"); lastInitializedRevision = revision; _; }
modifier initializer() { uint256 revision = getRevision(); require(revision > lastInitializedRevision, "Contract instance has already been initialized"); lastInitializedRevision = revision; _; }
75,985