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
165
// Returns the bond of a given darknode.
function darknodeBond(address darknodeID) external view onlyOwner returns (uint256) { return darknodeRegistry[darknodeID].bond; }
function darknodeBond(address darknodeID) external view onlyOwner returns (uint256) { return darknodeRegistry[darknodeID].bond; }
11,740
72
// We will set a minimum amount of tokens to be swaped => 5M
uint256 private _numOfTokensToExchangeForTeam = 5 * 10**3 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapEnabledUpdated(bool enabled);
uint256 private _numOfTokensToExchangeForTeam = 5 * 10**3 * 10**9; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapEnabledUpdated(bool enabled);
2,525
45
// Uniswap
address constant UNIV2_ROUTER2 = 0x1B7D628EEE764EB08d88ea2470B6351adf4681C0;
address constant UNIV2_ROUTER2 = 0x1B7D628EEE764EB08d88ea2470B6351adf4681C0;
2,200
7
// / Constructor for the BalanceTracker contract that sets an immutable variable. _profitWallet The address to send remaining ETH profits to. /
constructor( address payable _profitWallet ) { require(_profitWallet != address(0), "BalanceTracker: PROFIT_WALLET cannot be address(0)"); PROFIT_WALLET = _profitWallet; _disableInitializers(); }
constructor( address payable _profitWallet ) { require(_profitWallet != address(0), "BalanceTracker: PROFIT_WALLET cannot be address(0)"); PROFIT_WALLET = _profitWallet; _disableInitializers(); }
19,900
24
// Вывод средств с ICO (пользователь сам вызывает функцию)
function refund() public returns (bool success) { require(allowRefunds(), 'Refunds is not allowed, ICO is in progress'); uint amount = contributions[msg.sender]; if (amount > 0) { // It is important to set this to zero because the recipient // can call this function again as ...
function refund() public returns (bool success) { require(allowRefunds(), 'Refunds is not allowed, ICO is in progress'); uint amount = contributions[msg.sender]; if (amount > 0) { // It is important to set this to zero because the recipient // can call this function again as ...
47,812
1
// A flag that only has effect if a projectId is also specified, and that project has issued its tokens. If so, this flag indicates if the tokens that result from making a payment to the project should be delivered staked or unstaked to the beneficiary.
bool preferClaimed;
bool preferClaimed;
27,013
98
// -如果失败的调用有返回回滚提示,则拼接到回滚消息.
if (resulti.returnData.length > 4){ revertMsg = string(abi.encodePacked(revertMsg," Reason:",abi.decode(resulti.returnData.slice(4,resulti.returnData.length - 4),(string)))); }
if (resulti.returnData.length > 4){ revertMsg = string(abi.encodePacked(revertMsg," Reason:",abi.decode(resulti.returnData.slice(4,resulti.returnData.length - 4),(string)))); }
19,533
199
// Cache the end of the memory to calculate the length later.
let end := str
let end := str
3,701
151
// We now have the first a_n (with no decimals), and the product of all other a_n present, and the Taylor approximation of the exponentiation of the remainder (both with 20 decimals). All that remains is to multiply all three (one 20 decimal fixed point multiplication, dividing by ONE_20, and one integer multiplication...
return (((product * seriesSum) / ONE_20) * firstAN) / 100;
return (((product * seriesSum) / ONE_20) * firstAN) / 100;
9,741
6
// ICO per-address limit tracking
mapping(address => uint) internal ICOBuyIn; uint public tokensMintedDuringICO; uint public ethInvestedDuringICO; uint public currentEthInvested; uint internal tokenSupply = 0; uint internal ...
mapping(address => uint) internal ICOBuyIn; uint public tokensMintedDuringICO; uint public ethInvestedDuringICO; uint public currentEthInvested; uint internal tokenSupply = 0; uint internal ...
53,464
170
// HomeAMBErc677ToErc677Home side implementation for erc677-to-erc677 mediator intended to work on top of AMB bridge. It is designed to be used as an implementation contract of EternalStorageProxy contract./
contract HomeAMBErc677ToErc677 is BasicAMBErc677ToErc677 { /** * @dev Executes action on the request to deposit tokens relayed from the other network * @param _recipient address of tokens receiver * @param _value amount of bridged tokens */ function executeActionOnBridgedTokens(address _reci...
contract HomeAMBErc677ToErc677 is BasicAMBErc677ToErc677 { /** * @dev Executes action on the request to deposit tokens relayed from the other network * @param _recipient address of tokens receiver * @param _value amount of bridged tokens */ function executeActionOnBridgedTokens(address _reci...
38,333
117
// ================= End Contract Variables ======================
IUniswapV2Router public constant uniswapRouterV2 = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uint public constant ONE_HUNDRED_X_100 = 10000; uint public immutable contractStartTime; address public immutable TRUSTED_DEPOSIT_TOKEN_ADDRESS;
IUniswapV2Router public constant uniswapRouterV2 = IUniswapV2Router(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); uint public constant ONE_HUNDRED_X_100 = 10000; uint public immutable contractStartTime; address public immutable TRUSTED_DEPOSIT_TOKEN_ADDRESS;
3,256
5
// Allowance amounts on behalf of others
mapping (address => mapping (address => uint256)) internal allowances;
mapping (address => mapping (address => uint256)) internal allowances;
47,444
0
// Interface of the ERC777TokensRecipient standard as defined in the EIP. Accounts can be notified of `IERC777` tokens being sent to them by having acontract implement this interface (contract holders can be their ownimplementer) and registering it on the See `IERC1820Registry` and `ERC1820Implementer`. /
interface IERC777Recipient { /** * @dev Called by an `IERC777` token contract whenever tokens are being * moved or created into a registered account (`to`). The type of operation * is conveyed by `from` being the zero address or not. * * This call occurs _after_ the token contract's state i...
interface IERC777Recipient { /** * @dev Called by an `IERC777` token contract whenever tokens are being * moved or created into a registered account (`to`). The type of operation * is conveyed by `from` being the zero address or not. * * This call occurs _after_ the token contract's state i...
16,563
29
// Takes up to the total amount required to fund an answer. Reimburses the rest. Creates an appeal if at least two answers are funded. _arbitrationID The ID of the arbitration. _answer One of the possible rulings the arbitrator can give that the funder considers to be the correct answer to the question.return Whether t...
function fundAppeal(uint256 _arbitrationID, uint256 _answer) external payable override returns (bool) { Arbitration storage arbitration = arbitrations[_arbitrationID]; require(arbitration.status == Status.Created, "No dispute to appeal."); (uint256 appealPeriodStart, uint256 appealPeriodEnd)...
function fundAppeal(uint256 _arbitrationID, uint256 _answer) external payable override returns (bool) { Arbitration storage arbitration = arbitrations[_arbitrationID]; require(arbitration.status == Status.Created, "No dispute to appeal."); (uint256 appealPeriodStart, uint256 appealPeriodEnd)...
53,287
492
// method to recover any stuck erc20 tokens (ie compound COMP) _token the ERC20 token to recover /
function recover(ERC20 _token) public onlyAvatar { require( _token.transfer(address(avatar), _token.balanceOf(address(this))), "recover transfer failed" ); }
function recover(ERC20 _token) public onlyAvatar { require( _token.transfer(address(avatar), _token.balanceOf(address(this))), "recover transfer failed" ); }
49,645
23
// Clean user storage
if (userLock.amount == 0) { uint256[] storage userLocks = users[msg.sender].locksForToken[_lpToken]; userLocks[_index] = userLocks[userLocks.length-1]; userLocks.pop(); if (userLocks.length == 0) { users[msg.sender].lockedTokens.remove(_lpToken); }
if (userLock.amount == 0) { uint256[] storage userLocks = users[msg.sender].locksForToken[_lpToken]; userLocks[_index] = userLocks[userLocks.length-1]; userLocks.pop(); if (userLocks.length == 0) { users[msg.sender].lockedTokens.remove(_lpToken); }
23,137
50
// Registers controller/id Bytes32 id of controller/controller Address of controller
function registerController(bytes32 id, address controller) external;
function registerController(bytes32 id, address controller) external;
69,744
11
// set the actual output length
mstore(result, encodedLen)
mstore(result, encodedLen)
46,739
15
// Function used to check the number of tokens `account` has minted./account Account to check balance for.
function balance(address account) external view returns (uint256) { return _numberMinted(account); }
function balance(address account) external view returns (uint256) { return _numberMinted(account); }
40,998
38
// For owner /
function withdraw(uint256 amount) public onlyOwner { if (amount == 0) { owner.transfer(address(this).balance); } else { owner.transfer(amount); } }
function withdraw(uint256 amount) public onlyOwner { if (amount == 0) { owner.transfer(address(this).balance); } else { owner.transfer(amount); } }
5,773
25
// determine what index the present sender is:
uint ownerIndex = m_ownerIndex[uint(msg.sender)];
uint ownerIndex = m_ownerIndex[uint(msg.sender)];
79,381
56
// Updates the listing Fee of the contract /
function updateListingFee(uint _listingFee) public payable { require(treasury == msg.sender, "Only marketplace owner can update listing Fee."); listingFee = _listingFee; }
function updateListingFee(uint _listingFee) public payable { require(treasury == msg.sender, "Only marketplace owner can update listing Fee."); listingFee = _listingFee; }
83,460
10
// Bank node lending rewards contract
BankNodeLendingRewards public override bankNodeLendingRewards;
BankNodeLendingRewards public override bankNodeLendingRewards;
7,873
225
// Nothing in vault to allocate
if (vaultValue == 0) return; uint256 strategiesValue = _totalValueInStrategies();
if (vaultValue == 0) return; uint256 strategiesValue = _totalValueInStrategies();
23,707
4
// Show info about redeemed ETH Gift Card // Show info about new ETH Gift Card Created /
modifier enoughForRedeem(uint _cardId) { require ( giftCards[_cardId] <= poolTotalAmount, "Not enough on account for withdrawal" ); _; }
modifier enoughForRedeem(uint _cardId) { require ( giftCards[_cardId] <= poolTotalAmount, "Not enough on account for withdrawal" ); _; }
20,072
4
// ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplifiedproxy whose upgrades are fully controlled by the current implementation. /
interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * brick...
interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * brick...
33,433
183
// {ERC721Enumerable}. /
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256;
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256;
15,612
81
// We exit in a single token, so we initialize amountsOut with zeros
uint256[] memory amountsOut = new uint256[](2);
uint256[] memory amountsOut = new uint256[](2);
14,870
21
// Return true if and only if the contract has been initializedreturn whether the contract has been initialized /
function isInitialized() public view returns (bool) { return initialized; }
function isInitialized() public view returns (bool) { return initialized; }
23,206
53
// valid index
function validIndex(address _account) external view returns(uint) { return _validIndex[_account]; }
function validIndex(address _account) external view returns(uint) { return _validIndex[_account]; }
40,250
337
// a non-zero value otherwise.
res = fullWithdrawalRequests[starkKey][vaultId];
res = fullWithdrawalRequests[starkKey][vaultId];
2,400
0
// _issuer The address of the owner. /
constructor(address _issuer) public Owned(_issuer){ name = "Skyrim Network"; symbol = "SNS"; decimals = uint8(DECIMALS); totalSupply = TOTAL_SUPPLY; balances[_issuer] = TOTAL_SUPPLY; emit Transfer(address(0), _issuer, TOTAL_SUPPLY); }
constructor(address _issuer) public Owned(_issuer){ name = "Skyrim Network"; symbol = "SNS"; decimals = uint8(DECIMALS); totalSupply = TOTAL_SUPPLY; balances[_issuer] = TOTAL_SUPPLY; emit Transfer(address(0), _issuer, TOTAL_SUPPLY); }
24,215
6
// get 3 highest dice rolls
uint256 stat = roll1 * roll2 * roll3 + roll4 + roll3 - min; string memory output = string(abi.encodePacked(toString(stat))); return output;
uint256 stat = roll1 * roll2 * roll3 + roll4 + roll3 - min; string memory output = string(abi.encodePacked(toString(stat))); return output;
52,623
20
// The threshold above which the flywheel transfers BRID+, in wei
uint public constant birdPlusClaimThreshold = 0.001e18;
uint public constant birdPlusClaimThreshold = 0.001e18;
36,064
115
// mark the items as paid
updateBalances(ethAddress,accountRef); emit RedFoxMigrated(msg.sender,withdrawAmount);
updateBalances(ethAddress,accountRef); emit RedFoxMigrated(msg.sender,withdrawAmount);
79,963
41
// transferToFeeDistributorAmount is total rewards fees received for genesis pool (this contract) and farming pool
if ( transferToFeeDistributorAmount > 0 && feeDistributor != address(0) ) { _balances[feeDistributor] = _balances[feeDistributor].add( transferToFeeDistributorAmount ); emit Transfer( sender, feeDistributor, ...
if ( transferToFeeDistributorAmount > 0 && feeDistributor != address(0) ) { _balances[feeDistributor] = _balances[feeDistributor].add( transferToFeeDistributorAmount ); emit Transfer( sender, feeDistributor, ...
40,976
94
// transfer 20% of profit to management
transferToManagement(forManagement);
transferToManagement(forManagement);
37,652
115
// 111111 /1111111111111111111111000111111111111<10001111111111111
uint256 public partialLiquidateAmount; uint256 public discount; //1111,11111111111 uint256 public liquidateLine = 7e17;//1111111130%11111 1-0.3 = 0.7 uint256 public gracePeriod = 1 days; //11111 uint256 public depositMultiple;
uint256 public partialLiquidateAmount; uint256 public discount; //1111,11111111111 uint256 public liquidateLine = 7e17;//1111111130%11111 1-0.3 = 0.7 uint256 public gracePeriod = 1 days; //11111 uint256 public depositMultiple;
46,916
207
// Private function to add a token to this extension's token tracking data structures. tokenId uint256 ID of the token to be added to the tokens list /
function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); }
function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); }
26,023
64
// 2 Mappings - one for the fundfee and one for the other fees
mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; mapping(address=>bool) private _isExcludedFromFundFee; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 10000000000...
mapping (address => bool) private _isExcludedFromFee; mapping (address => bool) private _isExcluded; mapping(address=>bool) private _isExcludedFromFundFee; address[] private _excluded; uint256 private constant MAX = ~uint256(0); uint256 private constant _tTotal = 10000000000...
8,507
28
// Vesting Enjinstarter /
contract Vesting is IVesting { using SafeMath for uint256; using SafeERC20 for IERC20; struct VestingSchedule { uint256 cliffDurationDays; // Cliff duration in days with respect to the start of vesting schedule uint256 percentReleaseAtScheduleStart; // Percentage of grant amount to be relea...
contract Vesting is IVesting { using SafeMath for uint256; using SafeERC20 for IERC20; struct VestingSchedule { uint256 cliffDurationDays; // Cliff duration in days with respect to the start of vesting schedule uint256 percentReleaseAtScheduleStart; // Percentage of grant amount to be relea...
1,916
145
// Reusable timelock variables
address private _timelock_address; uint256 private _timelock_data_1;
address private _timelock_address; uint256 private _timelock_data_1;
8,026
107
// Start baking
lastBakeTime = now; lastRewardTime = now; rewardPool = 0;
lastBakeTime = now; lastRewardTime = now; rewardPool = 0;
1,915
47
// Internal view function for verifying a signature and a message hashagainst the mapping of keys currently stored on the key ring. For V1, allstored keys are the Dual key type, and only a single signature is providedfor verification at once since the threshold is fixed at one signature. /
function _verifySignature( bytes32 hash, bytes memory signature
function _verifySignature( bytes32 hash, bytes memory signature
11,866
19
// Pack the below variables using uint32 values/Fee paid by bots
uint32 public botFeeBips;
uint32 public botFeeBips;
11,806
2
// Compound's JumpRateModel Contract V2 for V2 cTokens Arr00 Supports only for V2 cTokens /
contract JumpRateModelV2 is BaseJumpRateModelV2 { /** * @notice Calculates the current borrow rate per block * @param cash The amount of cash in the market * @param borrows The amount of borrows in the market * @param reserves The amount of reserves in the market * @return The borrow rate percentage pe...
contract JumpRateModelV2 is BaseJumpRateModelV2 { /** * @notice Calculates the current borrow rate per block * @param cash The amount of cash in the market * @param borrows The amount of borrows in the market * @param reserves The amount of reserves in the market * @return The borrow rate percentage pe...
28,334
47
// @inheritdoc IEIP4824
function daoURI() external view returns (string memory) { return _daoURI; }
function daoURI() external view returns (string memory) { return _daoURI; }
10,511
21
// Bool related functions
function createBool(bytes32 key, bool value) external returns (bool); function createBools(bytes32[] keys, bool[] values) external returns (bool); function updateBool(bytes32 key, bool value) external returns (bool); function updateBools(bytes32[] keys, bool[] values) external returns (bool); function removeB...
function createBool(bytes32 key, bool value) external returns (bool); function createBools(bytes32[] keys, bool[] values) external returns (bool); function updateBool(bytes32 key, bool value) external returns (bool); function updateBools(bytes32[] keys, bool[] values) external returns (bool); function removeB...
43,754
2
// The end Timestamp.
uint256 public endTime;
uint256 public endTime;
26,176
83
// Allows owner to clean out the contract of ANY tokens including v2, but not v1 /
function inCaseTokensGetStuck( address _token, address _to, uint256 _amount
function inCaseTokensGetStuck( address _token, address _to, uint256 _amount
13,847
198
// Helper to get royalties for a token /
function _getRoyalties(uint256 tokenId) view internal returns (address payable[] storage, uint256[] storage) { return (_getRoyaltyReceivers(tokenId), _getRoyaltyBPS(tokenId)); }
function _getRoyalties(uint256 tokenId) view internal returns (address payable[] storage, uint256[] storage) { return (_getRoyaltyReceivers(tokenId), _getRoyaltyBPS(tokenId)); }
39,950
1
// The protocol fees will always be charged using the token associated with the max weight in the pool. Since these Pools will register tokens only once, we can assume this index will be constant.
uint256 internal immutable _maxWeightTokenIndex; uint256 internal immutable _normalizedWeight0; uint256 internal immutable _normalizedWeight1; uint256 internal immutable _normalizedWeight2; uint256 internal immutable _normalizedWeight3; uint256 internal immutable _normalizedWeight4; uint256...
uint256 internal immutable _maxWeightTokenIndex; uint256 internal immutable _normalizedWeight0; uint256 internal immutable _normalizedWeight1; uint256 internal immutable _normalizedWeight2; uint256 internal immutable _normalizedWeight3; uint256 internal immutable _normalizedWeight4; uint256...
32,764
50
// Construct next token ID e.g. 100000 + 1 = ID of 100001 (this first in the edition set) Create the token
_mintToken(_to, _tokenId.add(i), _editionNumber, _editionDetails.tokenURI);
_mintToken(_to, _tokenId.add(i), _editionNumber, _editionDetails.tokenURI);
52,928
44
// Starts the redeeming phase of the contract
function startRedeeming() external onlyOwner isNotPaused { // Move the contract to Redeeming state isRedeeming = true; }
function startRedeeming() external onlyOwner isNotPaused { // Move the contract to Redeeming state isRedeeming = true; }
41,257
31
// receive event /
receive() external payable { deposit(); }
receive() external payable { deposit(); }
57,534
0
// Set constant coefficients for MT19937-32 as defined here: https:en.wikipedia.org/wiki/Mersenne_Twister
uint constant w = 32; uint constant n = 624; uint constant m = 397; uint constant r = 31; uint constant a = 0x9908B0DF; uint constant u = 11; uint constant d = 0xFFFFFFFF; uint constant s = 7; uint constant b = 0x9D2C5680; uint constant t = 15;
uint constant w = 32; uint constant n = 624; uint constant m = 397; uint constant r = 31; uint constant a = 0x9908B0DF; uint constant u = 11; uint constant d = 0xFFFFFFFF; uint constant s = 7; uint constant b = 0x9D2C5680; uint constant t = 15;
44,696
86
// Emit TokensLocked event
emit TokensLocked(from, amount);
emit TokensLocked(from, amount);
51,441
1,487
// PerpetualLiquidatable Adds logic to a position-managing contract that enables callers to liquidate an undercollateralized position. The liquidation has a liveness period before expiring successfully, during which someone can "dispute" theliquidation, which sends a price request to the relevant Oracle to settle the f...
contract PerpetualLiquidatable is PerpetualPositionManager { using FixedPoint for FixedPoint.Unsigned; using SafeMath for uint256; using SafeERC20 for IERC20; /**************************************** * LIQUIDATION DATA STRUCTURES * ****************************************/ // B...
contract PerpetualLiquidatable is PerpetualPositionManager { using FixedPoint for FixedPoint.Unsigned; using SafeMath for uint256; using SafeERC20 for IERC20; /**************************************** * LIQUIDATION DATA STRUCTURES * ****************************************/ // B...
12,638
102
// All members of the group have been elected
if (numMembers[groupIndex] <= numMembersElected[groupIndex]) { votesForNextMember[groupIndex] = FixidityLib.wrap(0); } else {
if (numMembers[groupIndex] <= numMembersElected[groupIndex]) { votesForNextMember[groupIndex] = FixidityLib.wrap(0); } else {
16,943
62
// Reward for participating
uint amount = (price / participationFactor) / total;
uint amount = (price / participationFactor) / total;
11,455
23
// the token is not our preferred token
require(swapEnabled, "Swaps Disabled");
require(swapEnabled, "Swaps Disabled");
29,165
70
// the global fee growth of the input token
uint256 feeGrowthGlobalX128;
uint256 feeGrowthGlobalX128;
4,274
1
// who has adopted this pet?
function getOwner(uint petId) public view returns (address) { require(petId >= 0 && petId <= 15); return adopters[petId]; }
function getOwner(uint petId) public view returns (address) { require(petId >= 0 && petId <= 15); return adopters[petId]; }
37,681
16
// Pushes this contract's balance of `token` to `getCaller()`. getCaller() is the original `msg.sender` of the Router's `execute` fn. token The token to transfer to `getCaller()`.returnWhether or not the `token` was transferred to `getCaller()`. /
function _transferToCaller(address token) internal returns (bool) { uint256 quantity = IERC20(token).balanceOf(address(this)); if (quantity > 0) { IERC20(token).safeTransfer(getCaller(), quantity); return true; } return false; }
function _transferToCaller(address token) internal returns (bool) { uint256 quantity = IERC20(token).balanceOf(address(this)); if (quantity > 0) { IERC20(token).safeTransfer(getCaller(), quantity); return true; } return false; }
64,384
345
// semi-opaque error code, we assume NO_ERROR == 0 is invariant between upgrades
return (Error.SNAPSHOT_ERROR, 0, 0);
return (Error.SNAPSHOT_ERROR, 0, 0);
71,949
11
// Yellow Paper Def. 5.2 (Withdrawal Fee) When covBefore >= 1, fee is 0 When covBefore < 1, we apply a fee to prevent withdrawal arbitrage k K slippage parameter in WAD n N slippage parameter c1 C1 slippage parameter in WAD xThreshold xThreshold slippage parameter in WAD cash cash position of asset in WAD liability lia...
function _withdrawalFee( uint256 k, uint256 n, uint256 c1, uint256 xThreshold, uint256 cash, uint256 liability, uint256 amount
function _withdrawalFee( uint256 k, uint256 n, uint256 c1, uint256 xThreshold, uint256 cash, uint256 liability, uint256 amount
13,244
5
// Removes the sender from the list the manager role/
function renounceRaffleManager() public { renounceRole(RAFFLE_MANAGER_ROLE, msg.sender); emit RaffleManagerRemoved(msg.sender, managerOf); }
function renounceRaffleManager() public { renounceRole(RAFFLE_MANAGER_ROLE, msg.sender); emit RaffleManagerRemoved(msg.sender, managerOf); }
2,972
223
// debt write offtokenAddress ERC20 token addressamount WriteOff amount /
function debtWriteOff(address tokenAddress, uint256 amount) external;
function debtWriteOff(address tokenAddress, uint256 amount) external;
71,507
253
// Reverts if the DAO has not won the NFT
modifier onlyIfAuctionWon() { // Ensure that owner of NFT(auctionId) is contract address require(IERC721(NFTAddress).ownerOf(auctionID) == address(this), "PartyBid: DAO has not won auction."); _; }
modifier onlyIfAuctionWon() { // Ensure that owner of NFT(auctionId) is contract address require(IERC721(NFTAddress).ownerOf(auctionID) == address(this), "PartyBid: DAO has not won auction."); _; }
23,217
25
// Receives the ruling for a dispute from the Foreign Chain. Should only be called by the xDAI/ETH bridge. _arbitrable The address of the arbitrable contract. UNTRUSTED. _arbitrableItemID The ID of the arbitrable item on the arbitrable contract. _ruling The ruling given by the arbitrator. /
function receiveRuling( ICrossChainArbitrable _arbitrable, uint256 _arbitrableItemID, uint256 _ruling
function receiveRuling( ICrossChainArbitrable _arbitrable, uint256 _arbitrableItemID, uint256 _ruling
16,411
0
// Contract Address Locator Interface. /
interface IContractAddressLocator { /** * @dev Get the contract address mapped to a given identifier. * @param _identifier The identifier. * @return The contract address. */ function getContractAddress(bytes32 _identifier) external view returns (address); /** * @dev Determine wheth...
interface IContractAddressLocator { /** * @dev Get the contract address mapped to a given identifier. * @param _identifier The identifier. * @return The contract address. */ function getContractAddress(bytes32 _identifier) external view returns (address); /** * @dev Determine wheth...
80,258
98
// Ensure bet and number are valid.
if (!_validateBetOrRefund(_number)) return;
if (!_validateBetOrRefund(_number)) return;
81,097
239
// The percentage of developer cut Default set to 2.8%
_setUint(EXCHANGE_DEVELOPER_CUT, 2800);
_setUint(EXCHANGE_DEVELOPER_CUT, 2800);
36,952
225
// The FARMING TOKEN!
BlackfarmingToken public blackfarming;
BlackfarmingToken public blackfarming;
24,591
21
// Controls the initialization state, allowing to call an initialization function only once. /
modifier initializes() { address impl = implementation(); // require(!initialized[implementation()]); require(!boolStorage[keccak256(abi.encodePacked(impl, "initialized"))], "Contract is already initialized"); _; // initialized[implementation()] = true; boolStorage[ke...
modifier initializes() { address impl = implementation(); // require(!initialized[implementation()]); require(!boolStorage[keccak256(abi.encodePacked(impl, "initialized"))], "Contract is already initialized"); _; // initialized[implementation()] = true; boolStorage[ke...
43,719
59
// Liquidity/Liquidation Calculations // Local vars for avoiding stack-depth limits in calculating account liquidity. Note that `lendTokenBalance` is the number of lendTokens the account owns in the market, whereas `borrowBalance` is the amount of underlying that the account has borrowed. /
struct AccountLiquidityLocalVars { uint sumCollateral; uint sumBorrowPlusEffects; uint lendTokenBalance; uint borrowBalance; uint exchangeRateMantissa; uint oraclePriceMantissa; uint goldOraclePriceMantissa; uint tokensToDenom; }
struct AccountLiquidityLocalVars { uint sumCollateral; uint sumBorrowPlusEffects; uint lendTokenBalance; uint borrowBalance; uint exchangeRateMantissa; uint oraclePriceMantissa; uint goldOraclePriceMantissa; uint tokensToDenom; }
39,900
3
// Transfer the tokens back to the depositor
IERC20(userDeposit.token).safeTransfer(msg.sender, amount);
IERC20(userDeposit.token).safeTransfer(msg.sender, amount);
7,682
12
// двадцать одно пальто висело на вешалке ^^^^^^^^^^^^^
pattern Числ1 { N10=Десятки : export { ПАДЕЖ node:root_node }
pattern Числ1 { N10=Десятки : export { ПАДЕЖ node:root_node }
16,630
360
// . Gets the list of methods for binding to wallets./Sub-contracts should override this method to provide methods for/wallet binding./ return methods A list of method selectors for binding to the wallet/ when this module is activated for the wallet.
function bindableMethods() public pure virtual returns (bytes4[] memory methods);
function bindableMethods() public pure virtual returns (bytes4[] memory methods);
23,517
15
// get the lzReceive() LayerZero messaging library version_userApplication - the contract address of the user application
function getReceiveVersion(address _userApplication) external view returns (uint16);
function getReceiveVersion(address _userApplication) external view returns (uint16);
34,733
178
// Should never occur
if (_proof.length == 64) { return false; }
if (_proof.length == 64) { return false; }
31,602
47
// if there is an unexpected bug, leading to an endless game/
function forceGameOver() external { require(owner == msg.sender, "only owner can force game over"); require(block.number > ((3600 * 24 * 30) / blockTime) + startBlockNum, "only force game over after 30 days"); endBlockNum = block.number - 1; }
function forceGameOver() external { require(owner == msg.sender, "only owner can force game over"); require(block.number > ((3600 * 24 * 30) / blockTime) + startBlockNum, "only force game over after 30 days"); endBlockNum = block.number - 1; }
14,960
11
// Redeem RToken for basket collateral to a particular recipient/recipient The address to receive the backing collateral tokens/amount {qRTok} The quantity {qRToken} of RToken to redeem/revertOnPartialRedemption If true, will revert on partial redemption/ @custom:interaction
function redeemTo( address recipient, uint256 amount, bool revertOnPartialRedemption ) external;
function redeemTo( address recipient, uint256 amount, bool revertOnPartialRedemption ) external;
20,802
38
// address of the interest rate strategy
address interestRateStrategyAddress;
address interestRateStrategyAddress;
1,787
70
// iterate over the conversion paths
for (uint256 i = 0; i < _pathStartIndex.length; i += 1) { pathEndIndex = i == (_pathStartIndex.length - 1) ? _paths.length : _pathStartIndex[i + 1];
for (uint256 i = 0; i < _pathStartIndex.length; i += 1) { pathEndIndex = i == (_pathStartIndex.length - 1) ? _paths.length : _pathStartIndex[i + 1];
15,028
45
// Choose new validators
validatorSetContract.newValidatorSet();
validatorSetContract.newValidatorSet();
15,145
196
// locate the index of the validator approval to be removed
uint256 index = _validatorApprovalsIndex[validator][attributeTypeID];
uint256 index = _validatorApprovalsIndex[validator][attributeTypeID];
42,432
5
// @custom:security-contact security@munitar.com
contract Lithereum is ERC20, ERC20Snapshot, AccessControl, ERC20FlashMint { bytes32 public constant SNAPSHOT_ROLE = keccak256("SNAPSHOT_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() ERC20("Lithereum", "HER") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); ...
contract Lithereum is ERC20, ERC20Snapshot, AccessControl, ERC20FlashMint { bytes32 public constant SNAPSHOT_ROLE = keccak256("SNAPSHOT_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() ERC20("Lithereum", "HER") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); ...
27,774
212
// returns the ongoing normalized income for the reserve. a value of 1e27 means there is no income. As time passes, the income is accrued. A value of 21e27 means that the income of the reserve is double the initial amount._reserve the reserve object return the normalized income. expressed in ray/
{ uint256 cumulated = calculateLinearInterest( _reserve .currentLiquidityRate, _reserve .lastUpdateTimestamp ) .rayMul(_reserve.lastLiquidityCumulativeIndex); return cumulated; }
{ uint256 cumulated = calculateLinearInterest( _reserve .currentLiquidityRate, _reserve .lastUpdateTimestamp ) .rayMul(_reserve.lastLiquidityCumulativeIndex); return cumulated; }
31,962
34
// Remove an user from the whitelist
function removeUser(address user) onlyOwner { whitelisted[user] = false; LogUserRemoved(user); }
function removeUser(address user) onlyOwner { whitelisted[user] = false; LogUserRemoved(user); }
20,179
128
// ERC777 ERC777 logic /
contract ERC777 is IERC777, Ownable, ERC820Client, CertificateController, ReentrancyGuard { using SafeMath for uint256; string internal _name; string internal _symbol; uint256 internal _granularity; uint256 internal _totalSupply; // Indicate whether the token can still be controlled by operators or not an...
contract ERC777 is IERC777, Ownable, ERC820Client, CertificateController, ReentrancyGuard { using SafeMath for uint256; string internal _name; string internal _symbol; uint256 internal _granularity; uint256 internal _totalSupply; // Indicate whether the token can still be controlled by operators or not an...
23,804
62
// Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; }
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner { _swapTokensAtAmount = swapTokensAtAmount; }
5,195
153
// Core fonction / withdraw DTH when teller delete
function withdrawDthTeller(address _receiver) external onlyOwner { require(dthTellerBalance[_receiver] > 0); uint tosend = dthTellerBalance[_receiver]; dthTellerBalance[_receiver] = 0; require(dth.transfer(_receiver, tosend)); }
function withdrawDthTeller(address _receiver) external onlyOwner { require(dthTellerBalance[_receiver] > 0); uint tosend = dthTellerBalance[_receiver]; dthTellerBalance[_receiver] = 0; require(dth.transfer(_receiver, tosend)); }
79,024
35
// Token Bucket leak event fires on each minting/to is address of target tokens holder/left is amount of tokens available in bucket after leak
event Leak(address indexed to, uint256 left);
event Leak(address indexed to, uint256 left);
58,671
9
// rdefines an authority _name the authority name _address the authority address. /
function defineAuthority(string _name, address _address) public onlyOwner { emit AuthorityDefined(_name, _address); authority = _address; }
function defineAuthority(string _name, address _address) public onlyOwner { emit AuthorityDefined(_name, _address); authority = _address; }
20,389
12
// The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
mapping (address => uint32) public numCheckpoints;
10,598
220
// Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. /
function isApprovedForAll(address owner, address operator) override public view returns (bool)
function isApprovedForAll(address owner, address operator) override public view returns (bool)
18,078
153
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
(bool success, ) = recipient.call{ value: amount }("");
2,336
24
// check if contract is able to pay player a win
require(playerEarnings <= deposits[platformReserve]);
require(playerEarnings <= deposits[platformReserve]);
9,593