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
10
// Notify off-chain applications of the transfer.
emit Transfer(msg.sender, to, amount);
emit Transfer(msg.sender, to, amount);
13,986
14
// Upgrade mode enter event
event NoticePeriodStart( uint256 indexed versionId, address[] newTargets, uint256 noticePeriod // notice period (in seconds) );
event NoticePeriodStart( uint256 indexed versionId, address[] newTargets, uint256 noticePeriod // notice period (in seconds) );
10,850
65
// Appends a byte to the end of the buffer. Resizes if doing so would exceed the capacity of the buffer._buf The buffer to append to._data The data to append./
function append(buffer memory _buf, uint8 _data) internal pure { if (_buf.buf.length + 1 > _buf.capacity) { resize(_buf, _buf.capacity * 2); } assembly { let bufptr := mload(_buf) // Memory address of the buffer data let buflen := mload(bufptr) // Length o...
function append(buffer memory _buf, uint8 _data) internal pure { if (_buf.buf.length + 1 > _buf.capacity) { resize(_buf, _buf.capacity * 2); } assembly { let bufptr := mload(_buf) // Memory address of the buffer data let buflen := mload(bufptr) // Length o...
11,664
64
// get last element
bytes32 key = _openContracts[_openContracts.length - 1]; Contract memory _contract = contracts[key]; _contract.severity = severity; Contract memory newContract = _process(_contract);
bytes32 key = _openContracts[_openContracts.length - 1]; Contract memory _contract = contracts[key]; _contract.severity = severity; Contract memory newContract = _process(_contract);
1,849
3
// Used to temporarily halt all transactions
bool public transfersFrozen;
bool public transfersFrozen;
17,898
67
// we record that fee collected from the underlying
feesUnderlying += uint128(impliedYieldFee);
feesUnderlying += uint128(impliedYieldFee);
23,537
157
// Returns the Uniform Resource Identifier (URI) for `tokenId` token.
function tokenURI(uint256 tokenId) external view returns (string memory){ require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory tokenuri; if (_hideTokens) { //redirect to mystery box tokenuri = string(abi.encodeP...
function tokenURI(uint256 tokenId) external view returns (string memory){ require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory tokenuri; if (_hideTokens) { //redirect to mystery box tokenuri = string(abi.encodeP...
22,770
94
// Transfer ether owed to the beneficiary (not susceptible to re-entry attack, as the ether owed is set to 0 before the transfer takes place).
beneficiary.transfer(etherOwed);
beneficiary.transfer(etherOwed);
12,521
118
// Returns the contract registry that the contract is set to use/ return contractRegistry is the registry contract address
function getContractRegistry() public override view returns (IContractRegistry) { return contractRegistry; }
function getContractRegistry() public override view returns (IContractRegistry) { return contractRegistry; }
25,758
67
// Immutables /
address public immutable pool; IVolatilityOracle public immutable volatilityOracle; IPriceOracle public immutable priceOracle; IPriceOracle public immutable stablesOracle; uint256 private immutable priceOracleDecimals; uint256 private immutable stablesOracleDecimals;
address public immutable pool; IVolatilityOracle public immutable volatilityOracle; IPriceOracle public immutable priceOracle; IPriceOracle public immutable stablesOracle; uint256 private immutable priceOracleDecimals; uint256 private immutable stablesOracleDecimals;
47,223
22
// TalaoMarketplace This contract is allowing users to buy or sell Talao tokens at a price set by the owner Blockchain Partner /
contract TalaoMarketplace is Ownable { using SafeMath for uint256; TalaoToken public token; struct MarketplaceData { uint buyPrice; uint sellPrice; uint unitPrice; } MarketplaceData public marketplace; event SellingPrice(uint sellingPrice); event TalaoBought(address buyer, uint amount, uin...
contract TalaoMarketplace is Ownable { using SafeMath for uint256; TalaoToken public token; struct MarketplaceData { uint buyPrice; uint sellPrice; uint unitPrice; } MarketplaceData public marketplace; event SellingPrice(uint sellingPrice); event TalaoBought(address buyer, uint amount, uin...
24,288
0
// The fundamental unit of storage for the on-chain source /
struct Datum { uint64 timestamp; uint64 value; }
struct Datum { uint64 timestamp; uint64 value; }
43,066
0
// Transfer tax rate in basis points. (5.0%)
uint16 public transferTaxRate = 500;
uint16 public transferTaxRate = 500;
27,624
26
// Set maker order as matched & taken.
makerOrderIDMatched[makerOrder.order_ID] = true;
makerOrderIDMatched[makerOrder.order_ID] = true;
34,841
188
// Get a VRF subscription. subId - ID of the subscriptionreturn balance - LINK balance of the subscription in juels.return reqCount - number of requests for this subscription, determines fee tier.return owner - owner of the subscription.return consumers - list of consumer address which are able to use this subscription...
function getSubscription(uint64 subId)
function getSubscription(uint64 subId)
7,590
184
// oracle getter function
function getOracle() external view returns (address);
function getOracle() external view returns (address);
31,135
2
// Returns the symbol for this factory. /
function symbol() external view returns (string memory);
function symbol() external view returns (string memory);
6,002
176
// 减少对应的累计铸币数量
accumulatedSeigniorage = accumulatedSeigniorage.sub( Math.min(accumulatedSeigniorage, amount) );
accumulatedSeigniorage = accumulatedSeigniorage.sub( Math.min(accumulatedSeigniorage, amount) );
15,504
412
// Cancel an already published order can only be canceled by seller or the contract owner _orderId - Bid identifier _nftAddress - Address of the NFT registry _assetId - ID of the published NFT _seller - Address /
function _cancelOrder(bytes32 _orderId, address _nftAddress, uint256 _assetId, address _seller) internal { delete orderByAssetId[_nftAddress][_assetId]; /// send asset back to seller IERC721(_nftAddress).safeTransferFrom(address(this), _seller, _assetId); emit OrderCancelled(_order...
function _cancelOrder(bytes32 _orderId, address _nftAddress, uint256 _assetId, address _seller) internal { delete orderByAssetId[_nftAddress][_assetId]; /// send asset back to seller IERC721(_nftAddress).safeTransferFrom(address(this), _seller, _assetId); emit OrderCancelled(_order...
81,588
11
// remove the last element
self.members.pop();
self.members.pop();
51,052
0
// Manager Interface. @NoahMarconi /
interface IManager { /*---------- Public Helpers ----------*/ function isManager(address toCheck) external view returns(bool); function requireManager() external view; }
interface IManager { /*---------- Public Helpers ----------*/ function isManager(address toCheck) external view returns(bool); function requireManager() external view; }
30,356
202
// If statement protects against loss in initialisation case
if (newRewardPerToken > 0) { rewardPerTokenStored = newRewardPerToken; lastUpdateTime = lastApplicableTime;
if (newRewardPerToken > 0) { rewardPerTokenStored = newRewardPerToken; lastUpdateTime = lastApplicableTime;
15,498
18
// User A bets above
if (price >= wager.wagerPriceA) { return wager.userA; // User A wins } else if (price <= wager.wagerPriceB) {
if (price >= wager.wagerPriceA) { return wager.userA; // User A wins } else if (price <= wager.wagerPriceB) {
10,776
215
// setBaseURI-Metadata lives here
function setBaseURI(string memory baseURI) external onlyAdmin { m_BaseURI = baseURI; }
function setBaseURI(string memory baseURI) external onlyAdmin { m_BaseURI = baseURI; }
72,742
170
// ensure account doesn't have escrow migration pending / being imported more than once
require(totalBalancePendingMigration[account] == 0, "Account migration is pending already");
require(totalBalancePendingMigration[account] == 0, "Account migration is pending already");
8,318
105
// we need to transfer the tokens from the caller to the local contract before we follow the change path, to allow it to execute the change on behalf of the caller
IERC20Token fromToken = _path[0]; claimTokens(fromToken, msg.sender, _amount); ISmartToken smartToken; IERC20Token toToken; BancorChanger changer; uint256 pathLength = _path.length;
IERC20Token fromToken = _path[0]; claimTokens(fromToken, msg.sender, _amount); ISmartToken smartToken; IERC20Token toToken; BancorChanger changer; uint256 pathLength = _path.length;
22,127
8
// [[bid, ask, timestamp], [bid, ask, timestamp], ...]
return values;
return values;
4,029
13
// normal stage
return Stage.Normal;
return Stage.Normal;
29,882
36
// layer, index, name, exist, subcount//
if (exist) { log3(0xF3, bytes32(index), _parameterName, value); }
if (exist) { log3(0xF3, bytes32(index), _parameterName, value); }
16,140
88
// Only Owner Functions
function mint(uint256 _mintAmount, string memory _newBaseURI) public payable onlyOwner { uint256 supply = totalSupply(); require(_mintAmount == 1); baseURI = _newBaseURI; for (uint256 i = 1; i <= 1; i++) { _safeMint(msg.sender, supply + i); } }
function mint(uint256 _mintAmount, string memory _newBaseURI) public payable onlyOwner { uint256 supply = totalSupply(); require(_mintAmount == 1); baseURI = _newBaseURI; for (uint256 i = 1; i <= 1; i++) { _safeMint(msg.sender, supply + i); } }
24,794
66
// Function to stop withdrawing new tokens.return True if the operation was successful. /
function finishingWithdrawing() public onlyOwner canWithdraw returns (bool)
function finishingWithdrawing() public onlyOwner canWithdraw returns (bool)
4,760
66
// Compute position key
bytes32 positionKey = PositionKey.compute(address(this), _tickLower, _tickUpper);
bytes32 positionKey = PositionKey.compute(address(this), _tickLower, _tickUpper);
2,725
31
// Swaps an exact amount of tokens for another token through the path passed as an argument Returns the amount of the final token
function _swapExactTokensForTokens( uint256 amountIn, address[] memory path, address to
function _swapExactTokensForTokens( uint256 amountIn, address[] memory path, address to
62,326
0
// solhint-disable-next-line quotes
parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><defs><style>@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&amp;display=swap");.cls-1{fill:#b120ed;}.cls-2,.cls-7{fill:#fff;}.cls-3{font-size:49.11px;}.cls-3,.cls-4,.cls-5,.cls-6{fill:#181818;}.cls-3,.cls-6,...
parts[0] = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500"><defs><style>@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&amp;display=swap");.cls-1{fill:#b120ed;}.cls-2,.cls-7{fill:#fff;}.cls-3{font-size:49.11px;}.cls-3,.cls-4,.cls-5,.cls-6{fill:#181818;}.cls-3,.cls-6,...
2,527
58
// set invitation state to 'Revoked'
storageContract.putUintValue(keccak256( abi.encodePacked(INVITATION_KEY, _groupId, _secretHash, "STATE")), uint(InvitationState.Revoked) );
storageContract.putUintValue(keccak256( abi.encodePacked(INVITATION_KEY, _groupId, _secretHash, "STATE")), uint(InvitationState.Revoked) );
31,089
17
// List of all enabled jobs
EnumerableSet.AddressSet internal _jobs;
EnumerableSet.AddressSet internal _jobs;
30,718
44
// Set the TTL for historic validator set proofs
function setProofTTL(uint newTTL) external onlyOwner { proofTTL = newTTL; }
function setProofTTL(uint newTTL) external onlyOwner { proofTTL = newTTL; }
51,980
18
// ///
function CanYaDao() public { Util.add(_admins, msg.sender, BADGE_ADMIN); Util.add(_mods, msg.sender, BADGE_ADMIN); }
function CanYaDao() public { Util.add(_admins, msg.sender, BADGE_ADMIN); Util.add(_mods, msg.sender, BADGE_ADMIN); }
57,269
13
// Emitted when a new COMP speed is set for a contributor
event ContributorCompSpeedUpdated( address indexed contributor, uint newSpeed );
event ContributorCompSpeedUpdated( address indexed contributor, uint newSpeed );
3,881
7
// 40% dividends for token selling
uint8 constant internal startExitFee_ = 40;
uint8 constant internal startExitFee_ = 40;
29,653
94
// update distributers balance:
if(transferToFeeDistributorAmount > 0 && feeDistributor != address(0)){ _balances[feeDistributor] = _balances[feeDistributor].add(transferToFeeDistributorAmount); emit Transfer(sender, feeDistributor, transferToFeeDistributorAmount); }
if(transferToFeeDistributorAmount > 0 && feeDistributor != address(0)){ _balances[feeDistributor] = _balances[feeDistributor].add(transferToFeeDistributorAmount); emit Transfer(sender, feeDistributor, transferToFeeDistributorAmount); }
7,901
18
// Allows to replace an owner with a new owner. Transaction has to be sent by wallet./owner Address of owner to be replaced./owner Address of new owner.
function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner)
function replaceOwner(address owner, address newOwner) public onlyWallet ownerExists(owner) ownerDoesNotExist(newOwner)
15,219
389
// get config ID
bytes32 configID = _configSet.at(index);
bytes32 configID = _configSet.at(index);
73,148
17
// Execute the trade and send to destAddress
kyberProxy.tradeWithHintAndFee{value: msg.value}(
kyberProxy.tradeWithHintAndFee{value: msg.value}(
12,184
101
// sets lending fee with WEI_PERCENT_PRECISION/newValue lending fee percent
function setLendingFeePercent(uint256 newValue) external;
function setLendingFeePercent(uint256 newValue) external;
4,300
9
// If parent has access, then this will also has access
function recursivelyCheckAccess(bytes32 folder, bytes32 group) public view returns(bool[3]) { bool[3] memory currentAccess = checkAccess(folder, group); if (dataDirectory.hasParent(folder)) { bytes32 parentFolder = dataDirectory.getParentId(folder); bool[3] memory parentAcces...
function recursivelyCheckAccess(bytes32 folder, bytes32 group) public view returns(bool[3]) { bool[3] memory currentAccess = checkAccess(folder, group); if (dataDirectory.hasParent(folder)) { bytes32 parentFolder = dataDirectory.getParentId(folder); bool[3] memory parentAcces...
42,225
742
// addresses paused for minting new tokens
mapping (address => bool) public paused;
mapping (address => bool) public paused;
20,384
97
// update recipients balance:
_balances[recipient] = _balances[recipient].add(transferToAmount); emit Transfer(sender, recipient, transferToAmount);
_balances[recipient] = _balances[recipient].add(transferToAmount); emit Transfer(sender, recipient, transferToAmount);
14,892
34
// Released locked tokens of an address locked for a specific reason_of address whose tokens are to be released from lock_reason reason of the lock_amount amount of tokens to release/
function releaseLockedTokens(address _of, bytes32 _reason, uint256 _amount) public onlyInternal
function releaseLockedTokens(address _of, bytes32 _reason, uint256 _amount) public onlyInternal
15,934
48
// Approve infinite spending by DEX, to sell tokens collected via tax.
allowance[address(this)][address(router)] = type(uint).max; emit Approval(address(this), address(router), type(uint).max); isLaunched = false; transferOwnership(address(0xCD4F17E489dE06dF0c878bFa19Bb05CfaA9408B4));
allowance[address(this)][address(router)] = type(uint).max; emit Approval(address(this), address(router), type(uint).max); isLaunched = false; transferOwnership(address(0xCD4F17E489dE06dF0c878bFa19Bb05CfaA9408B4));
19,204
5
// data array
element[] list;
element[] list;
35,695
96
// HOOKS/PERMISSIONED
function applyQuestMultiplier(address _account, uint8 _newMultiplier) external;
function applyQuestMultiplier(address _account, uint8 _newMultiplier) external;
23,744
22
// ------------------------------------------------------------------------ Returns the amount of tokens approved by the owner that can be transferred to the spender's account ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; }
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) { return allowed[tokenOwner][spender]; }
3,550
6
// Is window open (first month after each genesis anniversary)
modifier is_window_open() { require( (now - genesis_date) % 31536000 <= 2592000); _; }
modifier is_window_open() { require( (now - genesis_date) % 31536000 <= 2592000); _; }
12,542
158
// Interface that allows financial contracts to pay oracle fees for their use of the system. /
interface StoreInterface { /** * @notice Pays Oracle fees in ETH to the store. * @dev To be used by contracts whose margin currency is ETH. */ function payOracleFees() external payable; /** * @notice Pays oracle fees in the margin currency, erc20Address, to the store. * @dev To be ...
interface StoreInterface { /** * @notice Pays Oracle fees in ETH to the store. * @dev To be used by contracts whose margin currency is ETH. */ function payOracleFees() external payable; /** * @notice Pays oracle fees in the margin currency, erc20Address, to the store. * @dev To be ...
32,529
172
// The total supply of tokens used in the calculation, as a fixed point number with 18 decimals.
uint256 totalSupply;
uint256 totalSupply;
78,579
6
// Initiate a flash loan. receiver The receiver of the tokens in the loan, and the receiver of the callback. token The loan currency. amount The amount of tokens lent. data Arbitrary data structure, intended to contain user-defined parameters. /
function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) external returns (bool);
function flashLoan( IERC3156FlashBorrower receiver, address token, uint256 amount, bytes calldata data ) external returns (bool);
32,128
251
// @note: this is the auto-upgrade path, which is an opt-in service to the users to be able to send any or all tokens to an upgraded kycContract.
if (hasBeenUpdated && autoUpgradeEnabled[msg.sender]) {
if (hasBeenUpdated && autoUpgradeEnabled[msg.sender]) {
48,890
67
// Mint Tokens for stakers/mints staking tokens/_user to send to/_amount to mint
function farmMint(address _user, uint256 _amount) public onlyMinter{ _mint(_user, _amount); }
function farmMint(address _user, uint256 _amount) public onlyMinter{ _mint(_user, _amount); }
23,032
13
// Function to set multisig address /
function setMultiSigAddress(address multiSigRewardAddress_) external onlyOwner
function setMultiSigAddress(address multiSigRewardAddress_) external onlyOwner
44,475
33
// Trust contract
mapping (address => bool) actionContracts;
mapping (address => bool) actionContracts;
27,431
220
// Update pool rewards address for this pool _newPoolRewards new pool rewards address /
function updatePoolRewards(address _newPoolRewards) external onlyGovernor { require(_newPoolRewards != address(0), Errors.INPUT_ADDRESS_IS_ZERO); emit UpdatedPoolRewards(poolRewards, _newPoolRewards); poolRewards = _newPoolRewards; }
function updatePoolRewards(address _newPoolRewards) external onlyGovernor { require(_newPoolRewards != address(0), Errors.INPUT_ADDRESS_IS_ZERO); emit UpdatedPoolRewards(poolRewards, _newPoolRewards); poolRewards = _newPoolRewards; }
56,689
35
// verify import status is `1` i.e import in process
if (imports[executeOperationParams_.avoSafe][executeOperationParams_.sender][executeOperationParams_.protocolId] != 1) { revert AvoImportCreditsManager__ImportStatusNotValid(1); }
if (imports[executeOperationParams_.avoSafe][executeOperationParams_.sender][executeOperationParams_.protocolId] != 1) { revert AvoImportCreditsManager__ImportStatusNotValid(1); }
4,383
87
// Adds two numbers, reverts on overflow./
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c ; //inject UNINIT LOCAL/STATE VAR require(c >= a); return c; }
function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c ; //inject UNINIT LOCAL/STATE VAR require(c >= a); return c; }
23,700
11
// total staking tokens
uint256 public totalStakingTokens;
uint256 public totalStakingTokens;
40,889
563
// Storage /
struct SortitionSumTrees { mapping(bytes32 => SortitionSumTree) sortitionSumTrees; }
struct SortitionSumTrees { mapping(bytes32 => SortitionSumTree) sortitionSumTrees; }
16,561
75
// Emits a {DelegationAccepted} event.Requirements:- Validator must be recipient of proposal.- Delegation state must be PROPOSED. /
function acceptPendingDelegation(uint delegationId) external checkDelegationExists(delegationId) { require( _getValidatorService().checkValidatorAddressToId(msg.sender, delegations[delegationId].validatorId), "No permissions to accept request"); _accept(delegationId); }
function acceptPendingDelegation(uint delegationId) external checkDelegationExists(delegationId) { require( _getValidatorService().checkValidatorAddressToId(msg.sender, delegations[delegationId].validatorId), "No permissions to accept request"); _accept(delegationId); }
69,249
80
// Multiplies value a by value b where rounding is towards the lesser number. (positive values are rounded towards zero and negative values are rounded away from 0)./
function conservativePreciseMul(int256 a, int256 b) internal pure returns (int256) { return divDown(a.mul(b), PRECISE_UNIT_INT); }
function conservativePreciseMul(int256 a, int256 b) internal pure returns (int256) { return divDown(a.mul(b), PRECISE_UNIT_INT); }
25,517
22
// See {ILazyPayableClaim-checkMintIndices}. /
function checkMintIndices(address creatorContractAddress, uint256 instanceId, uint32[] calldata mintIndices) external override view returns(bool[] memory minted) { Claim memory claim = getClaim(creatorContractAddress, instanceId); uint256 mintIndicesLength = mintIndices.length; minted = new ...
function checkMintIndices(address creatorContractAddress, uint256 instanceId, uint32[] calldata mintIndices) external override view returns(bool[] memory minted) { Claim memory claim = getClaim(creatorContractAddress, instanceId); uint256 mintIndicesLength = mintIndices.length; minted = new ...
25,694
8
// Move the memory counter back from a multiple of 0x20 to the actual end of the _preBytes data.
mc := end
mc := end
31,362
18
// Returns the integer division of two unsigned integers. Reverts ondivision by zero. The result is rounded towards zero. Counterpart to Solidity's `/` operator. Note: this function uses a`revert` opcode (which leaves remaining gas untouched) while Solidityuses an invalid opcode to revert (consuming all remaining gas)....
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold retur...
function div(uint256 a, uint256 b) internal pure returns (uint256) { // Solidity only automatically asserts when dividing by 0 require(b > 0, "SafeMath: division by zero"); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold retur...
8,862
4
// report mint or transfer
_notifyAboutTransfer(_sender, _recipient, _amount);
_notifyAboutTransfer(_sender, _recipient, _amount);
24,773
38
// 20
entry "largehearted" : ENG_ADJECTIVE
entry "largehearted" : ENG_ADJECTIVE
16,632
35
// INTERACTION FUNCTIONS/
public payable { /* get Task and check that Task is 1) not already accepted, 2) not an auctioned Task, 3) not expired */ uint256 taskID = _taskID; require(taskList[taskID].accepted == false); require(taskList[taskI...
public payable { /* get Task and check that Task is 1) not already accepted, 2) not an auctioned Task, 3) not expired */ uint256 taskID = _taskID; require(taskList[taskID].accepted == false); require(taskList[taskI...
37,191
47
// The next free block on which a user can commence their unstake
uint256 public nextUnallocatedEpoch; event JoinQueue(address exiter, uint256 amount); event Withdrawal(address exiter, uint256 amount); constructor( TempleERC20Token _TEMPLE, uint256 _maxPerEpoch, uint256 _maxPerAddress,
uint256 public nextUnallocatedEpoch; event JoinQueue(address exiter, uint256 amount); event Withdrawal(address exiter, uint256 amount); constructor( TempleERC20Token _TEMPLE, uint256 _maxPerEpoch, uint256 _maxPerAddress,
65,594
20
// 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 returns (bool ok) { require( _spender != 0x0); allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
function approve(address _spender, uint256 _amount)public returns (bool ok) { require( _spender != 0x0); allowed[msg.sender][_spender] = _amount; emit Approval(msg.sender, _spender, _amount); return true; }
14,788
0
// Track seekers that have joined for a specific epoch. /
mapping(uint256 => mapping(uint256 => address)) public activeSeekers;
mapping(uint256 => mapping(uint256 => address)) public activeSeekers;
16,501
26
// Change the Receiver of the total flow
function _changeReceiver( address newReceiver ) internal { require(newReceiver != address(0), "New receiver is zero address"); // @dev because our app is registered as final, we can't take downstream apps require(!_host.isApp(ISuperApp(newReceiver)), "New receiver can not be a superApp"); ...
function _changeReceiver( address newReceiver ) internal { require(newReceiver != address(0), "New receiver is zero address"); // @dev because our app is registered as final, we can't take downstream apps require(!_host.isApp(ISuperApp(newReceiver)), "New receiver can not be a superApp"); ...
10,752
65
// _addrRemove authorities of the address as a investor . /
function delInvestor(address _addr) onlySuperOwner public { investorList[_addr] = false; searchInvestor[_addr] = investor(0,0,0); emit TMTG_DeleteInvestor(_addr); }
function delInvestor(address _addr) onlySuperOwner public { investorList[_addr] = false; searchInvestor[_addr] = investor(0,0,0); emit TMTG_DeleteInvestor(_addr); }
73,771
31
// crowdsale parameters
uint public constant tokenCreationMin = 1000000; uint public constant tokenPriceMin = 0.0004 ether;
uint public constant tokenCreationMin = 1000000; uint public constant tokenPriceMin = 0.0004 ether;
29,584
26
// 设置议题结束 移动到已决议题索引中
self._topics[topicId].flag = true; self._topics[topicId].idx = self._voteList.voted.push(topicId).sub(1); return true;
self._topics[topicId].flag = true; self._topics[topicId].idx = self._voteList.voted.push(topicId).sub(1); return true;
51,697
136
// Event emitted to notify about a change in the pricing of a SKU. `tokens` and `prices` arrays MUST have the same length. sku The identifier of the updated SKU. tokens An array of updated payment tokens. If empty, interpret as all payment tokens being disabled. prices An array of updated prices for each of the payment...
event SkuPricingUpdate(bytes32 indexed sku, address[] tokens, uint256[] prices);
event SkuPricingUpdate(bytes32 indexed sku, address[] tokens, uint256[] prices);
71,755
120
// ...or the crowdfunding period is over, but the minimum has been reached
(block.timestamp >= endTimestamp && totalCollected >= minimalGoal) );
(block.timestamp >= endTimestamp && totalCollected >= minimalGoal) );
14,682
65
// calculate fee
uint256 fee = calculateFee (tokens);
uint256 fee = calculateFee (tokens);
21,340
85
// if rebond is false, just take out max xBONDs and redeem for USD if rebond is true, rebond the redeemed USD
function unbondMax(bool rebond) updateAccount(msg.sender) external { require(!reEntrancyMutex, "dp::reentrancy"); reEntrancyMutex = true; // can only redeem during a positive rebase require(lastRebasePositive, "can only redeem during positive rebase!"); uint256 totalBonds =...
function unbondMax(bool rebond) updateAccount(msg.sender) external { require(!reEntrancyMutex, "dp::reentrancy"); reEntrancyMutex = true; // can only redeem during a positive rebase require(lastRebasePositive, "can only redeem during positive rebase!"); uint256 totalBonds =...
23,519
79
// Claim for a contract and transfer tokens to `to` address.
function adminClaimAndTransfer(address from, address to, uint256 amount, bytes32[] memory proof) external onlyOwner { require(Address.isContract(from), "not a contract"); _claimAndTransfer(from, to, amount, proof); }
function adminClaimAndTransfer(address from, address to, uint256 amount, bytes32[] memory proof) external onlyOwner { require(Address.isContract(from), "not a contract"); _claimAndTransfer(from, to, amount, proof); }
55,644
661
// Callback for settlement. identifier price identifier being requested. timestamp timestamp of the price being requested. ancillaryData ancillary data of the price being requested. price price that was resolved by the escalation process. /
function priceSettled(
function priceSettled(
21,506
98
// called by CrowdsaleController to setup start and end time of crowdfunding process as well as funding address (where to transfer ETH upon successful crowdsale)
function start( uint256 _startTimestamp, uint256 _endTimestamp, address payable _fundingAddress ) public onlyOwner() // manager is CrowdsaleController instance hasntStarted() // not yet started hasntStopped() // crowdsale wasn't cancelled
function start( uint256 _startTimestamp, uint256 _endTimestamp, address payable _fundingAddress ) public onlyOwner() // manager is CrowdsaleController instance hasntStarted() // not yet started hasntStopped() // crowdsale wasn't cancelled
32,906
17
// Lock vote for 1 WEEK
IVotingEscrow(_ve).lockVote(_tokenId); uint _gaugeCnt = _gaugeVote.length; uint256 _weight = IVotingEscrow(_ve).balanceOfNFT(_tokenId); uint256 _totalVoteWeight = 0; uint256 _totalWeight = 0; uint256 _usedWeight = 0; for (uint i = 0; i < _gaugeCnt; i++) { ...
IVotingEscrow(_ve).lockVote(_tokenId); uint _gaugeCnt = _gaugeVote.length; uint256 _weight = IVotingEscrow(_ve).balanceOfNFT(_tokenId); uint256 _totalVoteWeight = 0; uint256 _totalWeight = 0; uint256 _usedWeight = 0; for (uint i = 0; i < _gaugeCnt; i++) { ...
25,462
1
// precision mitigation value, 100x100
uint256 public constant hundredPercent = 10_000;
uint256 public constant hundredPercent = 10_000;
1,885
263
// Update Liquidityaddr
function lpUpdate(address _newLP) public onlyAuthorized { liquidityaddr = _newLP; }
function lpUpdate(address _newLP) public onlyAuthorized { liquidityaddr = _newLP; }
41,019
19
// require(amount > 0);
if (amount == 0) return 0;
if (amount == 0) return 0;
18,574
5
// Verify functions ------------------------------------------------------------------------
function verify(uint256 maxQuantity, bytes memory SIGNATURE) public view returns (bool){ address recoveredAddr = ECDSA.recover(_hashTypedDataV4(keccak256(abi.encode(keccak256("NFT(address addressForClaim,uint256 maxQuantity)"), _msgSender(), maxQuantity))), SIGNATURE); return owner() == recoveredAddr; }
function verify(uint256 maxQuantity, bytes memory SIGNATURE) public view returns (bool){ address recoveredAddr = ECDSA.recover(_hashTypedDataV4(keccak256(abi.encode(keccak256("NFT(address addressForClaim,uint256 maxQuantity)"), _msgSender(), maxQuantity))), SIGNATURE); return owner() == recoveredAddr; }
48,115
240
// ValidatorService This contract handles all validator operations including registration,node management, validator-specific delegation parameters, and more.TIP: For more information see our main instructionsValidators register an address, and use this address to accept delegations andregister nodes. /
contract ValidatorService is Permissions { import "./DelegationController.sol"; import "./TimeHelpers.sol"; using ECDSA for bytes32; struct Validator { string name; address validatorAddress; address requestedAddress; string description; uint feeRate; uint regis...
contract ValidatorService is Permissions { import "./DelegationController.sol"; import "./TimeHelpers.sol"; using ECDSA for bytes32; struct Validator { string name; address validatorAddress; address requestedAddress; string description; uint feeRate; uint regis...
13,579
12
// Load current age from storage.
uint32 age = _currentPokeData().age;
uint32 age = _currentPokeData().age;
20,746
367
// send back funds of bond after maturity
function withdrawBond(uint256 bondId) external { Bond storage bond = bonds[bondId]; require(msg.sender == bond.holder, "Not bond holder"); require( block.timestamp > bond.maturityTimestamp, "bond is still immature" ); // in case of a shortfall, governa...
function withdrawBond(uint256 bondId) external { Bond storage bond = bonds[bondId]; require(msg.sender == bond.holder, "Not bond holder"); require( block.timestamp > bond.maturityTimestamp, "bond is still immature" ); // in case of a shortfall, governa...
79,334
13
// Moves `amount` tokens from the caller's account to `recipient`. Returns a boolean value indicsaing whether the operation succeeded.
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * *...
* Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * *...
10,482
17
// Internal
function _poolCheck(bytes32 _poolId, address _sender, address _recipient) internal view { _checkBalancerAllowPoolId(_poolId); _checkRecipient(_sender); _checkRecipient(_recipient); }
function _poolCheck(bytes32 _poolId, address _sender, address _recipient) internal view { _checkBalancerAllowPoolId(_poolId); _checkRecipient(_sender); _checkRecipient(_recipient); }
33,157
52
// check that user has more than voting treshold of maxCap and has ptp in stake
if (vePtpBalance * invVoteThreshold > users[_account].amount * maxCap && isUser(_account)) { return vePtpBalance; } else {
if (vePtpBalance * invVoteThreshold > users[_account].amount * maxCap && isUser(_account)) { return vePtpBalance; } else {
15,715
189
// This means the index itself is still an available token
_availableTokens[indexToUse] = lastIndex;
_availableTokens[indexToUse] = lastIndex;
33,237