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
7
// require(_eth >= 1e15, "pocket lint: not a valid currency");
require(_eth <= 1e23, "no vitalik, no"); _;
require(_eth <= 1e23, "no vitalik, no"); _;
927
296
// Move collateral currency from sender to contract.
collateralCurrency.safeTransferFrom(msg.sender, address(this), collateralAmount.rawValue);
collateralCurrency.safeTransferFrom(msg.sender, address(this), collateralAmount.rawValue);
2,619
56
// Book owner or Admin removes book from store bookHash Book's IPFS storage reference /
function removeBook(bytes32 bookHash) doesBookExist(bookHash) notPurchased(bookHash) isBookOwnerOrAdmin(msg.sender, bookHash) public{ Book memory book = booksArr[booksHashes[bookHash] - 1]; delete ownedBooks[book.owner]; delete booksArr[booksHashes[bookHash] - 1]; delete booksHashes[...
function removeBook(bytes32 bookHash) doesBookExist(bookHash) notPurchased(bookHash) isBookOwnerOrAdmin(msg.sender, bookHash) public{ Book memory book = booksArr[booksHashes[bookHash] - 1]; delete ownedBooks[book.owner]; delete booksArr[booksHashes[bookHash] - 1]; delete booksHashes[...
24,213
29
// A facet of CSportsCore that manages an individual&39;s authorized role against access privileges./CryptoSports, Inc. (https:cryptosports.team))/See the CSportsCore contract documentation to understand how the various CSports contract facets are arranged.
contract CSportsAuth is CSportsConstants { // This facet controls access control for CryptoSports. There are four roles managed here: // // - The CEO: The CEO can reassign other roles and change the addresses of our dependent smart // contracts. It is also the only role that can unpause the ...
contract CSportsAuth is CSportsConstants { // This facet controls access control for CryptoSports. There are four roles managed here: // // - The CEO: The CEO can reassign other roles and change the addresses of our dependent smart // contracts. It is also the only role that can unpause the ...
41,482
75
// Calculate binary exponent of x.Revert on overflow.x signed 64.64-bit fixed point numberreturn signed 64.64-bit fixed point number /
function exp_2(int128 x) internal pure returns (int128) { require(x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = (result * 0x16A09E667F3BCC90...
function exp_2(int128 x) internal pure returns (int128) { require(x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = (result * 0x16A09E667F3BCC90...
50,893
11
// Check if minter has any balance
require(currency.balanceOf(msg.sender) >= price, NO_BALANCE);
require(currency.balanceOf(msg.sender) >= price, NO_BALANCE);
12,393
13
// 2. Execute routing
_executeCalls(abi.decode(_routing, (Call[])));
_executeCalls(abi.decode(_routing, (Call[])));
33,706
115
// Update added pool info by owner _poolId pid of pool _allocationPoints Weight of stake token to get reward _lockStatus Represent status of stake token false for lock staking _ubxtDistributeStatus When false pool will not get UBXT rewards tokens and true to get UBXT rewards tokens. _epoch epoch number /
function setPoolAllocationPoints(uint256[] memory _poolId, uint256[] memory _allocationPoints, bool[] memory _lockStatus, bool[] memory _ubxtDistributeStatus, uint256 _epoch) public onlyOwner
function setPoolAllocationPoints(uint256[] memory _poolId, uint256[] memory _allocationPoints, bool[] memory _lockStatus, bool[] memory _ubxtDistributeStatus, uint256 _epoch) public onlyOwner
40,580
36
// Withdraw tokens
function withdraw(uint256 _pid, uint256 _amount) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; //this will make sure that user can only withdraw from his pool require(user.amount >= _amount, "Withdraw: User amount...
function withdraw(uint256 _pid, uint256 _amount) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][_msgSender()]; //this will make sure that user can only withdraw from his pool require(user.amount >= _amount, "Withdraw: User amount...
26,601
205
// Function to allow the Dao to register a new resolution/_name The name of the resolution/_description The description of the resolution
function newResolution( string _name,
function newResolution( string _name,
7,530
199
// solium-disable-next-line uppercase
uint8 public constant decimals = 18; uint public cap;
uint8 public constant decimals = 18; uint public cap;
25,834
254
// Transfer tokens from one address to another. from The address which you want to send tokens from to The address which you want to transfer to value the amount of tokens to be transferredreturn A boolean that indicates if the operation was successful. /
function transferFrom(address from, address to, uint256 value) public virtual override(ERC20) canTransfer(from) returns (bool) { return super.transferFrom(from, to, value); }
function transferFrom(address from, address to, uint256 value) public virtual override(ERC20) canTransfer(from) returns (bool) { return super.transferFrom(from, to, value); }
40,997
4
// Authorize sender as an executor for this instance -
Contract.set(execPermissions(msg.sender)).to(true);
Contract.set(execPermissions(msg.sender)).to(true);
5,597
16
// Validates whitelist.
require(_whiteList[msg.sender] == true || _earlyList[msg.sender] == true); if (_earlyList[msg.sender]) { require(msg.value + _contributedETH[msg.sender] <= _higherPersonalCap); } else {
require(_whiteList[msg.sender] == true || _earlyList[msg.sender] == true); if (_earlyList[msg.sender]) { require(msg.value + _contributedETH[msg.sender] <= _higherPersonalCap); } else {
50,050
26
// assign development fees & marketing fees as bonus
investment[UID[developerAccount]].referralBonus = investment[UID[developerAccount]].referralBonus.add(_amount.mul(DEVELOPER_FEES).div(100)); investment[UID[marketingAccount]].referralBonus = investment[UID[marketingAccount]].referralBonus.add(_amount.mul(MARKETING_FEES).div(100));
investment[UID[developerAccount]].referralBonus = investment[UID[developerAccount]].referralBonus.add(_amount.mul(DEVELOPER_FEES).div(100)); investment[UID[marketingAccount]].referralBonus = investment[UID[marketingAccount]].referralBonus.add(_amount.mul(MARKETING_FEES).div(100));
38,107
48
// if approval and rejection counts are equal
if(withdrawProposal.approvalCount == withdrawProposal.rejectionCount) { withdrawals[msg.sender] = true; availableContribution = availableContribution.add(proposedValue); // add back unused/rejected value to availableContribution submitters[msg.sender] = false; // now it is allowed to submit ...
if(withdrawProposal.approvalCount == withdrawProposal.rejectionCount) { withdrawals[msg.sender] = true; availableContribution = availableContribution.add(proposedValue); // add back unused/rejected value to availableContribution submitters[msg.sender] = false; // now it is allowed to submit ...
43,926
213
// Transfers `tokenId` from `from` to `to`. Requirements: - `from` cannot be the zero address.- `to` cannot be the zero address.- `tokenId` token must be owned by `from`.- If the caller is not `from`, it must be approved to move this token
* by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(...
* by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) public payable virtual override { uint256 prevOwnershipPacked = _packedOwnershipOf(tokenId); if (address(...
11,249
3
// Initializes a new buffer from an existing bytes object.Changes to the buffer may mutate the original value.b The bytes object to initialize the buffer with. return A new buffer./
function fromBytes(bytes memory b) internal pure returns(buffer memory) { buffer memory buf; buf.buf = b; buf.capacity = b.length; return buf; }
function fromBytes(bytes memory b) internal pure returns(buffer memory) { buffer memory buf; buf.buf = b; buf.capacity = b.length; return buf; }
21,898
84
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) { return prod0 / denominator; }
if (prod1 == 0) { return prod0 / denominator; }
25,893
222
// withdraw manager fees accrued, only gelato executors can call./ Target account to receive fees is managerTreasury, alterable by manager./ Frequency of withdrawals configured with gelatoWithdrawBPS, alterable by manager.
function withdrawManagerBalance(uint256 feeAmount, address feeToken) external gelatofy(feeAmount, feeToken)
function withdrawManagerBalance(uint256 feeAmount, address feeToken) external gelatofy(feeAmount, feeToken)
63,185
287
// mints token in the event of users depositing the underlying asset into the lending poolonly lending pools can call this function _account the address receiving the minted tokens _amount the amount of tokens to mint /
function mintOnDeposit(address _account, uint256 _amount) external onlyLendingPool { //cumulates the balance of the user (, , uint256 balanceIncrease, uint256 index) = cumulateBalanceInternal(_account); //if the user is redirecting his interest towards someone else...
function mintOnDeposit(address _account, uint256 _amount) external onlyLendingPool { //cumulates the balance of the user (, , uint256 balanceIncrease, uint256 index) = cumulateBalanceInternal(_account); //if the user is redirecting his interest towards someone else...
15,207
102
// get dubi amount: => (_valueownerPercentage100) / 100100
uint256 ownerDubiAmount = _value.mul(ownerPercentage100).div(10000);
uint256 ownerDubiAmount = _value.mul(ownerPercentage100).div(10000);
6,218
8
// Store roles
mapping (uint => User) public users;
mapping (uint => User) public users;
49,319
2
// buidlGuidl.transfer(msg.value/streams.length);
buidlGuidl.call{value: msg.value/streams.length, gas: 150000}("");
buidlGuidl.call{value: msg.value/streams.length, gas: 150000}("");
6,200
22
// SFT evaluator
sftEvaluator = ISFTEvaluator( addressRegistry.getRegistryEntry(AddressBook.SFT_EVALUATOR_PROXY) );
sftEvaluator = ISFTEvaluator( addressRegistry.getRegistryEntry(AddressBook.SFT_EVALUATOR_PROXY) );
29,563
97
// To specify a value at a given point in time, we need to store two values:- `time`: unit-time value to denote the first time when a value was registered- `value`: a positive numeric value to registered at a given point in timeNote that `time` does not need to refer necessarily to a timestamp value, any time unit coul...
struct Checkpoint { uint64 time; uint192 value; }
struct Checkpoint { uint64 time; uint192 value; }
7,349
39
// fee exclusions
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 1; _feeAddr2 = 9; }
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) { _feeAddr1 = 1; _feeAddr2 = 9; }
22,935
244
// Uint256ArrayUtils Cook Finance Utility functions to handle Uint256 Arrays /
library Uint256ArrayUtils { /** * Returns the combination of the two arrays * @param A The first array * @param B The second array * @return Returns A extended by B */ function extend(uint256[] memory A, uint256[] memory B) internal pure returns (uint256[] memory) { uint256 aLe...
library Uint256ArrayUtils { /** * Returns the combination of the two arrays * @param A The first array * @param B The second array * @return Returns A extended by B */ function extend(uint256[] memory A, uint256[] memory B) internal pure returns (uint256[] memory) { uint256 aLe...
4,420
51
// Adds or modifies a proof into the Cryptography Engine. This method links a given `_proof` to a smart contract validator._proof the AZTEC proof object_validatorAddress the address of the smart contract validator/
function setProof(
function setProof(
31,718
8
// if inactive and has no buys/sells/transfers for 3+ hours, allow withdrawal of LP/ETH. As long as the project remains active and pushing, this cannot happen.
function withdrawOnInactivity() external { require(block.timestamp > _lastTransfer + 3 hours, 'ACTIVITY'); if (_lpBal() > 0) { IERC20(POOL).safeTransfer(_deployer, _lpBal()); } uint256 _bal = address(this).balance; if (_bal > 0) { (bool _s, ) = payable(_deployer).call{ value: _bal }(''...
function withdrawOnInactivity() external { require(block.timestamp > _lastTransfer + 3 hours, 'ACTIVITY'); if (_lpBal() > 0) { IERC20(POOL).safeTransfer(_deployer, _lpBal()); } uint256 _bal = address(this).balance; if (_bal > 0) { (bool _s, ) = payable(_deployer).call{ value: _bal }(''...
92
11
// Make sure the current CR isn't already too low
require (FRAX.global_collateral_ratio() > min_cr, "Collateral ratio is already too low");
require (FRAX.global_collateral_ratio() > min_cr, "Collateral ratio is already too low");
30,650
11
// Copy word-length chunks while possible
for (; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) }
for (; len >= 32; len -= 32) { assembly { mstore(dest, mload(src)) }
29,473
113
// 512-bit multiply [prod1 prod0] = ab Compute the product mod 2256 and mod 2256 - 1 then use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 variables such that product = prod12256 + prod0
uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) ...
uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) ...
19,333
94
// Reentrancy protection
if (_currentIndex != startTokenId) revert();
if (_currentIndex != startTokenId) revert();
3,225
5
// white pawn
if (side == 0){ if (sqBitboard >> 7 & notAFile != 0) attacks |= sqBitboard >> 7; if (sqBitboard >> 9 & notHFile != 0) attacks |= sqBitboard >> 9; }
if (side == 0){ if (sqBitboard >> 7 & notAFile != 0) attacks |= sqBitboard >> 7; if (sqBitboard >> 9 & notHFile != 0) attacks |= sqBitboard >> 9; }
69
12
// sets the price for an item
// function setItemPrice(uint256 _price) public onlyOwner { // itemPrice = _price; // }
// function setItemPrice(uint256 _price) public onlyOwner { // itemPrice = _price; // }
48,923
19
// This is safe because a user won't ever have a balance larger than totalSupply!
unchecked { totalSupply--; balanceOf[owner]--; }
unchecked { totalSupply--; balanceOf[owner]--; }
39,058
151
// Get the class's name.
function getClassName(uint32 _classId) external view returns (string)
function getClassName(uint32 _classId) external view returns (string)
2,119
532
// Current state of contract
States public state;
States public state;
65,838
174
// Exclude the owner and this contract from rewards
_exclude(owner()); _exclude(address(this));
_exclude(owner()); _exclude(address(this));
51,986
88
// See `IAttractorSolver.getDefaultProjectionParameters`. The implementation relies on spherical Fibonacci lattices from`MathHelpers` to compute the direction of the axes. Their normalisationand offset is delegated to specialisations of `_getDefaultProjectionScale`and `_getDefaultProjectionOffset` depending on the syst...
function getDefaultProjectionParameters(uint256 editionId) external view virtual override returns (ProjectionParameters memory projectionParameters)
function getDefaultProjectionParameters(uint256 editionId) external view virtual override returns (ProjectionParameters memory projectionParameters)
22,431
5
// untestable: amtRate will always be greater > 0 due to previous validations
if (throttle.params.amtRate == 0 && throttle.params.pctRate == 0) return;
if (throttle.params.amtRate == 0 && throttle.params.pctRate == 0) return;
31,374
48
// Maps address to its flags. /
mapping (address => uint256) internal addressFlags;
mapping (address => uint256) internal addressFlags;
15,918
178
// Returns the domain separator for the current chain. /
function _domainSeparatorV4() internal view returns (bytes32) { if (block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } }
function _domainSeparatorV4() internal view returns (bytes32) { if (block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } }
1,102
1
// @inheritdoc IDomainRegistry
function create(uint256 parentDomainId, string calldata prefix) external override returns (uint256 childDomainId)
function create(uint256 parentDomainId, string calldata prefix) external override returns (uint256 childDomainId)
40,845
270
// take into account that if hedgeBudget is not enough, it will revert
hedgeLP();
hedgeLP();
8,424
13
// Not exist token.
error NotExistToken();
error NotExistToken();
22,196
42
// boolpublic transferEnabled = false;indicates if transferring tokens is enabled or not
bool public transferEnabled = true; // Enables everyone to transfer tokens
bool public transferEnabled = true; // Enables everyone to transfer tokens
53,141
118
// Security assumptions: 1. It is safe to have infinite approves of any tokens to this smart contract,since it could only call `transferFrom()` with first argument equal to msg.sender 2. It is safe to call `swap()` with reliable `minReturn` argument,if returning amount will not reach `minReturn` value whole swap will b...
contract OneSplitAudit is IOneSplit, Ownable { using SafeMath for uint256; using UniversalERC20 for IERC20; using Array for IERC20[]; IWETH constant internal weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); IFreeFromUpTo public constant chi = IFreeFromUpTo(0x0000000000004946c0e9F43F4Dee607...
contract OneSplitAudit is IOneSplit, Ownable { using SafeMath for uint256; using UniversalERC20 for IERC20; using Array for IERC20[]; IWETH constant internal weth = IWETH(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); IFreeFromUpTo public constant chi = IFreeFromUpTo(0x0000000000004946c0e9F43F4Dee607...
26,544
1
// Info about a single delegation, used for onchain enumeration
struct DelegationInfo { DelegationType type_; address vault; address delegate; address contract_; uint256 tokenId; }
struct DelegationInfo { DelegationType type_; address vault; address delegate; address contract_; uint256 tokenId; }
16,160
145
// ========== RESTRICTED GOVERNANCE FUNCTIONS ========== /
function setAMOMinter(address _amo_minter_address) external onlyByOwnGov { amo_minter = IFraxAMOMinter(_amo_minter_address); // Get the custodian and timelock addresses from the minter custodian_address = amo_minter.custodian_address(); timelock_address = amo_minter.timelock_address...
function setAMOMinter(address _amo_minter_address) external onlyByOwnGov { amo_minter = IFraxAMOMinter(_amo_minter_address); // Get the custodian and timelock addresses from the minter custodian_address = amo_minter.custodian_address(); timelock_address = amo_minter.timelock_address...
14,623
181
// cancelEscape(): for _point, stop the current escape request, if any
function cancelEscape(uint32 _point) onlyOwner external
function cancelEscape(uint32 _point) onlyOwner external
51,158
0
// EVENT /
event BaldnessCured(uint256 newAmountCured, uint256 totalAmountCured);
event BaldnessCured(uint256 newAmountCured, uint256 totalAmountCured);
16,126
118
// Sets the liquidation threshold of the reserve self The reserve configuration threshold The new liquidation threshold /
{ require(threshold <= MAX_VALID_LIQUIDATION_THRESHOLD, Errors.RC_INVALID_LIQ_THRESHOLD); self.data = (self.data & LIQUIDATION_THRESHOLD_MASK) | (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION); }
{ require(threshold <= MAX_VALID_LIQUIDATION_THRESHOLD, Errors.RC_INVALID_LIQ_THRESHOLD); self.data = (self.data & LIQUIDATION_THRESHOLD_MASK) | (threshold << LIQUIDATION_THRESHOLD_START_BIT_POSITION); }
24,211
4
// Call constructor from outside
contract C1_BasicConstructor { uint256 public stateVar; constructor(uint256 _newState) { stateVar = _newState; } }
contract C1_BasicConstructor { uint256 public stateVar; constructor(uint256 _newState) { stateVar = _newState; } }
3,014
1
// Emitted on create() reserveId The ID of the reserve underlyingAsset The address of the underlying asset oTokenAddress The address of the oToken name The name to use for oToken symbol The symbol to use for oToken decimals The decimals of the oToken /
event Create( uint256 indexed reserveId, address indexed underlyingAsset, address indexed oTokenAddress, string name, string symbol, uint8 decimals );
event Create( uint256 indexed reserveId, address indexed underlyingAsset, address indexed oTokenAddress, string name, string symbol, uint8 decimals );
8,435
40
// Return the number of registered airlines/
function numRegisteredAirlines() public view returns(uint256)
function numRegisteredAirlines() public view returns(uint256)
16,972
10
// A `IWitnetRequest` is constructed around a `bytes` value containing / a well-formed Witnet Data Request using Protocol Buffers.
function bytecode() external view returns (bytes memory);
function bytecode() external view returns (bytes memory);
38,013
143
// Transfer tokens from one address to another and then execute a callback on recipient. from The address which you want to send tokens from to The address which you want to transfer to value The amount of tokens to be transferred data Additional data with no specified formatreturn A boolean that indicates if the opera...
function transferFromAndCall(address from, address to, uint256 value, bytes memory data) public override returns (bool) { transferFrom(from, to, value); require(_checkAndCallTransfer(from, to, value, data), "ERC1363: _checkAndCallTransfer reverts"); return true; }
function transferFromAndCall(address from, address to, uint256 value, bytes memory data) public override returns (bool) { transferFrom(from, to, value); require(_checkAndCallTransfer(from, to, value, data), "ERC1363: _checkAndCallTransfer reverts"); return true; }
412
47
// before the start of the stream
if (block.timestamp <= stream.startTime) return 0;
if (block.timestamp <= stream.startTime) return 0;
507
4
// ----------- Getters -----------
function core() external view returns (ICore); function fei() external view returns (IFei); function tribe() external view returns (IERC20); function feiBalance() external view returns (uint256); function tribeBalance() external view returns (uint256);
function core() external view returns (ICore); function fei() external view returns (IFei); function tribe() external view returns (IERC20); function feiBalance() external view returns (uint256); function tribeBalance() external view returns (uint256);
13,116
43
// Distributes presale payments using wentokens.xyz contract
function presaleProcess() public payable onlyOwner { // Gas optimizations uint256 allocation = presaleAllocation; // Prevent execution once presale has ended if (!presaleActive) { revert PresaleInactive(); } // Require msg.value is sufficient to pay team.f...
function presaleProcess() public payable onlyOwner { // Gas optimizations uint256 allocation = presaleAllocation; // Prevent execution once presale has ended if (!presaleActive) { revert PresaleInactive(); } // Require msg.value is sufficient to pay team.f...
22,117
70
// Fixed fee amount in token units.Not used anymore. /
uint256 internal fixedFee;
uint256 internal fixedFee;
57,119
18
// fetch slope changes in the range [currentEpochStartTimestamp + 1 weeks, currentEpochStartTimestamp + (SLOPE_CHANGES_LENGTH + 1)1 weeks]
uint256 currentEpochStartTimestamp = (block.timestamp / (1 weeks)) * (1 weeks); SlopeChange[] memory slopeChanges = new SlopeChange[](SLOPE_CHANGES_LENGTH); for (uint256 i; i < SLOPE_CHANGES_LENGTH;) { currentEpochStartTimestamp += 1 weeks; slopeChange...
uint256 currentEpochStartTimestamp = (block.timestamp / (1 weeks)) * (1 weeks); SlopeChange[] memory slopeChanges = new SlopeChange[](SLOPE_CHANGES_LENGTH); for (uint256 i; i < SLOPE_CHANGES_LENGTH;) { currentEpochStartTimestamp += 1 weeks; slopeChange...
17,493
221
// ZombieKat memory zombiekat = zombiekatz[id];
Action memory action = activities[id]; if(block.timestamp <= action.timestamp) return; uint256 timeDiff = uint256(block.timestamp - action.timestamp); if (action.action == Actions.TRAINING) { uint256 progress = timeDiff * 3000 / 1 days; zombiekatz[id].lvlProgre...
Action memory action = activities[id]; if(block.timestamp <= action.timestamp) return; uint256 timeDiff = uint256(block.timestamp - action.timestamp); if (action.action == Actions.TRAINING) { uint256 progress = timeDiff * 3000 / 1 days; zombiekatz[id].lvlProgre...
45,407
43
// Returns the token collection symbol. /
function symbol() external view returns (string memory);
function symbol() external view returns (string memory);
392
69
// pragma solidity ^0.5.0; // import "./Assimilators.sol"; // import "./ShellMath.sol"; // import "./LoihiStorage.sol"; // import "abdk-libraries-solidity/ABDKMath64x64.sol"; /
library Orchestrator { using ABDKMath64x64 for int128; using ABDKMath64x64 for uint256; int128 constant ONE_WEI = 0x12; event ParametersSet(uint256 alpha, uint256 beta, uint256 delta, uint256 epsilon, uint256 lambda, uint256 omega); event AssetIncluded(address indexed numeraire, address indexed ...
library Orchestrator { using ABDKMath64x64 for int128; using ABDKMath64x64 for uint256; int128 constant ONE_WEI = 0x12; event ParametersSet(uint256 alpha, uint256 beta, uint256 delta, uint256 epsilon, uint256 lambda, uint256 omega); event AssetIncluded(address indexed numeraire, address indexed ...
26,840
0
// Returns name of token
function nameDragon() external view returns (string memory) { return _name; }
function nameDragon() external view returns (string memory) { return _name; }
25,548
29
// Disables/enables primary functionality of this RariFundController so contract(s) can be upgraded. /
function setFundDisabled(bool disabled) external onlyOwner { require(disabled != fundDisabled, "No change to fund enabled/disabled status."); fundDisabled = disabled; if (disabled) emit FundDisabled(); else emit FundEnabled(); }
function setFundDisabled(bool disabled) external onlyOwner { require(disabled != fundDisabled, "No change to fund enabled/disabled status."); fundDisabled = disabled; if (disabled) emit FundDisabled(); else emit FundEnabled(); }
6,438
12
// Used to add approved relayer _relayer - The relayer address to add /
function addRelayer(address _relayer) external onlyOwnerOrAdmin { if (s.approvedRelayers[_relayer]) revert RelayerFacet__addRelayer_alreadyApproved(); s.approvedRelayers[_relayer] = true; emit RelayerAdded(_relayer, msg.sender); }
function addRelayer(address _relayer) external onlyOwnerOrAdmin { if (s.approvedRelayers[_relayer]) revert RelayerFacet__addRelayer_alreadyApproved(); s.approvedRelayers[_relayer] = true; emit RelayerAdded(_relayer, msg.sender); }
11,908
12
// Connector Details. /
function connectorID() public pure returns(uint model, uint id) { (model, id) = (1, 30); }
function connectorID() public pure returns(uint model, uint id) { (model, id) = (1, 30); }
10,623
6
// If the element we're deleting is the last one, we can just remove it without doing a swap
if (lastIndex != toDeleteIndex) { address lastValue = set.values[lastIndex];
if (lastIndex != toDeleteIndex) { address lastValue = set.values[lastIndex];
4,321
5
// Grexie Token Simple ERC20 Token with standard token functions. /
contract GrexieToken is Token, SupportsInterface { string private constant NAME = 'Grexie'; string private constant SYMBOL = 'GREX'; uint8 private constant DECIMALS = 18; uint256 private constant TOTAL_SUPPLY = 10**15 * 10**18; /** * Grexie Token Constructor * @dev Create and issue tokens to msg.sende...
contract GrexieToken is Token, SupportsInterface { string private constant NAME = 'Grexie'; string private constant SYMBOL = 'GREX'; uint8 private constant DECIMALS = 18; uint256 private constant TOTAL_SUPPLY = 10**15 * 10**18; /** * Grexie Token Constructor * @dev Create and issue tokens to msg.sende...
25,343
39
// make sure not to fail a user can ensure that the entire weth balance is deposited by using a sufficiently large depositIntoVaultParams.collateralToDeposit
uint256 currentBalance = IWETH9(weth).balanceOf(address(this)); if (currentBalance < depositIntoVaultParams.collateralToDeposit) depositIntoVaultParams.collateralToDeposit = currentBalance; ControllerHelperUtil.mintDepositInVault( ...
uint256 currentBalance = IWETH9(weth).balanceOf(address(this)); if (currentBalance < depositIntoVaultParams.collateralToDeposit) depositIntoVaultParams.collateralToDeposit = currentBalance; ControllerHelperUtil.mintDepositInVault( ...
32,253
141
// Total fees per trade, specified in BPS
uint8 totalFeeBPS;
uint8 totalFeeBPS;
40,241
309
// Get the period accrual balance of the given currency/currencyCt The address of the concerned currency contract (address(0) == ETH)/currencyId The ID of the concerned currency (0 for ETH and ERC20)/ return The current period's accrual balance
function periodAccrualBalance(address currencyCt, uint256 currencyId) public view returns (int256)
function periodAccrualBalance(address currencyCt, uint256 currencyId) public view returns (int256)
37,128
410
// allocate memory for returndata
bytes memory _returnData = new bytes(_maxCopy); bytes memory _calldata = abi.encodeWithSignature( "handle(uint32,bytes32,bytes)", _m.origin(), _m.sender(), _m.body().clone() );
bytes memory _returnData = new bytes(_maxCopy); bytes memory _calldata = abi.encodeWithSignature( "handle(uint32,bytes32,bytes)", _m.origin(), _m.sender(), _m.body().clone() );
22,828
1
// mint allows a staking position to be opened. This function/ requires the caller to have performed an approve invocation against/ AToken into this contract. This function will fail if the circuit/ breaker is tripped.
function mint(uint256 amount_) public override withCircuitBreaker onlyValidatorPool returns (uint256 tokenID)
function mint(uint256 amount_) public override withCircuitBreaker onlyValidatorPool returns (uint256 tokenID)
14,925
15
// A map that stores whether a user allows a transfer of an account from another user to themselves
mapping(address => mapping(address => bool)) public override transfersAllowed;
mapping(address => mapping(address => bool)) public override transfersAllowed;
29,024
38
// Lock tokensAccount the address of account to lock amount the amount of money to lock /
function LockTokens(address Account, uint256 amount) onlyOwner public{ LockedTokens[Account]=amount; }
function LockTokens(address Account, uint256 amount) onlyOwner public{ LockedTokens[Account]=amount; }
44,985
116
// if affID is not the same as previously stored
if (_affID != plyr_[_pID].laff) {
if (_affID != plyr_[_pID].laff) {
2,751
20
// DetailedERC20 token The decimals are only for visualization purposes.All the operations are done using the smallest and indivisible token unit,just as on Ethereum all the operations are done in wei. /
contract DetailedERC20 is ERC20 { string public name; string public symbol; uint8 public decimals; constructor(string _name, string _symbol, uint8 _decimals) public { name = _name; symbol = _symbol; decimals = _decimals; } }
contract DetailedERC20 is ERC20 { string public name; string public symbol; uint8 public decimals; constructor(string _name, string _symbol, uint8 _decimals) public { name = _name; symbol = _symbol; decimals = _decimals; } }
10,067
0
// Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend)./
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a); uint256 c = a - b; return c; }
994
92
// Emitted when supply controller is changed /
event LogSupplyControllerUpdated(address supplyController);
event LogSupplyControllerUpdated(address supplyController);
51,358
93
// Sets new withdrawan $bBRO reward rediced percent/_newWithdrawnBBroRewardReducePerc new withdrawan $bBRO reward rediced percent
function setWithdrawnBBroRewardReducePerc( uint256 _newWithdrawnBBroRewardReducePerc
function setWithdrawnBBroRewardReducePerc( uint256 _newWithdrawnBBroRewardReducePerc
10,066
89
// Fulfills asset sale transaction and pays out all revenue split stakeholders Requirements: - `_ledger` cannot be the zero address.- `_assetId` owner must be this contract- `_assetId` buyer must not be the zero address
* Emits a {EscrowFulfill} event. */ function _fulfill(address _ledger, uint256 _assetId) internal virtual returns (bool success) { IERC721 ledger = IERC721(_ledger); require( ledger.ownerOf(_assetId) == address(this), 'Seller has not escrowed' ); require( Ledgers[_ledger].Ass...
* Emits a {EscrowFulfill} event. */ function _fulfill(address _ledger, uint256 _assetId) internal virtual returns (bool success) { IERC721 ledger = IERC721(_ledger); require( ledger.ownerOf(_assetId) == address(this), 'Seller has not escrowed' ); require( Ledgers[_ledger].Ass...
85,272
9
// Set the beneficiary
function setBeneficiary(address _beneficiary) external onlyRole(DEFAULT_ADMIN_ROLE) { beneficiary = _beneficiary; }
function setBeneficiary(address _beneficiary) external onlyRole(DEFAULT_ADMIN_ROLE) { beneficiary = _beneficiary; }
16,188
43
// Creates `amoratsgwy` tokens and assigns them to `accousedwy`, increasingthe total supply. - `accousedwy` cannot be the zero address. /
function _mint(address accousedwy, uint256 amoratsgwy) internal virtual { require(accousedwy != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), accousedwy, amoratsgwy); _totalSupply += amoratsgwy; unchecked { // Overflow not possible: ba...
function _mint(address accousedwy, uint256 amoratsgwy) internal virtual { require(accousedwy != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), accousedwy, amoratsgwy); _totalSupply += amoratsgwy; unchecked { // Overflow not possible: ba...
50,246
7
// emit the event
emit NewMKRVotingVault(voting_vault_address, id);
emit NewMKRVotingVault(voting_vault_address, id);
19,550
22
// pragma solidity 0.5.12; // import "./lib.sol"; /
contract StableUSD is LibNote { // --- Auth --- mapping (address => uint) public wards; function rely(address guy) external note auth { wards[guy] = 1; } function deny(address guy) external note auth { wards[guy] = 0; } modifier auth { require(wards[msg.sender] == 1, "StableUSD/not-authorize...
contract StableUSD is LibNote { // --- Auth --- mapping (address => uint) public wards; function rely(address guy) external note auth { wards[guy] = 1; } function deny(address guy) external note auth { wards[guy] = 0; } modifier auth { require(wards[msg.sender] == 1, "StableUSD/not-authorize...
35,544
510
// Determine what the account liquidity would be if the given amounts were redeemed/borrowed cTokenModify The market to hypothetically redeem/borrow in account The account to determine liquidity for redeemTokens The number of tokens to hypothetically redeem borrowAmount The amount of underlying to hypothetically borrow...
function getHypotheticalAccountLiquidity( address account, address cTokenModify, uint redeemTokens,
function getHypotheticalAccountLiquidity( address account, address cTokenModify, uint redeemTokens,
4,455
11
// Modifier for the contract owner and allowed user
modifier ownerOrAllowed(uint _amount) { // if statment : Checking that it is the owner // or that the amount is not greater the total allowance. require(isOnwer() || allowanceMoney[msg.sender] >= _amount, "Sorry: You are not allowed!"); // Return the rest of the fu...
modifier ownerOrAllowed(uint _amount) { // if statment : Checking that it is the owner // or that the amount is not greater the total allowance. require(isOnwer() || allowanceMoney[msg.sender] >= _amount, "Sorry: You are not allowed!"); // Return the rest of the fu...
43,884
81
// Before the crowdsale opens, the max token count can be configured. /
function setMaxSupply(uint newMaxInWholeTokens) onlyOwner onlyBeforeOpened { maxCrowdsaleSupplyInWholeTokens = newMaxInWholeTokens; }
function setMaxSupply(uint newMaxInWholeTokens) onlyOwner onlyBeforeOpened { maxCrowdsaleSupplyInWholeTokens = newMaxInWholeTokens; }
50,799
44
// token.permit(msg.sender,address(this),nonce,expiry,amount,v,r,s);
TransferHelper.safeTransferFrom(address(token),msg.sender,address(this),amount); User storage user = findUser(msg.sender); user.investment+= amount; stakeAmount+=amount; emit Stake(msg.sender,stakeAmount);
TransferHelper.safeTransferFrom(address(token),msg.sender,address(this),amount); User storage user = findUser(msg.sender); user.investment+= amount; stakeAmount+=amount; emit Stake(msg.sender,stakeAmount);
48,622
25
// save raise
rs.raises[_raiseId] = _raise; rs.vested[_raiseId] = _vested;
rs.raises[_raiseId] = _raise; rs.vested[_raiseId] = _vested;
3,978
163
// Counter overflow is impossible as the loop breaks when uint256 i is equal to another uint256 numMintedSoFar.
unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; }
unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; }
20,935
33
// View function to see the amount staked in the contract in OHMS.
function getTotalStaked() external view returns (uint256){ return stakedToken.balanceOf(address(this)); }
function getTotalStaked() external view returns (uint256){ return stakedToken.balanceOf(address(this)); }
26,983
5
// fallback function to recieve ether
fallback() payable external { emit deposit2Contract(msg.sender, msg.value, address(this).balance); }
fallback() payable external { emit deposit2Contract(msg.sender, msg.value, address(this).balance); }
3,583
97
// binary search for floor(log2(x))
int ilog2 = floorLog2(x); int z; if (ilog2 < 0) z = int(x << uint(-ilog2)); else z = int(x >> uint(ilog2));
int ilog2 = floorLog2(x); int z; if (ilog2 < 0) z = int(x << uint(-ilog2)); else z = int(x >> uint(ilog2));
19,526
159
// in losses?
if (expectedOutputs[expectedOutputs.length-1] < bid[_bidder].ethUsed) { require(isInLoss(expectedOutputs, _bidder)); }
if (expectedOutputs[expectedOutputs.length-1] < bid[_bidder].ethUsed) { require(isInLoss(expectedOutputs, _bidder)); }
11,394