Unnamed: 0 int64 0 7.36k | comments stringlengths 3 35.2k | code_string stringlengths 1 527k | code stringlengths 1 527k | __index_level_0__ int64 0 88.6k |
|---|---|---|---|---|
10 | // Stake tokens | return kudos.transferFrom(msg.sender, address(this), _tokens);
| return kudos.transferFrom(msg.sender, address(this), _tokens);
| 28,947 |
25 | // Function for retrieving the currentAdoptionFee return Returns the adoptionFee of uint256 | function getCurrentAdoptionFee()
external
view
returns (uint256 adoptionFee)
| function getCurrentAdoptionFee()
external
view
returns (uint256 adoptionFee)
| 47,003 |
357 | // Emitted when market comped status is changed | event MarketComped(GToken gToken, bool isComped);
| event MarketComped(GToken gToken, bool isComped);
| 45,371 |
206 | // --- public --- / public mint function - just some safeguards for fair launch / | function mint(uint amount) public payable whenMintingAllowed {
require(((_tokenIds.current() + amount) <= _maxSupply) && (amount <= _maxMintPerTx) && (msg.value >= _actualMintPrice() * amount), "Mint failed");
mintToken(_msgSender(), amount, msg.value);
}
| function mint(uint amount) public payable whenMintingAllowed {
require(((_tokenIds.current() + amount) <= _maxSupply) && (amount <= _maxMintPerTx) && (msg.value >= _actualMintPrice() * amount), "Mint failed");
mintToken(_msgSender(), amount, msg.value);
}
| 30,277 |
14 | // Set house commission.newHouseCommission New house comission./ | function setHouseCommission(uint256 newHouseCommission) public onlyOwner {
houseCommission = newHouseCommission;
}
| function setHouseCommission(uint256 newHouseCommission) public onlyOwner {
houseCommission = newHouseCommission;
}
| 20,806 |
45 | // DerpfiToken with Governance. | contract DerpfiToken is ERC20("Derpfi", "DFI"), Ownable {
uint256 private constant CAP = 210000000e18; // 210 million Derpfi
uint256 private _totalLock;
uint256 public startReleaseBlock;
uint256 public endReleaseBlock;
uint256 public constant MANUAL_MINT_LIMIT = 10500000e18; // 10.5 million Derpfi
... | contract DerpfiToken is ERC20("Derpfi", "DFI"), Ownable {
uint256 private constant CAP = 210000000e18; // 210 million Derpfi
uint256 private _totalLock;
uint256 public startReleaseBlock;
uint256 public endReleaseBlock;
uint256 public constant MANUAL_MINT_LIMIT = 10500000e18; // 10.5 million Derpfi
... | 26,673 |
24 | // This function is internally called by the buyTokens function to automatically forward all investments made to the multi signature wallet. / | function forwardFunds() internal {
multiSigWallet.transfer(msg.value);
}
| function forwardFunds() internal {
multiSigWallet.transfer(msg.value);
}
| 41,578 |
32 | // Multiplies two `Unsigned`s and "ceil's" the product, reverting on overflow. a a FixedPoint. b a FixedPoint.return the product of `a` and `b`. / | function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
uint256 mulRaw = a.rawValue.mul(b.rawValue);
uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;
uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);
if (mod != 0) {
return Unsigned(mulFlo... | function mulCeil(Unsigned memory a, Unsigned memory b) internal pure returns (Unsigned memory) {
uint256 mulRaw = a.rawValue.mul(b.rawValue);
uint256 mulFloor = mulRaw / FP_SCALING_FACTOR;
uint256 mod = mulRaw.mod(FP_SCALING_FACTOR);
if (mod != 0) {
return Unsigned(mulFlo... | 11,885 |
155 | // We're done withdrawing | if (strategyId == address(0)) break;
uint256 vaultBalance = _vaultTokenBalance();
uint256 amountNeeded = amountAdjusted - vaultBalance;
| if (strategyId == address(0)) break;
uint256 vaultBalance = _vaultTokenBalance();
uint256 amountNeeded = amountAdjusted - vaultBalance;
| 59,614 |
0 | // generate example Merkle tree | (bytes32 root, bytes32[] memory proof) = generateMerkleTree(
keccak256(abi.encodePacked(address(this), EXAMPLE_USER_SHARES)),
10,
keccak256(abi.encodePacked(block.timestamp))
);
exampleProof = proof;
| (bytes32 root, bytes32[] memory proof) = generateMerkleTree(
keccak256(abi.encodePacked(address(this), EXAMPLE_USER_SHARES)),
10,
keccak256(abi.encodePacked(block.timestamp))
);
exampleProof = proof;
| 21,471 |
44 | // Minting and burning can be permanently disabled by the owner | function disableMinting() external onlyOwner {
mintingEnabled = false;
}
| function disableMinting() external onlyOwner {
mintingEnabled = false;
}
| 11,611 |
2 | // Grant the items to the minter | items[_id].balances[msg.sender] = _totalSupply;
emit Mint(_name, _totalSupply, _uri, _decimals, _symbol, _itemId);
| items[_id].balances[msg.sender] = _totalSupply;
emit Mint(_name, _totalSupply, _uri, _decimals, _symbol, _itemId);
| 10,156 |
252 | // The token URI determines which NFT this is | _safeMint(msg.sender, lastId, "");
_setTokenURI(lastId, _tokenURI);
| _safeMint(msg.sender, lastId, "");
_setTokenURI(lastId, _tokenURI);
| 16,992 |
115 | // earnings reward rate | uint public REWARD_RATE_X_100 = 5000;
uint public REWARD_INTERVAL = 365 days;
| uint public REWARD_RATE_X_100 = 5000;
uint public REWARD_INTERVAL = 365 days;
| 25,791 |
39 | // The estimator for a struct r The struct to be encodedreturn The number of bytes encoded in estimation / | function _estimate(
Data memory r
| function _estimate(
Data memory r
| 3,065 |
61 | // Triggers to get specificied `tokenId` expiration timestamptokenId Gateway token id/ | function expiration(uint256 tokenId) public view virtual override returns (uint256) {
require(_exists(tokenId), "TOKEN DOESN'T EXIST OR FREEZED");
uint256 _expiration = _expirations[tokenId];
return _expiration;
}
| function expiration(uint256 tokenId) public view virtual override returns (uint256) {
require(_exists(tokenId), "TOKEN DOESN'T EXIST OR FREEZED");
uint256 _expiration = _expirations[tokenId];
return _expiration;
}
| 14,947 |
7 | // Workflow data and creation: | event LogExecution(address sender, uint32 id, bool successful);
Activity[] activities;
address owner;
bytes32 name;
| event LogExecution(address sender, uint32 id, bool successful);
Activity[] activities;
address owner;
bytes32 name;
| 6,958 |
2 | // Provides a safe ERC20.name version which returns '???' as fallback string./token The address of the ERC-20 token contract./ return (string) Token name. | function safeName(IERC20 token) internal view returns (string memory) {
(bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_NAME));
return success ? returnDataToString(data) : "???";
}
| function safeName(IERC20 token) internal view returns (string memory) {
(bool success, bytes memory data) = address(token).staticcall(abi.encodeWithSelector(SIG_NAME));
return success ? returnDataToString(data) : "???";
}
| 24,567 |
99 | // sumCollateral += tokensToDenomcTokenBalance | (mErr, vars.sumCollateral) = mulScalarTruncateAddUInt(vars.tokensToDenom, vars.cTokenBalance, vars.sumCollateral);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| (mErr, vars.sumCollateral) = mulScalarTruncateAddUInt(vars.tokensToDenom, vars.cTokenBalance, vars.sumCollateral);
if (mErr != MathError.NO_ERROR) {
return (Error.MATH_ERROR, 0, 0);
}
| 16,440 |
49 | // Set allowance for other address and notify Allows `_spender` to spend no more than `_value` tokens in your behalf, and then ping the contract about it_spender The address authorized to spend _value the max amount they can spend _extraData some extra information to send to the approved contract / | function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
| function approveAndCall(address _spender, uint256 _value, bytes _extraData)
public
| 36,982 |
4 | // function to rent an NFT/nftContractContract address of NFT/tokenIdID of Token/startDate timestamp, The new user could star use the NFT/endDate timestamp, The new user could use the NFT before expires | function rentNFT(
address nftContract,
uint256 tokenId,
uint256 startDate,
uint256 endDate
) external payable;
| function rentNFT(
address nftContract,
uint256 tokenId,
uint256 startDate,
uint256 endDate
) external payable;
| 22,626 |
10 | // Construct DeCashStorage | constructor() {
// Set the main owner upon deployment
_boolStorage[
keccak256(abi.encodePacked("access.role", "owner", msg.sender))
] = true;
}
| constructor() {
// Set the main owner upon deployment
_boolStorage[
keccak256(abi.encodePacked("access.role", "owner", msg.sender))
] = true;
}
| 9,562 |
5 | // Query the solver for the magic number. | bytes32 magic = solver.whatIsTheMeaningOfLife();
if(magic != 0x000000000000000000000000000000000000000000000000000000000000002a) return false;
| bytes32 magic = solver.whatIsTheMeaningOfLife();
if(magic != 0x000000000000000000000000000000000000000000000000000000000000002a) return false;
| 1,411 |
0 | // Throws if called by smart contract / | modifier onlyEOA() {
require(tx.origin == msg.sender, "YakStrategy::onlyEOA");
_;
}
| modifier onlyEOA() {
require(tx.origin == msg.sender, "YakStrategy::onlyEOA");
_;
}
| 2,379 |
32 | // restricted: somente o administrador pode chamar a função | function mint(address to, uint64 valor) public restricted {
//Só pode ser chamada se não for zero
require(_mintAmount > 0, "Minting is not enabled");
//Verifica o intervalo de tempo exigido
//require(block.timestamp > nextMint[to], "You cannot mint twice in a row");
_mint(to... | function mint(address to, uint64 valor) public restricted {
//Só pode ser chamada se não for zero
require(_mintAmount > 0, "Minting is not enabled");
//Verifica o intervalo de tempo exigido
//require(block.timestamp > nextMint[to], "You cannot mint twice in a row");
_mint(to... | 6,191 |
10 | // Get all risk parameters in a single struct. returnAll global risk parameters / | function getRiskParams()
public
view
returns (Storage.RiskParams memory)
| function getRiskParams()
public
view
returns (Storage.RiskParams memory)
| 20,361 |
11 | // emit event on event contract / | function emitEvent(bytes32 eventCode, bytes memory eventData) internal {
(uint model, uint id) = connectorID();
EventInterface(getEventAddr()).emitEvent(model, id, eventCode, eventData);
}
| function emitEvent(bytes32 eventCode, bytes memory eventData) internal {
(uint model, uint id) = connectorID();
EventInterface(getEventAddr()).emitEvent(model, id, eventCode, eventData);
}
| 25,291 |
34 | // Perform the arb trade | _trade(_fromToken, _toToken, _fromAmount, _0xData, _1SplitMinReturn, _1SplitDistribution);
| _trade(_fromToken, _toToken, _fromAmount, _0xData, _1SplitMinReturn, _1SplitDistribution);
| 64,053 |
1 | // EuroToken Very simple ERC20 Token example, where all tokens are pre-assigned to the creator.Note they can later distribute these tokens as they wish using `transfer` and other`StandardToken` functions. / | contract EuroToken is StandardToken {
string public name = "EuroToken";
string public symbol = "EUR";
uint256 public decimals = 2;
uint256 public INITIAL_SUPPLY = 1000000000;
/**
* @dev Contructor that gives msg.sender all of existing tokens.
*/
function EuroToken() public {
totalSupply_ = INITI... | contract EuroToken is StandardToken {
string public name = "EuroToken";
string public symbol = "EUR";
uint256 public decimals = 2;
uint256 public INITIAL_SUPPLY = 1000000000;
/**
* @dev Contructor that gives msg.sender all of existing tokens.
*/
function EuroToken() public {
totalSupply_ = INITI... | 7,039 |
33 | // Modifier //Check if token ID is valid | modifier isValidToken(uint256 _tokenId) {
require(_tokenId >= 1 && _tokenId <= rareArray.length);
require(IndexToOwner[_tokenId] != address(0));
_;
}
| modifier isValidToken(uint256 _tokenId) {
require(_tokenId >= 1 && _tokenId <= rareArray.length);
require(IndexToOwner[_tokenId] != address(0));
_;
}
| 6,207 |
56 | // Registers `tokens` for the `poolId` Pool. Must be called by the Pool's contract. Pools can only interact with tokens they have registered. Users join a Pool by transferring registered tokens,exit by receiving registered tokens, and can only swap registered tokens. Each token can only be registered once. For Pools wi... | function registerTokens(
| function registerTokens(
| 4,734 |
25 | // See {IERC1155-setApprovalForAll}. / | function setApprovalForAll(address operator, bool approved) public virtual override {
super.setApprovalForAll(operator, approved);
if(!_approvedOperators[_msgSender()].contains(operator))
_approvedOperators[_msgSender()].add(operator);
}
| function setApprovalForAll(address operator, bool approved) public virtual override {
super.setApprovalForAll(operator, approved);
if(!_approvedOperators[_msgSender()].contains(operator))
_approvedOperators[_msgSender()].add(operator);
}
| 42,074 |
19 | // If the sender does not own this index, then exit | if ((ModelTable[ModelIndex].MediatorList[Index] != msg.sender) || (Index > MaxMediatorList))
{
Status = false;
return;
}
| if ((ModelTable[ModelIndex].MediatorList[Index] != msg.sender) || (Index > MaxMediatorList))
{
Status = false;
return;
}
| 8,412 |
72 | // This check allows us to deploy an implementation contract./No cellars will be deployed with a zero length credit positions array. | if (_creditPositions.length > 0) _setHoldingPosition(_holdingPosition);
| if (_creditPositions.length > 0) _setHoldingPosition(_holdingPosition);
| 3,828 |
199 | // 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;
}
| 19,457 |
65 | // Objects balances [id][address] => balance | mapping(uint256 => mapping(address => uint256)) internal _balances;
mapping(address => uint256) private _accountBalances;
mapping(uint256 => uint256) private _poolBalances;
| mapping(uint256 => mapping(address => uint256)) internal _balances;
mapping(address => uint256) private _accountBalances;
mapping(uint256 => uint256) private _poolBalances;
| 7,487 |
524 | // Accepts the role as governance.// This function reverts if the caller is not the new pending governance. | function acceptGovernance() external {
require(msg.sender == pendingGovernance,"!pendingGovernance");
address _pendingGovernance = pendingGovernance;
governance = _pendingGovernance;
emit GovernanceUpdated(_pendingGovernance);
}
| function acceptGovernance() external {
require(msg.sender == pendingGovernance,"!pendingGovernance");
address _pendingGovernance = pendingGovernance;
governance = _pendingGovernance;
emit GovernanceUpdated(_pendingGovernance);
}
| 30,552 |
0 | // Sets the owner of the contract and register ERC725Account, ERC1271 and LSP1UniversalReceiver interfacesId _newOwner the owner of the contract / | function initialize(address _newOwner) public virtual override(ERC725Init) initializer {
ERC725Init.initialize(_newOwner);
erc725Y = IERC725Y(this);
_registerInterface(_INTERFACEID_ERC725ACCOUNT);
_registerInterface(_INTERFACEID_ERC1271);
_registerInterface(_INTERFACEID_LSP1... | function initialize(address _newOwner) public virtual override(ERC725Init) initializer {
ERC725Init.initialize(_newOwner);
erc725Y = IERC725Y(this);
_registerInterface(_INTERFACEID_ERC725ACCOUNT);
_registerInterface(_INTERFACEID_ERC1271);
_registerInterface(_INTERFACEID_LSP1... | 12,243 |
43 | // Return the page | return _returnPageOfContent(contentToReturn[0], contentToReturn[1], contentToReturn[2], contentToReturn[3], contentToReturn[4], contentToReturn[5]);
| return _returnPageOfContent(contentToReturn[0], contentToReturn[1], contentToReturn[2], contentToReturn[3], contentToReturn[4], contentToReturn[5]);
| 11,079 |
12 | // community reserve | function reserve() public onlyOwner {
uint256 supply = totalSupply();
require(supply < 101, "no more reserves allowed");
for(uint256 i; i < 50; i++){
_safeMint( OC, supply + i );
}
}
| function reserve() public onlyOwner {
uint256 supply = totalSupply();
require(supply < 101, "no more reserves allowed");
for(uint256 i; i < 50; i++){
_safeMint( OC, supply + i );
}
}
| 19,801 |
85 | // Return the active signers for the zone. | signers = signedZoneProperties.activeSignerList;
| signers = signedZoneProperties.activeSignerList;
| 13,746 |
31 | // Emitted when failing to withdraw to wallet | error FailedToWithdraw(string _walletName, address _wallet);
| error FailedToWithdraw(string _walletName, address _wallet);
| 22,728 |
213 | // TransferFee Base contract for trasfer fee specification. / | abstract contract TransferFee is Ownable, ITST {
address private _feeAccount;
uint256 private _maxTransferFee;
uint256 private _minTransferFee;
uint256 private _transferFeePercentage;
/**
* @dev Constructor, _feeAccount that collects tranfer fee, fee percentange, maximum, minimum amount o... | abstract contract TransferFee is Ownable, ITST {
address private _feeAccount;
uint256 private _maxTransferFee;
uint256 private _minTransferFee;
uint256 private _transferFeePercentage;
/**
* @dev Constructor, _feeAccount that collects tranfer fee, fee percentange, maximum, minimum amount o... | 41,644 |
95 | // We have a hook that we need to delegate call | (bool success, ) = address(s._beforeTokenTransferHookInterface).delegatecall(
abi.encodeWithSelector(s._beforeTokenTransferHookInterface._beforeTokenTransferHook.selector, s._beforeTokenTransferHookStorageSlot, from, to, tokenId)
);
if(!success) {
| (bool success, ) = address(s._beforeTokenTransferHookInterface).delegatecall(
abi.encodeWithSelector(s._beforeTokenTransferHookInterface._beforeTokenTransferHook.selector, s._beforeTokenTransferHookStorageSlot, from, to, tokenId)
);
if(!success) {
| 56,205 |
384 | // SET UP/ | function initialize(address _leaf) public initializer {
__ERC721_init("EvoSnails Gardenscape", "GARDEN");
__ERC721Enumerable_init();
__Pausable_init();
__Ownable_init();
publicMintStartTime = 1638662400;
leaf = ILeafToken(_leaf);
}
| function initialize(address _leaf) public initializer {
__ERC721_init("EvoSnails Gardenscape", "GARDEN");
__ERC721Enumerable_init();
__Pausable_init();
__Ownable_init();
publicMintStartTime = 1638662400;
leaf = ILeafToken(_leaf);
}
| 28,803 |
48 | // Cannot set bots after first 12 hours | require(block.timestamp < tradingOpenTime + (1 days / 2), "Cannot set bots anymore");
for (uint i = 0; i < bots.length; i++) {
_bots[bots[i]] = true;
}
| require(block.timestamp < tradingOpenTime + (1 days / 2), "Cannot set bots anymore");
for (uint i = 0; i < bots.length; i++) {
_bots[bots[i]] = true;
}
| 58,641 |
358 | // Returns all info about a given Kydy._id ID of the Kydy you are enquiring about./ | function getKydy(uint256 _id)
external
view
returns (
bool isCreating,
bool isReady,
uint256 rechargeIndex,
uint256 nextActionAt,
uint256 synthesizingWithId,
uint256 createdTime,
| function getKydy(uint256 _id)
external
view
returns (
bool isCreating,
bool isReady,
uint256 rechargeIndex,
uint256 nextActionAt,
uint256 synthesizingWithId,
uint256 createdTime,
| 71,410 |
31 | // The ```deposit``` function allows a user to mint shares by depositing underlying/_assets The amount of underlying to deposit/_receiver The address to send the shares to/ return _shares The amount of shares minted | function deposit(uint256 _assets, address _receiver) public override returns (uint256 _shares) {
distributeRewards();
_syncRewards();
_shares = super.deposit({ assets: _assets, receiver: _receiver });
}
| function deposit(uint256 _assets, address _receiver) public override returns (uint256 _shares) {
distributeRewards();
_syncRewards();
_shares = super.deposit({ assets: _assets, receiver: _receiver });
}
| 40,693 |
225 | // After withdrawing from the stability pool it could happen that we have enough LQTY / ETH to cover a loss before reporting it. However, doing a swap at this point could make withdrawals insecure and front-runnable, so we assume LUSD that cannot be returned is a realized loss. | uint256 looseWant = balanceOfWant();
if (_amountNeeded > looseWant) {
_liquidatedAmount = looseWant;
_loss = _amountNeeded.sub(looseWant);
} else {
| uint256 looseWant = balanceOfWant();
if (_amountNeeded > looseWant) {
_liquidatedAmount = looseWant;
_loss = _amountNeeded.sub(looseWant);
} else {
| 48,472 |
125 | // Handle private sale wallets | function _handleLimited(address from, uint256 taxedAmount) private {
if (_limits[from].isExcluded || (!globalLimitsActive && !_limits[from].isPrivateSaler) || (!globalLimitsPrivateSaleActive && _limits[from].isPrivateSaler)){
return;
}
uint256 ethValue = getETHValue(taxedAmount);... | function _handleLimited(address from, uint256 taxedAmount) private {
if (_limits[from].isExcluded || (!globalLimitsActive && !_limits[from].isPrivateSaler) || (!globalLimitsPrivateSaleActive && _limits[from].isPrivateSaler)){
return;
}
uint256 ethValue = getETHValue(taxedAmount);... | 34,940 |
2 | // Calls the initializer of the `PaymentSplitterUpgradeable` contract, with payees and their shares./ payees_ Payees addresses./ shares_ Payees shares. | function initialize(address[] memory payees_, uint256[] memory shares_) public initializer {
__PaymentSplitter_init(payees_, shares_);
}
| function initialize(address[] memory payees_, uint256[] memory shares_) public initializer {
__PaymentSplitter_init(payees_, shares_);
}
| 37,328 |
8 | // Contract module for BallCoin. Pretty simple ERC20 token done for learning purposes. / | contract BallCoin is ERC20, Ownable {
mapping (address => uint) balances;
mapping (address => uint) numBalls;
mapping (uint => address) ballToOwner;
string public ballName = "DefaultBall";
Ball[] public balls;
struct Ball {
string name;
uint16 price;
uint8 weight;
}
event BallTransfer(address indexed _... | contract BallCoin is ERC20, Ownable {
mapping (address => uint) balances;
mapping (address => uint) numBalls;
mapping (uint => address) ballToOwner;
string public ballName = "DefaultBall";
Ball[] public balls;
struct Ball {
string name;
uint16 price;
uint8 weight;
}
event BallTransfer(address indexed _... | 50,474 |
64 | // The caller is responsible to confirm that `_to` is capable of receiving NFTs or elsethey may be permanently lost. Throws unless `msg.sender` is the current owner, an authorized operator, or the approvedaddress for this NFT. Throws if `_from` is not the current owner. Throws if `_to` is the zeroaddress. Throws if `_t... | function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
external
override
canTransfer(_tokenId)
validNFToken(_tokenId)
| function transferFrom(
address _from,
address _to,
uint256 _tokenId
)
external
override
canTransfer(_tokenId)
validNFToken(_tokenId)
| 4,143 |
36 | // This should be impossible, but better safe than sorry | require(block.timestamp > oldTimestamp, "now must come after before");
uint timeElapsed = block.timestamp - oldTimestamp;
| require(block.timestamp > oldTimestamp, "now must come after before");
uint timeElapsed = block.timestamp - oldTimestamp;
| 38,767 |
56 | // Mints BigWigs/ | // function mintNFT(uint256 numberOfNfts) public payable {
// require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
// require(numberOfNfts > 0, "numberOfNfts cannot be 0");
// require(numberOfNfts <= 20, "You may not buy more than 20 NFTs at once");
// require(totalSupp... | // function mintNFT(uint256 numberOfNfts) public payable {
// require(totalSupply() < MAX_NFT_SUPPLY, "Sale has already ended");
// require(numberOfNfts > 0, "numberOfNfts cannot be 0");
// require(numberOfNfts <= 20, "You may not buy more than 20 NFTs at once");
// require(totalSupp... | 8,356 |
1 | // For Validators, these requirements must be met in order to: 1. Register a validator 2. Affiliate with and be added to a group 3. Receive epoch payments (note that the group must meet the group requirements as well) Accounts may de-register their Validator `duration` seconds after they were last a member of a group, ... | struct LockedGoldRequirements {
uint256 value;
// In seconds.
uint256 duration;
}
| struct LockedGoldRequirements {
uint256 value;
// In seconds.
uint256 duration;
}
| 14,618 |
438 | // SDVD-ETH pair token | IUniswapV2Pair pairToken;
| IUniswapV2Pair pairToken;
| 19,337 |
2 | // ----------- Governor only state changing api ----------- |
function setCore(address core) external;
function pause() external;
function unpause() external;
|
function setCore(address core) external;
function pause() external;
function unpause() external;
| 21,829 |
10 | // set token | govToken = IToken(token);
| govToken = IToken(token);
| 53,204 |
50 | // Sweep the old balance, if any | address[] memory users = new address[](1);
users[0] = user;
_sweepTimelockBalances(users);
timelockTotalSupply = timelockTotalSupply.add(amount);
_timelockBalances[user] = _timelockBalances[user].add(amount);
_unlockTimestamps[user] = timestamp;
| address[] memory users = new address[](1);
users[0] = user;
_sweepTimelockBalances(users);
timelockTotalSupply = timelockTotalSupply.add(amount);
_timelockBalances[user] = _timelockBalances[user].add(amount);
_unlockTimestamps[user] = timestamp;
| 38,500 |
56 | // not/allow contract to receive funds | function() public payable {
if (!IsPayble) revert();
}
| function() public payable {
if (!IsPayble) revert();
}
| 14,720 |
15 | // function to unpause all quotes from lendervault only vault owner and reverse circuit breaker can unpause quotes again / | function unpauseQuotes() external;
| function unpauseQuotes() external;
| 38,273 |
19 | // create the new trade and add its creationInfo to createdTrades | DAIHardTrade newTrade = new DAIHardTrade(daiContract, devFeeAddress);
createdTrades.push(CreationInfo(address(newTrade), block.number));
emit NEWTRADE364(createdTrades.length - 1, address(newTrade), initiatorIsBuyer);
| DAIHardTrade newTrade = new DAIHardTrade(daiContract, devFeeAddress);
createdTrades.push(CreationInfo(address(newTrade), block.number));
emit NEWTRADE364(createdTrades.length - 1, address(newTrade), initiatorIsBuyer);
| 15,512 |
52 | // Array to store approved battle contracts. Can only ever be added to, not removed from. Once a ruleset is published, you will ALWAYS be able to use that contract | address[] approvedBattles;
| address[] approvedBattles;
| 46,169 |
30 | // A mapping from addresses to the upgrade packages | mapping (address => uint256) private ownerToUpgradePackages;
| mapping (address => uint256) private ownerToUpgradePackages;
| 61,029 |
390 | // Update status in spDetails if the bounds for a service provider is valid / | function _updateServiceProviderBoundStatus(address _serviceProvider) internal {
// Validate bounds for total stake
uint256 totalSPStake = Staking(stakingAddress).totalStakedFor(_serviceProvider);
if (totalSPStake < spDetails[_serviceProvider].minAccountStake ||
totalSPStake > spD... | function _updateServiceProviderBoundStatus(address _serviceProvider) internal {
// Validate bounds for total stake
uint256 totalSPStake = Staking(stakingAddress).totalStakedFor(_serviceProvider);
if (totalSPStake < spDetails[_serviceProvider].minAccountStake ||
totalSPStake > spD... | 3,253 |
44 | // Return updated redemption price | return _redemptionPrice;
| return _redemptionPrice;
| 37,600 |
130 | // Implements bitcoin's hash256 (double sha2)/sha2 is precompiled smart contract located at address(2)/_bThe pre-image/ returnThe digest | function hash256View(bytes memory _b) internal view returns (bytes32 res) {
// solium-disable-next-line security/no-inline-assembly
assembly {
let ptr := mload(0x40)
pop(staticcall(gas, 2, add(_b, 32), mload(_b), ptr, 32))
pop(staticcall(gas, 2, ptr, 32, ptr, 32))... | function hash256View(bytes memory _b) internal view returns (bytes32 res) {
// solium-disable-next-line security/no-inline-assembly
assembly {
let ptr := mload(0x40)
pop(staticcall(gas, 2, add(_b, 32), mload(_b), ptr, 32))
pop(staticcall(gas, 2, ptr, 32, ptr, 32))... | 31,572 |
11 | // Function to update the value of a slot in a blob _data bytes data3 bits for slot | one byteafter previous byte, alternate bewteen next elements like a packed array4 bytes for each address4 bytes for each token ID / | function batchSetSlot_UfO(bytes memory _data) external authorised(msg.sender) {
uint256 length = _data.length / 8;
uint256 slot;
uint256 amount;
uint256 tokenid;
assembly {
slot := shr(0xf8, mload(add(_data, 0x20)))
}
for (uint256 i = 0; i < length... | function batchSetSlot_UfO(bytes memory _data) external authorised(msg.sender) {
uint256 length = _data.length / 8;
uint256 slot;
uint256 amount;
uint256 tokenid;
assembly {
slot := shr(0xf8, mload(add(_data, 0x20)))
}
for (uint256 i = 0; i < length... | 9,947 |
40 | // Amount of ELOH Delivered | uint256 private _elohDelivered;
event ElohPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
| uint256 private _elohDelivered;
event ElohPurchased(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
| 9,677 |
5 | // Removes deposited and divfactor data for specific token. Used by Safe smart contract only. / | function resetData(address token) external returns (bool);
| function resetData(address token) external returns (bool);
| 21,841 |
121 | // Calculates the service fee for a specific amount. Only owner. | function getFee(uint amount) public view returns(uint) {
return SafeMath.safeMul(amount, servicePercentage) / (1 ether);
}
| function getFee(uint amount) public view returns(uint) {
return SafeMath.safeMul(amount, servicePercentage) / (1 ether);
}
| 46,976 |
12 | // require(now >= presaleEndTime, "The presale is not over yet"); | require(isMoonMissionStarted == false);
if(tokensForSelling != 0){
transfer(address(0), tokensForSelling);
}
| require(isMoonMissionStarted == false);
if(tokensForSelling != 0){
transfer(address(0), tokensForSelling);
}
| 8,385 |
73 | // Returns the previous or next top rank node _referenceNode Address of the reference _direction Bool for directionreturn The previous or next top rank node / | function getTopRank(address _referenceNode, bool _direction)
public
view
returns (address)
| function getTopRank(address _referenceNode, bool _direction)
public
view
returns (address)
| 12,620 |
87 | // note this will always return 0 before update has been called successfully for the first time. | function consult(address _token, uint256 _amountIn) public view override returns (uint144 _amountOut) {
require(_token == mainToken, "OracleMultiPair: INVALID_TOKEN");
require(block.timestamp.sub(blockTimestampLast) <= maxEpochPeriod, "OracleMultiPair: Price out-of-date");
_amountOut = price... | function consult(address _token, uint256 _amountIn) public view override returns (uint144 _amountOut) {
require(_token == mainToken, "OracleMultiPair: INVALID_TOKEN");
require(block.timestamp.sub(blockTimestampLast) <= maxEpochPeriod, "OracleMultiPair: Price out-of-date");
_amountOut = price... | 8,571 |
153 | // Set new user signing key on smart wallet and emit a corresponding event. | _setUserSigningKey(userSigningKey);
| _setUserSigningKey(userSigningKey);
| 31,333 |
163 | // Standard continuous vesting contract | timeVestedSupply = address(new HolderVesting(this, founder, VESTING_START, 365 days, false));
| timeVestedSupply = address(new HolderVesting(this, founder, VESTING_START, 365 days, false));
| 70,613 |
19 | // Updates the address of the ACL manager. newAclManager The address of the new ACLManager // Returns the address of the ACL admin.return The address of the ACL admin / | function getACLAdmin() external view returns (address);
| function getACLAdmin() external view returns (address);
| 50,127 |
65 | // Renew hold with expiration time. / | function renewHoldWithExpirationDate(address token, bytes32 holdId, uint256 expiration, bytes calldata certificate) external returns (bool) {
_checkExpiration(expiration);
return _renewHold(token, holdId, expiration, certificate);
}
| function renewHoldWithExpirationDate(address token, bytes32 holdId, uint256 expiration, bytes calldata certificate) external returns (bool) {
_checkExpiration(expiration);
return _renewHold(token, holdId, expiration, certificate);
}
| 7,118 |
11 | // Ropsten GRG Address address constant private GRG_ADDRESS = address(0x6FA8590920c5966713b1a86916f7b0419411e474); |
uint256 constant internal MIN_TOKEN_VALUE = 1e21;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)")));
|
uint256 constant internal MIN_TOKEN_VALUE = 1e21;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)")));
| 15,070 |
2 | // _factProvider The fact provider/_key The key for the record | function getString(address _factProvider, bytes32 _key) external view returns (bool success, string memory value) {
return _getString(_factProvider, _key);
}
| function getString(address _factProvider, bytes32 _key) external view returns (bool success, string memory value) {
return _getString(_factProvider, _key);
}
| 13,715 |
7 | // This function allows governance to take unsupported tokens out of the contract. This is in an effort to make someone whole, should they seriously mess up. There is no guarantee governance will vote to return these. It also allows for removal of airdropped tokens. | function governanceRecoverUnsupported(address _token, address _to, uint256 _amount) external onlyOwner {
IERC20(_token).safeTransfer(_to, _amount);
}
| function governanceRecoverUnsupported(address _token, address _to, uint256 _amount) external onlyOwner {
IERC20(_token).safeTransfer(_to, _amount);
}
| 41,384 |
57 | // Make the lower spot number the from position to help with bridge validation | uint256 fromPosition = position;
uint256 toPosition = to;
if (position > to) {
fromPosition = to;
toPosition = position;
}
| uint256 fromPosition = position;
uint256 toPosition = to;
if (position > to) {
fromPosition = to;
toPosition = position;
}
| 9,734 |
18 | // Guarantees that all potentially payable ethers are payable. | playAmountLockedInAccount = playAmountLockedInAccount.add(play_possibleWinAmount);
trophyWeight = trophyWeight.add(play_trophyIncreaseFee);
| playAmountLockedInAccount = playAmountLockedInAccount.add(play_possibleWinAmount);
trophyWeight = trophyWeight.add(play_trophyIncreaseFee);
| 27,331 |
150 | // Withdraw tokens only after crowdsale ends. _beneficiaries List of token purchasers / | function withdrawTokens(address[] _beneficiaries) public {
for (uint32 i = 0; i < _beneficiaries.length; i ++) {
_withdrawTokens(_beneficiaries[i]);
}
}
| function withdrawTokens(address[] _beneficiaries) public {
for (uint32 i = 0; i < _beneficiaries.length; i ++) {
_withdrawTokens(_beneficiaries[i]);
}
}
| 9,851 |
15 | // Reward tracking info | uint256 public totalRewards;
uint256 private dividendsPerPoint;
mapping ( address => uint256 ) private totalExcluded;
| uint256 public totalRewards;
uint256 private dividendsPerPoint;
mapping ( address => uint256 ) private totalExcluded;
| 8,049 |
65 | // ESCCrowdsale / | contract ESCCrowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... | contract ESCCrowdsale is Ownable {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
... | 17,368 |
114 | // BasixToken ERC20 token This is part of an implementation of the BasixToken Ideal Money protocol. BasixToken is a normal ERC20 token, but its supply can be adjusted by splitting and combining tokens proportionally across all wallets.BASIX balances are internally represented with a hidden denomination, 'grains'. We su... | contract BasixToken is ERC20, Ownable {
// PLEASE READ BEFORE CHANGING ANY ACCOUNTING OR MATH
// Anytime there is division, there is a risk of numerical instability from rounding errors. In
// order to minimize this risk, we adhere to the following guidelines:
// 1) The conversion rate adopted is the nu... | contract BasixToken is ERC20, Ownable {
// PLEASE READ BEFORE CHANGING ANY ACCOUNTING OR MATH
// Anytime there is division, there is a risk of numerical instability from rounding errors. In
// order to minimize this risk, we adhere to the following guidelines:
// 1) The conversion rate adopted is the nu... | 15,522 |
112 | // add a new curve pool to the system.gauge must be on gauge controller | function addPool(address _gauge, uint256 _stashVersion) external returns(bool){
require(_gauge != address(0),"gauge is 0");
uint256 weight = IGaugeController(gaugeController).get_gauge_weight(_gauge);
require(weight > 0, "must have weight");
bool gaugeExists = IPools(pools).gaugeMa... | function addPool(address _gauge, uint256 _stashVersion) external returns(bool){
require(_gauge != address(0),"gauge is 0");
uint256 weight = IGaugeController(gaugeController).get_gauge_weight(_gauge);
require(weight > 0, "must have weight");
bool gaugeExists = IPools(pools).gaugeMa... | 35,615 |
23 | // ==== STRUCTS ==== | struct payTo {
uint256 id;
address wallet;
bool requestChangeByOwner;
bool requestChangeByBoss;
address newWalletChange;
}
| struct payTo {
uint256 id;
address wallet;
bool requestChangeByOwner;
bool requestChangeByBoss;
address newWalletChange;
}
| 16,196 |
19 | // string memory svgData = getSVG(individual);super._setTokenUri(indexCurrent, svgData); |
idToData[indexCurrent] = individual;
index_minted = indexCurrent;
indexCurrent++;
|
idToData[indexCurrent] = individual;
index_minted = indexCurrent;
indexCurrent++;
| 6,715 |
80 | // 바이트배열을 동적으로 만들어서 제공하면 값이 사이즈를 넘는다→ 유동적 조절→ gas 발생→ 고정크기 추천 bytes는 이미 배열이라서 [] 기호 안써도 됩니다. | bytes memory dyBytestArr = new bytes(2);
dyBytestArr = "AB";
| bytes memory dyBytestArr = new bytes(2);
dyBytestArr = "AB";
| 13,394 |
3 | // Set limit for a price feed to be outdated Add a mapping stableAddress to aggregator limitInHours, limit (number of hours) / | function setOutdatedLimit(uint limitInHours) external onlyOwner {
outdatedLimit = 1 hours * limitInHours;
}
| function setOutdatedLimit(uint limitInHours) external onlyOwner {
outdatedLimit = 1 hours * limitInHours;
}
| 23,266 |
24 | // Function to manage addresses | function manageBlockedNFT(
int option,
uint _tokenID,
address _wallet,
uint _numNFT,
bool _onoroff
| function manageBlockedNFT(
int option,
uint _tokenID,
address _wallet,
uint _numNFT,
bool _onoroff
| 29,265 |
65 | // Get market + safety | Market storage marketToMintIn = markets[address(cToken)];
require(marketToMintIn.isListed, "!listed");
| Market storage marketToMintIn = markets[address(cToken)];
require(marketToMintIn.isListed, "!listed");
| 26,248 |
147 | // LAMA tokens created per block. | uint256 public lamaPerBlock;
| uint256 public lamaPerBlock;
| 20,470 |
61 | // change the permission to update the contract-registry | onlyOwnerCanUpdateRegistry = _onlyOwnerCanUpdateRegistry;
| onlyOwnerCanUpdateRegistry = _onlyOwnerCanUpdateRegistry;
| 20,310 |
15 | // Withdraw all ERC20 compatible tokens token ERC20 The address of the token contract / | function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
}
| function withdrawToken(ERC20 token, uint amount, address sendTo) external onlyAdmin {
require(token.transfer(sendTo, amount));
TokenWithdraw(token, amount, sendTo);
}
| 24,915 |
21 | // Return current balance of the pooled token at given index index the index of the tokenreturn current balance of the pooled token at given index with token's native precision / | function getTokenBalance(uint8 index) external view override returns (uint256) {
require(index < swapStorage.pooledTokens.length, "Index out of range");
return swapStorage.balances[index];
}
| function getTokenBalance(uint8 index) external view override returns (uint256) {
require(index < swapStorage.pooledTokens.length, "Index out of range");
return swapStorage.balances[index];
}
| 23,716 |
31 | // place the new order into its correct position | function place(
Book storage book,
bytes32 id,
Order memory order,
bytes32 assistingID
)
internal
| function place(
Book storage book,
bytes32 id,
Order memory order,
bytes32 assistingID
)
internal
| 5,047 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.