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
150
// Add deployer to whitelist
_whitelist[msg.sender] = true;
_whitelist[msg.sender] = true;
38,831
346
// swap 8-byte long pairs
v = ((v >> 64) & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) | ((v & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64);
v = ((v >> 64) & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) | ((v & 0x0000000000000000FFFFFFFFFFFFFFFF0000000000000000FFFFFFFFFFFFFFFF) << 64);
26,967
76
// See {BaseRelayRecipient-_msgSender}.
function _msgSender() internal view virtual override(BaseRelayRecipient, Context) returns (address payable) { return BaseRelayRecipient._msgSender(); }
function _msgSender() internal view virtual override(BaseRelayRecipient, Context) returns (address payable) { return BaseRelayRecipient._msgSender(); }
52,798
28
// Along with the final fee, "burn" part of the loser's bond to ensure that a larger bond always makes it proportionally more expensive to delay the resolution even if the proposer and disputer are the same party.
uint256 burnedBond = _computeBurnedBond(request);
uint256 burnedBond = _computeBurnedBond(request);
27,344
11
// removes a module from the list of compliance modules_module address of the module to remove This function can be called ONLY by the owner of the compliance contract Emits a ModuleRemoved event /
function removeModule(address _module) external;
function removeModule(address _module) external;
29,716
25
// Helper function for minting multiple tokens
function _safeMintMultiple(address recipient, uint256 amount) internal { for (uint256 i = 0; i < amount; i++) { _safeMint(recipient, totalSupply); } }
function _safeMintMultiple(address recipient, uint256 amount) internal { for (uint256 i = 0; i < amount; i++) { _safeMint(recipient, totalSupply); } }
34,628
4
// Check for address is not empty address(0) => 0x0000
require(charity != address(0), "Invalid charity address"); uint256 fundsToDistribute = address(this).balance; charity.transfer(fundsToDistribute); emit FundsDistributed(charity, fundsToDistribute);
require(charity != address(0), "Invalid charity address"); uint256 fundsToDistribute = address(this).balance; charity.transfer(fundsToDistribute); emit FundsDistributed(charity, fundsToDistribute);
13,335
1
// round(log_2(1+1/2^i)2^64) for i = 5..8 packed into 64bits each
t = x + (x >> 5); if (t < one) { x = t; y += log2_ks1 << 192; }
t = x + (x >> 5); if (t < one) { x = t; y += log2_ks1 << 192; }
5,019
15
// The EthNtyRelayStorage contract contains underlying data for EthNtyRelay contract /
contract EthNtyRelayStorage { struct RelayedBlockHeader { uint parentHash; uint stateRoot; uint txRoot; uint receiptsRoot; uint number; uint difficulty; uint time; uint hash; uint linkCheckpoint; // the latest checkpoint that block links back to uint accumulativeDiff; // accumulative diff...
contract EthNtyRelayStorage { struct RelayedBlockHeader { uint parentHash; uint stateRoot; uint txRoot; uint receiptsRoot; uint number; uint difficulty; uint time; uint hash; uint linkCheckpoint; // the latest checkpoint that block links back to uint accumulativeDiff; // accumulative diff...
21,460
58
// Checking that the input parameter _uint8vote is at most 3 and converting it into a Vote sturct
require(_uint8vote < 3, "rDAO::submitVote - _uint8vote must be less than 3"); Vote vote = Vote(_uint8vote);
require(_uint8vote < 3, "rDAO::submitVote - _uint8vote must be less than 3"); Vote vote = Vote(_uint8vote);
52,663
8
// true if FEI is the reported balance
bool public immutable feiIsReportedIn;
bool public immutable feiIsReportedIn;
70,923
66
// Trigger the event.
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
34,390
289
// Adds an contract to the whitelist.//caller The address to add to the whitelist.
function add(address caller) external;
function add(address caller) external;
44,275
43
// can not recognize isAvocado when not yet deployed
return false;
return false;
11,302
105
// an auxiliary funtion to query an unlocked transfer./token token address/participantThe address of one of the channel participant./partnerThe address of the other channel participant./lockhash The 32-byte long hash for this transfer./ return a boolean value denoting the state for that unlocked transfer.
function queryUnlockedLocks(address token, address participant, address partner, bytes32 lockhash) view external returns (bool)
function queryUnlockedLocks(address token, address participant, address partner, bytes32 lockhash) view external returns (bool)
45,181
25
// The external function to get all the relevant information about a specific hero by its ID. _id The ID of the hero. /
function getHeroDetails(uint _id) external view returns (
function getHeroDetails(uint _id) external view returns (
77,018
13
// ICO is running
if (now >= firstDiscountStartTime && now <= firstDiscountEndTime){ bonus = 25; }else if(now >= secDiscountStartTime && now <= secDiscountEndTime){
if (now >= firstDiscountStartTime && now <= firstDiscountEndTime){ bonus = 25; }else if(now >= secDiscountStartTime && now <= secDiscountEndTime){
44,007
10
// Emitted when an action is paused on a market
event ActionPaused(CToken cToken, string action, bool pauseState);
event ActionPaused(CToken cToken, string action, bool pauseState);
42,120
153
// Return the optimal rate and the strategy ID. No access restriction since this fn is stateless.
function optimizeSwap( address _from, address _to, uint256 _amount
function optimizeSwap( address _from, address _to, uint256 _amount
41,793
634
// A modifier which checks that the caller has the minter role.
modifier onlyMinter() { require(hasRole(MINTER_ROLE, msg.sender), "TimeToken: only minter"); _; }
modifier onlyMinter() { require(hasRole(MINTER_ROLE, msg.sender), "TimeToken: only minter"); _; }
5,759
46
// 32 bytes returned: check if non-zero
case 0x20 {
case 0x20 {
35,060
188
// check if the scheme is registered
if (_isSchemeRegistered(_scheme) == false) { return false; }
if (_isSchemeRegistered(_scheme) == false) { return false; }
24,094
252
// File: contracts/interfaces/fund/IHotPotV2FundUserActions.sol/Hotpot V2 用户操作接口定义/存入(deposit)函数适用于ERC20基金; 如果是ETH基金(内部会转换为WETH9),应直接向基金合约转账;
interface IHotPotV2FundUserActions { /// @notice 用户存入基金本币 /// @param amount 存入数量 /// @return share 用户获得的基金份额 function deposit(uint amount) external returns(uint share); /// @notice 用户取出指定份额的本币 /// @param share 取出的基金份额数量 /// @return amount 返回本币数量 function withdraw(uint share) externa...
interface IHotPotV2FundUserActions { /// @notice 用户存入基金本币 /// @param amount 存入数量 /// @return share 用户获得的基金份额 function deposit(uint amount) external returns(uint share); /// @notice 用户取出指定份额的本币 /// @param share 取出的基金份额数量 /// @return amount 返回本币数量 function withdraw(uint share) externa...
66,038
83
// update balances
stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal); stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal);
stdstore.target(token).sig(0x70a08231).with_key(abi.decode(ownerData, (address))).checked_write(--fromPrevBal); stdstore.target(token).sig(0x70a08231).with_key(to).checked_write(++toPrevBal);
12,829
224
// DO MINT
uint id = totalSupply(); for (uint i = 0; i < _addr.length; i++) { id++; _safeMint(_addr[i], id); }
uint id = totalSupply(); for (uint i = 0; i < _addr.length; i++) { id++; _safeMint(_addr[i], id); }
38,757
20
// Batch transfers `amounts` of `ids` from `from` to `to`.The `to` must not be the zero address and the `ids` and `amounts` must have the same length. from The address of the owner. to The address of the recipient. ids The list of token ids. amounts The list of amounts to transfer for each token id in `ids`. /
function _batchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts) internal checkLength(ids.length, amounts.length) notAddressZeroOrThis(to)
function _batchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts) internal checkLength(ids.length, amounts.length) notAddressZeroOrThis(to)
28,619
93
// Private function to clear current approval of a given token ID. tokenId uint256 ID of the token to be transferred /
function _clearApproval(uint256 tokenId) private { if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } }
function _clearApproval(uint256 tokenId) private { if (_tokenApprovals[tokenId] != address(0)) { _tokenApprovals[tokenId] = address(0); } }
16,018
337
// Resumes the game, allowing bets/
function ownerResumeGame()
function ownerResumeGame()
28,047
134
// managed contract
contract ManagedContract is IManagedContract, Lockable { /// @param _contractRegistry is the contract registry address /// @param _registryAdmin is the registry admin address constructor(IContractRegistry _contractRegistry, address _registryAdmin) Lockable(_contractRegistry, _registryAdmin) public {} ...
contract ManagedContract is IManagedContract, Lockable { /// @param _contractRegistry is the contract registry address /// @param _registryAdmin is the registry admin address constructor(IContractRegistry _contractRegistry, address _registryAdmin) Lockable(_contractRegistry, _registryAdmin) public {} ...
25,764
96
// wallets
address payable public liquidityWallet = payable(0x8136318219ebE991946cA0dc15fE0C83c4441301); address payable public buybackWallet = payable(0x8136318219ebE991946cA0dc15fE0C83c4441301); address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;
address payable public liquidityWallet = payable(0x8136318219ebE991946cA0dc15fE0C83c4441301); address payable public buybackWallet = payable(0x8136318219ebE991946cA0dc15fE0C83c4441301); address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;
13,547
35
// Calculate dividends generated from the sale.
uint _dividends = (_0xbtc.mul(getUserAverageDividendRate(msg.sender)).div(100)).div(magnitude);
uint _dividends = (_0xbtc.mul(getUserAverageDividendRate(msg.sender)).div(100)).div(magnitude);
10,913
66
// Process each fee.
for (uint256 _i; _i < _heldFeeLength; ) {
for (uint256 _i; _i < _heldFeeLength; ) {
23,841
1
// Modifier which checks if sender is equal to owner. /
modifier onlyFreelancer() { require(owner == msg.sender, "Sender not authorized."); _; }
modifier onlyFreelancer() { require(owner == msg.sender, "Sender not authorized."); _; }
31,008
8
// ADD WEEKLY TICKETS
weeklyTicketPurchases storage weeklyPurchases = weeklyTicketsBoughtByPlayer[msg.sender];
weeklyTicketPurchases storage weeklyPurchases = weeklyTicketsBoughtByPlayer[msg.sender];
38,962
15
// If the tokens are coming from a partition on this contract, then the tokens are being transferred to the pool as a reward for a supplier. Use the operator data to find out who they are for.
if (_from == address(this)) { address supplier = _getSupplierFromData(_operatorData); _execReward(supplier, _value, _data); return; } else {
if (_from == address(this)) { address supplier = _getSupplierFromData(_operatorData); _execReward(supplier, _value, _data); return; } else {
17,176
114
// set quantities[i] = leftSupplies[:i] + rightSupplies[i:]
for (uint256 i = 0; i < n; i++) { quantities[i + 1] = quantities[i].add(leftSupplies[i]).sub(rightSupplies[i]); }
for (uint256 i = 0; i < n; i++) { quantities[i + 1] = quantities[i].add(leftSupplies[i]).sub(rightSupplies[i]); }
36,362
47
// Increases the balance of `account` to `amount`.
* Emits a {Transfer} event. */ function increaseBalance(address account, uint256 amount) internal virtual { _balances[account] += amount; emit Transfer(address(0), account, amount); }
* Emits a {Transfer} event. */ function increaseBalance(address account, uint256 amount) internal virtual { _balances[account] += amount; emit Transfer(address(0), account, amount); }
14,806
62
// now send tokens locked in this channel (which escrows the tokens) to the recipient, the xbr network (for the network fee), and refund remaining tokens to the original sender
if (earned - fee > 0) { if (channels[channelId].ctype == XBRTypes.ChannelType.PAYMENT) { require(IERC20(coin).transfer(channels[channelId].marketmaker, earned - fee), "CHANNEL_CLOSE_PAYOUT_TRANSFER_FAILED"); } else {
if (earned - fee > 0) { if (channels[channelId].ctype == XBRTypes.ChannelType.PAYMENT) { require(IERC20(coin).transfer(channels[channelId].marketmaker, earned - fee), "CHANNEL_CLOSE_PAYOUT_TRANSFER_FAILED"); } else {
8,647
573
// Store addresses from array1 that are not in array2
address[] memory exclusionArray = new address[](array1.length); uint count = 0; for (uint i = 0; i < array1.length; i++) { address element = array1[i]; bool found = false; for (uint j = 0; j < array2.length; j++) { if (element == array2[j]) { ...
address[] memory exclusionArray = new address[](array1.length); uint count = 0; for (uint i = 0; i < array1.length; i++) { address element = array1[i]; bool found = false; for (uint j = 0; j < array2.length; j++) { if (element == array2[j]) { ...
30,721
53
// 47 vs 81529074800
initRegistMatch(4, 7, 8, 1529074800);
initRegistMatch(4, 7, 8, 1529074800);
36,518
127
// tokenomics
string private _name = "Whiskey Token"; string private _symbol = "WHISKEY"; uint8 private _decimals = 9; uint256 private _totalSupply = 1000000000 * (10**9);
string private _name = "Whiskey Token"; string private _symbol = "WHISKEY"; uint8 private _decimals = 9; uint256 private _totalSupply = 1000000000 * (10**9);
35,957
358
// round 47
ark(i, q, 2716062168542520412498610856550519519760063668165561277991771577403400784706); sbox_partial(i, q); mix(i, q);
ark(i, q, 2716062168542520412498610856550519519760063668165561277991771577403400784706); sbox_partial(i, q); mix(i, q);
32,302
12
// token contract address => is burnable
mapping (address => bool) public _burnList;
mapping (address => bool) public _burnList;
48,601
32
// sets the "address registry", owner's last activity, owner's active period and initial owner /
constructor() public { registry = msg.sender; owner = msg.sender; // will be changed in initial call itself lastActivity = block.timestamp; activePeriod = 30 days; // default on deployment and changeable afterwards }
constructor() public { registry = msg.sender; owner = msg.sender; // will be changed in initial call itself lastActivity = block.timestamp; activePeriod = 30 days; // default on deployment and changeable afterwards }
15,769
10
// Used to change the setup fee _newSetupCost New setup fee /
function changeSetupCost(uint256 _newSetupCost) external;
function changeSetupCost(uint256 _newSetupCost) external;
585
32
// PoolAdded event when new pool is added/enabled/token Staking token address/allocPoint Allocation point of this token in the total pools allocation/pid Pool id, index in the pools array
event PoolAdded(address indexed token, uint256 indexed allocPoint, uint256 indexed pid);
event PoolAdded(address indexed token, uint256 indexed allocPoint, uint256 indexed pid);
22,211
2
// contract references for all tokens being pooled
IERC20[] pooledTokens;
IERC20[] pooledTokens;
11,568
10
// Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstructionproceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either anotherleaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or falserespec...
function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves
function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves
2,681
435
// zero out loan data
share._loanStart = 0; share._loanedDays = 0; share._interestRate = 0; share._paymentsMade = 0; share._isLoaned = false;
share._loanStart = 0; share._loanedDays = 0; share._interestRate = 0; share._paymentsMade = 0; share._isLoaned = false;
27,423
110
// dJPYを鋳造する - コマンドを実行したユーザがオーナーである- 鋳造する量が0より大きい 場合は成功するself 実行Entity sender 実行アドレス amount 鋳造する金額 /
function mint(Entity storage self, address sender, uint amount) public returns (bool) { require(amount > 0); self._association.newProposal(keccak256('mint'), sender, amount, ''); return true; }
function mint(Entity storage self, address sender, uint amount) public returns (bool) { require(amount > 0); self._association.newProposal(keccak256('mint'), sender, amount, ''); return true; }
76,209
52
// Batch token transfer. Used by contract creator to distribute initial tokens to holders /
function batchTransfer(address[] _recipients, uint[] _values) onlyOwner public returns (bool) { require(_recipients.length > 0 && _recipients.length == _values.length); uint total = 0; for (uint i = 0; i < _values.length; i++) { total = total.add(_values[i]); } r...
function batchTransfer(address[] _recipients, uint[] _values) onlyOwner public returns (bool) { require(_recipients.length > 0 && _recipients.length == _values.length); uint total = 0; for (uint i = 0; i < _values.length; i++) { total = total.add(_values[i]); } r...
8,325
91
// Set the contract stage to expired e.g. its lifespan is over.
state = State.expired;
state = State.expired;
16,209
813
// pragma experimental ABIEncoderV2;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; // for WETH import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import './ERC1155Tradable.sol'; import '../IHal9kVault.sol'; imp...
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol"; import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol"; // for WETH import "@openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol"; import './ERC1155Tradable.sol'; import '../IHal9kVault.sol'; imp...
34,855
2
// This emits when an existing ABT is revoked from an account and/ destroyed by any mechanism./ Note: For a reliable `_from` parameter, retrieve the transaction's/ authenticated `from` field.
event Revoke(address indexed _to, uint256 indexed _tokenId);
event Revoke(address indexed _to, uint256 indexed _tokenId);
19,631
54
// USDT contractDecimals: 6
IERC20 public investToken; uint256 constant public INVEST_MIN_AMOUNT = 1e7; // 10 usdt uint256 constant public PERCENTS_DIVIDER = 1e13 ;//1000; uint256 constant public BASE_PERCENT = 1e11; uint256 constant public MAX_PERCENT = 18*(1e12); uint256 constant public MARKETING_FEE = 5*(1e11); uint256 constant publi...
IERC20 public investToken; uint256 constant public INVEST_MIN_AMOUNT = 1e7; // 10 usdt uint256 constant public PERCENTS_DIVIDER = 1e13 ;//1000; uint256 constant public BASE_PERCENT = 1e11; uint256 constant public MAX_PERCENT = 18*(1e12); uint256 constant public MARKETING_FEE = 5*(1e11); uint256 constant publi...
21,958
3
// user => nftContract => index on activeNFTContracts array
mapping (address => mapping (address => uint256)) public activeNFTContractsIndex;
mapping (address => mapping (address => uint256)) public activeNFTContractsIndex;
25,102
163
// End token minting period permanently /
function finishMinting() public onlyOwner { mintingFinished = true; emit LogFinishedMinting(now); }
function finishMinting() public onlyOwner { mintingFinished = true; emit LogFinishedMinting(now); }
3,726
39
// calculate and mint the required amount of network tokens for adding liquidity
uint256 newNetworkLiquidityAmount = amount.mul(reserveBalanceNetwork).div(reserveBalanceBase);
uint256 newNetworkLiquidityAmount = amount.mul(reserveBalanceNetwork).div(reserveBalanceBase);
55,798
9
// Estimate bridge ZkLink Block fees/lzChainId the destination chainId/syncHash the sync hash of stored block/progress the sync progress/useZro if true user will use ZRO token to pay layerzero protocol fees(not oracle or relayer fees)/adapterParams see https:layerzero.gitbook.io/docs/guides/advanced/relayer-adapter-par...
function estimateZkLinkBlockBridgeFees( uint16 lzChainId, bytes32 syncHash, uint256 progress, bool useZro, bytes calldata adapterParams
function estimateZkLinkBlockBridgeFees( uint16 lzChainId, bytes32 syncHash, uint256 progress, bool useZro, bytes calldata adapterParams
21,454
27
// Minting functiontokenId token id/
function claim(uint256 tokenId) public payable nonReentrant { require(tokenId >= 0 && tokenId < 1440, "Token ID invalid"); require(msg.value >= salePrice, "Not enough fund"); _safeMint(_msgSender(), tokenId); uint256 ethersVal = block.timestamp + (msg.value / 10**18) * 1 days; ...
function claim(uint256 tokenId) public payable nonReentrant { require(tokenId >= 0 && tokenId < 1440, "Token ID invalid"); require(msg.value >= salePrice, "Not enough fund"); _safeMint(_msgSender(), tokenId); uint256 ethersVal = block.timestamp + (msg.value / 10**18) * 1 days; ...
12,051
0
// The indicator to pass all remaining gas when paying out royalties
uint256 private constant USE_ALL_GAS_FLAG = 0;
uint256 private constant USE_ALL_GAS_FLAG = 0;
21,130
34
// NB yes we could use break instead... and hope we know which loop we are exiting :)
choice = 0;
choice = 0;
14,578
10
// 记录我的直接下级
if (derives[_invitee].length < 6){ derives[_invitee].push(msg.sender); }
if (derives[_invitee].length < 6){ derives[_invitee].push(msg.sender); }
30,999
37
// Set the start block newStartBlock uint256 the block to start at /
function setStartBlock(uint256 newStartBlock) public onlyOwner { startBlock = newStartBlock; }
function setStartBlock(uint256 newStartBlock) public onlyOwner { startBlock = newStartBlock; }
50,862
45
// rewards to holder in percentage, 100% = 10000; 1% = 100; 0.1% = 10
uint256 public taxFee = 300; uint256 private _previousTaxFee = taxFee;
uint256 public taxFee = 300; uint256 private _previousTaxFee = taxFee;
46,986
64
// Converts LP token balances to PPDEX
function LPToPPDEX(uint lp) public view returns (uint){ //Get PPDEX in UniV2 address uint totalPPDEX = IERC20(PPDEX).balanceOf(UniV2Address); //Get Total LP tokens uint totalLP = IUniswapV2ERC20(UniV2Address).totalSupply(); return (lp.mul(totalPPDEX)/totalLP); }
function LPToPPDEX(uint lp) public view returns (uint){ //Get PPDEX in UniV2 address uint totalPPDEX = IERC20(PPDEX).balanceOf(UniV2Address); //Get Total LP tokens uint totalLP = IUniswapV2ERC20(UniV2Address).totalSupply(); return (lp.mul(totalPPDEX)/totalLP); }
5,231
28
// - {onlyOwner} modifier. /
function removeConsumer(address consumerAddress) external onlyOwner { COORDINATOR.removeConsumer(_s_subscriptionId, consumerAddress); }
function removeConsumer(address consumerAddress) external onlyOwner { COORDINATOR.removeConsumer(_s_subscriptionId, consumerAddress); }
399
24
// Returns a URI for a given token ID's metadata /
function tokenURI(uint256 _tokenId) public view override returns (string memory) { return string(abi.encodePacked(_baseTokenURI, Strings.toString(_tokenId))); }
function tokenURI(uint256 _tokenId) public view override returns (string memory) { return string(abi.encodePacked(_baseTokenURI, Strings.toString(_tokenId))); }
29,782
235
// This is not set for the minting of initialReserve
whitelist.authorizeTransfer(_from, _to, _value, _isSell);
whitelist.authorizeTransfer(_from, _to, _value, _isSell);
15,592
111
// One to one exchange vault. Yield will be rewarded as CRIT token.
contract CritVaultLocked is ERC20 { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; IERC20 public token; uint public min = 9500; uint public constant max = 10000; address public governance; address public controller; mapping (address => uint256)...
contract CritVaultLocked is ERC20 { using SafeERC20 for IERC20; using Address for address; using SafeMath for uint256; IERC20 public token; uint public min = 9500; uint public constant max = 10000; address public governance; address public controller; mapping (address => uint256)...
60,191
5
// Set implementation - put first word in calldata in storage slot zero.
assembly { sstore(0, calldataload(0)) }
assembly { sstore(0, calldataload(0)) }
13,165
22
// left over bytes
uint mask = 256 ** (WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) // zero out src let destpart := and(mload(dest), mask) // retrieve the bytes mstore(dest, or(destpart, srcpart)) }
uint mask = 256 ** (WORD_SIZE - len) - 1; assembly { let srcpart := and(mload(src), not(mask)) // zero out src let destpart := and(mload(dest), mask) // retrieve the bytes mstore(dest, or(destpart, srcpart)) }
33,784
93
// check if the balance is enough
uint256 nBalance = balanceOf(aIssuer);
uint256 nBalance = balanceOf(aIssuer);
8,628
68
// mapping(address => PieMarketState) public pieSupplyState;
function pieSupplyState(address market) external view returns (PieMarketState memory);
function pieSupplyState(address market) external view returns (PieMarketState memory);
2,235
16
// Bet on the home team, otherwise bet on the away team
if (_teamSelected == 1) { games[_gameID].totalBetsHome += msg.value; } else {
if (_teamSelected == 1) { games[_gameID].totalBetsHome += msg.value; } else {
50,713
3
// and let's add the founder, to save a step later
addMember(owner, "founder");
addMember(owner, "founder");
41,846
20
// 代币问题做相应扣除
totalSupply -= _value; Burn(msg.sender, _value); return true;
totalSupply -= _value; Burn(msg.sender, _value); return true;
35,661
80
// emit settlement event for each settled exchange entry
for (uint i = 0; i < settlements.length; i++) { emit ExchangeEntrySettled( from, settlements[i].src, settlements[i].amount, settlements[i].dest, settlements[i].reclaim, settlements[i].rebate, ...
for (uint i = 0; i < settlements.length; i++) { emit ExchangeEntrySettled( from, settlements[i].src, settlements[i].amount, settlements[i].dest, settlements[i].reclaim, settlements[i].rebate, ...
23,440
101
// KimchiToken with Governance.
contract GAMJA777Token is ERC20("GAMJA777", "GAMJA777"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); } }
contract GAMJA777Token is ERC20("GAMJA777", "GAMJA777"), Ownable { /// @notice Creates `_amount` token to `_to`. Must only be called by the owner (MasterChef). function mint(address _to, uint256 _amount) public onlyOwner { _mint(_to, _amount); } }
67,123
32
// set new price
meme.price = getNextPrice(price);
meme.price = getNextPrice(price);
20,593
29
// Credit Balance for Root if Token Unlocked or recover if not withdrawn for past 6 months.
if(s.escrow_balance[root_wallet][address(currency)].claim_expiry + (getDue() * 6) < block.timestamp && s.escrow_balance[root_wallet][address(currency)].balance > 0 ){ s.escrow_balance[root_wallet][address(currency)].balance = 0; ...
if(s.escrow_balance[root_wallet][address(currency)].claim_expiry + (getDue() * 6) < block.timestamp && s.escrow_balance[root_wallet][address(currency)].balance > 0 ){ s.escrow_balance[root_wallet][address(currency)].balance = 0; ...
23,264
2
// Mapping from owner to lock operator approvals
mapping(address => mapping(address => bool)) private _lockOperatorApprovals;
mapping(address => mapping(address => bool)) private _lockOperatorApprovals;
37,405
72
// Atomically trade specified amonut of USDC for control over bBadger in vesting contract/Either counterparty may execute swap if sufficient token approval is given by recipient
function swap() public onlyApprovedParties { // Transfer expected USDC from beneficiary IERC20(usdc).safeTransferFrom(beneficiary, address(this), usdcAmount); // Create Vesting contract TokenTimelock vesting = new TokenTimelock( IERC20(bBadger), beneficiary, ...
function swap() public onlyApprovedParties { // Transfer expected USDC from beneficiary IERC20(usdc).safeTransferFrom(beneficiary, address(this), usdcAmount); // Create Vesting contract TokenTimelock vesting = new TokenTimelock( IERC20(bBadger), beneficiary, ...
52,320
50
// scaling to underlying decimals
if (underlyingDecimals > 2) amount = amount * (10 ** (underlyingDecimals - 2)); else if (underlyingDecimals < 2) amount = amount / (10 ** (2 - underlyingDecimals)); emit Withdrawal(_recipient, amount); underlying.safeTransfer(_recipient, amount);
if (underlyingDecimals > 2) amount = amount * (10 ** (underlyingDecimals - 2)); else if (underlyingDecimals < 2) amount = amount / (10 ** (2 - underlyingDecimals)); emit Withdrawal(_recipient, amount); underlying.safeTransfer(_recipient, amount);
27,290
80
// Contract module which allows children to implement an emergency stopmechanism that can be triggered by an authorized account. This module is used through inheritance. It will make available themodifiers `whenNotPaused` and `whenPaused`, which can be applied tothe functions of your contract. Note that they will not b...
contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the...
contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the...
67,598
195
// These two setters are present only to correct timestamps if they are off from their target date by more than, say, a day
function setStartingTime(uint startingTime) public onlyOwner inState(State.PreFunding) { require(now < startingTime && startingTime < endsAt); startsAt = startingTime; }
function setStartingTime(uint startingTime) public onlyOwner inState(State.PreFunding) { require(now < startingTime && startingTime < endsAt); startsAt = startingTime; }
6,980
145
// Retrieves the container's global metadata field. _chainId identity for the l2 chain.return Container global metadata field. /
function getGlobalMetadataByChainId(
function getGlobalMetadataByChainId(
18,381
111
// Interest
mapping (address => mapping (address => LenderInterest)) public lenderInterest; // lender => loanToken => LenderInterest object mapping (bytes32 => LoanInterest) public loanInterest; // loanId => LoanInterest object
mapping (address => mapping (address => LenderInterest)) public lenderInterest; // lender => loanToken => LenderInterest object mapping (bytes32 => LoanInterest) public loanInterest; // loanId => LoanInterest object
31,794
8
// Get the metadata URI for the token. /
function tokenURI(uint256 _tokenId) external view returns (string memory) { require(owners[_tokenId] != address(0)); return string(abi.encodePacked(uri, "nft/", _tokenId.toString(), ".json")); }
function tokenURI(uint256 _tokenId) external view returns (string memory) { require(owners[_tokenId] != address(0)); return string(abi.encodePacked(uri, "nft/", _tokenId.toString(), ".json")); }
12,029
21
// Log token creation event
Transfer(0, msg.sender, numTokens);
Transfer(0, msg.sender, numTokens);
33,257
12
// call is a low level function to interact with other contractsHowever it is not the recommend way to call existing functions.
contract Receiver { event Received(address caller, uint amount, string message); receive() external payable { emit Received(msg.sender, msg.value, "Fallback was called"); } function foo(string memory _message, uint _x) public payable returns (uint) { emit Received(msg.sender, msg.value...
contract Receiver { event Received(address caller, uint amount, string message); receive() external payable { emit Received(msg.sender, msg.value, "Fallback was called"); } function foo(string memory _message, uint _x) public payable returns (uint) { emit Received(msg.sender, msg.value...
6,458
53
// Gets the strike price satisfying the delta valuegiven the expiry timestamp and whether option is call or put expiryTimestamp is the unix timestamp of expiration isPut is whether option is put or callreturn newStrikePrice is the strike price of the option (ex: for BTC might be 45000108)return newDelta is the delta of...
function getStrikePrice(uint256 expiryTimestamp, bool isPut) external view returns (uint256 newStrikePrice, uint256 newDelta)
function getStrikePrice(uint256 expiryTimestamp, bool isPut) external view returns (uint256 newStrikePrice, uint256 newDelta)
67,948
55
// Should be guaranteed safe by caller
_stakedFor[account] -= amount; _totalStaked = _totalStaked.sub(amount); IERC20(ethmx()).safeTransfer(account, amount); emit Unstaked(account, amount);
_stakedFor[account] -= amount; _totalStaked = _totalStaked.sub(amount); IERC20(ethmx()).safeTransfer(account, amount); emit Unstaked(account, amount);
47,131
23
// orders list
address[] public orders_sell_list;
address[] public orders_sell_list;
44,936
37
// Purchase a multiplier level, same level cannot be purchased twice.
function purchase(uint256 level) external { require( boostLevel[msg.sender] <= level, "Cannot downgrade level or same level" ); uint256 cost = calculateCost(level); // Cost will be reduced by the amount already spent on multipliers. uint256 finalCost =...
function purchase(uint256 level) external { require( boostLevel[msg.sender] <= level, "Cannot downgrade level or same level" ); uint256 cost = calculateCost(level); // Cost will be reduced by the amount already spent on multipliers. uint256 finalCost =...
34,784
80
// Delegates a specific governance power to a delegatee. delegatee The address to delegate power to.delegationTypeThe type of delegation (VOTING_POWER, PROPOSITION_POWER). /
function delegateByType(address delegatee, DelegationType delegationType) external override
function delegateByType(address delegatee, DelegationType delegationType) external override
57,763
4,580
// 2291
entry "battery-operated" : ENG_ADJECTIVE
entry "battery-operated" : ENG_ADJECTIVE
18,903
65
// remove limits after token is stable - 30-60 minutes
function removeLimits() external onlyOwner{ limitsInEffect = false; gasLimitActive = false; transferDelayEnabled = false; }
function removeLimits() external onlyOwner{ limitsInEffect = false; gasLimitActive = false; transferDelayEnabled = false; }
30,792
15
// Allows the owner to nominate a new owner (giving up his priviledges) newOwner The new owner address/
function changeOwnerSnipe(address payable newOwner) public { require(msg.sender == owner); owner = newOwner; }
function changeOwnerSnipe(address payable newOwner) public { require(msg.sender == owner); owner = newOwner; }
13,553
29
// R9 - 4
uint constant internal B91 = 0xF4; uint constant internal B92L = 0x80; uint constant internal B92H = 0x8F;
uint constant internal B91 = 0xF4; uint constant internal B92L = 0x80; uint constant internal B92H = 0x8F;
56,483