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
151
// in all cases we first wish to log the transfer no merging later can deny the fact that `from` transferred to `to`
emit Transfer(from, to, tokenId); if (from == to) {
emit Transfer(from, to, tokenId); if (from == to) {
39,899
153
// we need to transfer the source tokens from the caller to the BancorNetwork contract, so it can execute the conversion on behalf of the caller
if (msg.value == 0) {
if (msg.value == 0) {
6,917
432
// Supply caps enforced by mintAllowed for each cToken address. Defaults to zero which corresponds to unlimited supplying.
mapping(address => uint) public supplyCaps;
mapping(address => uint) public supplyCaps;
43,419
25
// Modifier to allow actions only when the contract IS paused
modifier whenPaused { require(paused); _; }
modifier whenPaused { require(paused); _; }
6,845
13
// check whether it's off cooldown
uint256 cooldown = getCooldown( numberTimesRedeemed, isOriginalLoot(lootTokenId) ); require( blockNumber - lastRedeemedBlock >= cooldown, "Loot not off cooldown" );
uint256 cooldown = getCooldown( numberTimesRedeemed, isOriginalLoot(lootTokenId) ); require( blockNumber - lastRedeemedBlock >= cooldown, "Loot not off cooldown" );
13,490
130
// calculate the portions of the liquidity to add to Tipping
uint256 TippingBalance = newBalance.div(totalLiqFee).mul(_TippingFee); uint256 TippingPortion = otherHalf.div(totalLiqFee).mul(_TippingFee);
uint256 TippingBalance = newBalance.div(totalLiqFee).mul(_TippingFee); uint256 TippingPortion = otherHalf.div(totalLiqFee).mul(_TippingFee);
47,483
28
// shouldSwapBack
if(shouldSwapBack() && recipient == pair){swapBack();}
if(shouldSwapBack() && recipient == pair){swapBack();}
21,389
449
// no need to check for recoveredAddress == 0 because if it's 0, it won't work
(recoveredAddress == owner_ || isApprovedForAll(owner_, recoveredAddress)) ) ||
(recoveredAddress == owner_ || isApprovedForAll(owner_, recoveredAddress)) ) ||
44,453
1
// - Configure data for Spigot stakeholders - Owner/operator/treasury can all be the same address when setting up a Spigot _owner- An address that controls the Spigot and owns rights to some or all tokens earned by owned revenue contracts _operator - An active address for non-Owner that can execute whitelisted function...
constructor(address _owner, address _operator) { state.owner = _owner; state.operator = _operator; }
constructor(address _owner, address _operator) { state.owner = _owner; state.operator = _operator; }
15,612
279
// Check whether an external position is active on the vault/_externalPosition The externalPosition to check/ return isActiveExternalPosition_ True if the address is an active external position on the vault
function isActiveExternalPosition(address _externalPosition) public view override returns (bool isActiveExternalPosition_)
function isActiveExternalPosition(address _externalPosition) public view override returns (bool isActiveExternalPosition_)
19,413
4
// Events / Triggered when tokens are transferred.
event Transfer( address indexed from, address indexed to, uint256 value);
event Transfer( address indexed from, address indexed to, uint256 value);
3,232
2
// toggle mint on
function toggleOn() public onlyOwner { active = true; }
function toggleOn() public onlyOwner { active = true; }
1,484
194
// Send bounty. Wrapper over the real function that performs an extracheck to see if it&39;s after execution window (and thus the first transaction failed) /
function sendBounty(Request storage self) public returns (bool)
function sendBounty(Request storage self) public returns (bool)
16,038
9
// Withdraw cUSD from Moola lending pool. /
function _withdrawFromStakedAsset(uint256 stakedAssets) internal virtual override returns (uint256 assets)
function _withdrawFromStakedAsset(uint256 stakedAssets) internal virtual override returns (uint256 assets)
17,673
21
// Spends credit from multiple `tokenIds` - owned by `account` - as specified by `amounts`-for the consumption of an external service identified by `serviceId`.Optionally sending additional `data`. Requirements:
* See {NFTYieldedToken._spendMultiple} */ function externalSpendMultiple( address account, uint256[] calldata tokenIds, uint256[] calldata amounts, uint256 serviceId, bytes calldata data ) external onlyRole(EXTERNAL_SPENDER_RO...
* See {NFTYieldedToken._spendMultiple} */ function externalSpendMultiple( address account, uint256[] calldata tokenIds, uint256[] calldata amounts, uint256 serviceId, bytes calldata data ) external onlyRole(EXTERNAL_SPENDER_RO...
49,752
14
// Verifies a signature against a hash./hash The hash to verify./signature The signature to use for verification./ return True if the signature is valid, false otherwise.
function verify(bytes32 hash, bytes memory signature) internal view returns (bool) { return ECDSA.recover(hash, signature) == signer; }
function verify(bytes32 hash, bytes memory signature) internal view returns (bool) { return ECDSA.recover(hash, signature) == signer; }
15,666
84
// This contract implements a proxy that is upgradeable by an admin.clashing], which can potentially be used in an attack, this contract uses thethings that go hand in hand:1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even ifthat call matches one of the admin...
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is UpgradeableProxy { /** * @dev Initializes an up...
* Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy. */ contract TransparentUpgradeableProxy is UpgradeableProxy { /** * @dev Initializes an up...
6,642
15
// migrate base token
_bToken.safeTransferFrom(source, address(this), _bToken.balanceOf(source));
_bToken.safeTransferFrom(source, address(this), _bToken.balanceOf(source));
26,734
0
// For interacting with our own strategy
interface IStrategy { // Want address function wantAddress() external view returns (address); // Total want tokens managed by strategy function wantLockedTotal() external view returns (uint256); // Sum of all shares of users to wantLockedTotal function sharesTotal() external view returns (uint...
interface IStrategy { // Want address function wantAddress() external view returns (address); // Total want tokens managed by strategy function wantLockedTotal() external view returns (uint256); // Sum of all shares of users to wantLockedTotal function sharesTotal() external view returns (uint...
31,862
71
// Overload of {ECDSA-recover} that receives the `r` and `vs` short-signature fields separately._Available since v4.2._ /
function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27)
function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { bytes32 s; uint8 v; assembly { s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) v := add(shr(255, vs), 27)
48,426
94
// Vesper pools are using this function so it should exist in all strategies.solhint-disable-next-line no-empty-blocks
function beforeWithdraw() external override onlyPool {} /** * @dev Withdraw collateral token from Compound. * @param _amount Amount of collateral token */ function withdraw(uint256 _amount) external override onlyAuthorized { _withdraw(_amount); }
function beforeWithdraw() external override onlyPool {} /** * @dev Withdraw collateral token from Compound. * @param _amount Amount of collateral token */ function withdraw(uint256 _amount) external override onlyAuthorized { _withdraw(_amount); }
39,896
4
// This default function allows token to be purchased by directly / sending ether to this smart contract.
function () public payable { purchaseTokens(msg.sender); }
function () public payable { purchaseTokens(msg.sender); }
22,896
181
// Returns the total amount of tokens stored by the contract. return total amount of tokens./
function totalSupply() public view returns (uint) { return _tokenOwners.length(); }
function totalSupply() public view returns (uint) { return _tokenOwners.length(); }
23,084
11
// Get the value/
function getName() public view returns (string memory forumName) { return _forumName; }
function getName() public view returns (string memory forumName) { return _forumName; }
43,763
37
// Mint tokens only if minting stage is not finished
require(!mintingIsFinished); balances[_to] = balances[_to].add(_value); totalSupply = totalSupply.add(_value); emit Transfer(address(0), _to, _value); return true;
require(!mintingIsFinished); balances[_to] = balances[_to].add(_value); totalSupply = totalSupply.add(_value); emit Transfer(address(0), _to, _value); return true;
19,736
14
// Information for calculating a weighted arithmetic mean tick
struct WeightedTickData { int24 tick; uint128 weight; }
struct WeightedTickData { int24 tick; uint128 weight; }
32,196
73
// Addresses to be used for random letItRain!
address[] lastAddresses; int32 maxAddresses = 100; //Maximum number of addresses at the same time (will keep the N most recently mentioned addresses) int32 firstAddress = 0; //Indexes that will mark the first and the last address received in the array of last addresses (revolving array) int32 lastAddres...
address[] lastAddresses; int32 maxAddresses = 100; //Maximum number of addresses at the same time (will keep the N most recently mentioned addresses) int32 firstAddress = 0; //Indexes that will mark the first and the last address received in the array of last addresses (revolving array) int32 lastAddres...
13,483
10
// define function modifier excluding the landlord
modifier notLandlord() { if (msg.sender == lease.landlord) revert(); _; }
modifier notLandlord() { if (msg.sender == lease.landlord) revert(); _; }
31,795
5
// Add a new curve pool to the system /
function addPool(address _gauge, uint256 _stashVersion) external returns(bool){ _addPool(_gauge,_stashVersion); return true; }
function addPool(address _gauge, uint256 _stashVersion) external returns(bool){ _addPool(_gauge,_stashVersion); return true; }
15,907
1
// All open channels for a given node
mapping(address => address[]) node_channels;
mapping(address => address[]) node_channels;
5,937
7
// Stores the last Witnet-provided response data struct.
Witnet.Response public lastResponse;
Witnet.Response public lastResponse;
29,025
22
// Checks if the user calling a function exists
modifier onlyUsers () { require(addressToUser[msg.sender].isExist == true, "Cet utilisateur n'existe pas"); _; }
modifier onlyUsers () { require(addressToUser[msg.sender].isExist == true, "Cet utilisateur n'existe pas"); _; }
52,634
34
// Register retirement event in the certificates contract
address certAddr = IToucanContractRegistry(contractRegistry) .carbonOffsetBadgesAddress(); retirementEventId = IRetirementCertificates(certAddr).registerEvent( account, projectVintageTokenId, amount, false ); emit Retired(accou...
address certAddr = IToucanContractRegistry(contractRegistry) .carbonOffsetBadgesAddress(); retirementEventId = IRetirementCertificates(certAddr).registerEvent( account, projectVintageTokenId, amount, false ); emit Retired(accou...
7,042
57
// Create swap identifier
swapId = keccak256( msigId, msg.sender, beneficiary, amount, fee, expirationTime, hashedSecret ); emit AtomicSwapInitialised(swapId);
swapId = keccak256( msigId, msg.sender, beneficiary, amount, fee, expirationTime, hashedSecret ); emit AtomicSwapInitialised(swapId);
62,802
20
// The address that should receive the funds once the NFT is sold.
address tokenOwner;
address tokenOwner;
17,081
52
// Swaps as little as possible of one token for `amountOut` of another token/params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata/ return amountIn The amount of the input token
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn);
10,618
17
// emergency rescue to allow unstaking without any checks but without $WOOL
bool public rescueEnabled = false;
bool public rescueEnabled = false;
9,060
138
// Takes out 5.0% as system fees from the rewards.1% -> Call Fee0.5% -> Treasury fee0.5% -> Strategist fee3% -> BIFI Holders /
function _chargeFees() internal { uint256 toWbnb = IERC20(venus).balanceOf(address(this)).mul(50).div(1000); IUniswapRouter(unirouter).swapExactTokensForTokens(toWbnb, 0, venusToWbnbRoute, address(this), now.add(600)); uint256 wbnbBal = IERC20(wbnb).balanceOf(address(this)); uint25...
function _chargeFees() internal { uint256 toWbnb = IERC20(venus).balanceOf(address(this)).mul(50).div(1000); IUniswapRouter(unirouter).swapExactTokensForTokens(toWbnb, 0, venusToWbnbRoute, address(this), now.add(600)); uint256 wbnbBal = IERC20(wbnb).balanceOf(address(this)); uint25...
18,854
104
// Public methods
function mhAmount() public view returns (uint256) { return (_totalSupply * mhPercentage) / 10000; }
function mhAmount() public view returns (uint256) { return (_totalSupply * mhPercentage) / 10000; }
19,880
9
// Returns the split ratio of asset and performance reward./poolId Id of the pool./ return epochReward Value of the reward factor./ return epochTime Value of epoch time./ return ratio Value of the ratio from 1 to 100.
function getRewardParameters(uint256 poolId) external view returns ( uint256 epochReward, uint256 epochTime, uint256 ratio );
function getRewardParameters(uint256 poolId) external view returns ( uint256 epochReward, uint256 epochTime, uint256 ratio );
42,102
240
// Returns utf8-encoded bytes32 string that can be read via web3.utils.hexToUtf8. Will return bytes32 in all lower case hex characters and without the leading 0x.This has minor changes from the toUtf8BytesAddress to control for the size of the input. bytesIn bytes32 to encode.return utf8 encoded bytes32. /
function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) { return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn)); }
function toUtf8Bytes(bytes32 bytesIn) internal pure returns (bytes memory) { return abi.encodePacked(toUtf8Bytes32Bottom(bytesIn >> 128), toUtf8Bytes32Bottom(bytesIn)); }
15,126
214
// Calculate delegation rewards and add them to the delegation pool
uint256 delegationRewards = _collectDelegationIndexingRewards(_indexer, totalRewards); uint256 indexerRewards = totalRewards.sub(delegationRewards);
uint256 delegationRewards = _collectDelegationIndexingRewards(_indexer, totalRewards); uint256 indexerRewards = totalRewards.sub(delegationRewards);
9,449
17
// Completes airline registration by funding it./
function fundAirline() public payable
function fundAirline() public payable
48,337
30
// not resetting presaleTokensClaimed[addresses[i]], so we can't add an address twice
presaleAccessList[addresses[i]] = numberOfTokens;
presaleAccessList[addresses[i]] = numberOfTokens;
66,407
13
// Returns amount in terms of asset 0 amountasset 1 price /
function getAmountInAsset0Terms(uint256 amount) public view returns (uint256)
function getAmountInAsset0Terms(uint256 amount) public view returns (uint256)
81,760
198
// Function to stop minting new tokens. /
function _finishMinting() internal virtual { _mintingFinished = true; emit MintFinished(); }
function _finishMinting() internal virtual { _mintingFinished = true; emit MintFinished(); }
11,027
18
// Expect ordered array arranged in ascending order
for(uint i = 0; i < timestampList.length-1; i++){ uint timestamp_diff = (timestampList[i+1]-timestampList[i]); require((timestamp_diff / 1000) == 10); }
for(uint i = 0; i < timestampList.length-1; i++){ uint timestamp_diff = (timestampList[i+1]-timestampList[i]); require((timestamp_diff / 1000) == 10); }
70,149
12
// after the signing of the configuration by the organizers the admin changes the state of the contract
function signWholeConfiguration() onlyState(contractState.configurationSet) returns (bool){ bool correct = false; if(msg.sender == owner){ for(uint i=0; i<signedConfiguration.length; i++){ if(signedConfiguration[i]==nullAddress){ revert(); } else{ corr...
function signWholeConfiguration() onlyState(contractState.configurationSet) returns (bool){ bool correct = false; if(msg.sender == owner){ for(uint i=0; i<signedConfiguration.length; i++){ if(signedConfiguration[i]==nullAddress){ revert(); } else{ corr...
32,468
281
// Asset type (fCash or Liquidity Token marker)
uint8 assetType;
uint8 assetType;
15,912
6
// get this Endpoint's immutable source identifier
function getChainId() external view returns (uint16);
function getChainId() external view returns (uint16);
20,002
11
// Local scope used to prevent stack-too-deep errors.
bytes32 oldestSample = samples[oldestIndex]; uint256 oldestTimestamp = oldestSample.timestamp();
bytes32 oldestSample = samples[oldestIndex]; uint256 oldestTimestamp = oldestSample.timestamp();
35,552
38
// Helper to get the network mining basefee as introduced in EIP-1559 this helper can be wrapped in try/catch statement to avoid revert in networks where EIP-1559 is not implemented /
function networkBaseFee() external view returns (uint) { return block.basefee; }
function networkBaseFee() external view returns (uint) { return block.basefee; }
35,614
190
// Price
uint256 public price = 50000000000000000; // 0.05 eth
uint256 public price = 50000000000000000; // 0.05 eth
16,971
19
// returns remaining balance of stream for respective user /
function streamBalance(address to) public view returns (uint256){}
function streamBalance(address to) public view returns (uint256){}
47,937
18
// Update reward variables of the given pool./pid The index of the pool. See `poolInfo`./ return pool Returns the pool that was updated.
function updatePool(uint256 pid) public returns (PoolInfo memory pool) { pool = poolInfo[pid]; if (block.timestamp > pool.lastRewardTime) { uint256 lpSupply = lpToken[pid].balanceOf(address(this)); if (lpSupply > 0) { uint256 time = block.timestamp.sub(pool.la...
function updatePool(uint256 pid) public returns (PoolInfo memory pool) { pool = poolInfo[pid]; if (block.timestamp > pool.lastRewardTime) { uint256 lpSupply = lpToken[pid].balanceOf(address(this)); if (lpSupply > 0) { uint256 time = block.timestamp.sub(pool.la...
46,867
1,599
// Retrieves rewards owed for a set of resolved price requests. Can only retrieve rewards if calling for a valid round and if the call is done within the timeout threshold(not expired). Note that a named return value is used here to avoid a stack to deep error. voterAddress voter for which rewards will be retrieved. Do...
function retrieveRewards( address voterAddress, uint256 roundId, PendingRequestAncillary[] memory toRetrieve
function retrieveRewards( address voterAddress, uint256 roundId, PendingRequestAncillary[] memory toRetrieve
17,917
19
// shows if an address has done a manual withdrawal. manual withdrawals are only allowed once
mapping (address => bool) hasManuallyWithdrawn;
mapping (address => bool) hasManuallyWithdrawn;
1,118
12
// can't call arbitrary functions on parent moloch
require(action.to != address(moloch), "invalid target"); require(!action.executed, "action executed"); require(address(this).balance >= action.value, "insufficient eth"); require(flags[2], "proposal not passed");
require(action.to != address(moloch), "invalid target"); require(!action.executed, "action executed"); require(address(this).balance >= action.value, "insufficient eth"); require(flags[2], "proposal not passed");
358
148
// Update share recipient _newRecipient address of the new recipient _currentRecipient address of the current recipient /
function updateSharesOwner(address _newRecipient, address _currentRecipient) external onlyOwner { require(accountInfo[_currentRecipient].shares > 0, "Owner: Current recipient has no shares"); require(accountInfo[_newRecipient].shares == 0, "Owner: New recipient has existing shares"); // Cop...
function updateSharesOwner(address _newRecipient, address _currentRecipient) external onlyOwner { require(accountInfo[_currentRecipient].shares > 0, "Owner: Current recipient has no shares"); require(accountInfo[_newRecipient].shares == 0, "Owner: New recipient has existing shares"); // Cop...
37,862
47
// called by the owner to withdraw unsold tokens /
function withdrawTokens() public onlyOwner { uint256 unsold = token.balanceOf(this); token.transfer(owner, unsold); }
function withdrawTokens() public onlyOwner { uint256 unsold = token.balanceOf(this); token.transfer(owner, unsold); }
4,477
44
// make sure the invalidator is the signer
require(recoveredSignatureSigner == from);
require(recoveredSignatureSigner == from);
20,403
35
// Withdraw from the options protocol by closing short in an event of a emergency /
function emergencyWithdrawFromShort() external onlyManager nonReentrant { address oldOption = currentOption; require(oldOption != address(0), "!currentOption"); currentOption = address(0); nextOption = address(0); lockedAmount = 0; uint256 withdrawAmount = adapter.d...
function emergencyWithdrawFromShort() external onlyManager nonReentrant { address oldOption = currentOption; require(oldOption != address(0), "!currentOption"); currentOption = address(0); nextOption = address(0); lockedAmount = 0; uint256 withdrawAmount = adapter.d...
32,284
1
// Some extra Loan's settings struct. This data is saved upon loan creation.We need this to avoid stack too deep errors.revenueSharePartner - The address of the partner that will receive the revenue share. revenueShareInBasisPoints - The percent (measured in basis points) of the admin fee amount that will betaken as a ...
struct LoanExtras { address revenueSharePartner; uint16 revenueShareInBasisPoints; uint16 referralFeeInBasisPoints; }
struct LoanExtras { address revenueSharePartner; uint16 revenueShareInBasisPoints; uint16 referralFeeInBasisPoints; }
40,336
6
// access control
require(msg.sender == permissionedPairAddress, "only permissioned UniswapV2 pair can call"); require(_sender == address(this), "only this contract may initiate");
require(msg.sender == permissionedPairAddress, "only permissioned UniswapV2 pair can call"); require(_sender == address(this), "only this contract may initiate");
14,789
2
// Token Decimals for avoif friction with several wallets
uint8 private _decimals;
uint8 private _decimals;
8,317
2
// modifier to make functions only accessible to owners
modifier onlyOwner() { if (!contractOwner[msg.sender]) { revert("Function was not called by owner."); } _; // continue executing rest of method body }
modifier onlyOwner() { if (!contractOwner[msg.sender]) { revert("Function was not called by owner."); } _; // continue executing rest of method body }
48,805
30
// Determine the user's smart wallet address based on the user signing key.
wallet = _computeNextAddress(initializationCalldata);
wallet = _computeNextAddress(initializationCalldata);
48,003
28
// Remove from Whitelist
function removeFromWhitelist(uint256 BatchId, address user) public onlyOwner { delete whitelisted[BatchId][user]; }
function removeFromWhitelist(uint256 BatchId, address user) public onlyOwner { delete whitelisted[BatchId][user]; }
23,318
34
// The address of the contractor smart contract
address contractorAddress;
address contractorAddress;
45,768
44
// Check if the token is one of BTC relared address token The token addressreturn It's BTC or not /
function isBtcAddress(address token) internal returns (bool) { for (uint256 i = 0; i < btcAddresses.length; i++) { if (btcAddresses[i] == token) { return true; } } return false; }
function isBtcAddress(address token) internal returns (bool) { for (uint256 i = 0; i < btcAddresses.length; i++) { if (btcAddresses[i] == token) { return true; } } return false; }
19,349
123
// Check balance
uint256 b = token.balanceOf(address(this)); if (b < r) { uint256 _withdraw = r.sub(b); IController(controller).withdraw(address(token), _withdraw); uint256 _after = token.balanceOf(address(this)); uint256 _diff = _after.sub(b); if (_diff < _wit...
uint256 b = token.balanceOf(address(this)); if (b < r) { uint256 _withdraw = r.sub(b); IController(controller).withdraw(address(token), _withdraw); uint256 _after = token.balanceOf(address(this)); uint256 _diff = _after.sub(b); if (_diff < _wit...
11,643
24
// map from validator set nonce to validator ECDSA addresses (i.e bridge session keys) these should be in sorted order matching `pallet_session::Module<T>::validators()` signatures from a threshold of these addresses are considered approved by the CENNZnet protocol
mapping(uint => address[]) public validators;
mapping(uint => address[]) public validators;
51,963
34
// Check user is registered as staker
if (isStaking(msg.sender)) { _stakers[msg.sender].staked += stakeAmount; _stakers[msg.sender].earned += _userEarned(msg.sender); _stakers[msg.sender].start = block.timestamp; } else {
if (isStaking(msg.sender)) { _stakers[msg.sender].staked += stakeAmount; _stakers[msg.sender].earned += _userEarned(msg.sender); _stakers[msg.sender].start = block.timestamp; } else {
20,019
12
// Add the new player to the players list for random number generation
addPlayer(msg.sender);
addPlayer(msg.sender);
13,656
2
// rewards
event RewardsDistributed( address indexed user, address indexed token, uint256 amount, uint256 shares ); event RewardsFunded( address indexed token, uint256 amount, uint256 shares,
event RewardsDistributed( address indexed user, address indexed token, uint256 amount, uint256 shares ); event RewardsFunded( address indexed token, uint256 amount, uint256 shares,
1,009
45
// Update owner field
_setOwner(newOwner);
_setOwner(newOwner);
15,245
30
// Adds a relayer address to the allowed relayers mapping._relayer - Relayer address to add. /
function addRelayer(address _relayer) external onlyOwner definedAddress(_relayer) { _addRelayer(_relayer); }
function addRelayer(address _relayer) external onlyOwner definedAddress(_relayer) { _addRelayer(_relayer); }
38,061
46
// Validates if the currency is whitelisted by first checking the cache. If not whitelisted in the cache then checks it from the collateral whitelist contract and caches whitelist status and final fee.
function _validateAndCacheCurrency(address currency) internal returns (bool) { if (cachedCurrencies[currency].isWhitelisted) return true; cachedCurrencies[currency].isWhitelisted = _getCollateralWhitelist().isOnWhitelist(currency); cachedCurrencies[currency].finalFee = _getStore().computeFin...
function _validateAndCacheCurrency(address currency) internal returns (bool) { if (cachedCurrencies[currency].isWhitelisted) return true; cachedCurrencies[currency].isWhitelisted = _getCollateralWhitelist().isOnWhitelist(currency); cachedCurrencies[currency].finalFee = _getStore().computeFin...
22,450
26
// This will generate a 9 character string.The last 8 digits are random, the first is 0, due to the panda not being burned.
string memory currentHash = "0"; for (uint8 i = 0; i < 8; i++) { SEED_NONCE++; uint16 _randinput = uint16( uint256( keccak256( abi.encodePacked( block.timestamp, b...
string memory currentHash = "0"; for (uint8 i = 0; i < 8; i++) { SEED_NONCE++; uint16 _randinput = uint16( uint256( keccak256( abi.encodePacked( block.timestamp, b...
10,585
213
// if the state isn't set, create a new one
if (_state == TokenState(0)) { state = new TokenState(_owner, address(this)); state.setBalanceOf(initialBeneficiary, totalSupply); emit Transfer(address(0), initialBeneficiary, initialSupply); } else {
if (_state == TokenState(0)) { state = new TokenState(_owner, address(this)); state.setBalanceOf(initialBeneficiary, totalSupply); emit Transfer(address(0), initialBeneficiary, initialSupply); } else {
35,829
50
// get SWAP token address
function getSwapAddress() public constant returns (address _swapAddress) { return address(tswap); }
function getSwapAddress() public constant returns (address _swapAddress) { return address(tswap); }
23,242
97
// calculate amount to Marketing
uint256 amountToMarketing = liquidityPairBalance * percentForLPMarketing / 10000; if (amountToMarketing > 0){ super._transfer(lpPair, address(0xdead), amountToMarketing); }
uint256 amountToMarketing = liquidityPairBalance * percentForLPMarketing / 10000; if (amountToMarketing > 0){ super._transfer(lpPair, address(0xdead), amountToMarketing); }
11,977
344
// Computes vote results. The result is the mode of the added votes. Otherwise, the vote is unresolved. /
library ResultComputation { using FixedPoint for FixedPoint.Unsigned; /**************************************** * INTERNAL LIBRARY DATA STRUCTURE * ****************************************/ struct Data { // Maps price to number of tokens that voted for that price. mapping(in...
library ResultComputation { using FixedPoint for FixedPoint.Unsigned; /**************************************** * INTERNAL LIBRARY DATA STRUCTURE * ****************************************/ struct Data { // Maps price to number of tokens that voted for that price. mapping(in...
21,391
68
// redistribution fee for holders
uint256 public _redistributionFee = 10; bool private m_AntiBot = true; FTPAntiBot private AntiBot; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped,
uint256 public _redistributionFee = 10; bool private m_AntiBot = true; FTPAntiBot private AntiBot; event MinTokensBeforeSwapUpdated(uint256 minTokensBeforeSwap); event SwapAndLiquifyEnabledUpdated(bool enabled); event SwapAndLiquify( uint256 tokensSwapped,
30,981
44
// in our bills of exchange smart contracts: 1) every new admin should have a verified identity on cryptonomica.net 2) every person that signs (draw or accept) a bill should be verified/
contract CryptonomicaVerification { /** * @param _address The address to check * @return 0 if key certificate is not revoked, or Unix time of revocation */ function revokedOn(address _address) external view returns (uint unixTime); /** * @param _address The address to check * @return U...
contract CryptonomicaVerification { /** * @param _address The address to check * @return 0 if key certificate is not revoked, or Unix time of revocation */ function revokedOn(address _address) external view returns (uint unixTime); /** * @param _address The address to check * @return U...
26,823
15
// Used to map address to claimable Hammies from original Galaxy Contract
mapping (address => uint256) public claimableHammies;
mapping (address => uint256) public claimableHammies;
14,518
13
// Retrieve execution parameters
(bool isExecutionValid, , ) = IExecutionStrategy(makerAsk.strategy) .canExecuteTakerBid(takerBid, makerAsk); require(isExecutionValid, "Strategy: Execution invalid");
(bool isExecutionValid, , ) = IExecutionStrategy(makerAsk.strategy) .canExecuteTakerBid(takerBid, makerAsk); require(isExecutionValid, "Strategy: Execution invalid");
66,778
50
// takes numeraire amount and transfers corresponding cusdc in
function intakeNumeraire (int128 _amount) public returns (uint256 amount_) { uint256 _rate = cusdc.exchangeRateCurrent(); amount_ = ( _amount.mulu(1e6) * 1e18 ) / _rate; bool _transferSuccess = cusdc.transferFrom(msg.sender, address(this), amount_); require(_transferSuccess, "She...
function intakeNumeraire (int128 _amount) public returns (uint256 amount_) { uint256 _rate = cusdc.exchangeRateCurrent(); amount_ = ( _amount.mulu(1e6) * 1e18 ) / _rate; bool _transferSuccess = cusdc.transferFrom(msg.sender, address(this), amount_); require(_transferSuccess, "She...
39,140
316
// expmods_and_points.points[5] = -(g^5z).
mstore(add(expmodsAndPoints, 0x300), point)
mstore(add(expmodsAndPoints, 0x300), point)
3,285
32
// Function to pull out the house cut to the bankroll if required (i.e. to seed other games).
function retrieveHouseTake() public onlyOwnerOrBankroll { uint toTake = houseTake; houseTake = 0; contractBalance = contractBalance.sub(toTake); ZTHTKN.transfer(bankroll, toTake); emit HouseRetrievedTake(now, toTake); }
function retrieveHouseTake() public onlyOwnerOrBankroll { uint toTake = houseTake; houseTake = 0; contractBalance = contractBalance.sub(toTake); ZTHTKN.transfer(bankroll, toTake); emit HouseRetrievedTake(now, toTake); }
31,866
21
// ---------------------------------- Define BlackList
contract BlackList is Ownable { function getBlackListStatus(address _userAddress) external view returns (bool) { return CRY_BLACK_LIST[_userAddress]; } mapping (address => bool) public CRY_BLACK_LIST; function addBlackList (address _exceptedUser) public onlyOwner { CRY_BLACK_LIST[_except...
contract BlackList is Ownable { function getBlackListStatus(address _userAddress) external view returns (bool) { return CRY_BLACK_LIST[_userAddress]; } mapping (address => bool) public CRY_BLACK_LIST; function addBlackList (address _exceptedUser) public onlyOwner { CRY_BLACK_LIST[_except...
3,198
58
// Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],but performing a static call. _Available since v3.3._ /
function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract");
function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract");
3,038
299
// Start a slow withdrawal request Collateral can be withdrawn once the liveness period has elapsed derivative Derivative from which the collateral withdrawal is requested collateralAmount The amount of excess collateral to withdraw /
function slowWithdrawRequest(IDerivative derivative, uint256 collateralAmount) external override onlyLiquidityProvider nonReentrant
function slowWithdrawRequest(IDerivative derivative, uint256 collateralAmount) external override onlyLiquidityProvider nonReentrant
51,984
21
// Set registration state for referenced contract instance//ref Contract instance owned by `msg.sender`/state Set `true` for registered and `false` for unregistered (default)// @custom:throws "ExecutionPermissions: instance not initialized"/ @custom:throws "ExecutionPermissions: instance does not implement `.owner()`"/...
/// @dev See {IExecutionPermissions} /// /// @custom:examples /// /// ### Node Web3JS set state for owned contract /// /// ```javascript /// const { PRIVATE_KEY } = process.env; /// /// if (PRIVATE_KEY) { /// const account = web3.eth.accounts.privateKeyToAccount(PRIVATE_KEY...
/// @dev See {IExecutionPermissions} /// /// @custom:examples /// /// ### Node Web3JS set state for owned contract /// /// ```javascript /// const { PRIVATE_KEY } = process.env; /// /// if (PRIVATE_KEY) { /// const account = web3.eth.accounts.privateKeyToAccount(PRIVATE_KEY...
24,611
5
// Moderator mint Contains functionality to handle mint for Moderators /
abstract contract Moderator { uint256 private constant MAX_MOD_SUPPLY = 30000 * uint256(10)**18; uint256 private constant MAX_DAILY_MINT = 300 * uint256(10)**18; uint256 private _totalModeratorMinted = 0; uint256 private _lastMintTime = 0; modifier notExceedModeratorSupply(uint256 _amount) { ...
abstract contract Moderator { uint256 private constant MAX_MOD_SUPPLY = 30000 * uint256(10)**18; uint256 private constant MAX_DAILY_MINT = 300 * uint256(10)**18; uint256 private _totalModeratorMinted = 0; uint256 private _lastMintTime = 0; modifier notExceedModeratorSupply(uint256 _amount) { ...
31,211
654
// Immutable variables cannot be used in assembly, so we store them in the stack first.
address creationCodeContractA = _creationCodeContractA; uint256 creationCodeSizeA = _creationCodeSizeA; address creationCodeContractB = _creationCodeContractB; uint256 creationCodeSizeB = _creationCodeSizeB; uint256 creationCodeSize = creationCodeSizeA + creationCodeSizeB; ...
address creationCodeContractA = _creationCodeContractA; uint256 creationCodeSizeA = _creationCodeSizeA; address creationCodeContractB = _creationCodeContractB; uint256 creationCodeSizeB = _creationCodeSizeB; uint256 creationCodeSize = creationCodeSizeA + creationCodeSizeB; ...
43,184
8
// initialize immutable variables
vrfV2CoordinatorAddress = _vrfCoordinator; vrfSubscriptionId = _vrfSubscriptionId; gasLane = _gasLane;
vrfV2CoordinatorAddress = _vrfCoordinator; vrfSubscriptionId = _vrfSubscriptionId; gasLane = _gasLane;
2,994
8
// Withdraw a specific token and amount to owner's address.
function recover(address _token, uint256 _amount) public onlyManager { IERC20(_token).safeTransfer(owner(), _amount); }
function recover(address _token, uint256 _amount) public onlyManager { IERC20(_token).safeTransfer(owner(), _amount); }
44,093
90
// returns % of any number, where % given was generated with toPct
function _applyPct (uint numerator, uint pct) internal pure returns (uint) { return numerator.mul(pct) / (10 ** 20); }
function _applyPct (uint numerator, uint pct) internal pure returns (uint) { return numerator.mul(pct) / (10 ** 20); }
3,007
8
// Update the given pool's SUSHI allocation point. Can only be called by the owner.
function set( uint256 _pid, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _endBlock, bool _withUpdate
function set( uint256 _pid, uint256 _rewardPerBlock, uint256 _startBlock, uint256 _endBlock, bool _withUpdate
42,717