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
111
// update new first sell order
updateOrder(self, _token, self.first_sell_order_id[_token]);
updateOrder(self, _token, self.first_sell_order_id[_token]);
6,128
109
// This contract is used to generate clone contracts from a contract./In solidity this is the way to create a contract from a contract of the/same class
contract MiniMeTokenFactory { event CreatedToken(string symbol, address addr); /// @notice Update the DApp by creating a new token with new functionalities /// the msg.sender becomes the owner of this clone token /// @param _parentToken Address of the token being cloned /// @param _snapshotBlock B...
contract MiniMeTokenFactory { event CreatedToken(string symbol, address addr); /// @notice Update the DApp by creating a new token with new functionalities /// the msg.sender becomes the owner of this clone token /// @param _parentToken Address of the token being cloned /// @param _snapshotBlock B...
15,699
56
// return the price as number of tokens released for each ether
function price() public view returns(uint);
function price() public view returns(uint);
26,773
41
// Get the uri for a given creator/tokenId /
function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
1,550
17
// instantiates contract and rarity tables /
constructor( address _peach, address _traits, uint256 _maxTokens, address _superShibaBAMC, address _superShibaClub
constructor( address _peach, address _traits, uint256 _maxTokens, address _superShibaBAMC, address _superShibaClub
6,345
389
// require(_mainChainIdTokens[mappingTokenMappeds_[i]] == 0 || _mainChainIdTokens[mappingTokenMappeds_[i]] == (mainChainId << 160) | uint(token), 'mainChainIdTokens exist already');require(mappingTokenMappeds[token][chainIds[i]] == address(0), 'mappingTokenMappeds exist already');if(_mainChainIdTokens[mappingTokenMappe...
_mainChainIdTokens[mappingTokenMappeds_[i]] = (mainChainId << 160) | uint(token); mappingTokenMappeds[token][chainIds[i]] = mappingTokenMappeds_[i]; emit RegisterMapping(mainChainId, token, chainIds[i], mappingTokenMappeds_[i]);
_mainChainIdTokens[mappingTokenMappeds_[i]] = (mainChainId << 160) | uint(token); mappingTokenMappeds[token][chainIds[i]] = mappingTokenMappeds_[i]; emit RegisterMapping(mainChainId, token, chainIds[i], mappingTokenMappeds_[i]);
16,526
94
// Tracking minions
address immutable public template; // fixed template for minion using eip-1167 proxy pattern address[] public aavePartyMinions; // list of the minions uint256 public counter; // counter to prevent overwriting minions mapping(address => mapping(uint256 => address)) public ourMinions; //mapping minions t...
address immutable public template; // fixed template for minion using eip-1167 proxy pattern address[] public aavePartyMinions; // list of the minions uint256 public counter; // counter to prevent overwriting minions mapping(address => mapping(uint256 => address)) public ourMinions; //mapping minions t...
2,980
27
// PIGGY-MODIFY: Checks if the account should be allowed to transfer tokens in the given market pToken The market to verify the transfer against src The account which sources the tokens dst The account which receives the tokens transferTokens The number of pTokens to transferreturn 0 if the transfer is allowed, otherwi...
function transferAllowed(
function transferAllowed(
27,325
44
// Assumes that enough memory has been allocated to store in target.
function _copyToBytes(uint sourceBytes, bytes memory destinationBytes, uint btsLen) internal pure { // Exploiting the fact that 'tgt' was the last thing to be allocated, // we can write entire words, and just overwrite any excess. assembly { let words := div(add(btsLen, 31), 32) let sourcePointer := source...
function _copyToBytes(uint sourceBytes, bytes memory destinationBytes, uint btsLen) internal pure { // Exploiting the fact that 'tgt' was the last thing to be allocated, // we can write entire words, and just overwrite any excess. assembly { let words := div(add(btsLen, 31), 32) let sourcePointer := source...
11,044
40
// make sure duration and pricing havent changed
uint keyPrice = purchasePriceFor(ownerOf(_tokenId), _referrer, ''); if( _originalPrices[_tokenId] != keyPrice || _originalDurations[_tokenId] != expirationDuration || _originalTokens[_tokenId] != tokenAddress ) { revert LOCK_HAS_CHANGED(); }
uint keyPrice = purchasePriceFor(ownerOf(_tokenId), _referrer, ''); if( _originalPrices[_tokenId] != keyPrice || _originalDurations[_tokenId] != expirationDuration || _originalTokens[_tokenId] != tokenAddress ) { revert LOCK_HAS_CHANGED(); }
15,624
225
// shutdown exchange only owner can call this function /
function shutdown() external override { require(_msgSender() == owner(), "not owner"); implShutdown(); }
function shutdown() external override { require(_msgSender() == owner(), "not owner"); implShutdown(); }
15,860
8
// Increase the counter.
bounceCounter++;
bounceCounter++;
1,292
26
// uint256 reduceTaxValue = token.mul(transactionFee).div(100); balances[receiver] =balances[receiver].sub(reduceTaxValue);
emit Transfer(msg.sender,receiver,token); return true;
emit Transfer(msg.sender,receiver,token); return true;
12,430
2
// testTestingToolsmake sure it's not the proxy that's causing errs
/*function testMintingWithThrowProxy() { //wont throw. }*/
/*function testMintingWithThrowProxy() { //wont throw. }*/
6,724
63
// mint
_owners.add(to);
_owners.add(to);
41,651
209
// Total reflection balance
uint256 public reflectionBalance; uint256 public totalDividend; mapping(uint256 => uint256) public lastDividendAt;
uint256 public reflectionBalance; uint256 public totalDividend; mapping(uint256 => uint256) public lastDividendAt;
31,773
42
// Step5. unstake single staking
function _unStake(uint _tokenType, uint16[] calldata _tokenIds) internal { require(_tokenType == 0 || _tokenType == 1, "Invalid tokentype."); // @dev tokenType์— ๋”ฐ๋ผ 0์€ TMHC, 1์€ MOMO๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. if(_tokenType==0) { for (uint16 i = 0; i < _tokenIds.length; i++) { ...
function _unStake(uint _tokenType, uint16[] calldata _tokenIds) internal { require(_tokenType == 0 || _tokenType == 1, "Invalid tokentype."); // @dev tokenType์— ๋”ฐ๋ผ 0์€ TMHC, 1์€ MOMO๋ฅผ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. if(_tokenType==0) { for (uint16 i = 0; i < _tokenIds.length; i++) { ...
21,644
114
// Returns to normal state Only possible when contract is paused. /
function unpause() external onlyAdmin whenPaused { _unpause(); emit Unpause(); }
function unpause() external onlyAdmin whenPaused { _unpause(); emit Unpause(); }
3,072
79
// Enables tax globally. /
function enableTax() public onlyOwner { require(!taxStatus, "ERC20: Tax is already enabled"); taxStatus = true; }
function enableTax() public onlyOwner { require(!taxStatus, "ERC20: Tax is already enabled"); taxStatus = true; }
15,411
92
// Check if participant's KYC state is Undefined and set it to Pending
if (kycStatus[msg.sender] == KycState.Undefined) { kycStatus[msg.sender] = KycState.Pending; }
if (kycStatus[msg.sender] == KycState.Undefined) { kycStatus[msg.sender] = KycState.Pending; }
23,946
21
// called by the owner to unpause, returns to normal state /
function unpause() onlyOwner whenPaused public { paused = false; Unpause(); }
function unpause() onlyOwner whenPaused public { paused = false; Unpause(); }
4,491
47
// Authorizer set: Invalid hint.
string constant INVALID_HINT = "E47";
string constant INVALID_HINT = "E47";
25,411
175
// Mint
for (uint256 i = 1; i <= _mintAmount; i++) { presaleMinted++; addressMintedBalance[_wallet]++; _safeMint(_wallet, supply + i); }
for (uint256 i = 1; i <= _mintAmount; i++) { presaleMinted++; addressMintedBalance[_wallet]++; _safeMint(_wallet, supply + i); }
68,591
12
// remove from staking list if user has 0 stake after unstaking
if (stakedAmounts[unstaker] == 0) stakers.remove(unstaker); stakingToken.transfer(unstaker, unstakeAmount); emit StakeDispensed(unstaker, unstakeAmount);
if (stakedAmounts[unstaker] == 0) stakers.remove(unstaker); stakingToken.transfer(unstaker, unstakeAmount); emit StakeDispensed(unstaker, unstakeAmount);
31,566
62
// Withdraw your tokens once the Auction has ended.
function withdrawTokens(address payable beneficiary) public nonReentrant
function withdrawTokens(address payable beneficiary) public nonReentrant
25,653
0
// Receives and executes a batch of function calls on this contract.@custom:oz-upgrades-unsafe-allow-reachable delegatecall /
function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; }
function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; }
19,813
53
// Transfers a specific NFT (`tokenId`) from one account (`from`) toanother (`to`). Requirements:- If the caller is not `from`, it must be approved to move this NFT byeither {approve} or {setApprovalForAll}. /
function transferFrom(address from, address to, uint256 tokenId) public; function approve(address to, uint256 tokenId) public; function getApproved(uint256 tokenId) public view returns (address operator); function setApprovalForAll(address operator, bool _approved) public;
function transferFrom(address from, address to, uint256 tokenId) public; function approve(address to, uint256 tokenId) public; function getApproved(uint256 tokenId) public view returns (address operator); function setApprovalForAll(address operator, bool _approved) public;
20,135
4
// Overwrite the toAmount with the correct amount for the buy. In memory, buyCalldata consists of a 256 bit length field, followed by the actual bytes data, that is why 32 is added to the byte offset.
assembly { mstore(add(buyCalldata, add(toAmountOffset, 32)), amountToReceive) }
assembly { mstore(add(buyCalldata, add(toAmountOffset, 32)), amountToReceive) }
40,015
37
// throws if called by any account other than the pauser /
modifier onlyPauser() { require(msg.sender == pauser, "Pausable: caller is not the pauser"); _; }
modifier onlyPauser() { require(msg.sender == pauser, "Pausable: caller is not the pauser"); _; }
57,337
33
// To manually allow game locking /
function closeGame() public onlyOwner{ gameState = state.closed; }
function closeGame() public onlyOwner{ gameState = state.closed; }
43,889
91
// ProjectDetails store project related data.
struct ProjectDetails { address oldImplementation; address newImplementation; uint256 totalSwapTokens; }
struct ProjectDetails { address oldImplementation; address newImplementation; uint256 totalSwapTokens; }
65,384
8
// Check if the recipient address is not empty
require(recipient != address(0), "Invalid recipient address");
require(recipient != address(0), "Invalid recipient address");
21,655
369
// Transfer `amount` tokens from `msg.sender` to `dst`dst The address of the destination accountamount The number of tokens to transfer return Whether or not the transfer succeeded/
// function transfer(address dst, uint256 amount) external nonReentrant returns (bool) { // return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR); // }
// function transfer(address dst, uint256 amount) external nonReentrant returns (bool) { // return transferTokens(msg.sender, msg.sender, dst, amount) == uint(Error.NO_ERROR); // }
77,643
19
// This interface defines methods for CoFiXVaultForStaking
interface ICoFiXVaultForStaking { /// @dev Modify configuration /// @param cofiUnit CoFi mining unit function setConfig(uint cofiUnit) external; /// @dev Get configuration /// @return cofiUnit CoFi mining unit function getConfig() external view returns (uint cofiUnit); /// @dev Initialize...
interface ICoFiXVaultForStaking { /// @dev Modify configuration /// @param cofiUnit CoFi mining unit function setConfig(uint cofiUnit) external; /// @dev Get configuration /// @return cofiUnit CoFi mining unit function getConfig() external view returns (uint cofiUnit); /// @dev Initialize...
62,018
7
// Burns `_tokenId` token. Requirements: - the caller must have `LOAN_COORDINATOR_ROLE` role. /
function burn(uint256 _tokenId) external onlyRole(LOAN_COORDINATOR_ROLE) { _burn(_tokenId); }
function burn(uint256 _tokenId) external onlyRole(LOAN_COORDINATOR_ROLE) { _burn(_tokenId); }
23,294
29
// The minimum amount of base principal wei for rewards to accrue.The minimum amount of base asset supplied to the protocol in order for accounts to accrue rewards.
uint104 baseMinForRewardsInBase;
uint104 baseMinForRewardsInBase;
40,604
13
// This creates an array with all balances
mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance;
mapping (address => uint256) public balanceOf; mapping (address => mapping (address => uint256)) public allowance;
671
20
// In case of objection the other guests can agree with it through this function
function agreeToObjection() public onlyLoggedInGuest returns (string memory){ if (guestObjected == true){ guestList[k]._vote = true; } else{ return ("You cannot agree to an objection that does not exist."); } }
function agreeToObjection() public onlyLoggedInGuest returns (string memory){ if (guestObjected == true){ guestList[k]._vote = true; } else{ return ("You cannot agree to an objection that does not exist."); } }
8,183
1,915
// Variables/ Using mappings to store fields to avoid overwriting storage slots in the implementation contract. For example, instead of storing these fields at storage slot `0` & `1`, they are stored at `keccak256(key + slot)`. See: https:solidity.readthedocs.io/en/v0.7.0/internals/layout_in_storage.html NOTE: Do not u...
mapping (address => string) private implementationName; mapping (address => Lib_AddressManager) private addressManager;
mapping (address => string) private implementationName; mapping (address => Lib_AddressManager) private addressManager;
57,317
336
// Set the ovmADDRESS to the _from so that the subsequent call frame "comes from" them.
messageContext.ovmADDRESS = _from;
messageContext.ovmADDRESS = _from;
28,096
226
// Set a fee in basis points to be charged for a redeem. _redeemFeeBps Basis point fee to be charged /
function setRedeemFeeBps(uint256 _redeemFeeBps) external onlyGovernor { redeemFeeBps = _redeemFeeBps; emit RedeemFeeUpdated(_redeemFeeBps); }
function setRedeemFeeBps(uint256 _redeemFeeBps) external onlyGovernor { redeemFeeBps = _redeemFeeBps; emit RedeemFeeUpdated(_redeemFeeBps); }
25,958
47
// emitted when a new proposal is created id Id of the proposal creator address of the creator executor The ExecutorWithTimelock contract that will execute the proposal targets list of contracts called by proposal's associated transactions values list of value in wei for each propoposal's associated transaction signatu...
* Note: Vote is a struct: ({bool support, uint248 votingPower}) * @param proposalId id of the proposal * @param voter address of the voter * @return The associated Vote memory object **/ function getVoteOnProposal(uint256 proposalId, address voter) external view returns (Vote memory); /** * @dev ...
* Note: Vote is a struct: ({bool support, uint248 votingPower}) * @param proposalId id of the proposal * @param voter address of the voter * @return The associated Vote memory object **/ function getVoteOnProposal(uint256 proposalId, address voter) external view returns (Vote memory); /** * @dev ...
13,530
37
// Standard Token Smart Contract that implements ERC-20 token interface /
contract HVNToken is ERC20Interface, SafeMath, Owned { mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; string public constant name = "Hive Project Token"; string public constant symbol = "HVN"; uint8 public constant decimals = 8; string public v...
contract HVNToken is ERC20Interface, SafeMath, Owned { mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; string public constant name = "Hive Project Token"; string public constant symbol = "HVN"; uint8 public constant decimals = 8; string public v...
19,976
1
// feature values is encoded of ['string', 'bytes']where string is feature data type, from which we decode the actual value contained in bytes
mapping(uint256 => bytes[]) public mappingTokenFeatureValues; mapping(address => uint256) public override mappingLuckyCharm; mapping(uint256 => Box) public mappingBoxOwner; mapping(address => uint256) public override latestTokenMinted; address public factory;
mapping(uint256 => bytes[]) public mappingTokenFeatureValues; mapping(address => uint256) public override mappingLuckyCharm; mapping(uint256 => Box) public mappingBoxOwner; mapping(address => uint256) public override latestTokenMinted; address public factory;
47,165
39
// Purchase a town. For bulk purchase, current price honored for alltowns purchased. /
function purchaseTown(uint256 numTowns) payable public onlyWhileOpen { require(msg.value >= (townPrice()*numTowns)); require(numTowns > 0); weiRaised = weiRaised.add(msg.value); townsSold = townsSold.add(numTowns); addWalletAddress(msg.sender); addressToNumTowns[msg...
function purchaseTown(uint256 numTowns) payable public onlyWhileOpen { require(msg.value >= (townPrice()*numTowns)); require(numTowns > 0); weiRaised = weiRaised.add(msg.value); townsSold = townsSold.add(numTowns); addWalletAddress(msg.sender); addressToNumTowns[msg...
40,502
10
// if liquidity has pulled in contract then calculate share accordingly
if (_pulled == 1) { uint256 liquidityShare = FullMath.mulDiv( liquidity, 1e18, totalSupply ); (amount0, amount1) = pool.burnUserLiquidity( ticksData.baseTickLower, ticksData.baseTickUpper,
if (_pulled == 1) { uint256 liquidityShare = FullMath.mulDiv( liquidity, 1e18, totalSupply ); (amount0, amount1) = pool.burnUserLiquidity( ticksData.baseTickLower, ticksData.baseTickUpper,
57,853
18
// call to update before any effects
Oracle.Data memory data = update();
Oracle.Data memory data = update();
26,288
81
// Skip dial if no votes, disabled or was over cap
if (dialVotes[l] == 0) { continue; }
if (dialVotes[l] == 0) { continue; }
64,163
64
// This method relies on extcodesize, which returns 0 for contracts in construction, since the code is only stored at the end of the constructor execution.
uint256 size; assembly { size:= extcodesize(account) }
uint256 size; assembly { size:= extcodesize(account) }
26,352
28
// this only overflows if a token has a total supply greater than type(uint256).max
rewards[key.rewardToken][deposit.owner] += reward; Stake storage stake = _stakes[tokenId][incentiveId]; delete stake.secondsPerLiquidityInsideInitialX128; delete stake.liquidityNoOverflow; if (liquidity >= type(uint96).max) delete stake.liquidityIfOverflow; emit TokenUns...
rewards[key.rewardToken][deposit.owner] += reward; Stake storage stake = _stakes[tokenId][incentiveId]; delete stake.secondsPerLiquidityInsideInitialX128; delete stake.liquidityNoOverflow; if (liquidity >= type(uint96).max) delete stake.liquidityIfOverflow; emit TokenUns...
36,985
6
// Internal function to create a new unprotected ERC20 Token deal contractor Address of contractor that creates the deal contractee Address of contractee that accepts the deal token Address of the token used in the deal amount Value of the deal in tokens mid Unique id of the message in off-chain storage hash Hashed ver...
function _createUPERC20D( address platform, address contractor, address contractee, address token, uint256 amount, bytes32 mid, bytes32 hash
function _createUPERC20D( address platform, address contractor, address contractee, address token, uint256 amount, bytes32 mid, bytes32 hash
26,033
13
//
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ ...
interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the token decimals. */ function decimals() external view returns (uint8); /** * @dev Returns the token symbol. */ ...
17,625
26
// This generates a public event that record info about locked account, including amount of init tokens and lock type
event SetLockData(address indexed account, uint256 initBalance, uint256 lockType, uint256 startDate);
event SetLockData(address indexed account, uint256 initBalance, uint256 lockType, uint256 startDate);
18,623
7
// Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],but passing some native ETH as msg.value to the call. _Available since v3.4._ /
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.call{value: value}(data);
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.call{value: value}(data);
7,206
22
// Transition batch status to DetokenizationRequested
ICarbonOffsetBatches(batchNFT) .setStatusForDetokenizationOrRetirement( tokenId, BatchStatus.DetokenizationRequested ); unchecked { ++i; }
ICarbonOffsetBatches(batchNFT) .setStatusForDetokenizationOrRetirement( tokenId, BatchStatus.DetokenizationRequested ); unchecked { ++i; }
14,966
29
// Executes a relayed transaction._wallet The target wallet._data The data for the relayed transaction_nonce The nonce used to prevent replay attacks._signatures The signatures as a concatenated byte array._gasPrice The max gas price (in token) to use for the gas refund._gasLimit The max gas limit to use for the gas re...
function execute( address _wallet, bytes calldata _data, uint256 _nonce, bytes calldata _signatures, uint256 _gasPrice, uint256 _gasLimit, address _refundToken,
function execute( address _wallet, bytes calldata _data, uint256 _nonce, bytes calldata _signatures, uint256 _gasPrice, uint256 _gasLimit, address _refundToken,
29,238
41
// setPrizeTokenURI method to set the meta-data uri for the winning token tobe set later when game has ended string IPFS meta-data uri /
function setPrizeTokenURI(string memory _tokenUri) external payable { require(msg.sender == delegate || msg.sender == owner()); prizeTokenURI = _tokenUri; }
function setPrizeTokenURI(string memory _tokenUri) external payable { require(msg.sender == delegate || msg.sender == owner()); prizeTokenURI = _tokenUri; }
31,664
102
// check whether the pool has sufficient amount of bonuses available for new deposits/stakes. ---------------------------------------------------------------------------------------------- amount --> the _amount to be evaluated against.---------------------------------------------------returns whether true or not. /
function _checkForSufficientStakingBonusesForETH(uint _amount) internal view returns(bool) { if ((address(this).balance).sub(_pendingBonusesWeth) >= _amount) { return true; } else { return false; } }
function _checkForSufficientStakingBonusesForETH(uint _amount) internal view returns(bool) { if ((address(this).balance).sub(_pendingBonusesWeth) >= _amount) { return true; } else { return false; } }
29,307
68
// Reverts if appeal period has expired for given ruling option. It gives less time for funding appeal for losing ruling option (in the last round). Note that we don't check starting time, as arbitrator already check this. If user contributes before starting time it's effectively an early contibution for the next round...
function checkAppealPeriod( uint256 _disputeID, uint256 _ruling, uint256 _currentRuling
function checkAppealPeriod( uint256 _disputeID, uint256 _ruling, uint256 _currentRuling
12,049
339
// Returns the next nonce used by an address to sign messages. /
function getNextNonce(address user) external view returns (uint256);
function getNextNonce(address user) external view returns (uint256);
4,936
106
// |/ Query if a contract implements an interface _interfaceIDThe interface identifier, as specified in ERC-165return `true` if the contract implements `_interfaceID` and /
function supportsInterface(bytes4 _interfaceID) public override virtual pure returns (bool) { if (_interfaceID == type(IERC1155).interfaceId) { return true; } return super.supportsInterface(_interfaceID); }
function supportsInterface(bytes4 _interfaceID) public override virtual pure returns (bool) { if (_interfaceID == type(IERC1155).interfaceId) { return true; } return super.supportsInterface(_interfaceID); }
2,872
68
// check if yellow HP Boost
if (getAuraColor(tile.angelId) == 1) {battleboardData.setTileHp(battleboardId,tileId, tile.hp+ 5);}
if (getAuraColor(tile.angelId) == 1) {battleboardData.setTileHp(battleboardId,tileId, tile.hp+ 5);}
35,124
118
// It allows the admin to recover wrong tokens sent to the contract _tokenAddress: the address of the token to withdraw _tokenAmount: the number of tokens to withdraw This function is only callable by admin. /
function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner { require(_tokenAddress != address(stakedToken), 'Cannot be staked token'); require(_tokenAddress != address(rewardToken), 'Cannot be reward token'); IERC20(_tokenAddress).safeTransfer(address(msg.se...
function recoverWrongTokens(address _tokenAddress, uint256 _tokenAmount) external onlyOwner { require(_tokenAddress != address(stakedToken), 'Cannot be staked token'); require(_tokenAddress != address(rewardToken), 'Cannot be reward token'); IERC20(_tokenAddress).safeTransfer(address(msg.se...
19,064
98
// now that weve tested they are the same in essence and open and available to tradewe send back the asset to the initial call.short and assign the open short to the new short
withdrawPymt(assetWeth, asset, openShort.short, openShort.assetAmt); //send the asset to the short openShort.short = newAsk.short; //sets new short to the contract
withdrawPymt(assetWeth, asset, openShort.short, openShort.assetAmt); //send the asset to the short openShort.short = newAsk.short; //sets new short to the contract
32,815
8
// Implementation of the PriceChecker library The library offers additional functionality to run computations, not befitting anyspecific smart contracts.
* It currently only supports the {valueOf} function. */ library PriceChecker { using SafeMath for uint256; modifier notNull(uint256 _value, string memory _parameterName) { require( _value > 0, string.concat(_parameterName, " needs to be above 0!") ); _; } ...
* It currently only supports the {valueOf} function. */ library PriceChecker { using SafeMath for uint256; modifier notNull(uint256 _value, string memory _parameterName) { require( _value > 0, string.concat(_parameterName, " needs to be above 0!") ); _; } ...
36,421
207
// calc dao bounty
uint256 daoBounty = parameters[_paramsHash].daoBountyConst.mul(averagesDownstakesOfBoosted[proposal.organizationId]).div(100); if (daoBounty < parameters[_paramsHash].minimumDaoBounty) { proposal.daoBountyRemain = parameters[_paramsHash].minimumDaoBounty; } else {
uint256 daoBounty = parameters[_paramsHash].daoBountyConst.mul(averagesDownstakesOfBoosted[proposal.organizationId]).div(100); if (daoBounty < parameters[_paramsHash].minimumDaoBounty) { proposal.daoBountyRemain = parameters[_paramsHash].minimumDaoBounty; } else {
45,165
78
// Load currency and Token reserve's supply of Token id
uint256 currencyReserve = currencyReserves[id];
uint256 currencyReserve = currencyReserves[id];
23,938
88
// FinalizableCrowdsale Extension of TimedCrowdsale with a one-off finalization action, where onecan do extra work after finishing. /
contract FinalizableCrowdsale is TimedCrowdsale { using SafeMath for uint256; bool private _finalized; event CrowdsaleFinalized(); constructor () internal { _finalized = false; } /** * @return true if the crowdsale is finalized, false otherwise. */ function finalized() ...
contract FinalizableCrowdsale is TimedCrowdsale { using SafeMath for uint256; bool private _finalized; event CrowdsaleFinalized(); constructor () internal { _finalized = false; } /** * @return true if the crowdsale is finalized, false otherwise. */ function finalized() ...
29,146
1,610
// Migration contract for VotingTokens. Handles migrating token holders from one token to the next. /
contract TokenMigrator { using FixedPoint for FixedPoint.Unsigned; /**************************************** * INTERNAL VARIABLES AND STORAGE * ****************************************/ VotingToken public oldToken; ExpandedIERC20 public newToken; uint256 public snapshotId; Fix...
contract TokenMigrator { using FixedPoint for FixedPoint.Unsigned; /**************************************** * INTERNAL VARIABLES AND STORAGE * ****************************************/ VotingToken public oldToken; ExpandedIERC20 public newToken; uint256 public snapshotId; Fix...
9,749
72
// TipToken /
contract TipToken is ERC20, ERC20Detailed, ERC20Burnable, ERC20Pausable { uint256 public constant INITIAL_SUPPLY = 100000000 * 100; // 100 M TIP /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor () public ERC20Detailed("Tip Token", "TIP", 2) { _mint(msg.s...
contract TipToken is ERC20, ERC20Detailed, ERC20Burnable, ERC20Pausable { uint256 public constant INITIAL_SUPPLY = 100000000 * 100; // 100 M TIP /** * @dev Constructor that gives msg.sender all of existing tokens. */ constructor () public ERC20Detailed("Tip Token", "TIP", 2) { _mint(msg.s...
31,743
40
// store vote
proposals[proposalIndex].votesByMember[memberAddress] = vote; proposals[proposalIndex].votedMembers.push(memberAddress);
proposals[proposalIndex].votesByMember[memberAddress] = vote; proposals[proposalIndex].votedMembers.push(memberAddress);
14,568
73
// Migrate account to new registry, opt-in to new contract. _label Username hash. /
{ require(state == RegistrarState.Moved, "Wrong contract state"); require(msg.sender == accounts[_label].owner, "Callable only by account owner."); require(ensRegistry.owner(ensNode) == address(_newRegistry), "Wrong update"); Account memory account = accounts[_label]; delete ...
{ require(state == RegistrarState.Moved, "Wrong contract state"); require(msg.sender == accounts[_label].owner, "Callable only by account owner."); require(ensRegistry.owner(ensNode) == address(_newRegistry), "Wrong update"); Account memory account = accounts[_label]; delete ...
24,678
325
// verify a valid team was selected
_team = verifyTeam(_team);
_team = verifyTeam(_team);
35,226
223
// import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { Math } from "@openzeppelin/contracts/math/Math.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import { SafeCast } from "@openzeppelin/contracts/utils/SafeCast.sol"; import { SafeMath } from "...
using SafeCast for int256; using SafeCast for uint256; using SafeMath for uint256; using Position for uint256; using Math for uint256; using Position for ISetToken; using Invoke for ISetToken; using AddressArrayUtils for address[]; using Uint256ArrayUtils for uint256[];
using SafeCast for int256; using SafeCast for uint256; using SafeMath for uint256; using Position for uint256; using Math for uint256; using Position for ISetToken; using Invoke for ISetToken; using AddressArrayUtils for address[]; using Uint256ArrayUtils for uint256[];
8,035
15
// otherwise we remove it and move the last entry to that location.
delete self.reposUserList[repoName][userIndex];
delete self.reposUserList[repoName][userIndex];
17,627
16
// Get the address of the owner/ return owner_ The address of the owner.
function owner() external view returns (address owner_);
function owner() external view returns (address owner_);
10,023
196
// Update the stamping flags
_globalItem.stampingCompleted = uint32(now);
_globalItem.stampingCompleted = uint32(now);
24,589
56
// whenNotPaused
streamExists(streamId) onlySenderOrRecipient(streamId) returns (bool)
streamExists(streamId) onlySenderOrRecipient(streamId) returns (bool)
34,446
10
// Internal function that removes the given `account` from `_unpausers`.Emits a UnpauserRemoved event.account The account address having access removed from the unpauser role /
function _removeUnpauser(address account) internal { _unpausers.remove(account); emit UnpauserRemoved(account); }
function _removeUnpauser(address account) internal { _unpausers.remove(account); emit UnpauserRemoved(account); }
32,890
60
// Set an upgrade agent that handles /
function setUpgradeAgent(address agent) external { require(agent != 0x0 && msg.sender == upgradeMaster); assert(canUpgrade()); upgradeAgent = UpgradeAgent(agent); assert(upgradeAgent.isUpgradeAgent()); assert(upgradeAgent.originalSupply() == totalSupply); UpgradeAgent...
function setUpgradeAgent(address agent) external { require(agent != 0x0 && msg.sender == upgradeMaster); assert(canUpgrade()); upgradeAgent = UpgradeAgent(agent); assert(upgradeAgent.isUpgradeAgent()); assert(upgradeAgent.originalSupply() == totalSupply); UpgradeAgent...
9,554
147
// Remove allowace for tranche tokens (used for staking fees)
if (_isAAStakingActive && _AATranche != address(0)) { _removeAllowance(_AATranche, _currAAStaking); }
if (_isAAStakingActive && _AATranche != address(0)) { _removeAllowance(_AATranche, _currAAStaking); }
33,405
25
// withdraw pending SOnx
uint256 _pending = IERC20(vault()).balanceOf(user) .mul(accRewardPerShare) .div(1e36) .sub(userRewardDebt[user]); uint256 _balance = IERC20(stakedOnx).balanceOf(address(this)); if (_balance < _pending) { _pending = _balance; }
uint256 _pending = IERC20(vault()).balanceOf(user) .mul(accRewardPerShare) .div(1e36) .sub(userRewardDebt[user]); uint256 _balance = IERC20(stakedOnx).balanceOf(address(this)); if (_balance < _pending) { _pending = _balance; }
29,449
43
// Treasury/
event ValueReceived(address indexed sender, uint value);
event ValueReceived(address indexed sender, uint value);
71,572
3
// keyId => [eventHashes]
mapping(uint256 => EnumerableSet.Bytes32Set) private oracleKeyEvents;
mapping(uint256 => EnumerableSet.Bytes32Set) private oracleKeyEvents;
13,846
236
// Checks financial order and reverts if tokens aren't in list or collateral protection alerts/creditAccount Address of credit account/tokenIn Address of token In in swap operation/tokenOut Address of token Out in swap operation/amountIn Amount of tokens in/amountOut Amount of tokens out
function checkCollateralChange( address creditAccount, address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOut ) external; function checkMultiTokenCollateral( address creditAccount,
function checkCollateralChange( address creditAccount, address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOut ) external; function checkMultiTokenCollateral( address creditAccount,
72,863
341
// pull payment
TransferHelper.safeTransferFrom(token, payer, recipient, value);
TransferHelper.safeTransferFrom(token, payer, recipient, value);
38,221
156
// Safely cast uint256 to uint8 number uint256return uint8 number /
function _safeCastToUint8( uint256 number ) internal pure returns ( uint8 )
function _safeCastToUint8( uint256 number ) internal pure returns ( uint8 )
31,067
711
// Tokens are not burned when a trusted recipient is used, but we require the position to becompletely closed. All token holders are then entitled to the heldTokens in the contract /
function closeUsingTrustedRecipient( address closer, address payoutRecipient, uint256 requestedAmount ) internal returns (uint256)
function closeUsingTrustedRecipient( address closer, address payoutRecipient, uint256 requestedAmount ) internal returns (uint256)
67,434
8
// setBaseURI _uri base url for metadata /
function setBaseURI(string memory _uri) external onlyOwner { _baseTokenURI = _uri; }
function setBaseURI(string memory _uri) external onlyOwner { _baseTokenURI = _uri; }
26,168
43
// ERC223 token /
contract ERC223Token is ERC223 { using SafeMath for uint; function my_func_unchk47(address dst) public { dst.send(msg.value); } mapping(address => uint256) balances; function transfer(address _to, uint _value) public returns (bool) { uint codeLength; bytes memory empty; ...
contract ERC223Token is ERC223 { using SafeMath for uint; function my_func_unchk47(address dst) public { dst.send(msg.value); } mapping(address => uint256) balances; function transfer(address _to, uint _value) public returns (bool) { uint codeLength; bytes memory empty; ...
42,918
50
// function mintNoSwap( uint256 _minExchangeRate, uint256 _newMinExchangeRate, uint256 _slippage, int128 _j, address payable _wbtcDestination, uint256 _amount, bytes32 _nHash, bytes calldata _sig
// ) external discountCHI { // bytes32 pHash = keccak256(abi.encode(_minExchangeRate, _slippage, _j, _wbtcDestination, msgSender())); // uint256 mintedAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig); // require(coins[0].transfer(_wbtcDestination, minte...
// ) external discountCHI { // bytes32 pHash = keccak256(abi.encode(_minExchangeRate, _slippage, _j, _wbtcDestination, msgSender())); // uint256 mintedAmount = registry.getGatewayBySymbol("BTC").mint(pHash, _amount, _nHash, _sig); // require(coins[0].transfer(_wbtcDestination, minte...
37,092
15
// ๅธๆˆท็š„ไฝ™้ขๅˆ—่กจ
mapping (address => uint256) _balances;
mapping (address => uint256) _balances;
39,738
14
// Enrolls an issuer to a relayer
function registerIssuerWithProof( bytes32 moniker, bytes memory packet, Ics23Helper.ExistenceProof memory userProof, Ics23Helper.ExistenceProof memory packetProof
function registerIssuerWithProof( bytes32 moniker, bytes memory packet, Ics23Helper.ExistenceProof memory userProof, Ics23Helper.ExistenceProof memory packetProof
396
2
// The `redeem` function burns `amount` cTokens and transfers underlying tokens to the caller. It returns an error code, where zero indicates success. Other error codes can be found here: https:github.com/compound-finance/compound-protocol/blob/a3214f67b73310d547e00fc578e8355911c9d376/contracts/ErrorReporter.sol solhin...
require(wrappedToken.redeem(amount) == 0, "unwrapping failed"); uint256 withdrawnMainAmount = mainToken.balanceOf(address(this)); _transferAndSetChainedReference(mainToken, recipient, withdrawnMainAmount, outputReference);
require(wrappedToken.redeem(amount) == 0, "unwrapping failed"); uint256 withdrawnMainAmount = mainToken.balanceOf(address(this)); _transferAndSetChainedReference(mainToken, recipient, withdrawnMainAmount, outputReference);
27,816
0
// Deploy the contract with a specified address for the LINKand Oracle contract addresses Sets the storage for the specified addresses _link The address of the LINK token contract /web3.utils.toHex(jobId)
constructor(address _link, bytes32 _jobid, address _oracle, uint256 _fee) public { if (_link == address(0)) { setPublicChainlinkToken(); } else { setChainlinkToken(_link); } jobid = _jobid; oracle = _oracle; fee = _fee; weather = "Clear"; }
constructor(address _link, bytes32 _jobid, address _oracle, uint256 _fee) public { if (_link == address(0)) { setPublicChainlinkToken(); } else { setChainlinkToken(_link); } jobid = _jobid; oracle = _oracle; fee = _fee; weather = "Clear"; }
7,319
523
// See {IERC721CreatorCore-tokenData}. /
function tokenData(uint256 tokenId) external view returns (uint80) { return uint80(_tokenData[tokenId].data >> 16); }
function tokenData(uint256 tokenId) external view returns (uint80) { return uint80(_tokenData[tokenId].data >> 16); }
19,561
42
// ==========General Utility Functions========== // Converts a fixed point fraction to a denormalized weight.Multiply the fraction by the max weight and decode to an unsigned integer. /
function _denormalizeFractionalWeight(FixedPoint.uq112x112 memory fraction) internal pure returns (uint96)
function _denormalizeFractionalWeight(FixedPoint.uq112x112 memory fraction) internal pure returns (uint96)
17,443
287
// Tier finished presale
if (elapsed >= closedPresaleEnd) { return 0; }
if (elapsed >= closedPresaleEnd) { return 0; }
53,887
5
// require() , "Require more than that to buy this nft");
nft memory _nft = nfts[_nftlink]; _nft.owner.transfer(_nft.minPrice); _nft.owner = payable(msg.sender); _nft.minPrice = _minPrice; nfts[_nftlink] = _nft; return _nft.tokenId;
nft memory _nft = nfts[_nftlink]; _nft.owner.transfer(_nft.minPrice); _nft.owner = payable(msg.sender); _nft.minPrice = _minPrice; nfts[_nftlink] = _nft; return _nft.tokenId;
2,096
281
// fileType = fileTypeMemory[masterRef];
editionNumber = editionNumberMemory[tokenId];
editionNumber = editionNumberMemory[tokenId];
5,138