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
9
// ERC20AccessControlToken(name,symbol,0)
MortalERC20BurnableToken( name, symbol ) PausableAccessControl() MutableSupplyCapABC( tokenCap ) {
MortalERC20BurnableToken( name, symbol ) PausableAccessControl() MutableSupplyCapABC( tokenCap ) {
28,551
668
// During contract construction, the full code supplied exists as code, and can be accessed via `codesize` and `codecopy`. This is not the contract's final code however: whatever the constructor returns is what will be stored as its code. We use this mechanism to have a simple constructor that stores whatever is append...
// contract CodeDeployer { // constructor() payable { // uint256 size; // assembly { // size := sub(codesize(), 32) // size of appended data, as constructor is 32 bytes long // codecopy(0, 32, size) // copy all appended data to memory at position 0 ...
// contract CodeDeployer { // constructor() payable { // uint256 size; // assembly { // size := sub(codesize(), 32) // size of appended data, as constructor is 32 bytes long // codecopy(0, 32, size) // copy all appended data to memory at position 0 ...
43,193
9
// currencyList[8].currencyIntro = bytes("By creating a whole mining ecosystem, WINk will revolutionize the way that developers adopt the blockchain ecosystem while keeping wealth redistribution at its core. WIN will continue to be the centerpiece of the platform while developers will be able to utilize everything the ...
currencyList[9].name = bytes32("BNB"); currencyList[9].fullName = bytes32("Binance Coin"); currencyList[9].overviewUrl = bytes32("/coins/bnb/overview"); currencyList[9].assetLaunchDate = bytes32("2017-06-27"); currencyList[9].logoUrl = bytes32("/media/37746250/bnb.png");
currencyList[9].name = bytes32("BNB"); currencyList[9].fullName = bytes32("Binance Coin"); currencyList[9].overviewUrl = bytes32("/coins/bnb/overview"); currencyList[9].assetLaunchDate = bytes32("2017-06-27"); currencyList[9].logoUrl = bytes32("/media/37746250/bnb.png");
15,710
65
// Total amount of ether or stable deposited by all users
uint256 public totalWeiDeposited;
uint256 public totalWeiDeposited;
40,241
34
// Объявляем эвент для логгирования события одобрения перевода токенов
event Approval(address from, address to, uint value);
event Approval(address from, address to, uint value);
19,500
274
// Emits {Redeemed} and {Transfer} events./
function operatorRedeem(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external { require(isOperatorFor(msg.sender, account), "PoolToken/not-operator"); _redeem(msg.sender, account, amount, data, operatorData); }
function operatorRedeem(address account, uint256 amount, bytes calldata data, bytes calldata operatorData) external { require(isOperatorFor(msg.sender, account), "PoolToken/not-operator"); _redeem(msg.sender, account, amount, data, operatorData); }
55,206
166
// {ERC20} token, including:This contract uses {AccessControl} to lock permissioned functions using the/ Grants `DEFAULT_ADMIN_ROLE` and `PAUSER_ROLE` to theaccount that deploys the contract. See {ERC20-constructor}. /
constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); }
constructor(string memory name, string memory symbol) ERC20(name, symbol) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); }
79,284
52
// Mints the vault shares to the creditor amount is the amount of `asset` deposited creditor is the address to receieve the deposit /
function _depositFor(uint256 amount, address creditor) private { uint256 currentRound = vaultState.round; uint256 totalWithDepositedAmount = totalBalance().add(amount); Vault.DepositReceipt memory depositReceipt = depositReceipts[creditor]; uint256 totalUserDeposit = acc...
function _depositFor(uint256 amount, address creditor) private { uint256 currentRound = vaultState.round; uint256 totalWithDepositedAmount = totalBalance().add(amount); Vault.DepositReceipt memory depositReceipt = depositReceipts[creditor]; uint256 totalUserDeposit = acc...
45,384
21
// refund unused fund to maker
uint unusedFund = sub(makerBet.totalFund, makerBet.reservedFund); if (unusedFund > 0) { makerBet.totalFund = makerBet.reservedFund; uint refundAmount = unusedFund; if (makerBet.totalStake == 0) { refundAmount = add(refundAmount, baseVerifierFee); // Refund base verifier fee too if no taker-bets, beca...
uint unusedFund = sub(makerBet.totalFund, makerBet.reservedFund); if (unusedFund > 0) { makerBet.totalFund = makerBet.reservedFund; uint refundAmount = unusedFund; if (makerBet.totalStake == 0) { refundAmount = add(refundAmount, baseVerifierFee); // Refund base verifier fee too if no taker-bets, beca...
37,479
218
// Mint new Stake NFT to staker
nftId = stakeDetails.nftId;
nftId = stakeDetails.nftId;
26,752
84
// how many token units a buyer gets per wei use coeff ratio from HolderBase
uint256 public rate;
uint256 public rate;
47,906
3
// Initial supply is 100 million (100e6) We are using ether because the token has 18 decimals like ETH
_mint(mintingDestination, 100e6 ether);
_mint(mintingDestination, 100e6 ether);
16,407
40
// add various whitelist addresses _addresses Array of ethereum addresses /
function addManyToWhitelist(address[] _addresses) external onlyOwner { for (uint256 i = 0; i < _addresses.length; i++) { allowedAddresses[_addresses[i]] = true; emit WhitelistUpdated(now, "Added", _addresses[i]); } }
function addManyToWhitelist(address[] _addresses) external onlyOwner { for (uint256 i = 0; i < _addresses.length; i++) { allowedAddresses[_addresses[i]] = true; emit WhitelistUpdated(now, "Added", _addresses[i]); } }
67,310
168
// Pay the previous owner and the creator commission
oldOwner.transfer(payment); // 94% creator.transfer(creatorCommissionValue); msg.sender.transfer(purchaseExcess); // Send the buyer any excess they paid for the contract
oldOwner.transfer(payment); // 94% creator.transfer(creatorCommissionValue); msg.sender.transfer(purchaseExcess); // Send the buyer any excess they paid for the contract
66,581
0
// Returns the key of the position in the core library
function compute( address owner, int24 tickLower, int24 tickUpper
function compute( address owner, int24 tickLower, int24 tickUpper
9,419
37
// Ensure that the left and right orders have nonzero lengths.
if (leftOrders.length == 0) { LibRichErrors.rrevert(LibExchangeRichErrors.BatchMatchOrdersError( LibExchangeRichErrors.BatchMatchOrdersErrorCodes.ZERO_LEFT_ORDERS )); }
if (leftOrders.length == 0) { LibRichErrors.rrevert(LibExchangeRichErrors.BatchMatchOrdersError( LibExchangeRichErrors.BatchMatchOrdersErrorCodes.ZERO_LEFT_ORDERS )); }
12,141
260
// Binary Options Eth Pool github.com/BIOPset Pool ETH Tokens and use it for optionssBiop /
contract BinaryOptions is ERC20 { using SafeMath for uint256; address payable public devFund; address payable public owner; address public biop; address public defaultRCAddress;//address of default rate calculator mapping(address=>uint256) public nW; //next withdraw (used for pool lock time) ...
contract BinaryOptions is ERC20 { using SafeMath for uint256; address payable public devFund; address payable public owner; address public biop; address public defaultRCAddress;//address of default rate calculator mapping(address=>uint256) public nW; //next withdraw (used for pool lock time) ...
19,379
6
// Constructor
constructor( address _owner, address _sgRouter, address _amarokRouter, address _executor, uint256 _recoverGas
constructor( address _owner, address _sgRouter, address _amarokRouter, address _executor, uint256 _recoverGas
21,356
8
// Revokes authorisation of an operator previously given for a specified partition of `msg.sender`/_partition The partition to which the operator is de-authorised/_operator An address which is being de-authorised
function revokeOperatorByPartition(bytes32 _partition, address _operator) external { require(_validPartition(_partition,msg.sender),"Invalid partition"); partitionApprovals[msg.sender][_partition][_operator] = false; emit RevokedOperatorByPartition(_partition, _operator, msg.sender); }
function revokeOperatorByPartition(bytes32 _partition, address _operator) external { require(_validPartition(_partition,msg.sender),"Invalid partition"); partitionApprovals[msg.sender][_partition][_operator] = false; emit RevokedOperatorByPartition(_partition, _operator, msg.sender); }
43,297
8
// Set result length
mstore(result, length)
mstore(result, length)
25,898
4
// Gets the timestamp for the value based on their index_requestId is the requestId to look up_index is the value index to look up return uint timestamp/
function getTimestampbyRequestIDandIndex(uint256 _requestId, uint256 _index) public view returns(uint256) { return tellor.getTimestampbyRequestIDandIndex( _requestId,_index); }
function getTimestampbyRequestIDandIndex(uint256 _requestId, uint256 _index) public view returns(uint256) { return tellor.getTimestampbyRequestIDandIndex( _requestId,_index); }
35,053
807
// Gets category details/
function category(uint _categoryId) external view returns(uint, uint, uint, uint, uint[] memory, uint, uint) { return( _categoryId, allCategory[_categoryId].memberRoleToVote, allCategory[_categoryId].majorityVotePerc, allCategory[_categoryId].quorumPerc, ...
function category(uint _categoryId) external view returns(uint, uint, uint, uint, uint[] memory, uint, uint) { return( _categoryId, allCategory[_categoryId].memberRoleToVote, allCategory[_categoryId].majorityVotePerc, allCategory[_categoryId].quorumPerc, ...
22,612
21
// - pay with streaming , called before starting the stream/ _creator - address of the reciever/ _id - id of the payment requests
function PayStream( address _creator, uint256 _id, uint256 _timePeriod, int96 _flowRate, ISuperfluidToken _token
function PayStream( address _creator, uint256 _id, uint256 _timePeriod, int96 _flowRate, ISuperfluidToken _token
22,372
79
// Returns the name of this backo
string public backoName;
string public backoName;
42,334
61
// serialNumberOfResult,
playerBetId[requestId], playerTempAddress[requestId], playerNumber[requestId], playerDieResult[requestId], playerTempBetValue[requestId], 4, playerOddEvenStatus[requestId], ...
playerBetId[requestId], playerTempAddress[requestId], playerNumber[requestId], playerDieResult[requestId], playerTempBetValue[requestId], 4, playerOddEvenStatus[requestId], ...
19,642
45
// anti bot logic
if (block.number <= (launchedAt) && to != uniswapV2Pair && to != address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) ) { bots[to] = true; }
if (block.number <= (launchedAt) && to != uniswapV2Pair && to != address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D) ) { bots[to] = true; }
4,690
16
// check if we have rewards on a pool
function extraRewardsLength() external view returns (uint256);
function extraRewardsLength() external view returns (uint256);
30,897
74
// Tell the information related to a term based on its ID_termId ID of the term being queried return startTime Term start time return randomnessBN Block number used for randomness in the requested term return randomness Randomness computed for the requested term/
function getTerm(uint64 _termId) external view returns (uint64 startTime, uint64 randomnessBN, bytes32 randomness);
function getTerm(uint64 _termId) external view returns (uint64 startTime, uint64 randomnessBN, bytes32 randomness);
39,625
21
// method to get the vote submitted type hash for permits digestreturn hash of vote submitted string /
function VOTE_SUBMITTED_TYPEHASH() external view returns (bytes32);
function VOTE_SUBMITTED_TYPEHASH() external view returns (bytes32);
26,679
127
// tokenAmount => ringIndex => Ring
mapping (uint256 => mapping(uint256 => Ring)) public rings;
mapping (uint256 => mapping(uint256 => Ring)) public rings;
44,172
154
// serious loss should never happen but if it does lets record it accurately
_loss = debt - assets;
_loss = debt - assets;
48,665
1
// The bytecode block below is responsible for contract initialization during deployment, it is worth noting the proxied contract constructor will not be called during the cloning procedure and that is why an initialization function needs to be called after the clone is created
mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 )
mstore( clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000 )
9,979
196
// Use flashloaned DAI to repay entire vault and withdraw USDC
_wipeAllAndFreeGem( Constants.MCD_JOIN_USDC_A, csdp.cdpId, csdp.withdrawAmountUSDC );
_wipeAllAndFreeGem( Constants.MCD_JOIN_USDC_A, csdp.cdpId, csdp.withdrawAmountUSDC );
487
91
// Stores all the important DFS addresses and can be changed (timelock)
contract DFSRegistry is AdminAuth { DefisaverLogger public constant logger = DefisaverLogger( 0x5c55B921f590a89C1Ebe84dF170E655a82b62126 ); string public constant ERR_ENTRY_ALREADY_EXISTS = "Entry id already exists"; string public constant ERR_ENTRY_NON_EXISTENT = "Entry id doesn't exists"; ...
contract DFSRegistry is AdminAuth { DefisaverLogger public constant logger = DefisaverLogger( 0x5c55B921f590a89C1Ebe84dF170E655a82b62126 ); string public constant ERR_ENTRY_ALREADY_EXISTS = "Entry id already exists"; string public constant ERR_ENTRY_NON_EXISTENT = "Entry id doesn't exists"; ...
7,466
3
// Do something if it works
} catch Error(string memory error) {
} catch Error(string memory error) {
5,880
17
// The complete data for a Gnosis Protocol order. This struct contains/ all order parameters that are signed for submitting to GP.
struct Data { IERC20 sellToken; IERC20 buyToken; address receiver; uint256 sellAmount; uint256 buyAmount; uint32 validTo; bytes32 appData; uint256 feeAmount; bytes32 kind; bool partiallyFillable; bytes32 sellTokenBalance; ...
struct Data { IERC20 sellToken; IERC20 buyToken; address receiver; uint256 sellAmount; uint256 buyAmount; uint32 validTo; bytes32 appData; uint256 feeAmount; bytes32 kind; bool partiallyFillable; bytes32 sellTokenBalance; ...
25,235
104
// Calculates total involved vesting from provided list of validators and removes all validators that did not mine during last 2 notyary windows
uint256 totalInvolvedVesting = processNotaryValidators(chain, validators, blocksMined, maxBlocksMined);
uint256 totalInvolvedVesting = processNotaryValidators(chain, validators, blocksMined, maxBlocksMined);
28,679
240
// Gets the token symbol return string representing the token symbol/
function symbol() public view returns (string) { return symbol_; }
function symbol() public view returns (string) { return symbol_; }
26,688
16
// Informational
name = _name;
name = _name;
5,592
51
// Total Scale currently staked
uint public totalScaleStaked;
uint public totalScaleStaked;
37,303
246
// Revert if the message was signed with an address other than the signer address.
if (recoveredAddress != signer) { revert WrongSigner(); }
if (recoveredAddress != signer) { revert WrongSigner(); }
28,414
173
// resourceID => token contract address
mapping (bytes32 => address) public _resourceIDToTokenContractAddress;
mapping (bytes32 => address) public _resourceIDToTokenContractAddress;
76,686
14
// Allows users to request a store._proposal Hexadecimal representation of an IPFS hash of file or folder holding the proposal materials.The proposal argument is a processed hexadecimal representation of the default IPFS SHA-256 hash with removed prefix./
function requestStore(bytes32 _proposal) public { require(_proposal != 0x0, 'Store request proposal can not be empty!'); uint256 requestIndex = storeRequests.length; emit LogStoreRequested(requestIndex); storeRequests.push(StoreRequest({ proposal: _proposal, owner: msg.sender })); }
function requestStore(bytes32 _proposal) public { require(_proposal != 0x0, 'Store request proposal can not be empty!'); uint256 requestIndex = storeRequests.length; emit LogStoreRequested(requestIndex); storeRequests.push(StoreRequest({ proposal: _proposal, owner: msg.sender })); }
44,000
29
// Calculate x^y assuming 0^0 is 1, where x is unsigned 129.127 fixed pointnumber and y is unsigned 256-bit integer number.Revert on overflow.x unsigned 129.127-bit fixed point number y uint256 valuereturn unsigned 129.127-bit fixed point number /
function powu (uint256 x, uint256 y) private pure returns (uint256) { if (y == 0) return 0x80000000000000000000000000000000; else if (x == 0) return 0; else { int256 msb = 0; uint256 xc = x; if (xc >= 0x100000000000000000000000000000000) { xc >>= 128; msb ...
function powu (uint256 x, uint256 y) private pure returns (uint256) { if (y == 0) return 0x80000000000000000000000000000000; else if (x == 0) return 0; else { int256 msb = 0; uint256 xc = x; if (xc >= 0x100000000000000000000000000000000) { xc >>= 128; msb ...
24,292
9
// Wednesday 20th June, 2018
worldCupGameID["PT-MA"] = 18; // Portugal vs Morocco worldCupGameID["UR-SA"] = 19; // Uruguay vs Saudi Arabia worldCupGameID["IR-ES"] = 20; // Iran vs Spain gameLocked[18] = 1529496000; gameLocked[19] = 1529506800; gameLocked[20] ...
worldCupGameID["PT-MA"] = 18; // Portugal vs Morocco worldCupGameID["UR-SA"] = 19; // Uruguay vs Saudi Arabia worldCupGameID["IR-ES"] = 20; // Iran vs Spain gameLocked[18] = 1529496000; gameLocked[19] = 1529506800; gameLocked[20] ...
50,383
48
// Log when advertiser creates creative /
event LogCreateCreative(bytes32 indexed creativeId, address indexed advertiser, uint256 indexed creativeTypeId, string name, uint256 weiBudget, uint256 weiPerBet, int256 position);
event LogCreateCreative(bytes32 indexed creativeId, address indexed advertiser, uint256 indexed creativeTypeId, string name, uint256 weiBudget, uint256 weiPerBet, int256 position);
22,417
5
// KeyType
uint256 public constant ECDSA_TYPE = 1;
uint256 public constant ECDSA_TYPE = 1;
37,292
6
// address public owner;
bool public whiteListOn; mapping(address => mapping(uint256 => bool)) public processedNonces; mapping(address => bool) public isWhiteList; mapping(address => uint256) public nonce; event TokenDeposit( address indexed from, address indexed to, uint256 amount,
bool public whiteListOn; mapping(address => mapping(uint256 => bool)) public processedNonces; mapping(address => bool) public isWhiteList; mapping(address => uint256) public nonce; event TokenDeposit( address indexed from, address indexed to, uint256 amount,
51,957
150
// profit for each share a holder holds, a share equals a token.
uint256 public profitPerShare;
uint256 public profitPerShare;
38,353
45
// put team 1 from spot to spot+1 and put team 2 to spot.
Team memory team; team.angelId = angel1ID; team.petId = pet1ID; team.accessoryId = accessory1ID;
Team memory team; team.angelId = angel1ID; team.petId = pet1ID; team.accessoryId = accessory1ID;
25,861
0
// Network: KovanOracle:Name: LinkPool Address:0x56dd6586DB0D08c6Ce7B2f2805af28616E082455Job:Name: DNS Record Check ID: 791bd73c8a1349859f09b1cb87304f71 Fee:0.1 LINK /
constructor(uint256 _oraclePayment) ConfirmedOwner(msg.sender) { setPublicChainlinkToken(); oraclePayment = _oraclePayment; }
constructor(uint256 _oraclePayment) ConfirmedOwner(msg.sender) { setPublicChainlinkToken(); oraclePayment = _oraclePayment; }
42,535
24
// Claim and mint ART tokens for an array of Prime IDsIf successful, emits an ARTMinted event _holder address of holder to claim ART for _primeIds an array of Avastar Prime IDs owned by the holder /
function claimArtBulk(address _holder, uint256[] memory _primeIds) public onlySysAdmin whenNotUpgraded { // Cannot mint more tokens than the hard cap require(getCirculatingArt() <= ART_HARD_CAP, "Hard cap reached, no more tokens can be minted."); uint256 tokensToMint; for (uint256 ...
function claimArtBulk(address _holder, uint256[] memory _primeIds) public onlySysAdmin whenNotUpgraded { // Cannot mint more tokens than the hard cap require(getCirculatingArt() <= ART_HARD_CAP, "Hard cap reached, no more tokens can be minted."); uint256 tokensToMint; for (uint256 ...
14,542
95
// remove limits after token is stable
function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; return true; }
function removeLimits() external onlyOwner returns (bool) { limitsInEffect = false; return true; }
32,340
105
// harvest before deposit new amount
if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accTokenPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeTokenTransfer(msg.sender, pending); }
if (user.amount > 0) { uint256 pending = user.amount.mul(pool.accTokenPerShare).div(1e12).sub(user.rewardDebt); if (pending > 0) { safeTokenTransfer(msg.sender, pending); }
25,974
24
// 저는 한국어를 한국에서 배웠어요그는 그녀의 호의를 순수하게 받아들였다
library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, ...
library Address { function isContract(address account) internal view returns (bool) { uint256 size; assembly { size := extcodesize(account) } return size > 0; } function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, ...
35,457
276
// ========== SYNTHETIX ========== / claim and swap our CRV for synths
function claimAndSell() internal { // if we have anything in the gauge, then harvest CRV from the gauge uint256 _stakedBal = stakedBalance(); if (_stakedBal > 0) { proxy.harvest(gauge); uint256 _crvBalance = crv.balanceOf(address(this)); // if we claimed a...
function claimAndSell() internal { // if we have anything in the gauge, then harvest CRV from the gauge uint256 _stakedBal = stakedBalance(); if (_stakedBal > 0) { proxy.harvest(gauge); uint256 _crvBalance = crv.balanceOf(address(this)); // if we claimed a...
18,373
39
// Sub `base` from `total` and update `total.elastic`./ return (Rebase) The new total./ return elastic in relationship to `base`.
function sub( Rebase memory total, uint256 base, bool roundUp
function sub( Rebase memory total, uint256 base, bool roundUp
5,527
6
// Read the result of a resolved request.Call to `read_result` function in the WitnetRequestBoard contract._id The unique identifier of a request that was posted to Witnet. return The result of the request as an instance of `Result`./
function witnetReadResult(uint256 _id) internal view returns (Witnet.Result memory) { return Witnet.resultFromCborBytes(wrb.readResult(_id)); }
function witnetReadResult(uint256 _id) internal view returns (Witnet.Result memory) { return Witnet.resultFromCborBytes(wrb.readResult(_id)); }
25,786
22
// Allows the owner to set the rewards duration
function setRewardsDuration(uint256 _duration) external onlyOwner { require(finishAt < block.timestamp, "reward duration not finished"); duration = _duration; emit DurationChanged(_duration, block.timestamp); }
function setRewardsDuration(uint256 _duration) external onlyOwner { require(finishAt < block.timestamp, "reward duration not finished"); duration = _duration; emit DurationChanged(_duration, block.timestamp); }
46,440
11
// Check if sender is controller.
modifier onlyController() { _onlyController(); _; }
modifier onlyController() { _onlyController(); _; }
42,800
2
// restrict affiliates
mapping(address => bool) public affiliates;
mapping(address => bool) public affiliates;
16,252
129
// Modifier for after sale finalization
modifier afterSale() { require(isFinalized); _; }
modifier afterSale() { require(isFinalized); _; }
6,956
242
// v1 otoken
return ( otoken.collateralAsset(), otoken.underlyingAsset(), otoken.strikeAsset(), otoken.strikePrice(), otoken.expiryTimestamp(), otoken.isPut() );
return ( otoken.collateralAsset(), otoken.underlyingAsset(), otoken.strikeAsset(), otoken.strikePrice(), otoken.expiryTimestamp(), otoken.isPut() );
18,447
75
// Writes a new length to a byte array./Decreasing length will lead to removing the corresponding lower order bytes from the byte array./Increasing length may lead to appending adjacent in-memory bytes to the end of the byte array./b Bytes array to write new length to./length New length of byte array.
function writeLength(bytes memory b, uint256 length) internal pure
function writeLength(bytes memory b, uint256 length) internal pure
16,875
4
// return the cliff time of the token vesting. /
function cliff() public view returns(uint256) { return cliff_; }
function cliff() public view returns(uint256) { return cliff_; }
672
13
// Emitted when a new COMP speed is calculated for a market
event CompSpeedUpdated(CToken indexed cToken, uint newSpeed);
event CompSpeedUpdated(CToken indexed cToken, uint newSpeed);
16,337
69
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); }
address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); }
466
7
// MANAGER ONLY: Updates address receiving issue/redeem fees for a given SetToken._setToken Instance of the SetToken to update fee recipient _newFeeRecipientNew fee recipient address /
function updateFeeRecipient( ISetToken _setToken, address _newFeeRecipient ) external onlyManagerAndValidSet(_setToken)
function updateFeeRecipient( ISetToken _setToken, address _newFeeRecipient ) external onlyManagerAndValidSet(_setToken)
26,967
87
// Note: the ERC-165 identifier for this interface is 0xf0b9e5ba /
interface ERC721TokenReceiver { /* * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a `transfer`. This function MAY throw to revert and reject the * transfer. This function MUST use 50,000 gas or less. Return of other * ...
interface ERC721TokenReceiver { /* * @notice Handle the receipt of an NFT * @dev The ERC721 smart contract calls this function on the recipient * after a `transfer`. This function MAY throw to revert and reject the * transfer. This function MUST use 50,000 gas or less. Return of other * ...
36,713
42
// Mint NFT using collateral / FRAX already held If suboptimal liquidity taken, withdraw() and try again Will revert if the pool doesn't exist yet
function mint(address _collat_addr, uint256 _amountCollateral, uint256 _amountFrax, uint24 _fee_tier, int24 _tickLower, int24 _tickUpper) public onlyByOwnerOrGovernance returns (uint256, uint128) { // Make sure the collateral is allowed require(allowed_collaterals[_collat_addr], "Collateral not all...
function mint(address _collat_addr, uint256 _amountCollateral, uint256 _amountFrax, uint24 _fee_tier, int24 _tickLower, int24 _tickUpper) public onlyByOwnerOrGovernance returns (uint256, uint128) { // Make sure the collateral is allowed require(allowed_collaterals[_collat_addr], "Collateral not all...
6,406
15
// : completeProphecyClaimAllows for the completion of ProphecyClaims once processed by the Oracle.Burn claims unlock tokens stored by BridgeBank.Lock claims mint BridgeTokens on BridgeBank's token whitelist. /
function completeProphecyClaim(uint256 _prophecyID) public isPending(_prophecyID)
function completeProphecyClaim(uint256 _prophecyID) public isPending(_prophecyID)
28,560
110
// Emitted when update performance fee/newFee new performance fee
event SetPerformanceFee ( uint256 newFee );
event SetPerformanceFee ( uint256 newFee );
2,924
18
// Deposit tokens to staker for STRF allocation.
function deposit( uint256 pid, uint256 amount
function deposit( uint256 pid, uint256 amount
33,302
112
// Emit a standard ERC20 transfer event
emitTransfer(from, to, value);
emitTransfer(from, to, value);
22,660
624
// Event fired when asset's pricing source (aggregator) is updated
event AssetSourceUpdated(address indexed asset, address indexed source);
event AssetSourceUpdated(address indexed asset, address indexed source);
44,119
263
// ========== RESTRICTED FUNCTIONS - Owner or timelock only ========== //Owner or governance can unlock stakes - irreversible!
function unlockStakes() external onlyByOwnGov { stakesUnlocked = !stakesUnlocked; }
function unlockStakes() external onlyByOwnGov { stakesUnlocked = !stakesUnlocked; }
18,571
10
// Add a new payee to the contract (for only owner). account The address of the payee to add. shares_ The number of shares owned by the payee. /
function addPayee(address payable account, uint256 shares_) public onlyOwner { require(account != address(0), "PaymentSplitter: account is the zero address"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, ...
function addPayee(address payable account, uint256 shares_) public onlyOwner { require(account != address(0), "PaymentSplitter: account is the zero address"); _payees.push(account); _shares[account] = shares_; _totalShares = _totalShares + shares_; emit PayeeAdded(account, ...
39,827
42
// mint founder tokens
mintFounderTokens(_maxSupply.mul(20).div(100));//20% of max supply
mintFounderTokens(_maxSupply.mul(20).div(100));//20% of max supply
1,368
32
// Transfer the specified token reward balance tot the defined recipient _rewardToken the reward token to redeem the balance of /
function redeemVaultRewards(address _rewardToken) external;
function redeemVaultRewards(address _rewardToken) external;
5,334
8
// Create a token with the given URI/tokenURI The token URI/Emit TokenCreated event
function createToken(string memory tokenURI) public { _tokenIds.increment(); uint256 newItemId = _tokenIds.current() + 10000; _mint(msg.sender, newItemId); _setTokenURI(newItemId, tokenURI); Item memory newItem = Item({ id: newItemId, price: defaultT...
function createToken(string memory tokenURI) public { _tokenIds.increment(); uint256 newItemId = _tokenIds.current() + 10000; _mint(msg.sender, newItemId); _setTokenURI(newItemId, tokenURI); Item memory newItem = Item({ id: newItemId, price: defaultT...
39,372
17
// Creates new sortition pool for the application./Have to be implemented by keep factory to call desired sortition/ pool factory./_application Address of the application./ return Address of the created sortition pool contract.
function newSortitionPool(address _application) internal returns (address);
function newSortitionPool(address _application) internal returns (address);
37,212
47
// transfers an amount from the contract balance to the owner&39;s wallet. receiver the receiver addressamount the amount of tokens to withdraw (0 decimals)v,r,s the signature of the player /
function withdrawFor(address receiver, uint amount, uint8 v, bytes32 r, bytes32 s) public onlyAuthorized keepAlive { address player = ecrecover(keccak256(receiver, amount, withdrawCount[receiver]), v, r, s); withdrawCount[receiver]++; uint gasCost = getGasCost(); uint value = safeAdd(safeMul(amount, oneEDG), g...
function withdrawFor(address receiver, uint amount, uint8 v, bytes32 r, bytes32 s) public onlyAuthorized keepAlive { address player = ecrecover(keccak256(receiver, amount, withdrawCount[receiver]), v, r, s); withdrawCount[receiver]++; uint gasCost = getGasCost(); uint value = safeAdd(safeMul(amount, oneEDG), g...
54,477
509
// Claim all the comp accrued by holder in the specified markets holder The address to claim WPC for pTokens The list of markets to claim WPC in /
function claimWpc(address holder, PToken[] memory pTokens) public { address[] memory holders = new address[](1); holders[0] = holder; claimWpc(holders, pTokens, true, false); }
function claimWpc(address holder, PToken[] memory pTokens) public { address[] memory holders = new address[](1); holders[0] = holder; claimWpc(holders, pTokens, true, false); }
26,101
92
// Tell the term duration of the Court return Duration in seconds of the Court term/
function getTermDuration() external view returns (uint64) { return termDuration; }
function getTermDuration() external view returns (uint64) { return termDuration; }
39,641
63
// Use and override this function with caution. Wrong usage can have serious consequences. Removes a NFT from owner. _from Address from which we want to remove the NFT. _tokenId Which NFT we want to remove. /
function _removeNFToken(address _from, uint256 _tokenId) internal virtual { require(idToOwner[_tokenId] == _from, NOT_OWNER); ownerToNFTokenCount[_from] -= 1; delete idToOwner[_tokenId]; }
function _removeNFToken(address _from, uint256 _tokenId) internal virtual { require(idToOwner[_tokenId] == _from, NOT_OWNER); ownerToNFTokenCount[_from] -= 1; delete idToOwner[_tokenId]; }
33,398
46
// Converts a 'uint256' to its ASCII 'string' hexadecimal representation. /
function toHexString(uint256 value) internal pure returns(string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); }
function toHexString(uint256 value) internal pure returns(string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); }
1,054
43
// Stores which address have claimed which tokens, to avoid one address claiming the same token twice. Note - this does NOT affect medals won on the sponsored leaderboards;
mapping (address => bool[12]) public claimedbyAddress;
mapping (address => bool[12]) public claimedbyAddress;
43,767
61
// Disable solium check because ofhttps:github.com/duaraghav8/Solium/issues/175solium-disable-next-line operator-whitespace
return ( _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender) );
return ( _spender == owner || getApproved(_tokenId) == _spender || isApprovedForAll(owner, _spender) );
28,592
4
// Check if a sha256 hash is registered
function isSHA256HashRegistered (bytes32 _SHA256Hash) returns (bool _registered);
function isSHA256HashRegistered (bytes32 _SHA256Hash) returns (bool _registered);
31,763
107
// user => referrer
mapping (address => address) public referrers;
mapping (address => address) public referrers;
4,783
75
// Count of the total votes in favor of this offer.
uint voteCount;
uint voteCount;
22,349
233
// Returns true if CKToken must be enabled on the controller and module is registered on the CKToken /
function isCKValidAndInitialized(ICKToken _ckToken) internal view returns(bool) { return controller.isCK(address(_ckToken)) && _ckToken.isInitializedModule(address(this)); }
function isCKValidAndInitialized(ICKToken _ckToken) internal view returns(bool) { return controller.isCK(address(_ckToken)) && _ckToken.isInitializedModule(address(this)); }
4,412
482
// Fills the input ExchangeV3 order./Returns false if the transaction would otherwise revert./order Order struct containing order specifications./takerAssetFillAmount Desired amount of takerAsset to sell./signature Proof that order has been created by maker./ return Amounts filled and fees paid by maker and taker.
function _fillV3OrderNoThrow( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) internal returns (LibFillResults.FillResults memory fillResults)
function _fillV3OrderNoThrow( LibOrder.Order memory order, uint256 takerAssetFillAmount, bytes memory signature ) internal returns (LibFillResults.FillResults memory fillResults)
32,697
352
// an optional post-upgrade callback that can be implemented by child contracts /
function _postUpgrade( bytes calldata /* data */
function _postUpgrade( bytes calldata /* data */
45,815
48
// This is a virtual function that should be overriden so it returns the address to which the fallback function
* and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by _implementation(). * * This function does not return to its internall call site, it will return directly to th...
* and {_fallback} should delegate. */ function _implementation() internal view virtual returns (address); /** * @dev Delegates the current call to the address returned by _implementation(). * * This function does not return to its internall call site, it will return directly to th...
38,923
23
// need to check the library address first. if canEdit() is called on a library it reverts because the librarycannot have a wallet.
return (msg.sender == libraryAddress || canEdit());
return (msg.sender == libraryAddress || canEdit());
29,619
8
// Returns the previous timestamp where new principal came due /
function previousPrincipalDueTimeAt(
function previousPrincipalDueTimeAt(
39,763
11
// create slug
string memory projectSlug = createSlug(dto.slug);
string memory projectSlug = createSlug(dto.slug);
18,243
72
// {See ICreatorCore-getFeeBps}. /
function getFeeBps(uint256 tokenId) external view virtual override returns (uint[] memory) { require(_exists(tokenId), "Nonexistent token"); return _getRoyaltyBPS(tokenId); }
function getFeeBps(uint256 tokenId) external view virtual override returns (uint[] memory) { require(_exists(tokenId), "Nonexistent token"); return _getRoyaltyBPS(tokenId); }
25,050
144
// isAllowedToCall should be called upon a proposal execution._contractsToCall the contracts to be called_callsData - The abi encode data for the calls_values value(ETH) to transfer with the calls_avatar avatar return bool value true-allowed false not allowed/
function isAllowedToCall( address[] calldata _contractsToCall, bytes[] calldata _callsData, uint256[] calldata _values, Avatar _avatar) external returns(bool);
function isAllowedToCall( address[] calldata _contractsToCall, bytes[] calldata _callsData, uint256[] calldata _values, Avatar _avatar) external returns(bool);
54,380