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
4
// the validator share contract deployed by a validator
address public validatorShareContractAddress;
address public validatorShareContractAddress;
13,273
2
// ============ ACCESS CONTROL/SANITY MODIFIERS ============
modifier publicSaleActive() { require(isPublicSaleActive, "Public sale is not open"); _; }
modifier publicSaleActive() { require(isPublicSaleActive, "Public sale is not open"); _; }
70,574
767
// Reads the bytes8 at `mPtr` in memory.
function readBytes8(MemoryPointer mPtr) internal pure returns (bytes8 value) { assembly { value := mload(mPtr) } }
function readBytes8(MemoryPointer mPtr) internal pure returns (bytes8 value) { assembly { value := mload(mPtr) } }
23,723
125
// Update the converter's median price first
try converterFeed.updateResult(finalFeeReceiver) {} catch (bytes memory converterRevertReason) { emit FailedConverterFeedUpdate(converterRevertReason); }
try converterFeed.updateResult(finalFeeReceiver) {} catch (bytes memory converterRevertReason) { emit FailedConverterFeedUpdate(converterRevertReason); }
73,111
276
// struct to note which Nodes and which number of Nodes owned by user
struct CreatedNodes { mapping (uint => bool) isNodeExist; uint numberOfNodes; }
struct CreatedNodes { mapping (uint => bool) isNodeExist; uint numberOfNodes; }
29,009
120
// Function to mint tokens only owner contract. tokenId The token id to mint. tokenURI The token URI of the minted token.return A boolean that indicates if the operation was successful. /
function setTokenURI(uint256 tokenId, string memory tokenURI) public onlyMinter returns (bool) { require(_ownerContract == msg.sender,"Identity: the token can mint only owner"); _setTokenURI(tokenId, tokenURI); return true; }
function setTokenURI(uint256 tokenId, string memory tokenURI) public onlyMinter returns (bool) { require(_ownerContract == msg.sender,"Identity: the token can mint only owner"); _setTokenURI(tokenId, tokenURI); return true; }
8,889
1,378
// Optimistic Requester. Optional interface that requesters can implement to receive callbacks. /
interface OptimisticRequester { /** * @notice Callback for proposals. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. */ function priceProposed( b...
interface OptimisticRequester { /** * @notice Callback for proposals. * @param identifier price identifier being requested. * @param timestamp timestamp of the price being requested. * @param ancillaryData ancillary data of the price being requested. */ function priceProposed( b...
17,810
107
// Get the increase rate of normalisedIncome / exchangeRate
function _getIncomeIndexIncreaseRate() internal virtual returns (uint256 increaseRate);
function _getIncomeIndexIncreaseRate() internal virtual returns (uint256 increaseRate);
38,849
89
// ether transfers
if (eth_returned > 0) msg.sender.transfer(eth_returned); wallet.transfer(eth_contributed);
if (eth_returned > 0) msg.sender.transfer(eth_returned); wallet.transfer(eth_contributed);
53,241
10
// Get the local Home contract from the xAppConnectionManagerreturn The local Home contract /
function _home() internal view returns (Home) { return xAppConnectionManager.home(); }
function _home() internal view returns (Home) { return xAppConnectionManager.home(); }
31,016
31
// Calculate Base Payouts
uint8 quote; uint112 deposit = users[adr].deposit; if(deposit >= 30 ether){ quote = 15; }else{
uint8 quote; uint112 deposit = users[adr].deposit; if(deposit >= 30 ether){ quote = 15; }else{
17,050
37
// ๅˆ›ๅปบๅญฆ็”Ÿ
function createStudent(string _name,string _nation,string _id,uint32 _birth,bytes1 _gender) public availableIdOf(_id){ Student memory student = Student(_name,_nation,_id,_birth,_gender); addrToStudent[msg.sender] = student; students.push(student); }
function createStudent(string _name,string _nation,string _id,uint32 _birth,bytes1 _gender) public availableIdOf(_id){ Student memory student = Student(_name,_nation,_id,_birth,_gender); addrToStudent[msg.sender] = student; students.push(student); }
23,821
192
// After the relayed call has been executed and the actual charge estimated, the excess pre-charge is returned
_token.safeTransfer(from, maxPossibleCharge.sub(actualCharge));
_token.safeTransfer(from, maxPossibleCharge.sub(actualCharge));
25,228
48
// How many bytes of payload are there in the last cell of single ID.
uint8 lastCellBytesCnt;
uint8 lastCellBytesCnt;
56,716
13
// coin has not yet been flipped to this address
require(s_results[player] != 0, "Coin not flipped");
require(s_results[player] != 0, "Coin not flipped");
15,262
9
// ERC20TokenInterface Token contract interface for external use /
contract ERC20TokenInterface { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(ad...
contract ERC20TokenInterface { function balanceOf(address _owner) public constant returns (uint256 balance); function transfer(address _to, uint256 _value) public returns (bool success); function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); function approve(ad...
74,779
57
// if (validatorDataContractAddress != address(0)) { validatorData.addWhitelistAdmin(address(this)); }
if (dpoAddr != address(0)) { dpoContract.approve(address(this), 1000000000000000000000000); }
if (dpoAddr != address(0)) { dpoContract.approve(address(this), 1000000000000000000000000); }
27,670
195
// Struct of holder data & scores.
struct HolderData
struct HolderData
4,629
545
// Get the default full set of balance types/ return The set of all balance types
function allBalanceTypes() public view returns (bytes32[] memory)
function allBalanceTypes() public view returns (bytes32[] memory)
35,713
83
// target config
targets[_id].collectionOwner = address(0); for (i = 1; i < 3; i++) { if (arrContractAddr[i] == address(0)) break; targets[_id].cardContractAddrs[i - 1] = arrContractAddr[i]; targets[_id].cardTokenIds[i - 1] = arrTokenIds[i]; targets[_id].tokenTypes[i - 1]...
targets[_id].collectionOwner = address(0); for (i = 1; i < 3; i++) { if (arrContractAddr[i] == address(0)) break; targets[_id].cardContractAddrs[i - 1] = arrContractAddr[i]; targets[_id].cardTokenIds[i - 1] = arrTokenIds[i]; targets[_id].tokenTypes[i - 1]...
17,534
20
// now we need 5th power
quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); PairingsBn254.Fr memory z_part = PairingsBn254.copy...
quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); quotient_challenge.mul_assign(state.alpha); PairingsBn254.Fr memory z_part = PairingsBn254.copy...
44,200
4
// ERC20 Basic
function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value);
function totalSupply() public view returns (uint256); function balanceOf(address who) public view returns (uint256); function transfer(address to, uint256 value) public returns (bool); event Transfer(address indexed from, address indexed to, uint256 value);
31,009
173
// 1% of tickets generated is sent to feeTo address
feeAmount = ticketType.numTickets.div(100); if (feeAmount == 0) { feeAmount = 1; }
feeAmount = ticketType.numTickets.div(100); if (feeAmount == 0) { feeAmount = 1; }
47,291
135
// update collectedAmount/
function updateCollectedAmount(uint256 _tokenId, uint256 _amount) external onlyCOO returns (bool) { require(isValidRedToken(_tokenId)); require(_amount > 0); address owner = ownerOf(_tokenId); redTokens[_tokenId].collectedAmount = redTokens[_tokenId].collectedAmount.add(_amount); em...
function updateCollectedAmount(uint256 _tokenId, uint256 _amount) external onlyCOO returns (bool) { require(isValidRedToken(_tokenId)); require(_amount > 0); address owner = ownerOf(_tokenId); redTokens[_tokenId].collectedAmount = redTokens[_tokenId].collectedAmount.add(_amount); em...
36,738
6
// Returns the amount of tokens owned by `account`. /
function balanceOf(address account) external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
614
46
// step for ApiId
uint256 public reqc;
uint256 public reqc;
51,040
308
// check the total supply uses the _totalSupply that includes mint + burn /
function totalSupply() public view virtual returns (uint256)
function totalSupply() public view virtual returns (uint256)
25,316
547
// sets the minter of the ElasticGovernanceTokena Minter is an address that can mint tokens(increase the amount of tokens in circulation)_minter - address of the minterRequirement:- Address of the minter cannot be zero address return bool /
function setMinter(address _minter) external onlyDAO nonReentrant returns (bool) { require(_minter != address(0), 'ElasticDAO: Address Zero'); minter = _minter; return true; }
function setMinter(address _minter) external onlyDAO nonReentrant returns (bool) { require(_minter != address(0), 'ElasticDAO: Address Zero'); minter = _minter; return true; }
25,034
25
// (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that result := call( sub(gas, 34710), // 34710 is the value that solidity is currently emitting
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that result := call( sub(gas, 34710), // 34710 is the value that solidity is currently emitting
17,244
19
// ์‹ ๊ณ ์ž์˜ ๋ฌดํšจ, ์ฆ๊ฑฐ ๋ถˆ์ถฉ๋ถ„์œผ๋กœ ์ธํ•œ RegFee ์ฐจ๊ฐ, ์œ„์›ํšŒ๊ฐ€ ํ˜ธ์ถœํ•จ_reporter ์ฐจ๊ฐ ์‹œํ‚ฌ ๋Œ€์ƒ_rate ์ฐจ๊ฐ ์‹œํ‚ฌ ๋น„์œจ_block ํŠน์ •์‹œ๊ฐ„ ํ–‰๋™ ํŽ˜๋„ํ‹ฐ๋ฅผ ์ค„๊ฒƒ/
function deduction(address _reporter, uint256 _rate, bool _block) external validAddress(_reporter) validRange(_rate) validRate(_rate) returns(uint256)
function deduction(address _reporter, uint256 _rate, bool _block) external validAddress(_reporter) validRange(_rate) validRate(_rate) returns(uint256)
24,669
126
// function to approve a pending Assetscan be called from anyone in the member addresses list /
{ for (uint i=0;i<memberAddresses.length;i++) { if (memberAddresses[i]==msg.sender) { for (uint j=0;j<animalIdsWithPendingAssetss.length;j++) { if (animalIdsWithPendingAssetss[j]==animalId) { ...
{ for (uint i=0;i<memberAddresses.length;i++) { if (memberAddresses[i]==msg.sender) { for (uint j=0;j<animalIdsWithPendingAssetss.length;j++) { if (animalIdsWithPendingAssetss[j]==animalId) { ...
1,303
1
// temporary address used for two step Factory change
address private PendingFactory;
address private PendingFactory;
18,062
48
// ่Žทๅ–้”€ๅ”ฎ็›ฎๆ ‡็บงๅˆซ get sales level from sales amount amount: sales amount /
function _getSalesToLevel(uint256 amount) internal pure virtual returns (uint8) { /* istanbul ignore else */ if (amount < 5000 * ACCURACY) { return 0; } else if (amount < 30000 * ACCURACY) { return 1; } else if (amount < 100000 * ACCURACY) { retur...
function _getSalesToLevel(uint256 amount) internal pure virtual returns (uint8) { /* istanbul ignore else */ if (amount < 5000 * ACCURACY) { return 0; } else if (amount < 30000 * ACCURACY) { return 1; } else if (amount < 100000 * ACCURACY) { retur...
9,324
14
// from HEX
uint16 private constant LAUNCH_PHASE_DAYS = 350; uint16 private constant LAUNCH_PHASE_END_DAY = 351; uint256 private constant XF_LOBBY_DAY_WORDS = (LAUNCH_PHASE_END_DAY + 255) >> 8;
uint16 private constant LAUNCH_PHASE_DAYS = 350; uint16 private constant LAUNCH_PHASE_END_DAY = 351; uint256 private constant XF_LOBBY_DAY_WORDS = (LAUNCH_PHASE_END_DAY + 255) >> 8;
27,371
129
// Set liquidation incentive to new incentive
liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;
liquidationIncentiveMantissa = newLiquidationIncentiveMantissa;
16,042
17
// _tokenPrice {uint} costo of token in ETH return true {bool} if successful
function enableExchange(uint _tokenPrice) public payable { require(!exchangeEnabled); require(exchangeEnableCost == msg.value); exchangeEnabled = true; tokenPrice = _tokenPrice; commissionAddress.transfer(msg.value); emit TokenExchangeEnabled(msg.sender, _tok...
function enableExchange(uint _tokenPrice) public payable { require(!exchangeEnabled); require(exchangeEnableCost == msg.value); exchangeEnabled = true; tokenPrice = _tokenPrice; commissionAddress.transfer(msg.value); emit TokenExchangeEnabled(msg.sender, _tok...
52,815
50
// Revoke PreSigned// Revoke signature without going through a delegate. _sigToRevoke The signature that you no longer want to be used./
{ invalidSignatures[msg.sender][_sigToRevoke] = true; emit SignatureRedeemed(_sigToRevoke, msg.sender); return true; }
{ invalidSignatures[msg.sender][_sigToRevoke] = true; emit SignatureRedeemed(_sigToRevoke, msg.sender); return true; }
54,883
204
// If above ripcord threshold, then check if incentivized cooldown period has elapsed
if (currentLeverageRatio >= incentive.incentivizedLeverageRatio) { if (lastTradeTimestamp.add(incentive.incentivizedTwapCooldownPeriod) < block.timestamp) { return ShouldRebalance.RIPCORD; }
if (currentLeverageRatio >= incentive.incentivizedLeverageRatio) { if (lastTradeTimestamp.add(incentive.incentivizedTwapCooldownPeriod) < block.timestamp) { return ShouldRebalance.RIPCORD; }
38,919
35
// helper method, check whether an address is in the array/addresses the array of address/addr the address
function addressExist(address[] addresses, address addr) internal pure returns (bool) { for(uint i = 0; i < addresses.length; i++) { if (addresses[i] == addr) { return true; } } return false; }
function addressExist(address[] addresses, address addr) internal pure returns (bool) { for(uint i = 0; i < addresses.length; i++) { if (addresses[i] == addr) { return true; } } return false; }
37,771
58
// end token minting on finalization override this with custom logic if needed
function finalization() internal { token.finishMinting(); }
function finalization() internal { token.finishMinting(); }
22,498
4
// We assign the same asset manager to both the main and wrapped tokens.
address[] memory assetManagers = new address[](2); assetManagers[0] = args.assetManager; assetManagers[1] = args.assetManager; return assetManagers;
address[] memory assetManagers = new address[](2); assetManagers[0] = args.assetManager; assetManagers[1] = args.assetManager; return assetManagers;
38,867
1
// Goerli VRF v2 coordinator address
address vrfCoordinator = 0x2Ca8E0C643bDe4C2E08ab1fA0da3401AdAD7734D;
address vrfCoordinator = 0x2Ca8E0C643bDe4C2E08ab1fA0da3401AdAD7734D;
13,352
27
// --------------------------- Ownership -------------------------- // @inheritdoc IIndieV1
function renounceOwnership() external virtual onlyRole(OWNER_ROLE) { _grantRole(OWNER_ROLE, address(0)); _revokeRole(OWNER_ROLE, _msgSender()); emit OwnershipRenounced(_msgSender()); }
function renounceOwnership() external virtual onlyRole(OWNER_ROLE) { _grantRole(OWNER_ROLE, address(0)); _revokeRole(OWNER_ROLE, _msgSender()); emit OwnershipRenounced(_msgSender()); }
15,160
330
// data of a erc721 bundle elementtokenContract - address of the token contract id - id of the token safeTransferable - wether the implementing token contract has a safeTransfer function or not /
struct BundleElementERC721 { address tokenContract; uint256 id; bool safeTransferable; }
struct BundleElementERC721 { address tokenContract; uint256 id; bool safeTransferable; }
59,549
11
// dsHash -> sha3(DATASOURCE_NAME, PROOF_TYPE);
for (uint i=0; i<dsHash.length; i++) { dsources[dsources.length++] = dsHash[i]; price_multiplier[dsHash[i]] = multiplier[i]; }
for (uint i=0; i<dsHash.length; i++) { dsources[dsources.length++] = dsHash[i]; price_multiplier[dsHash[i]] = multiplier[i]; }
17,445
146
// 3.3. Trade on Curve
IERC20(bAsset).safeApprove(address(curve), 0); IERC20(bAsset).safeApprove(address(curve), bAssetBal); uint256 purchased = curve.exchange_underlying(liquidation.curvePosition, 0, bAssetBal, 0);
IERC20(bAsset).safeApprove(address(curve), 0); IERC20(bAsset).safeApprove(address(curve), bAssetBal); uint256 purchased = curve.exchange_underlying(liquidation.curvePosition, 0, bAssetBal, 0);
73,376
44
// transfer the amount to the recipient
balances[dst] = add96(balances[dst], amount, "Uni::mint: transfer amount overflows"); emit Transfer(address(0), dst, amount);
balances[dst] = add96(balances[dst], amount, "Uni::mint: transfer amount overflows"); emit Transfer(address(0), dst, amount);
4,663
128
// Checks the next lockup entry for a given user and unlocksthose tokens if applicable. _ignoreExpiration bypasses the recorded expiration date andremoves the lockup entry if there are any remaining for this user. /
function _processLockup( UserInfo storage info, address _userId, bool _ignoreExpiration
function _processLockup( UserInfo storage info, address _userId, bool _ignoreExpiration
41,749
279
// ERC721TradableERC721Tradable - ERC721 contract that whitelists a trading address, and has minting functionality. /solhint-disable-next-line
abstract contract ERC721Tradable is ERC721, Ownable { using ExtendedStrings for string; using Counters for Counters.Counter; using SafeMath for uint256; address public proxyRegistryAddress; Counters.Counter private _tokenIdTracker; constructor(string memory _name, string memory _symbol, addre...
abstract contract ERC721Tradable is ERC721, Ownable { using ExtendedStrings for string; using Counters for Counters.Counter; using SafeMath for uint256; address public proxyRegistryAddress; Counters.Counter private _tokenIdTracker; constructor(string memory _name, string memory _symbol, addre...
2,921
3
// Completes a swap from another chain, called by a swapper account. Blockwell Exclusive (Intellectual Property that lives on-chain via Smart License) /
function swapFromChain( string memory fromChain, address from, address to, bytes32 swapId, uint256 value, uint64 stakeTime
function swapFromChain( string memory fromChain, address from, address to, bytes32 swapId, uint256 value, uint64 stakeTime
18,387
138
// Currently there is no better way to check if there is a contract in an address than to check the size of the code at that address or if it has a non-zero code hash or account hash solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(_address) }
assembly { codehash := extcodehash(_address) }
72,686
128
// NeptuneToken with Governance.
contract NeptuneToken is BEP20('NeptuneSwap Token', 'TUNE') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); ...
contract NeptuneToken is BEP20('NeptuneSwap Token', 'TUNE') { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); _moveDelegates(address(0), _delegates[_to], _amount); ...
12,570
34
// System commission from the workers mined part Mined tokens immidiately transffered as reward to the system owner (Pandora contract)
panToken.mint(address(pandora), priceDelta / 100 * systemCommission); emit RewardTransferred(_jobId, address(pandora), priceDelta / 100 * systemCommission);
panToken.mint(address(pandora), priceDelta / 100 * systemCommission); emit RewardTransferred(_jobId, address(pandora), priceDelta / 100 * systemCommission);
28,497
4
// Check the token balance
uint balance = whiteList[proposalId].balanceOf(msg.sender);
uint balance = whiteList[proposalId].balanceOf(msg.sender);
1,986
38
// require( (_newAssetStatus != 7) && (_newAssetStatus != 57) && (_newAssetStatus != 58), "S:MR: Stat Rsrvd" );
require(_rgtHash != 0, "S:MR: rgtHash = 0");
require(_rgtHash != 0, "S:MR: rgtHash = 0");
34,261
27
// Returns the block timestamp truncated to 32 bits, i.e. mod 232. This method is overridden in tests.
function _blockTimestamp() internal view virtual returns (uint32) { return uint32(block.timestamp); // truncation is desired }
function _blockTimestamp() internal view virtual returns (uint32) { return uint32(block.timestamp); // truncation is desired }
32,313
12
// //stake SUSHI `amount` into aXSUSHI by batching calls to `sushiBar` and `aave` lending pool.
function saave(uint256 amount) external { sushiToken.transferFrom(msg.sender, address(this), amount); // deposit `msg.sender` SUSHI `amount` into this contract sushiBar.enter(amount); // stake deposited SUSHI `amount` into `sushiBar` xSUSHI aave.deposit(address(sushiBar), sushiBar.balanceOf(...
function saave(uint256 amount) external { sushiToken.transferFrom(msg.sender, address(this), amount); // deposit `msg.sender` SUSHI `amount` into this contract sushiBar.enter(amount); // stake deposited SUSHI `amount` into `sushiBar` xSUSHI aave.deposit(address(sushiBar), sushiBar.balanceOf(...
21,082
20
// price check
require(uint(msg.data[0]) < BUY_LIMIT_CAP, "out of buy limit one time."); require(msg.value == uint(msg.data[0]) * price, "price not right, please check."); uint i = 1; while(i < msg.data.length) {
require(uint(msg.data[0]) < BUY_LIMIT_CAP, "out of buy limit one time."); require(msg.value == uint(msg.data[0]) * price, "price not right, please check."); uint i = 1; while(i < msg.data.length) {
6,463
62
// Approve collateral Tokens for Vault Contract
vars.collateralToken.approve(address(vars.vault), _collateralAmount);
vars.collateralToken.approve(address(vars.vault), _collateralAmount);
78,952
179
// Pay or lockup pending TOKEN.
function payOrLockupPendingToken(uint256 _pid) internal { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; if (user.harvestLockup == 0) { user.harvestLockup = block.timestamp.add(pool.harvestLockup + randomDays()); } ui...
function payOrLockupPendingToken(uint256 _pid) internal { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender]; if (user.harvestLockup == 0) { user.harvestLockup = block.timestamp.add(pool.harvestLockup + randomDays()); } ui...
10,094
128
// build event data
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
_eventData_.compressedData = _eventData_.compressedData + (_now * 1000000000000000000); _eventData_.compressedIDs = _eventData_.compressedIDs + _pID;
7,663
10
// RLPItem conversions into data types /
function toBoolean(RLPItem memory item) internal pure returns (bool) { require( item.len == 1, "Invalid RLPItem. Booleans are encoded in 1 byte" ); uint result; uint memPtr = item.memPtr; assembly { result := byte(0, mload(memPtr)) ...
function toBoolean(RLPItem memory item) internal pure returns (bool) { require( item.len == 1, "Invalid RLPItem. Booleans are encoded in 1 byte" ); uint result; uint memPtr = item.memPtr; assembly { result := byte(0, mload(memPtr)) ...
49,750
46
// When transfer tokens decrease dividendPayments for token owner and increase for receiver
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { // balance before transfer uint256 oldBalanceFrom = balances[_from]; // invoke super function with requires bool isTransferred = super.transferFrom(_from, _to, _value); uint256 transfe...
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) { // balance before transfer uint256 oldBalanceFrom = balances[_from]; // invoke super function with requires bool isTransferred = super.transferFrom(_from, _to, _value); uint256 transfe...
19,500
1
// Update unique donor and recipient counts
if(!hasDonated[msg.sender]) { hasDonated[msg.sender] = true; uniqueDonorCount++; }
if(!hasDonated[msg.sender]) { hasDonated[msg.sender] = true; uniqueDonorCount++; }
20,055
15
// transaction checking that the amount entered is the same as agreed in the contract
(bool success, ) = address(this).call{value: workStatements[_index].amount}("");
(bool success, ) = address(this).call{value: workStatements[_index].amount}("");
37,726
58
// Used by contracts implementing the I_P1Trader interface to return the result of a trade. /
struct TradeResult { uint256 marginAmount; uint256 positionAmount; bool isBuy; // From taker's perspective. bytes32 traderFlags; }
struct TradeResult { uint256 marginAmount; uint256 positionAmount; bool isBuy; // From taker's perspective. bytes32 traderFlags; }
45,889
74
// Zero out the previous white list
addressWhitelists[addressToRemove] = NO_WHITELIST;
addressWhitelists[addressToRemove] = NO_WHITELIST;
1,438
70
// See `ERC20Detailed.decimals`. Always returns 18, as per the /
function decimals() public pure returns (uint8) { return 18; }
function decimals() public pure returns (uint8) { return 18; }
15,934
120
// Calculates the amount of shares received according to ether deposited_amountAmount of ether to convert to shares return Amount of shares to be received/
function calculateDepositToShares(uint256 _amount) public view returns (uint256) { uint256 fundManagerCut; uint256 fundValue; // If there are no shares in the contract, whoever deposits owns 100% of the fund // we will set this to 10^18 shares, but this could be any amount if (totalShares == 0) ...
function calculateDepositToShares(uint256 _amount) public view returns (uint256) { uint256 fundManagerCut; uint256 fundValue; // If there are no shares in the contract, whoever deposits owns 100% of the fund // we will set this to 10^18 shares, but this could be any amount if (totalShares == 0) ...
128
380
// checks if a user is allowed to borrow at a stable rate_reserve the reserve address_user the user_amount the amount the the user wants to borrow return true if the user is allowed to borrow at a stable rate, false otherwise/
{ CoreLibrary.ReserveData storage reserve = reserves[_reserve]; CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; if (!reserve.isStableBorrowRateEnabled) return false; return !user.useAsCollateral || !reserve.usageAsCollateralEnab...
{ CoreLibrary.ReserveData storage reserve = reserves[_reserve]; CoreLibrary.UserReserveData storage user = usersReserveData[_user][_reserve]; if (!reserve.isStableBorrowRateEnabled) return false; return !user.useAsCollateral || !reserve.usageAsCollateralEnab...
15,288
59
// Invest in USD
function usdInvestment(address investor, uint256 investedInPicoUsd, uint256 tokensNumber) private
function usdInvestment(address investor, uint256 investedInPicoUsd, uint256 tokensNumber) private
29,526
175
// Equivalent to `_burn(tokenId, false)`. /
function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); }
function _burn(uint256 tokenId) internal virtual { _burn(tokenId, false); }
6,304
10
// 9: partial fills supported, anyone can execute
ERC20_TO_ERC721_PARTIAL_OPEN,
ERC20_TO_ERC721_PARTIAL_OPEN,
25,092
6
// Integer division of two unsigned integers truncating the quotient, reverts on division by zero. /
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0,"Invalid values"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0,"Invalid values"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; }
74,318
173
// Get a snapshot of the account's balances, and the cached exchange rate This is used by bController to more efficiently perform liquidity checks. account Address of the account to snapshotreturn (possible error, token balance, borrow balance, exchange rate mantissa) /
function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) { uint bTokenBalance = accountTokens[account]; uint borrowBalance; uint exchangeRateMantissa; MathError mErr; (mErr, borrowBalance) = borrowBalanceStoredInternal(account); if...
function getAccountSnapshot(address account) external view returns (uint, uint, uint, uint) { uint bTokenBalance = accountTokens[account]; uint borrowBalance; uint exchangeRateMantissa; MathError mErr; (mErr, borrowBalance) = borrowBalanceStoredInternal(account); if...
3,251
31
// Withdraw eth locked in contract back to owner amount amount of eth to send. /
function withdrawETH(uint256 amount) external onlyOwnerOrOperator { (bool success,) = payable(owner).call{value: amount}(""); require(success, "withdraw failed"); }
function withdrawETH(uint256 amount) external onlyOwnerOrOperator { (bool success,) = payable(owner).call{value: amount}(""); require(success, "withdraw failed"); }
19,558
141
// Minter Minting Contract seeding Theras for the purpose of developing cures and medicines using the exotic anticancer agents found in the Amazon Bioma.
contract TheraBioTech is TheraFounding { uint256 internal constant RATE = 39060000000000000; constructor(address payable Wallet, address payable Token) public Crowdsale(RATE, Wallet, TheraSeeding(Token)) { } }
contract TheraBioTech is TheraFounding { uint256 internal constant RATE = 39060000000000000; constructor(address payable Wallet, address payable Token) public Crowdsale(RATE, Wallet, TheraSeeding(Token)) { } }
38,618
15
// All for halting games for a contract/site upgradeTODO add functions for stopping any new games being createdTODO add function that shows number of in progress gamesTODO add function that pays out all accounts automatically
using SafeMath for uint256; uint256 private _maxFee = 10; uint256 private _fee = 3; uint256 private _pendingGameId; uint256 private inProgressGameId; mapping(uint256 => pendingGame) public pendingGames;
using SafeMath for uint256; uint256 private _maxFee = 10; uint256 private _fee = 3; uint256 private _pendingGameId; uint256 private inProgressGameId; mapping(uint256 => pendingGame) public pendingGames;
22,588
106
// The FOBO TOKEN!
FoboERC20 public fobo;
FoboERC20 public fobo;
60,005
120
// vesting allocates from the reserve fund
allocateVestable(FOUNDER_ADDRESS1, 9000000000, 365, PRIME_VESTING_DATE); allocateVestable(FOUNDER_ADDRESS2, 9000000000, 365, PRIME_VESTING_DATE); allocateVestable(FOUNDER_ADDRESS3, 7000000000, 365, PRIME_VESTING_DATE);
allocateVestable(FOUNDER_ADDRESS1, 9000000000, 365, PRIME_VESTING_DATE); allocateVestable(FOUNDER_ADDRESS2, 9000000000, 365, PRIME_VESTING_DATE); allocateVestable(FOUNDER_ADDRESS3, 7000000000, 365, PRIME_VESTING_DATE);
28,170
3
// Set contract deployer as owner /
constructor() public { owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor emit OwnerSet(address(0), owner); }
constructor() public { owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor emit OwnerSet(address(0), owner); }
20,738
64
// Returns true if the Address is in the list of token agents _agentAddress address of this agent/
function isTokenAgent(address _agentAddress) external view returns (bool);
function isTokenAgent(address _agentAddress) external view returns (bool);
18,211
29
// transfer b21 tokens or others tokens to any other address
function transferAnyERC20Token(address tokenAddress, uint256 tokens, address transferTo) external whenNotPaused returns (bool success) { require(msg.sender == owner || subAdmin[msg.sender]); if (subAdmin[msg.sender]) { require(limitOnSubAdmin[msg.sender] >= tokens); } r...
function transferAnyERC20Token(address tokenAddress, uint256 tokens, address transferTo) external whenNotPaused returns (bool success) { require(msg.sender == owner || subAdmin[msg.sender]); if (subAdmin[msg.sender]) { require(limitOnSubAdmin[msg.sender] >= tokens); } r...
8,825
70
// Translates a list guardians Orbs addresses to Ethereum addresses/ Used by the Election contract
function getEthereumAddresses(address[] calldata orbsAddrs) external view returns (address[] memory ethereumAddr);
function getEthereumAddresses(address[] calldata orbsAddrs) external view returns (address[] memory ethereumAddr);
36,673
78
// register the pool
pools[poolsCount] = Pool( PoolBaseData( _Token, msg.sender, _FinishTime, _Rate, _POZRate, _MainCoin, _StartAmount ),
pools[poolsCount] = Pool( PoolBaseData( _Token, msg.sender, _FinishTime, _Rate, _POZRate, _MainCoin, _StartAmount ),
13,738
15
// STANDARD OPERATIONS // returns information regarding how long the current rewards for the tokenin the reward wallet can maintain the current drip rate /
function runway(IERC20 token) public view returns ( uint256 _balance, uint256 _dripRatePerSecond, uint256 _stakeCount, uint256 _runRatePerSecond, uint256 _runRatePerDay, uint256 _runwaySeconds,
function runway(IERC20 token) public view returns ( uint256 _balance, uint256 _dripRatePerSecond, uint256 _stakeCount, uint256 _runRatePerSecond, uint256 _runRatePerDay, uint256 _runwaySeconds,
29,088
674
// Check ritual time is over
uint256 timeBlock = ritualTimeBlock[_owner]; require(timeBlock > 0 && timeBlock <= block.number); uint256 souls = soulCounter[_owner]; require(souls >= 10); uint256 identity = _generateIdentity(uint256(_owner), souls, timeBlock - 1, 0); ...
uint256 timeBlock = ritualTimeBlock[_owner]; require(timeBlock > 0 && timeBlock <= block.number); uint256 souls = soulCounter[_owner]; require(souls >= 10); uint256 identity = _generateIdentity(uint256(_owner), souls, timeBlock - 1, 0); ...
79,100
16
// If there are no challenges, return false
if (entry.challengeKeys.length == 0) return false;
if (entry.challengeKeys.length == 0) return false;
27,449
69
// CLRt+1 = max(MINLR, min(MAXLR, CLRt(1 - RS) + TLRRS)) a: TLRRS b: (1- RS)CLRt c: (1- RS)CLRt + TLRRS d: min(MAXLR, CLRt(1 - RS) + TLRRS)
uint256 a = methodology.targetLeverageRatio.preciseMul(methodology.recenteringSpeed); uint256 b = PreciseUnitMath.preciseUnit().sub(methodology.recenteringSpeed).preciseMul(_currentLeverageRatio); uint256 c = a.add(b); uint256 d = Math.min(c, methodology.maxLeverageRatio); return...
uint256 a = methodology.targetLeverageRatio.preciseMul(methodology.recenteringSpeed); uint256 b = PreciseUnitMath.preciseUnit().sub(methodology.recenteringSpeed).preciseMul(_currentLeverageRatio); uint256 c = a.add(b); uint256 d = Math.min(c, methodology.maxLeverageRatio); return...
29,364
101
// change the status
lockTokens.isWithdraw = true; require( IERC20(lockTokens.tokenAddress).balanceOf(address(this)) >= lockTokens.lockedAmount, "TimelockWallet: Insufficient Balance" ); IERC20(lockTokens.tokenAddress).safeTransfer( _msgSender(),
lockTokens.isWithdraw = true; require( IERC20(lockTokens.tokenAddress).balanceOf(address(this)) >= lockTokens.lockedAmount, "TimelockWallet: Insufficient Balance" ); IERC20(lockTokens.tokenAddress).safeTransfer( _msgSender(),
49,903
7
// Modifier used by all methods that impact accounting to make sure accounting period is changed before the operation if needed NOTE: its use MUST be accompanied by an initialization check
modifier transitionsPeriod { bool completeTransition = _tryTransitionAccountingPeriod(getMaxPeriodTransitions()); require(completeTransition, ERROR_COMPLETE_TRANSITION); _; }
modifier transitionsPeriod { bool completeTransition = _tryTransitionAccountingPeriod(getMaxPeriodTransitions()); require(completeTransition, ERROR_COMPLETE_TRANSITION); _; }
18,857
81
// Calculates the amount that has already vested. _recipient The address which is being vested /
function vestedAmount(address _recipient) public view returns (uint256) { if( block.timestamp < beneficiaries[_recipient].cliff ) { return 0; }else if( block.timestamp >= add( beneficiaries[_recipient].cliff, (30 days)*beneficiaries[_recipient].periods ) ) { return beneficiaries[_recipient].totalA...
function vestedAmount(address _recipient) public view returns (uint256) { if( block.timestamp < beneficiaries[_recipient].cliff ) { return 0; }else if( block.timestamp >= add( beneficiaries[_recipient].cliff, (30 days)*beneficiaries[_recipient].periods ) ) { return beneficiaries[_recipient].totalA...
4,001
46
// Emit an event indicating that the potential owner has been updated.
emit PotentialOwnerUpdated(newPotentialOwner);
emit PotentialOwnerUpdated(newPotentialOwner);
15,927
90
// Returns whether the SetToken has an external position for a given component (ifof position modules is > 0) /
function hasExternalPosition(ISetToken _setToken, address _component) internal view returns(bool) { return _setToken.getExternalPositionModules(_component).length > 0; }
function hasExternalPosition(ISetToken _setToken, address _component) internal view returns(bool) { return _setToken.getExternalPositionModules(_component).length > 0; }
27,544
38
// mapping investment number to the details of the investment
mapping(uint256 => Investment) public investments;
mapping(uint256 => Investment) public investments;
15,208
2
// Exclude from user cap per transaction
mapping(address => bool) public _isNotLimited;
mapping(address => bool) public _isNotLimited;
55,753
246
// Register an extension /
function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal { require(extension != address(this), "Creator: Invalid"); require(extension.isContract(), "Creator: Extension must be a contract"); if (!_extensions.contains(extension)) { _ex...
function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal { require(extension != address(this), "Creator: Invalid"); require(extension.isContract(), "Creator: Extension must be a contract"); if (!_extensions.contains(extension)) { _ex...
23,699
50
// fire event to send to charity
withdrawForCharity(_charity);
withdrawForCharity(_charity);
37,655
200
// A map from an accountID to a tokenID to if the balance is withdrawn
mapping (uint32 => mapping (uint16 => bool)) withdrawnInWithdrawMode;
mapping (uint32 => mapping (uint16 => bool)) withdrawnInWithdrawMode;
54,539
112
// Store fees earned by contract creator in contract until creator calls withdrawsEarnings() This prevents a halting condition that would occur if one of the fee earners rejects incoming transfers
if(_referrer != address(0)){ uint256 halfOfFees = fees.div(uint256(2)); addressToFeeEarnings[_referrer] = addressToFeeEarnings[_referrer].add(halfOfFees); addressToFeeEarnings[owner()] = addressToFeeEarnings[owner()].add(halfOfFees); } else {
if(_referrer != address(0)){ uint256 halfOfFees = fees.div(uint256(2)); addressToFeeEarnings[_referrer] = addressToFeeEarnings[_referrer].add(halfOfFees); addressToFeeEarnings[owner()] = addressToFeeEarnings[owner()].add(halfOfFees); } else {
28,337