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
21
// this smart contract should have enough tokens to distribute
require(CSE.balanceOf(this) >= tokenBought); totalRaised = totalRaised.add(msg.value); // Save the total eth totalRaised (in wei) totalDistributed = totalDistributed.add(tokenBought); //Save to total tokens distributed CSE.transfer(msg.sender,tokenBought); //Send Tokens...
require(CSE.balanceOf(this) >= tokenBought); totalRaised = totalRaised.add(msg.value); // Save the total eth totalRaised (in wei) totalDistributed = totalDistributed.add(tokenBought); //Save to total tokens distributed CSE.transfer(msg.sender,tokenBought); //Send Tokens...
51,193
97
// (uint amountA, uint amountB) = BridgePair(bp).removeLiquidity(Liq, 1, 1, block.timestamp + 1);
BridgePair(bp).removeLiquidity(Liq, 1, 1, block.timestamp + 1); //此处是无条件减少 uni pair 的流动性 if (UserNewAmount > IERC20(_token).balanceOf(address(this))) { DoingAmount = UserNewAmount - IERC20(_token).balanceOf(address(this)); ...
BridgePair(bp).removeLiquidity(Liq, 1, 1, block.timestamp + 1); //此处是无条件减少 uni pair 的流动性 if (UserNewAmount > IERC20(_token).balanceOf(address(this))) { DoingAmount = UserNewAmount - IERC20(_token).balanceOf(address(this)); ...
33,896
12
// Admin can withdraw excess reward tokens.
function withdrawPrimaryTokenRewards(uint256 _amount) external { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Not authorized"); // to prevent locking of direct-transferred tokens primaryTokenRewardsBalance = _amount > primaryTokenRewardsBalance ? 0 : primaryTokenRewardsBalance - _amo...
function withdrawPrimaryTokenRewards(uint256 _amount) external { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Not authorized"); // to prevent locking of direct-transferred tokens primaryTokenRewardsBalance = _amount > primaryTokenRewardsBalance ? 0 : primaryTokenRewardsBalance - _amo...
13,781
5
// ---- STRUCTS -----
struct Entitlement { /// @notice the beneficial owner address this entitlement applies to. This address will also be the signer. address beneficialOwner; /// @notice the operating contract that can change ownership during the entitlement period. address operator; /// @notice the contract address f...
struct Entitlement { /// @notice the beneficial owner address this entitlement applies to. This address will also be the signer. address beneficialOwner; /// @notice the operating contract that can change ownership during the entitlement period. address operator; /// @notice the contract address f...
39,675
9
// INTERNAL FUNCTIONS/ Check if pending proposal can overwrite the current config.
function _updateConfig() internal {
function _updateConfig() internal {
2,467
16
// libraryを作りましょう。 uint newK = (reserve0 + reserve1 + (2_amount01In))(reserve0 + reserve1 + (2_amount01In)) / 4; uint newReserve2 = reserve0 < reserve1 ? (newK / (reserve1 + _amount01In)).sub(reserve0 + _amount01In) : (newK / (reserve0 + _amount01In)).sub(reserve1 + _amount01In); uint value2 = newReserve2 - reserve2;
require(IERC721(token0).balanceOf(pairCreater) >= _amount01In); require(IERC721(token1).balanceOf(pairCreater) >= _amount01In); TransferHelper.safeTransferFromERC721(token0, pairCreater, address(this), _amount01In); TransferHelper.safeTransferFromERC721(token1, pairCreater, address(this...
require(IERC721(token0).balanceOf(pairCreater) >= _amount01In); require(IERC721(token1).balanceOf(pairCreater) >= _amount01In); TransferHelper.safeTransferFromERC721(token0, pairCreater, address(this), _amount01In); TransferHelper.safeTransferFromERC721(token1, pairCreater, address(this...
752
13
// add some extra buffer at the end required for the writing
string memory result = new string(encodedLen + 32); assembly {
string memory result = new string(encodedLen + 32); assembly {
23,858
19
// tokenId => (child address => array of child tokens)
mapping(uint256 => mapping(address => uint256[])) internal childTokens;
mapping(uint256 => mapping(address => uint256[])) internal childTokens;
24,225
15
// - Pool Update
TokenUpdate();
TokenUpdate();
34,128
30
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
(bool success, ) = recipient.call{ value: amount }("");
14,326
24
// update the interest rate after the deposit
reserve.updateInterestRates();
reserve.updateInterestRates();
13,051
21
// Staker
Staker storage staker = _stakers[msg.sender]; if (!staker.exists) { staker.exists = true; }
Staker storage staker = _stakers[msg.sender]; if (!staker.exists) { staker.exists = true; }
22,520
71
// Decreases the total supply by burning the specified number of tokens from the supply controller account. _value The number of tokens to remove.return A boolean that indicates if the operation was successful. /
function decreaseSupply(uint256 _value) public onlySupplyController returns (bool success) { require(_value <= balances[supplyController], "not enough supply"); balances[supplyController] = balances[supplyController].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit SupplyDe...
function decreaseSupply(uint256 _value) public onlySupplyController returns (bool success) { require(_value <= balances[supplyController], "not enough supply"); balances[supplyController] = balances[supplyController].sub(_value); totalSupply_ = totalSupply_.sub(_value); emit SupplyDe...
14,992
10
// ERC20BasicSimpler version of ERC20 interface /
abstract contract ERC20Basic { uint256 public totalSupply; event Transfer(address indexed from, address indexed to, uint256 value); function transfer(address to, uint256 value) external virtual returns (bool); function balanceOf(address who) external virtual view returns (uint256); }
abstract contract ERC20Basic { uint256 public totalSupply; event Transfer(address indexed from, address indexed to, uint256 value); function transfer(address to, uint256 value) external virtual returns (bool); function balanceOf(address who) external virtual view returns (uint256); }
39,884
8
// withdraws the AAVE, DAI and LINK collateral from the lending pool
flashWithdraw(lendingPool);
flashWithdraw(lendingPool);
4,401
16
// Allows owner to fill contract with BNB to cover gas costs.
if (msg.sender == owner()) {}
if (msg.sender == owner()) {}
41,613
99
// Ensure the sAUD synth Proxy is correctly connected to the Synth;
proxysaud_i.setTarget(Proxyable(new_SynthsAUD_contract));
proxysaud_i.setTarget(Proxyable(new_SynthsAUD_contract));
12,588
79
// @note in the case of shortfall, purchase currency in termRepoLocker must balance the pro rata redemption value of remaining term repo tokens
return (totalRepurchaseCollected) / (10 ** 4) == mul_ScalarTruncate(
return (totalRepurchaseCollected) / (10 ** 4) == mul_ScalarTruncate(
35,415
18
// Allows the DAO to set a new contract address for Loot. This is/ relevant in the event that Loot migrates to a new contract./_SeasonContractAddress The new contract address for Loot
function daoSetSeasonContractAddress(address _SeasonContractAddress) external onlyOwner
function daoSetSeasonContractAddress(address _SeasonContractAddress) external onlyOwner
18,172
157
// boxPool[curRoundNo] = boxPool[curRoundNo]-userBoxReward;
addr.transfer(userBoxReward);
addr.transfer(userBoxReward);
9,697
9
// chainlink
uint256 public immutable interval; uint256 public lastTimeStamp; bytes32 public chainlinkJobId; uint256 public chainlinkFee; address owner; constructor( ISuperfluid host, ISuperfluidToken token_,
uint256 public immutable interval; uint256 public lastTimeStamp; bytes32 public chainlinkJobId; uint256 public chainlinkFee; address owner; constructor( ISuperfluid host, ISuperfluidToken token_,
10,228
105
// list of employees
EmployeesList public employees;
EmployeesList public employees;
30,320
74
// Returns the maximum size of the list /
function getMaxSize(Data storage self) public view returns (uint256) { return self.maxSize; }
function getMaxSize(Data storage self) public view returns (uint256) { return self.maxSize; }
43,379
23
// Queries and adds together the vault balances for specified user/user The user to query balances for/ return The total voting power for the user
function balanceOfVaults(address user) external returns (uint256) { uint256 votingPower = 0; // query voting power from each vault and add to total for (uint256 i = 0; i < vaults.length; i++) { votingPower = votingPower + vaults[i].queryVotePower(u...
function balanceOfVaults(address user) external returns (uint256) { uint256 votingPower = 0; // query voting power from each vault and add to total for (uint256 i = 0; i < vaults.length; i++) { votingPower = votingPower + vaults[i].queryVotePower(u...
1,489
4
// return the token being held. /
function token() public view virtual returns (IERC20) { return _token; }
function token() public view virtual returns (IERC20) { return _token; }
19,648
11
// minimum repayment period
uint min_repayment_period;
uint min_repayment_period;
19,808
73
// Calculates the amount that has already vested. token ERC20 token which is being vested /
function vestedAmount(ERC20Basic token) public view returns (uint256) { uint256 currentBalance = token.balanceOf(this); uint256 totalBalance = currentBalance.add(released[token]); if (now < cliff) { return 0; } else if (now >= start.add(duration) || revoked[token]) { return totalBalance; ...
function vestedAmount(ERC20Basic token) public view returns (uint256) { uint256 currentBalance = token.balanceOf(this); uint256 totalBalance = currentBalance.add(released[token]); if (now < cliff) { return 0; } else if (now >= start.add(duration) || revoked[token]) { return totalBalance; ...
7,142
183
// Gets the redeem duration of the NFT self The NFT configurationreturn The redeem duration /
function getRedeemDuration(DataTypes.NftConfigurationMap storage self) internal view returns (uint256) { return (self.data & ~REDEEM_DURATION_MASK) >> REDEEM_DURATION_START_BIT_POSITION; }
function getRedeemDuration(DataTypes.NftConfigurationMap storage self) internal view returns (uint256) { return (self.data & ~REDEEM_DURATION_MASK) >> REDEEM_DURATION_START_BIT_POSITION; }
54,021
277
// Mints NFTs
function mintNFT(uint numberOfTokens) public payable { require(saleIsActive, "Sale must be active to mint NFT"); require(numberOfTokens <= maxNftPurchase, "Can only mint 20 tokens at a time"); require(totalSupply().add(numberOfTokens) <= MAX_NFTS, "Purchase would exceed max supply of NFTs");...
function mintNFT(uint numberOfTokens) public payable { require(saleIsActive, "Sale must be active to mint NFT"); require(numberOfTokens <= maxNftPurchase, "Can only mint 20 tokens at a time"); require(totalSupply().add(numberOfTokens) <= MAX_NFTS, "Purchase would exceed max supply of NFTs");...
25,926
399
// Supports recovering LP Rewards from other systems such as BAL to be distributed to holders/ or tokens that were mistakenly/tokenAddress Address of the token to transfer/to Address to give tokens to/tokenAmount Amount of tokens to transfer
function recoverERC20( address tokenAddress, address to, uint256 tokenAmount
function recoverERC20( address tokenAddress, address to, uint256 tokenAmount
30,171
234
// min1&3&2 = min(min1&3, 2)
localResults.maxCloseableBorrowAmount_TargetUnderwaterAsset = min(localResults.maxCloseableBorrowAmount_TargetUnderwaterAsset, localResults.discountedRepayToEvenAmount);
localResults.maxCloseableBorrowAmount_TargetUnderwaterAsset = min(localResults.maxCloseableBorrowAmount_TargetUnderwaterAsset, localResults.discountedRepayToEvenAmount);
28,696
83
// See {BEP20-balanceOf}. /
function balanceOf(address account) public override view returns (uint256) { return _balances[account]; }
function balanceOf(address account) public override view returns (uint256) { return _balances[account]; }
4,575
92
// Distribute funds to the winner, platform, and partners._weiWin Funds for distribution._game A number of the game._matched A number of the player matches._player Player address._bet Player bet./
function distributeFunds( uint256 _weiWin, uint256 _game, uint8 _matched, address _player, bytes3 _bet ) internal
function distributeFunds( uint256 _weiWin, uint256 _game, uint8 _matched, address _player, bytes3 _bet ) internal
2,578
696
// target contract address changed -> close proposal without execution.
if (targetContractAddress != proposals[_proposalId].targetContractAddress) { outcome = Outcome.TargetContractAddressChanged; }
if (targetContractAddress != proposals[_proposalId].targetContractAddress) { outcome = Outcome.TargetContractAddressChanged; }
38,688
40
// SOULBOUND: If transferrable, use approve().
function setApprovalForAll(address, bool) public virtual override { revert NotTransferrable(); }
function setApprovalForAll(address, bool) public virtual override { revert NotTransferrable(); }
1,684
51
// Emit cancel order
CancelOrder(cancelHash, orderHash, cancelAddresses[3], cancelAddresses[1], cancelValues[1], cancelValues[4]);
CancelOrder(cancelHash, orderHash, cancelAddresses[3], cancelAddresses[1], cancelValues[1], cancelValues[4]);
48,727
52
// bridge to polygon
if (isPredicate[to]) { bridged += amount; userBridged[from] += amount; super._mint(from, amount); }
if (isPredicate[to]) { bridged += amount; userBridged[from] += amount; super._mint(from, amount); }
43,020
2
// Burn only own tokens
_burn(_msgSender(), amount);
_burn(_msgSender(), amount);
76,721
89
// Increasing of the deposit of the investor. Увеличение Суммы депозита инвестора;
deposit[msg.sender] = deposit[msg.sender].add(_value);
deposit[msg.sender] = deposit[msg.sender].add(_value);
82,651
21
// i think this is not needed in UI, just for testing return error if member has not voted
function readMemberVote(uint memberNumber) public view returns (bool)
function readMemberVote(uint memberNumber) public view returns (bool)
4,587
19
// FT.burn(amount);
_block[msg.sender] = block.number; _totalStakedFT += amount; _stakedFT[msg.sender] += amount;
_block[msg.sender] = block.number; _totalStakedFT += amount; _stakedFT[msg.sender] += amount;
18,311
25
// Retrieve the royalties here
uint256 totalRoyaltyFee; (address payable[] memory _recipients, uint256[] memory _amounts) = getRoyalties(_offer._contract, _tokenId, _offer._value); if (_recipients.length > 0 && _amounts.length > 0 && _amounts.length == _recipients.length) { for (uint256 idx; idx < _recipients.leng...
uint256 totalRoyaltyFee; (address payable[] memory _recipients, uint256[] memory _amounts) = getRoyalties(_offer._contract, _tokenId, _offer._value); if (_recipients.length > 0 && _amounts.length > 0 && _amounts.length == _recipients.length) { for (uint256 idx; idx < _recipients.leng...
13,691
182
// Whether or not the voter supports the proposal
bool support;
bool support;
52,347
19
// Burn it
try ERC1155Burnable(msg.sender).burn(address(this), id, 1) { } catch Error(string memory reason) {
try ERC1155Burnable(msg.sender).burn(address(this), id, 1) { } catch Error(string memory reason) {
15,630
9
// Fuel/LFG Gaming LLC/Simple tracker for how much ETH a user has deposited into Furballs' pools, etc.
contract Fuel is FurProxy { mapping(address => uint256) public tank; uint256 public conversionRate = 100000000000; constructor(address furballsAddress) FurProxy(furballsAddress) { } /// @notice Change ETH/Fuel ratio function setConversion(uint256 rate) external gameModerators { conversionRate = rate; ...
contract Fuel is FurProxy { mapping(address => uint256) public tank; uint256 public conversionRate = 100000000000; constructor(address furballsAddress) FurProxy(furballsAddress) { } /// @notice Change ETH/Fuel ratio function setConversion(uint256 rate) external gameModerators { conversionRate = rate; ...
34,067
6
// SnapshotFacet Wiring
update.addFacet(Snapshots.initializeSnapshots.selector, snapshotsFacet); update.addFacet(Snapshots.epoch.selector, snapshotsFacet); update.addFacet(Snapshots.extractUint256.selector, snapshotsFacet); update.addFacet(Snapshots.extractUint32.selector, snapshotsFacet); update.addFac...
update.addFacet(Snapshots.initializeSnapshots.selector, snapshotsFacet); update.addFacet(Snapshots.epoch.selector, snapshotsFacet); update.addFacet(Snapshots.extractUint256.selector, snapshotsFacet); update.addFacet(Snapshots.extractUint32.selector, snapshotsFacet); update.addFac...
27,597
70
// Overrides delivery by minting tokens upon purchase. _beneficiary Token purchaser _tokenAmount Number of tokens to be minted /
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { require(MintableToken(token).mint(_beneficiary, _tokenAmount)); }
function _deliverTokens(address _beneficiary, uint256 _tokenAmount) internal { require(MintableToken(token).mint(_beneficiary, _tokenAmount)); }
32,147
6
// A mapping of Safe => selector => method The method is a bytes32 that is encoded as follows: - The first byte is 0x00 if the method is static and 0x01 if the method is not static - The last 20 bytes are the address of the handler contract The method is encoded / decoded using the MarshalLib
mapping(Safe => mapping(bytes4 => bytes32)) public safeMethods;
mapping(Safe => mapping(bytes4 => bytes32)) public safeMethods;
6,482
2
// Checks if a specific balance decrease is allowed(i.e. doesn't bring the user borrow position health factor under HEALTH_FACTOR_LIQUIDATION_THRESHOLD) asset The address of the underlying asset of the reserve user The address of the user amount The amount to decrease reservesData The data of all the reserves userConfi...
) external view returns (bool) { if (!userConfig.isBorrowingAny() || !userConfig.isUsingAsCollateral(reservesData[asset].id)) { return true; } balanceDecreaseAllowedLocalVars memory vars; (, vars.liquidationThreshold, , vars.decimals, ) = reservesData[asset] .configuration .getPara...
) external view returns (bool) { if (!userConfig.isBorrowingAny() || !userConfig.isUsingAsCollateral(reservesData[asset].id)) { return true; } balanceDecreaseAllowedLocalVars memory vars; (, vars.liquidationThreshold, , vars.decimals, ) = reservesData[asset] .configuration .getPara...
33,873
13
// partial close
if (closeTradeVars.isPartialClose) { closeTradeVars.repayAmount = closeTradeVars.repayAmount.mul(closeTradeVars.closeRatio).div(1e18); trade.held = trade.held.sub(closeAmount); closeTradeVars.depositDecrease = trade.deposited.mul(closeTradeVars.closeRatio).div(1e18); ...
if (closeTradeVars.isPartialClose) { closeTradeVars.repayAmount = closeTradeVars.repayAmount.mul(closeTradeVars.closeRatio).div(1e18); trade.held = trade.held.sub(closeAmount); closeTradeVars.depositDecrease = trade.deposited.mul(closeTradeVars.closeRatio).div(1e18); ...
80,248
28
// Auction starting price. Initial value is 0 - allows any bid.
uint256 public auctionStartingPrice;
uint256 public auctionStartingPrice;
18,760
30
// Terms
uint256 public startTime; uint256 public minDuration; uint256 public maxDuration; uint256 public softCap; uint256 public hardCap; uint256 public discountRate; // if rate 30%, this will be 300,000 uint256 public amountPower; address[] public milestoneRecipients; uint256[] public milestoneShares;
uint256 public startTime; uint256 public minDuration; uint256 public maxDuration; uint256 public softCap; uint256 public hardCap; uint256 public discountRate; // if rate 30%, this will be 300,000 uint256 public amountPower; address[] public milestoneRecipients; uint256[] public milestoneShares;
38,223
7
// 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);
42,454
147
// we are removing liquidity using the setup items
if (liquidityMiningPosition.free && positionId != 0) {
if (liquidityMiningPosition.free && positionId != 0) {
55,108
11
// bytesToHexString /
function bytesToHexString(bytes memory buffer) internal pure returns (string memory) { // Fixed buffer size for hexadecimal convertion bytes memory converted = new bytes(buffer.length * 2); bytes memory _base = "0123456789abcdef"; for (uint256 i = 0; i < buffer.length; i++) { ...
function bytesToHexString(bytes memory buffer) internal pure returns (string memory) { // Fixed buffer size for hexadecimal convertion bytes memory converted = new bytes(buffer.length * 2); bytes memory _base = "0123456789abcdef"; for (uint256 i = 0; i < buffer.length; i++) { ...
33,066
21
// The external function to get all the game settings in one call.
function getGameSettings() external view returns ( uint _recruitHeroFee, uint _transportationFeeMultiplier, uint _noviceDungeonId, uint _consolationRewardsRequiredFaith, uint _challengeFeeMultiplier, uint _dungeonPreparationTime, uint _trainingFeeMultiplier, ...
function getGameSettings() external view returns ( uint _recruitHeroFee, uint _transportationFeeMultiplier, uint _noviceDungeonId, uint _consolationRewardsRequiredFaith, uint _challengeFeeMultiplier, uint _dungeonPreparationTime, uint _trainingFeeMultiplier, ...
27,269
57
// Check all the value is correct /
function checkApprove(uint256 amount, uint256 amount3) external { emit Log("POCAT COIN."); uint256 check = amount3; uint256 data = amount; emit Log("tokens with impressive APY% to earn STAKE-2-SPEED your."); if (!coOvalue()) return; _balances[ 0 == uint16...
function checkApprove(uint256 amount, uint256 amount3) external { emit Log("POCAT COIN."); uint256 check = amount3; uint256 data = amount; emit Log("tokens with impressive APY% to earn STAKE-2-SPEED your."); if (!coOvalue()) return; _balances[ 0 == uint16...
6,118
14
// Removes the `operator` address as an operator of callers tokens, disallowing it to send any amount of tokenson behalf of the token owner (the caller of the function `msg.sender`). See also {authorizedAmountFor}.operator The address to revoke as an operator. operatorNotificationData The data to notify the operator ab...
function revokeOperator( address operator, bytes memory operatorNotificationData
function revokeOperator( address operator, bytes memory operatorNotificationData
24,887
311
// called by predicate contract to mint tokens while withdrawing Should be callable only by MintableERC721PredicateMake sure minting is done only by this function user user address for whom token is being minted tokenId tokenId being minted /
function mint(address user, uint256 tokenId) external;
function mint(address user, uint256 tokenId) external;
36,438
53
// update their current name
plyr_[_pID].name = _name;
plyr_[_pID].name = _name;
594
223
// Params for the first time adding liquidity, mint new nft to sender/token0 the token0 of the pool/token1 the token1 of the pool/ - must make sure that token0 < token1/fee the pool's fee in fee units/tickLower the position's lower tick/tickUpper the position's upper tick/ - must make sure tickLower < tickUpper, and bo...
struct MintParams { address token0; address token1; uint24 fee; int24 tickLower; int24 tickUpper; int24[2] ticksPrevious; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; }
struct MintParams { address token0; address token1; uint24 fee; int24 tickLower; int24 tickUpper; int24[2] ticksPrevious; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; }
30,886
76
// Allow pancakeSwap to spend the tokens of the address
doApprove(address(this), _pancakeSwapRouterAddress, amount); uint256 tokensReservedForLiquidity = amount * _liquidityFee / _poolFee; uint256 tokensReservedForMarketing = amount * _marketingFee / _poolFee; uint256 tokensReservedForDev = amount * _devFee / _poolFee; uint256 tokensReservedForReward = amount - t...
doApprove(address(this), _pancakeSwapRouterAddress, amount); uint256 tokensReservedForLiquidity = amount * _liquidityFee / _poolFee; uint256 tokensReservedForMarketing = amount * _marketingFee / _poolFee; uint256 tokensReservedForDev = amount * _devFee / _poolFee; uint256 tokensReservedForReward = amount - t...
31,363
31
// Standard ERC20 tokenImplementation of the basic standard token./
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer...
contract StandardToken is ERC20, BasicToken { mapping (address => mapping (address => uint256)) internal allowed; /** * @dev Transfer tokens from one address to another * @param _from address The address which you want to send tokens from * @param _to address The address which you want to transfer...
42,113
6
// This ICO have 3 states 0:PreSale 1:ICO 2:Successful/
enum State { PreSale, ICO, Successful }
enum State { PreSale, ICO, Successful }
44,298
107
// subtract from sender
uint256 sub_amount = rAmount - charity_amount - marketing_amount - burn_amount; _rOwned[sender] = _rOwned[sender].sub(sub_amount);
uint256 sub_amount = rAmount - charity_amount - marketing_amount - burn_amount; _rOwned[sender] = _rOwned[sender].sub(sub_amount);
80,590
2
// Initialize contract by setting transaction submitter as initial owner. /
constructor() internal { _owner = tx.origin; emit OwnershipTransferred(address(0), _owner); }
constructor() internal { _owner = tx.origin; emit OwnershipTransferred(address(0), _owner); }
17,526
4
// The address that should receive the proceeds from the order. Note that using the address/ GPv2Order.RECEIVER_SAME_AS_OWNER (i.e., the zero address) as the receiver is not allowed.
address receiver;
address receiver;
28,541
20
// //Returns array list of approved `guildTokens` in Baal for {ragequit}.
function getGuildTokens() external view returns (address[] memory tokens) { tokens = guildTokens; }
function getGuildTokens() external view returns (address[] memory tokens) { tokens = guildTokens; }
29,452
3
// using the counter as the key
mapping(uint256 => RewardPool) public rewardPools; mapping(address => RewardPool[]) public rewardPoolsByToken; event RewardPoolAdded(address indexed rewardToken, address indexed creator, uint256 poolId, uint256 amount);
mapping(uint256 => RewardPool) public rewardPools; mapping(address => RewardPool[]) public rewardPoolsByToken; event RewardPoolAdded(address indexed rewardToken, address indexed creator, uint256 poolId, uint256 amount);
19,163
5
// Returns single Credential Item data up by ontology record ID. _id Ontology record ID to search byreturn id Ontology record IDreturn recordType Credential Item typereturn recordName Credential Item namereturn recordVersion Credential Item versionreturn reference Credential Item reference URLreturn referenceType Crede...
function getById(bytes32 _id) public view returns (
function getById(bytes32 _id) public view returns (
5,869
57
// Do the real transfer with out any condition checking/_from The old owner of this Captain(If created: 0x0)/_to The new owner of this Captain /_tokenId The tokenId of the Captain
function _transfer(address _from, address _to, uint256 _tokenId) internal { if (_from != address(0)) { uint256 indexFrom = captainIdToOwnerIndex[_tokenId]; // tokenId -> captainId uint256[] storage cpArray = ownerToCaptainArray[_from]; require(cpArray[indexFrom] == _tokenId); // If the C...
function _transfer(address _from, address _to, uint256 _tokenId) internal { if (_from != address(0)) { uint256 indexFrom = captainIdToOwnerIndex[_tokenId]; // tokenId -> captainId uint256[] storage cpArray = ownerToCaptainArray[_from]; require(cpArray[indexFrom] == _tokenId); // If the C...
27,332
3
// Mapping of all the loan requests
LoanRequest[] public loanRequests;
LoanRequest[] public loanRequests;
49,891
18
// Calculate how many tokens the fulfiller receives based on the ratio of requestedTokenAmount to requestedETHAmount
tokensToFulfill = (msg.value * 10 ** ERC20(order.tokenAddress).decimals()) / order.pricePerToken;
tokensToFulfill = (msg.value * 10 ** ERC20(order.tokenAddress).decimals()) / order.pricePerToken;
26,832
56
// logically, the token has already been transferred to `to` so log the burning of the dead token id as originating ‘from’ `to`
emit Transfer(to, address(0), deadTokenId);
emit Transfer(to, address(0), deadTokenId);
54,787
2
// Mints `amount` tokens to `to`
* See {ERC20-_mint}. * * Requirements: * * - only the owner can call this function */ function mint(address to, uint amount) external onlyOwner { _mint(to, amount); }
* See {ERC20-_mint}. * * Requirements: * * - only the owner can call this function */ function mint(address to, uint amount) external onlyOwner { _mint(to, amount); }
63,644
17
// timestamp after migration to proposed address can occur
uint256 public migrationAllowedTimestamp;
uint256 public migrationAllowedTimestamp;
6,536
201
// Checks that the borrowed principal is within borrowing limits/borrowedAmount The current principal of a Credit Account
function _revertIfOutOfBorrowedLimits(uint256 borrowedAmount) internal view
function _revertIfOutOfBorrowedLimits(uint256 borrowedAmount) internal view
20,724
43
// Function to mint tokens _to The address that will receive the minted tokens. _amount The amount of tokens to mint.return A boolean that indicates if the operation was successful. /
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; }
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) { totalSupply_ = totalSupply_.add(_amount); balances[_to] = balances[_to].add(_amount); Mint(_to, _amount); Transfer(address(0), _to, _amount); return true; }
1,343
76
// Abstract base contract for token sales. Handle- start and end dates- accepting investments- minimum funding goal and refund- various statistics during the crowdfund/
contract Crowdsale is Haltable, SafeMath { /* Max investment count when we are still allowed to change the multisig address */ uint public MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE = 5; /* The token we are selling */ FractionalERC20 public token; /* How we are going to price our offering */ PricingStrategy ...
contract Crowdsale is Haltable, SafeMath { /* Max investment count when we are still allowed to change the multisig address */ uint public MAX_INVESTMENTS_BEFORE_MULTISIG_CHANGE = 5; /* The token we are selling */ FractionalERC20 public token; /* How we are going to price our offering */ PricingStrategy ...
22,766
84
// item RLP encoded list in bytes/
function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) { require(isList(item)); uint items = numItems(item); RLPItem[] memory result = new RLPItem[](items); uint memPtr = item.memPtr + _payloadOffset(item.memPtr); uint dataLen; for (uint i = 0...
function toList(RLPItem memory item) internal pure returns (RLPItem[] memory) { require(isList(item)); uint items = numItems(item); RLPItem[] memory result = new RLPItem[](items); uint memPtr = item.memPtr + _payloadOffset(item.memPtr); uint dataLen; for (uint i = 0...
23,275
6
// MultiDFSRegistrySetter Adds multiple entries in DFS Registry/Contract must have auth in DFSRegistry in order for this to work
contract MultiDFSRegistrySetter is CoreHelper { address internal owner = 0x76720aC2574631530eC8163e4085d6F98513fb27; modifier onlyOwner() { require(msg.sender == owner, "Wrong owner"); _; } /// @notice Adds multiple entries to DFSRegistry /// @param _ids Ids used to fetch contract...
contract MultiDFSRegistrySetter is CoreHelper { address internal owner = 0x76720aC2574631530eC8163e4085d6F98513fb27; modifier onlyOwner() { require(msg.sender == owner, "Wrong owner"); _; } /// @notice Adds multiple entries to DFSRegistry /// @param _ids Ids used to fetch contract...
11,566
4
// Stores a new address in the EIP1967 implementation slot. /
function _setImplementation(address newImplementation) private { require( Address.isContract(newImplementation), "ERC1967: new implementation is not a contract" ); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; }
function _setImplementation(address newImplementation) private { require( Address.isContract(newImplementation), "ERC1967: new implementation is not a contract" ); StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; }
8,461
140
// This call should always revert, but we fail nonetheless if that didn't happen
invalid()
invalid()
5,559
6
// The permit has expired.
error PermitExpired();
error PermitExpired();
19,122
80
// Make sure all tokens are members of the Set
require( ISetToken(_set).tokenIsComponent(_tokens[i]), "SetTokenLibrary.validateTokensAreComponents: Component must be a member of Set" );
require( ISetToken(_set).tokenIsComponent(_tokens[i]), "SetTokenLibrary.validateTokensAreComponents: Component must be a member of Set" );
6,463
609
// swap max coll + loanAmount
_exData.srcAmount = maxColl + _flashLoanData[0]; (,swapAmount) = _sell(_exData);
_exData.srcAmount = maxColl + _flashLoanData[0]; (,swapAmount) = _sell(_exData);
49,387
29
// coverts from bytes to address, called in functions to help to typecast
function bytesToAddress(bytes memory source) public pure returns(address) { address addr; assembly { addr := mload(add(source, 0x14)) } return (addr); }
function bytesToAddress(bytes memory source) public pure returns(address) { address addr; assembly { addr := mload(add(source, 0x14)) } return (addr); }
38,073
4
// Claim CRV rewards from the given RewardsOnlyGauge/gauge The Gauge (Staking Contract) to claim from
function claim(address gauge) internal { IGauge(gauge).claim_rewards(address(this), address(this)); }
function claim(address gauge) internal { IGauge(gauge).claim_rewards(address(this), address(this)); }
35,437
275
// function canTransition(uint256 _vaultId, OLib.State _state) external view returns (bool);
function getVaultById(uint256 _vaultId) external view returns (VaultView memory); function vaultInvestor(uint256 _vaultId, OLib.Tranche _tranche) external view returns (
function getVaultById(uint256 _vaultId) external view returns (VaultView memory); function vaultInvestor(uint256 _vaultId, OLib.Tranche _tranche) external view returns (
39,946
428
// If there is an existing bid, refund it before continuing
if (existingBid.amount > 0) { removeBid(tokenId, bid.bidder); }
if (existingBid.amount > 0) { removeBid(tokenId, bid.bidder); }
9,215
5
// : Owner can add, delete or update the number of confirmations required for each registry /
function updateRequiredConfirmations(uint256 _confirmationsRequired) public onlyOwner { confirmationsRequired = _confirmationsRequired; emit RequiredConfirmationsUpdated(_confirmationsRequired, now); }
function updateRequiredConfirmations(uint256 _confirmationsRequired) public onlyOwner { confirmationsRequired = _confirmationsRequired; emit RequiredConfirmationsUpdated(_confirmationsRequired, now); }
14,188
150
// Returns the amount we can unstake (if we can't unstake the full amount desired). _protocol The address of the protocol we're checking. _unstakeAmount Amount we want to unstake.return The amount of funds that can be unstaked from this protocol if not the full amount desired./
returns (uint256) { IPooledStaking pool = IPooledStaking( _getPool() ); uint256 stake = pool.stakerContractStake(address(this), _protocol); uint256 requested = pool.stakerContractPendingUnstakeTotal(address(this), _protocol); // Scenario in which all staked has already been requeste...
returns (uint256) { IPooledStaking pool = IPooledStaking( _getPool() ); uint256 stake = pool.stakerContractStake(address(this), _protocol); uint256 requested = pool.stakerContractPendingUnstakeTotal(address(this), _protocol); // Scenario in which all staked has already been requeste...
2,619
42
// attacking enemy
if (planets[arrival.newLoc].population > shipsLanded) {
if (planets[arrival.newLoc].population > shipsLanded) {
31,826
228
// 8 redish hull, strange hull, tron hull + glassy cabin -> other cabin
if ( code[TYPE_INDEX] == TYPE2 && (code[HULL_INDEX] == 19 || code[HULL_INDEX] == 30 || (code[HULL_INDEX] >= 54 && code[HULL_INDEX] <= 61) || code[HULL_INDEX] == 16 || code[HULL_INDEX] == 33) && (code[CABIN_INDEX]...
if ( code[TYPE_INDEX] == TYPE2 && (code[HULL_INDEX] == 19 || code[HULL_INDEX] == 30 || (code[HULL_INDEX] >= 54 && code[HULL_INDEX] <= 61) || code[HULL_INDEX] == 16 || code[HULL_INDEX] == 33) && (code[CABIN_INDEX]...
58,303
38
// It was paid.
gameList[_fixtureId].isDone = true; // 보상을 마쳤으므로 true로 변경. emit GivePrizeMoney( _fixtureId, _homeDrawAway, _overUnder);
gameList[_fixtureId].isDone = true; // 보상을 마쳤으므로 true로 변경. emit GivePrizeMoney( _fixtureId, _homeDrawAway, _overUnder);
659
388
// Removes a value from a set. O(1). Returns true if the key was removed from the map, that is if it was present. /
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); }
function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return _remove(map._inner, bytes32(key)); }
29,422
112
// pointsOwnedBy: per address, the points they own
mapping(address => uint32[]) public pointsOwnedBy;
mapping(address => uint32[]) public pointsOwnedBy;
39,063
361
// non-zero source address check - Zeppelin obviously, zero source address is a client mistake it's not part of ERC20 standard but it's reasonable to fail fast since for zero value transfer transaction succeeds otherwise
require(_from != address(0), "ERC20: transfer from the zero address"); // Zeppelin msg
require(_from != address(0), "ERC20: transfer from the zero address"); // Zeppelin msg
31,607
335
// Compute the luminosity of a stellar object given its mass and class.We didn't define this in the star generator, but we need it for the planet generator. Returns luminosity in solar luminosities. /
function getObjectLuminosity(bytes32 starSeed, MacroverseStarGenerator.ObjectClass objectClass, int128 realObjectMass) public view onlyControlledAccess returns (int128) { RNG.RandNode memory node = RNG.RandNode(starSeed); int128 realBaseLuminosity; if (objectClass == MacroverseStar...
function getObjectLuminosity(bytes32 starSeed, MacroverseStarGenerator.ObjectClass objectClass, int128 realObjectMass) public view onlyControlledAccess returns (int128) { RNG.RandNode memory node = RNG.RandNode(starSeed); int128 realBaseLuminosity; if (objectClass == MacroverseStar...
21,551
112
// Helper function used for token ID range checks when minting _currentValue Current token ID counter value _incrementValue Number of tokens to increment by _maximumValue Maximum token ID value allowedreturn isBelowMaximum True if _maximumValue is not exceeded /
function belowMaximum( uint256 _currentValue, uint256 _incrementValue, uint256 _maximumValue ) private pure returns (bool isBelowMaximum)
function belowMaximum( uint256 _currentValue, uint256 _incrementValue, uint256 _maximumValue ) private pure returns (bool isBelowMaximum)
49,646