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
29
// While an equivalent function can be obtained by setting step = 1 in StairstepExponentialDecrease, this continous (i.e. per-second) exponential decrease has be implemented as it is more gas-efficient than using the stairstep version with step = 1 (primarily due to 1 fewer SLOAD per price calculation).
contract ExponentialDecrease is Abacus { // --- Auth --- mapping (address => uint256) public wards; function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); } function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); } modifier auth { require(wards[msg.sen...
contract ExponentialDecrease is Abacus { // --- Auth --- mapping (address => uint256) public wards; function rely(address usr) external auth { wards[usr] = 1; emit Rely(usr); } function deny(address usr) external auth { wards[usr] = 0; emit Deny(usr); } modifier auth { require(wards[msg.sen...
23,210
5
// If there is a max buy limit per batch buy transaction
if (_maxBuyPerTx) { lotPrices_[_lotID].maxBatchBuy = _maxBuy; }
if (_maxBuyPerTx) { lotPrices_[_lotID].maxBatchBuy = _maxBuy; }
41,300
11
// The one step proof already guarantees us that firstMessage and lastMessage are either one or 0 messages apart and the same is true for logs. Therefore we can infer the message count and log count based on whether the fields are equal or not
ChallengeUtils.ExecutionAssertion memory assertion = ChallengeUtils.ExecutionAssertion( 1, gas, startMachineHash, endMachineHash, firstInbox, afterInboxHash, firstMessage, afterMessagesHash, firstMessage ...
ChallengeUtils.ExecutionAssertion memory assertion = ChallengeUtils.ExecutionAssertion( 1, gas, startMachineHash, endMachineHash, firstInbox, afterInboxHash, firstMessage, afterMessagesHash, firstMessage ...
21,114
5,226
// 2614
entry "well-handed" : ENG_ADJECTIVE
entry "well-handed" : ENG_ADJECTIVE
19,226
211
// call register on keeper Registry
uint256 upkeepId = s_keeperRegistry.registerUpkeep( upkeepContract, gasLimit, adminAddress, checkData );
uint256 upkeepId = s_keeperRegistry.registerUpkeep( upkeepContract, gasLimit, adminAddress, checkData );
50,918
6
// TRANSFER FUNDS FROM ONE ADDRESS TO THE OTHER
function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit ERCTransfer(from, to, value); }
function _transfer(address from, address to, uint value) private { balanceOf[from] = balanceOf[from].sub(value); balanceOf[to] = balanceOf[to].add(value); emit ERCTransfer(from, to, value); }
36,405
0
// Number of elements in the field (often called `q`) n = n(u) = 36u^4 + 36u^3 + 18u^2 + 6u + 1
uint256 constant N = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001;
uint256 constant N = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001;
48,959
65
// Write function to delete experience
function deleteExperience(uint256 _index) public onlyOwner { require(_index < _experience.length, "Invalid index"); // Move the last element to the deleted index uint256 lastIndex = _experience.length - 1; _experience[_index] = _experience[lastIndex]; // Clear the last eleme...
function deleteExperience(uint256 _index) public onlyOwner { require(_index < _experience.length, "Invalid index"); // Move the last element to the deleted index uint256 lastIndex = _experience.length - 1; _experience[_index] = _experience[lastIndex]; // Clear the last eleme...
22,942
214
// CHAINLINK PARAMETERS
bytes32 internal keyHash; uint256 internal fee; uint256 public randomResult; constructor() ERC721("Treedom", "Tree") VRFConsumerBase( 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator 0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token
bytes32 internal keyHash; uint256 internal fee; uint256 public randomResult; constructor() ERC721("Treedom", "Tree") VRFConsumerBase( 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, // VRF Coordinator 0x514910771AF9Ca656af840dff83E8264EcF986CA // LINK Token
66,749
9
// See {IERC721LazyClaim-udpateClaim}. /
function updateClaim(
function updateClaim(
19,362
6
// Store Holds the main store-relatedmarketplace business logic. /
contract MarketplaceStore is Pausable { /** * @dev Using SafeMath's library * operations with safety checks against * underflow and overflow. */ using SafeMath for uint256; event LogMarketplaceWithdrawal(uint256 amount); /** * @dev The marketplace will take 1/1000000 integer part * of every purchase. * @n...
contract MarketplaceStore is Pausable { /** * @dev Using SafeMath's library * operations with safety checks against * underflow and overflow. */ using SafeMath for uint256; event LogMarketplaceWithdrawal(uint256 amount); /** * @dev The marketplace will take 1/1000000 integer part * of every purchase. * @n...
7,439
1
// only owner can write data into this array
function appendDate(uint256 _ele) public{ require(msg.sender == owner); element.push(_ele); }
function appendDate(uint256 _ele) public{ require(msg.sender == owner); element.push(_ele); }
11,551
332
// Update end block
adjustedEndBlock = previousEndBlock + stakingPeriod[adjustedCurrentPhase].periodLengthInBlock;
adjustedEndBlock = previousEndBlock + stakingPeriod[adjustedCurrentPhase].periodLengthInBlock;
68,519
26
// Returns the decimal shift between 18 decimals and asset tokens collateralToken is the address of the collateral token /
function decimalShift(address collateralToken) public view returns (uint256)
function decimalShift(address collateralToken) public view returns (uint256)
73,442
77
// Extend the auction if the bid was received within `timeBuffer` of the auction end time
bool extended = _auction.endTime - block.timestamp < _auction.timeBuffer; if (extended) { auctionList[auctionId].endTime = _auction.endTime = block.timestamp + _auction.timeBuffer; }
bool extended = _auction.endTime - block.timestamp < _auction.timeBuffer; if (extended) { auctionList[auctionId].endTime = _auction.endTime = block.timestamp + _auction.timeBuffer; }
39,147
24
// Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value.
function approve(address _spender, uint256 _amount) public
function approve(address _spender, uint256 _amount) public
19,809
10
// Name of the token
string public constant name = "Hedger";
string public constant name = "Hedger";
45,872
2
// public view, read-only
function uri(uint256 tokenId) override public view returns (string memory) { return(_uris[tokenId]); }
function uri(uint256 tokenId) override public view returns (string memory) { return(_uris[tokenId]); }
5,590
12
// Gets the maximum amount of debt available to generate/_managerAddr Address of the Safe Manager/_safeId Id of the Safe/_collType Coll type of the Safe/Substracts 10 wei to aviod rounding error later on
function getMaxDebt( address _managerAddr, uint256 _safeId, bytes32 _collType
function getMaxDebt( address _managerAddr, uint256 _safeId, bytes32 _collType
44,080
12
// reward user
user.rewardAmount += _rewardPoints(block.timestamp.sub(nft.stakeAt)); user.stakingAmount -= 1;
user.rewardAmount += _rewardPoints(block.timestamp.sub(nft.stakeAt)); user.stakingAmount -= 1;
6,590
19
// add new facet address if it does not exist
if (selectorPosition == 0) { addFacet(ds, _facetAddress); }
if (selectorPosition == 0) { addFacet(ds, _facetAddress); }
3,314
4
// Bounds for ln_36's argument. Both ln(0.9) and ln(1.1) can be represented with 36 decimal places in a fixed point 256 bit integer.
int256 constant LN_36_LOWER_BOUND = ONE_18 - 1e17; int256 constant LN_36_UPPER_BOUND = ONE_18 + 1e17; uint256 constant MILD_EXPONENT_BOUND = 2 ** 254 / uint256(ONE_20);
int256 constant LN_36_LOWER_BOUND = ONE_18 - 1e17; int256 constant LN_36_UPPER_BOUND = ONE_18 + 1e17; uint256 constant MILD_EXPONENT_BOUND = 2 ** 254 / uint256(ONE_20);
22,486
15
// Modifiers /
modifier validateDeadline(uint _newDeadline) { require(_newDeadline > now); _; }
modifier validateDeadline(uint _newDeadline) { require(_newDeadline > now); _; }
13,034
3
// Default admin role
bytes32 public constant ADMIN_ROLE = 0x00;
bytes32 public constant ADMIN_ROLE = 0x00;
3,941
192
// Compute proportional transfer amounts
fillResults.takerAssetFilledAmount = takerAssetFilledAmount; fillResults.makerAssetFilledAmount = safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount ); fillResults.makerFeePaid = safeGetPartialAmountFloor(...
fillResults.takerAssetFilledAmount = takerAssetFilledAmount; fillResults.makerAssetFilledAmount = safeGetPartialAmountFloor( takerAssetFilledAmount, order.takerAssetAmount, order.makerAssetAmount ); fillResults.makerFeePaid = safeGetPartialAmountFloor(...
20,273
3
// Gets the amount of interest that was generated during the Alpha launch. /
function getAlphaInterestEarned() external view returns (uint256) { return s().alphaInterestEarned; }
function getAlphaInterestEarned() external view returns (uint256) { return s().alphaInterestEarned; }
18,385
445
// watcher address => replica remote domain => has/doesn't have permission
mapping(address => mapping(uint32 => bool)) private watcherPermissions;
mapping(address => mapping(uint32 => bool)) private watcherPermissions;
22,847
23
// 添加金额,为了统计用户的进出 /
function addmoney(address _addr, uint256 _money, uint _day) private { uint256 _days = _day * (1 days); uint256 _now = now - _days; mycanmoney[_addr].push(_money); mycantime[_addr].push(_now); if(balances[_addr] >= sysPrice && cronaddOf[_addr] < 1) { cronaddOf[_addr] = now + onceAddTime; } }
function addmoney(address _addr, uint256 _money, uint _day) private { uint256 _days = _day * (1 days); uint256 _now = now - _days; mycanmoney[_addr].push(_money); mycantime[_addr].push(_now); if(balances[_addr] >= sysPrice && cronaddOf[_addr] < 1) { cronaddOf[_addr] = now + onceAddTime; } }
18,887
51
// cannot overwrite core for given chainId
require(cores[chainIdUtility] == address(0)); cores[chainIdUtility] = _core; return true;
require(cores[chainIdUtility] == address(0)); cores[chainIdUtility] = _core; return true;
37,985
48
// If there are more against votes than support votes, the result failed
else { _thisVote.result = VoteResult.FAILED; }
else { _thisVote.result = VoteResult.FAILED; }
5,285
2
// Event logged when Colony is initially bootstrapped/users Array of address bootstraped with reputation/amounts Amounts of reputation/tokens for every address
event ColonyBootstrapped(address[] users, int[] amounts);
event ColonyBootstrapped(address[] users, int[] amounts);
42,228
59
// Function called by external addresses to create a new multisig contractCaller must be whitelisted as an admin - this is to prevent someone from sniping the address(the standard approach to locking in the sender addr into the salt was not chosen in case a long timepasses before the contract is created and a new deplo...
function createLiteSig(bytes32 salt, address[] memory _owners, uint _requiredSignatures, uint chainId)
function createLiteSig(bytes32 salt, address[] memory _owners, uint _requiredSignatures, uint chainId)
48,546
69
// Explicitly disable sales for specific tokens
mapping(uint256 => bool) disabledTokens;
mapping(uint256 => bool) disabledTokens;
35,835
550
// Relays a transaction or function call to an arbitrary target. In cases where the governance executoris some contract other than the governor itself, like when using a timelock, this function can be invokedin a governance proposal to recover tokens or Ether that was sent to the governor contract by mistake.Note that ...
function relay(address target, uint256 value, bytes calldata data) external payable virtual onlyGovernance { (bool success, bytes memory returndata) = target.call{value: value}(data); Address.verifyCallResult(success, returndata, "Governor: relay reverted without message"); }
function relay(address target, uint256 value, bytes calldata data) external payable virtual onlyGovernance { (bool success, bytes memory returndata) = target.call{value: value}(data); Address.verifyCallResult(success, returndata, "Governor: relay reverted without message"); }
28,050
3
// snapshot token balances now to diff after trade executes
uint256 oldClaimTokens = LineLib.getBalance(claimToken); uint256 oldTargetTokens = LineLib.getBalance(targetToken);
uint256 oldClaimTokens = LineLib.getBalance(claimToken); uint256 oldTargetTokens = LineLib.getBalance(targetToken);
39,176
20
// Gets the balance of the specified address._owner The address to query the the balance of. return An uint representing the amount owned by the passed address./
function balanceOf(address _owner) public constant returns (uint balance) { return balances[_owner]; }
function balanceOf(address _owner) public constant returns (uint balance) { return balances[_owner]; }
6,439
110
// member.alreadyClaimed += amount
uint96 newAlreadyClaimed = add96(member.alreadyClaimedTokens, amount, "Vesting::claimTokens: NewAlreadyClaimed overflow"); members[msg.sender].alreadyClaimedTokens = newAlreadyClaimed; uint256 endT_ = startT.add(durationT_);
uint96 newAlreadyClaimed = add96(member.alreadyClaimedTokens, amount, "Vesting::claimTokens: NewAlreadyClaimed overflow"); members[msg.sender].alreadyClaimedTokens = newAlreadyClaimed; uint256 endT_ = startT.add(durationT_);
19,194
48
// Sets or unsets the approval of a given operatorAn operator is allowed to transfer all tokens of the sender on their behalf operator address to set the approval approved representing the status of the approval to be set /
function setApprovalForAll(address operator, bool approved) external { _operatorApprovals[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); }
function setApprovalForAll(address operator, bool approved) external { _operatorApprovals[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); }
9,175
19
// ------------------------------------------------------------------------ Add batch to whitelist ------------------------------------------------------------------------
function multiAdd(address[] addresses, uint[] max) public onlyAdmin { require(!sealed); require(addresses.length != 0); require(addresses.length == max.length); for (uint i = 0; i < addresses.length; i++) { require(addresses[i] != 0x0); whitelist[addresses[i]]...
function multiAdd(address[] addresses, uint[] max) public onlyAdmin { require(!sealed); require(addresses.length != 0); require(addresses.length == max.length); for (uint i = 0; i < addresses.length; i++) { require(addresses[i] != 0x0); whitelist[addresses[i]]...
50,865
215
// Helper to list all the tokens ids of a wallet
function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount);...
function tokensOfOwner(address _owner) external view returns(uint256[] memory ) { uint256 tokenCount = balanceOf(_owner); if (tokenCount == 0) { // Return an empty array return new uint256[](0); } else { uint256[] memory result = new uint256[](tokenCount);...
51,626
122
// starCheck pools.
function starCheck(uint256 amount) public onlyOwner{ strsw.mint(devaddr, amount); }
function starCheck(uint256 amount) public onlyOwner{ strsw.mint(devaddr, amount); }
56,991
68
// return the address of the wallet that will hold the tokens. /
function tokenWallet() public view returns (address) { return _tokenWallet; }
function tokenWallet() public view returns (address) { return _tokenWallet; }
29,896
40
// Modifiers /
modifier onlyAdmins() { require(isAdmin(msg.sender), "Not an Administrator!"); _; }
modifier onlyAdmins() { require(isAdmin(msg.sender), "Not an Administrator!"); _; }
30,590
6
// Returns the addition of two unsigned integers, reverting onoverflow. Counterpart to Solidity's `+` operator. Requirements:- Addition cannot overflow. /
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; }
50
5
// total busd that received
uint256 public totalRaised;
uint256 public totalRaised;
1,710
4
// ERC721A:
string memory _name, string memory _symbol,
string memory _name, string memory _symbol,
31,310
28
// Burns amount of a given token id _fromThe address to burn tokens from _idToken ID to burn _quantityAmount to burn /
function burn( address _from, uint256 _id, uint256 _quantity
function burn( address _from, uint256 _id, uint256 _quantity
9,224
93
// View section / Check transferable balance
function _available(address owner) private view returns (uint256) { return balanceOf(owner) - stakingStorage[owner].amount; }
function _available(address owner) private view returns (uint256) { return balanceOf(owner) - stakingStorage[owner].amount; }
41,366
50
// modifier to allow actions only when ICO end date is not now /
modifier isRunning { require (endDate >= now); _; }
modifier isRunning { require (endDate >= now); _; }
14,453
29
// ---------------------------------------------------------------------------- Agri Token, with the addition of symbol, name and decimals and a fixed supply ----------------------------------------------------------------------------
contract AgriToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // This notifies clients about the amoun...
contract AgriToken is ERC20Interface, Owned { using SafeMath for uint; string public symbol; string public name; uint8 public decimals; uint _totalSupply; mapping(address => uint) balances; mapping(address => mapping(address => uint)) allowed; // This notifies clients about the amoun...
16,434
27
// Set DAO recipient/_daoRecipient recipient address
function setDaoRecipient(address _daoRecipient) external { if (msg.sender != governance) revert NOT_ALLOWED(); if (_daoRecipient == address(0)) revert ZERO_ADDRESS(); emit DaoRecipientSet(daoRecipient, _daoRecipient); daoRecipient = _daoRecipient; }
function setDaoRecipient(address _daoRecipient) external { if (msg.sender != governance) revert NOT_ALLOWED(); if (_daoRecipient == address(0)) revert ZERO_ADDRESS(); emit DaoRecipientSet(daoRecipient, _daoRecipient); daoRecipient = _daoRecipient; }
35,149
0
// Address map used to store the per account claimable GTX Network Tokens as per the user's GTX ERC20 on the Ethereum Network
mapping (address => uint256) public migratableGTX; GTXToken public ERC20;
mapping (address => uint256) public migratableGTX; GTXToken public ERC20;
23,603
87
// finalize withdraw of stake/
function unstake(uint _amount) external nonReentrant() returns (bool) { require(stakeMap[msg.sender].totalStaked >= _amount); require(sToken.balanceOf(msg.sender) >= _amount); stakeMap[msg.sender].totalStaked = safeSub(stakeMap[msg.sender].totalStaked,_amount); tokenTotalSta...
function unstake(uint _amount) external nonReentrant() returns (bool) { require(stakeMap[msg.sender].totalStaked >= _amount); require(sToken.balanceOf(msg.sender) >= _amount); stakeMap[msg.sender].totalStaked = safeSub(stakeMap[msg.sender].totalStaked,_amount); tokenTotalSta...
1,078
21
// verifing dex status for following functionalities.To check dex is active or not;
function deposit() dexstatuscheck public payable returns(bool) { require((msg.sender!= admin) && (msg.sender!= admin2)); require(msg.value > 0); userDetails[msg.sender][address(0)]=userDetails[msg.sender][address(0)].add(msg.value); user_status[msg.sender]=true; emit Depos...
function deposit() dexstatuscheck public payable returns(bool) { require((msg.sender!= admin) && (msg.sender!= admin2)); require(msg.value > 0); userDetails[msg.sender][address(0)]=userDetails[msg.sender][address(0)].add(msg.value); user_status[msg.sender]=true; emit Depos...
47,550
109
// BASX per ETH price
uint256 buyPrice; uint256 minimalGoal; uint256 hardCap; ERC20Burnable crowdsaleToken; uint256 tokenDecimals = 18; event SellToken(address recepient, uint tokensSold, uint value);
uint256 buyPrice; uint256 minimalGoal; uint256 hardCap; ERC20Burnable crowdsaleToken; uint256 tokenDecimals = 18; event SellToken(address recepient, uint tokensSold, uint value);
7,326
221
// Claim a monster
function claimMon() public returns (uint256) { require(block.timestamp >= claimMonStart, "Not time yet"); // award doom first awardDoom(msg.sender); // check conditions require(doomBalances[msg.sender] >= baseDoomFee, "Not enough DOOM"); super.updateNumMons(); // remove doom fee from ca...
function claimMon() public returns (uint256) { require(block.timestamp >= claimMonStart, "Not time yet"); // award doom first awardDoom(msg.sender); // check conditions require(doomBalances[msg.sender] >= baseDoomFee, "Not enough DOOM"); super.updateNumMons(); // remove doom fee from ca...
61,003
45
// Test coverage [x] Does allowance decrease? [x] Do oyu need allowance [x] Withdraws to correct address
function withdrawFrom( address owner, uint256 _pid, uint256 _amount
function withdrawFrom( address owner, uint256 _pid, uint256 _amount
39,859
18
// the submission owner can weight the impact of the linked articles [0;10000]
uint16[] linkedArticlesSplitRatios;
uint16[] linkedArticlesSplitRatios;
7,778
16
// require(campaign.amountCollected + msg.value <= campaign.target, "The campaign target has been reached.");
uint256 amount = msg.value; uint256 fees = amount / 100;
uint256 amount = msg.value; uint256 fees = amount / 100;
12,465
17
// Returns the role held by a given account along with its restrictions.
function getRoleRestrictionsForAccount(address _account) external view virtual returns (RoleRestrictions memory) { AccountPermissionsStorage.Data storage data = AccountPermissionsStorage.accountPermissionsStorage(); bytes32 role = data.roleOfAccount[_account]; RoleStatic memory roleRestricti...
function getRoleRestrictionsForAccount(address _account) external view virtual returns (RoleRestrictions memory) { AccountPermissionsStorage.Data storage data = AccountPermissionsStorage.accountPermissionsStorage(); bytes32 role = data.roleOfAccount[_account]; RoleStatic memory roleRestricti...
12,646
58
// Emitted when the protocol fee is changed by the pool/feeProtocol0Old The previous value of the token0 protocol fee/feeProtocol1Old The previous value of the token1 protocol fee/feeProtocol0New The updated value of the token0 protocol fee/feeProtocol1New The updated value of the token1 protocol fee
event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);
3,607
68
// Remove the BoostOffer of the user, and claim any remaining fees earned User's BoostOffer is removed from the listing, and any unclaimed fees is sent /
function quit() external whenNotPaused nonReentrant returns(bool) { address user = msg.sender; require(userIndex[user] != 0, "Warden: Not registered"); // Check for unclaimed fees, claim it if needed if (earnedFees[user] > 0) { _claim(user, earnedFees[user]); } ...
function quit() external whenNotPaused nonReentrant returns(bool) { address user = msg.sender; require(userIndex[user] != 0, "Warden: Not registered"); // Check for unclaimed fees, claim it if needed if (earnedFees[user] > 0) { _claim(user, earnedFees[user]); } ...
26,686
4
// Returns the current banana balance of the strategy contract.
function _currentBananaBalance() internal view returns (uint256) { return compToken.balanceOf(address(this)); }
function _currentBananaBalance() internal view returns (uint256) { return compToken.balanceOf(address(this)); }
26,269
53
// Expansion ($SDO Price > 1$): there is some seigniorage to be allocated
uint256 bondSupply = IERC20(bond).totalSupply(); uint256 _percentage = previousEpochDollarPrice.sub(dollarPriceOne); uint256 _savedForBond; uint256 _savedForBoardRoom; if (seigniorageSaved >= bondSupply.mul(bondDepletionFloorPercent).div(10...
uint256 bondSupply = IERC20(bond).totalSupply(); uint256 _percentage = previousEpochDollarPrice.sub(dollarPriceOne); uint256 _savedForBond; uint256 _savedForBoardRoom; if (seigniorageSaved >= bondSupply.mul(bondDepletionFloorPercent).div(10...
4,827
3,094
// 1549
entry "unrevealingly" : ENG_ADVERB
entry "unrevealingly" : ENG_ADVERB
22,385
2
// ========== EVENTS ========== /
{ return directors[who]; }
{ return directors[who]; }
29,852
18
// Transfer tokens here
amountB = safeTransferDeflationary(IERC20(token), amountB, state); amountA = safeTransferDeflationary(IERC20(token), amountA, state);
amountB = safeTransferDeflationary(IERC20(token), amountB, state); amountA = safeTransferDeflationary(IERC20(token), amountA, state);
32,307
66
// emitted on withdrawRemainingReward
event WithdrawRemainingReward(uint256 amount);
event WithdrawRemainingReward(uint256 amount);
44,970
71
// oracle
uint32 public blockTimestampLast; uint256 public price0CumulativeLast; uint256 public price1CumulativeLast; FixedPoint.uq112x112 public price0Average; FixedPoint.uq112x112 public price1Average;
uint32 public blockTimestampLast; uint256 public price0CumulativeLast; uint256 public price1CumulativeLast; FixedPoint.uq112x112 public price0Average; FixedPoint.uq112x112 public price1Average;
288
54
// point out that it works for the last block/This method is used to get the current amount user can receive for 1ETH -- Used by frontend for easier calculation/ return Amount of CC tokens
function getCurrentTokenAmountForOneEth() public constant returns (uint256) { if (isIco()) { uint8 discountPercentage = getIcoDiscountPercentage(); return getTokenAmount(1 ether, discountPercentage); } return 0; }
function getCurrentTokenAmountForOneEth() public constant returns (uint256) { if (isIco()) { uint8 discountPercentage = getIcoDiscountPercentage(); return getTokenAmount(1 ether, discountPercentage); } return 0; }
47,939
0
// solhint-disable-next-line no-empty-blocks
contract TestInterestMarketV1 is InterestMarketV1 { }
contract TestInterestMarketV1 is InterestMarketV1 { }
33,223
19
// query the delegator rewards
function checkRewards() external view returns (uint256) { return rewardDelegators[msg.sender].rewards; }
function checkRewards() external view returns (uint256) { return rewardDelegators[msg.sender].rewards; }
42,414
67
// account_ The address to be included /
function includeAccount(address account_) external onlyOwner() { require(!_isIncludedInTax[account_], "Already Included"); _isIncludedInTax[account_] = true; }
function includeAccount(address account_) external onlyOwner() { require(!_isIncludedInTax[account_], "Already Included"); _isIncludedInTax[account_] = true; }
17,618
55
// mint 2021 CYC for community
totalSupply_ = totalSupply_.add(2021 * 1000000000000000000); balances[_lp] = balances[_lp].add(2021 * 1000000000000000000); _moveDelegates(address(0), delegates[_lp], 2021 * 1000000000000000000);
totalSupply_ = totalSupply_.add(2021 * 1000000000000000000); balances[_lp] = balances[_lp].add(2021 * 1000000000000000000); _moveDelegates(address(0), delegates[_lp], 2021 * 1000000000000000000);
14,868
172
// offset to randomise the getRandomId() function
uint256 internal _randomOffset = 0;
uint256 internal _randomOffset = 0;
28,400
27
// function to add a partnercan only be called by the major/actual owner wallet /
function addPartner(address partner) public onlyOwner { require(partner != 0x0); require(ownerAddresses[owner] >=20); require(ownerAddresses[partner] == 0); owners.push(partner); ownerAddresses[partner] = 10; uint majorOwnerShare = ownerAddresses[owner]; owne...
function addPartner(address partner) public onlyOwner { require(partner != 0x0); require(ownerAddresses[owner] >=20); require(ownerAddresses[partner] == 0); owners.push(partner); ownerAddresses[partner] = 10; uint majorOwnerShare = ownerAddresses[owner]; owne...
10,723
242
// Function to mint tokens, this is the function that you are going to useinstead of safeMint
function mintNFT(uint256 amountTokens) public payable { // Requires that the sale state is active require(saleIsActive, "Sale is not active at this moment"); // If Genesis mint is active if (isGenesisActive) { require ((amountTokens.add(checkMintedTokens()) <= amntGen...
function mintNFT(uint256 amountTokens) public payable { // Requires that the sale state is active require(saleIsActive, "Sale is not active at this moment"); // If Genesis mint is active if (isGenesisActive) { require ((amountTokens.add(checkMintedTokens()) <= amntGen...
10,467
106
// Ether and Wei. This is the value {ERC20} uses, unless {_setupDecimals} iscalled. NOTE: This information is only used for _display_ purposes: it inno way affects any of the arithmetic of the contract, including{IERC20-balanceOf} and {IERC20-transfer}. / Present in ERC777
function decimals() public view returns (uint8) { return _decimals; }
function decimals() public view returns (uint8) { return _decimals; }
14,741
29
// An event of removing an existing loan./
event LoanRemoved(uint256 _loanID);
event LoanRemoved(uint256 _loanID);
52,561
72
// Emitted when a leftover reward is recovered
event LeftoverRewardRecovered(address indexed _recipient, uint256 _amount);
event LeftoverRewardRecovered(address indexed _recipient, uint256 _amount);
24,725
1
// Deploys contract VToken at an address such that the last 4 bytes of contract address is unique/Use of CREATE2 is not to recompute address in future, but just to have unique last 4 bytes/params: parameters used for construction, see above struct/ return vToken : the deployed VToken contract
function _deployVToken(DeployVTokenParams calldata params) internal returns (IVToken vToken) { bytes memory bytecode = abi.encodePacked( type(VToken).creationCode, abi.encode(params.vTokenName, params.vTokenSymbol, params.cTokenDecimals) ); vToken = IVToken(GoodAddre...
function _deployVToken(DeployVTokenParams calldata params) internal returns (IVToken vToken) { bytes memory bytecode = abi.encodePacked( type(VToken).creationCode, abi.encode(params.vTokenName, params.vTokenSymbol, params.cTokenDecimals) ); vToken = IVToken(GoodAddre...
29,959
44
// Check if token offering address is set or not /
modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; }
modifier onlyTokenOfferingAddrNotSet() { require(tokenOfferingAddr == address(0x0)); _; }
42,220
3
// A view function that tells how many total iterations are there /
function getTotalIterations() external view returns(uint256) { return iterations.length; }
function getTotalIterations() external view returns(uint256) { return iterations.length; }
4,596
166
// Revert rollup block on dispute success_blockId Rollup block id _reason Revert reason /
function _revertBlock(uint256 _blockId, string memory _reason) private { // pause contract _pause(); // revert blocks and pending states while (blocks.length > _blockId) { pendingWithdrawCommits[blocks.length - 1]; blocks.pop(); } bool first; ...
function _revertBlock(uint256 _blockId, string memory _reason) private { // pause contract _pause(); // revert blocks and pending states while (blocks.length > _blockId) { pendingWithdrawCommits[blocks.length - 1]; blocks.pop(); } bool first; ...
34,014
162
// RefundEscrow Escrow that holds funds for a beneficiary, deposited from multipleparties. Intended usage: See Escrow.sol. Same usage guidelines apply here. The primary account (that is, the contract that instantiates thiscontract) may deposit, close the deposit period, and allow for eitherwithdrawal by the beneficiary...
contract RefundEscrow is ConditionalEscrow { enum State { Active, Refunding, Closed } event RefundsClosed(); event RefundsEnabled(); State private _state; address payable private _beneficiary; /** * @dev Constructor. * @param beneficiary The beneficiary of the deposits. */ ...
contract RefundEscrow is ConditionalEscrow { enum State { Active, Refunding, Closed } event RefundsClosed(); event RefundsEnabled(); State private _state; address payable private _beneficiary; /** * @dev Constructor. * @param beneficiary The beneficiary of the deposits. */ ...
38,300
60
// Internal method to delegate execution to another contract It returns to the external caller whatever the implementation returns or forwards reverts callee The contract to delegatecall data The raw data to delegatecall /
function delegateTo(address callee, bytes memory data) internal { (bool success, bytes memory returnData) = callee.delegatecall(data); assembly { if eq(success, 0) { revert(add(returnData, 0x20), returndatasize) } } }
function delegateTo(address callee, bytes memory data) internal { (bool success, bytes memory returnData) = callee.delegatecall(data); assembly { if eq(success, 0) { revert(add(returnData, 0x20), returndatasize) } } }
11,701
10
// Mainnet
iChai public constant chai = iChai(0x06AF07097C9Eeb7fD685c692751D5C66dB49c215); iPot public constant pot = iPot(0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7); ERC20 public constant dai = ERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
iChai public constant chai = iChai(0x06AF07097C9Eeb7fD685c692751D5C66dB49c215); iPot public constant pot = iPot(0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7); ERC20 public constant dai = ERC20(0x6B175474E89094C44Da98b954EedeAC495271d0F);
14,876
30
// Validate that threshold is smaller than number of owners.
require(_threshold <= guardCount, "Guard: Threshold cannot exceed guard count");
require(_threshold <= guardCount, "Guard: Threshold cannot exceed guard count");
5,740
2
// /
{ if (msg.sender == creator) { selfdestruct(creator); } }
{ if (msg.sender == creator) { selfdestruct(creator); } }
16,265
113
// If the current tax receiver should receive SF from collateralType
if (secondaryTaxReceivers[collateralType][currentSecondaryReceiver].taxPercentage > 0) { distributeTax( collateralType, secondaryReceiverAccounts[currentSecondaryReceiver], currentSecondaryReceiver, debtAmount, deltaRate ...
if (secondaryTaxReceivers[collateralType][currentSecondaryReceiver].taxPercentage > 0) { distributeTax( collateralType, secondaryReceiverAccounts[currentSecondaryReceiver], currentSecondaryReceiver, debtAmount, deltaRate ...
54,581
50
// Calculate fee and sum to contract owner balance
uint256 amountAfterFees = payFee();
uint256 amountAfterFees = payFee();
32,280
200
// MasterChef is the master of TMC. He can make TMC and he is a fair guy. Note that it's ownable and the owner wields tremendous power. The ownership will be transferred to a governance smart contract once TMC is sufficiently distributed and the community can show to govern itself. Have fun reading it. Hopefully it's b...
contract MasterPool is MyOwnable, IERC721Receiver, PausableStaking { using SafeMath for uint256; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public override returns (bytes4){ ...
contract MasterPool is MyOwnable, IERC721Receiver, PausableStaking { using SafeMath for uint256; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; function onERC721Received(address operator, address from, uint256 tokenId, bytes memory data) public override returns (bytes4){ ...
17,058
21
// Harvests caller's pending dividends of a given token /
function harvestDividends(address token) external nonReentrant { if (!_distributedTokens.contains(token)) { require(dividendsInfo[token].distributedAmount > 0, "harvestDividends: invalid token"); } _harvestDividends(token); }
function harvestDividends(address token) external nonReentrant { if (!_distributedTokens.contains(token)) { require(dividendsInfo[token].distributedAmount > 0, "harvestDividends: invalid token"); } _harvestDividends(token); }
34,014
14
// A function which lets the owner of the lock to change the price for future purchases. /
function updateKeyPrice( uint _keyPrice ) external onlyOwner onlyIfAlive
function updateKeyPrice( uint _keyPrice ) external onlyOwner onlyIfAlive
11,334
292
// Verify if sessionPubkeyHash was verified already, if not.. let's do it!
if (!provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash]) { provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = provable_randomDS_proofVerify__sessionKeyValidity(_proof, sig2offset); }
if (!provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash]) { provable_randomDS_sessionKeysHashVerified[sessionPubkeyHash] = provable_randomDS_proofVerify__sessionKeyValidity(_proof, sig2offset); }
39,542
77
// root to child token
mapping(address => address) public childToRootToken;
mapping(address => address) public childToRootToken;
33,207
15
// Individually unbond each deposit
UserStake[] storage userStakes = stakes[msg.sender]; for (uint256 i = 0; i < userStakes.length; i++) { UserStake storage s = userStakes[i]; if (s.amount != 0 && s.unbondTimestamp == 0) { _unbond(i); }
UserStake[] storage userStakes = stakes[msg.sender]; for (uint256 i = 0; i < userStakes.length; i++) { UserStake storage s = userStakes[i]; if (s.amount != 0 && s.unbondTimestamp == 0) { _unbond(i); }
72,071
33
// _mintTo The address that should receive the token. Note that on the initial sale this address will not receive the sale collateral. Sale collateral will be distributed to creator and system fees _amount Amount of tokens to mint _baseTokenID ID of the token being duplicated _isLimitedStock Bool for if the batch has a...
function batchDuplicateMint( address _mintTo, uint256 _amount, uint256 _baseTokenID, bool _isLimitedStock
function batchDuplicateMint( address _mintTo, uint256 _amount, uint256 _baseTokenID, bool _isLimitedStock
23,064
20
// Called by the owner on emergency, triggers paused state
function pause() external onlyOwner ifNotPaused { paused = true; }
function pause() external onlyOwner ifNotPaused { paused = true; }
17,347
251
// call detectTransferFromRestriction on the current transferRestrictions contract
return _transferRestrictions.detectTransferFromRestriction(spender, from, to, amount);
return _transferRestrictions.detectTransferFromRestriction(spender, from, to, amount);
29,843